qpnp-fg-gen3: update empty voltage threshold and empty SOC irq handling

As per the hardware characterization, update the battery empty
voltage threshold to 2.8V. Since this moves the voltage little
away from cutoff voltage, update the empty SOC interrupt handling
to report SOC as 0. Since we only need the rising edge of empty
SOC interrupt, modify the interrupt flag as well.

Change-Id: I665a6f879af4e6b6e9f94b5464be7894d5ea67cb
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
Subbaraman Narayanamurthy 2016-11-01 16:29:46 -07:00
parent 5652fdc60b
commit 1ddf07d8e2
4 changed files with 12 additions and 3 deletions
Documentation/devicetree/bindings/power/qcom-charger
arch/arm/boot/dts/qcom
drivers/power/qcom-charger

View file

@ -55,7 +55,7 @@ First Level Node - FG Gen3 device
be notified via the power supply framework. The userspace
will read 0% soc and immediately shutdown. If this property
is not specified, then the default value used will be
3100mV.
2800mV.
- qcom,fg-vbatt-low-thr
Usage: optional

View file

@ -334,7 +334,8 @@
<0x2 0x40 0x2 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x40 0x3 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x40 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x40 0x5 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x40 0x5
IRQ_TYPE_EDGE_RISING>,
<0x2 0x40 0x6 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x40 0x7 IRQ_TYPE_EDGE_BOTH>;
interrupt-names = "soc-update",

View file

@ -288,6 +288,7 @@ struct fg_chip {
bool battery_missing;
bool fg_restarting;
bool charge_full;
bool charge_empty;
bool recharge_soc_adjusted;
bool ki_coeff_dischg_en;
struct completion soc_update;

View file

@ -676,6 +676,7 @@ static bool is_debug_batt_id(struct fg_chip *chip)
#define FULL_CAPACITY 100
#define FULL_SOC_RAW 255
#define DEBUG_BATT_SOC 67
#define EMPTY_SOC 0
static int fg_get_prop_capacity(struct fg_chip *chip, int *val)
{
int rc, msoc;
@ -685,6 +686,11 @@ static int fg_get_prop_capacity(struct fg_chip *chip, int *val)
return 0;
}
if (chip->charge_empty) {
*val = EMPTY_SOC;
return 0;
}
if (chip->charge_full) {
*val = FULL_CAPACITY;
return 0;
@ -2302,6 +2308,7 @@ static irqreturn_t fg_empty_soc_irq_handler(int irq, void *data)
{
struct fg_chip *chip = data;
chip->charge_empty = true;
if (is_charger_available(chip))
power_supply_changed(chip->batt_psy);
@ -2523,7 +2530,7 @@ static int fg_parse_ki_coefficients(struct fg_chip *chip)
}
#define DEFAULT_CUTOFF_VOLT_MV 3200
#define DEFAULT_EMPTY_VOLT_MV 3100
#define DEFAULT_EMPTY_VOLT_MV 2800
#define DEFAULT_CHG_TERM_CURR_MA 100
#define DEFAULT_SYS_TERM_CURR_MA -125
#define DEFAULT_DELTA_SOC_THR 1