mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
kevin / gru: Add BC1.2 charge ramp
BUG=chrome-os-partner:54099 BRANCH=reef, gru TEST=Verify charge_ramp success with a variety of BC1.2 chargers. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I0e8bbd063e0933893a4a7f48a15a391c0ad9898a Reviewed-on: https://chromium-review.googlesource.com/435562 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
fb063a39b3
commit
df2f085c16
@@ -116,6 +116,7 @@
|
||||
/* USB PD config */
|
||||
#define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
|
||||
#define CONFIG_CHARGE_MANAGER
|
||||
#define CONFIG_CHARGE_RAMP
|
||||
#define CONFIG_USB_POWER_DELIVERY
|
||||
#define CONFIG_USB_PD_ALT_MODE
|
||||
#define CONFIG_USB_PD_ALT_MODE_DFP
|
||||
@@ -184,6 +185,7 @@
|
||||
|
||||
/* Modules we want to exclude */
|
||||
#undef CONFIG_CMD_BATTFAKE
|
||||
#undef CONFIG_CMD_CHARGER_PSYS
|
||||
#undef CONFIG_CMD_FLASH
|
||||
#undef CONFIG_CMD_HASH
|
||||
#undef CONFIG_CMD_I2C_SCAN
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
CHIP:=npcx
|
||||
CHIP_VARIANT:=npcx5m5g
|
||||
|
||||
board-y=battery.o board.o usb_pd_policy.o
|
||||
board-y=battery.o board.o charge_ramp.o usb_pd_policy.o
|
||||
board-$(BOARD_GRU)+=led_gru.o
|
||||
board-$(BOARD_KEVIN)+=led_kevin.o
|
||||
|
||||
56
board/kevin/charge_ramp.c
Normal file
56
board/kevin/charge_ramp.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/* Board-specific charge ramp callbacks. */
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "bd9995x.h"
|
||||
#include "charge_manager.h"
|
||||
#include "charge_ramp.h"
|
||||
#include "charge_state.h"
|
||||
#include "system.h"
|
||||
|
||||
/**
|
||||
* Return true if ramping is allowed for given supplier
|
||||
*/
|
||||
int board_is_ramp_allowed(int supplier)
|
||||
{
|
||||
/* Don't allow ramping in RO when write protected */
|
||||
if (system_get_image_copy() != SYSTEM_IMAGE_RW
|
||||
&& system_is_locked())
|
||||
return 0;
|
||||
else
|
||||
return supplier == CHARGE_SUPPLIER_BC12_DCP ||
|
||||
supplier == CHARGE_SUPPLIER_BC12_SDP ||
|
||||
supplier == CHARGE_SUPPLIER_BC12_CDP ||
|
||||
supplier == CHARGE_SUPPLIER_PROPRIETARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if VBUS is sagging too low
|
||||
*/
|
||||
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
|
||||
{
|
||||
return charger_get_vbus_voltage(port) < BD9995X_BC12_MIN_VOLTAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the maximum allowed input current
|
||||
*/
|
||||
int board_get_ramp_current_limit(int supplier, int sup_curr)
|
||||
{
|
||||
return bd9995x_get_bc12_ilim(supplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if board is consuming full amount of input current
|
||||
*/
|
||||
int board_is_consuming_full_charge(void)
|
||||
{
|
||||
int chg_pct = charge_get_percent();
|
||||
|
||||
return chg_pct > 2 && chg_pct < 95;
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifdef BOARD_KEVIN
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(USB_CHG, usb_charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
@@ -33,6 +34,7 @@
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(ALS, als_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(USB_CHG, usb_charger_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
|
||||
Reference in New Issue
Block a user