1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
- index 17fecb156..2409b5ee1 100644
- --- a/drivers/mfd/axp20x.c
- +++ b/drivers/mfd/axp20x.c
- @@ -1644,6 +1644,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
- return ret;
- }
-
- + pm_power_off = 0;
- if (!pm_power_off) {
- axp20x_pm_power_off = axp20x;
- pm_power_off = axp20x_power_off;
- diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c
- index ac360016b..c11024f3c 100644
- --- a/drivers/power/supply/axp20x_ac_power.c
- +++ b/drivers/power/supply/axp20x_ac_power.c
- @@ -53,6 +53,9 @@ static irqreturn_t axp20x_ac_power_irq(int irq, void *devid)
- {
- struct axp20x_ac_power *power = devid;
-
- + regmap_update_bits(power->regmap, AXP20X_VBUS_IPSOUT_MGMT, 0x03, 0x00);
- + regmap_update_bits(power->regmap, AXP20X_VBUS_IPSOUT_MGMT, 0x03, 0x03);
- +
- power_supply_changed(power->supply);
-
- return IRQ_HANDLED;
- diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c
- index f6c849bd1..f203ebc6e 100644
- --- a/drivers/power/supply/axp20x_battery.c
- +++ b/drivers/power/supply/axp20x_battery.c
- @@ -378,6 +378,42 @@ static int axp20x_battery_get_prop(struct power_supply *psy,
- val->intval *= 1000;
- break;
-
- + case POWER_SUPPLY_PROP_ENERGY_FULL:
- + case POWER_SUPPLY_PROP_ENERGY_NOW:
- + /* When no battery is present, return 0 */
- + ret = regmap_read(axp20x_batt->regmap, AXP20X_PWR_OP_MODE,
- + ®);
- + if (ret)
- + return ret;
- +
- + if (!(reg & AXP20X_PWR_OP_BATT_PRESENT)) {
- + val->intval = 0;
- + return 0;
- + }
- +
- + if(psp == POWER_SUPPLY_PROP_ENERGY_FULL) {
- + val->intval = 8000000;
- + return 0;
- + }
- +
- + ret = regmap_read(axp20x_batt->regmap, AXP20X_FG_RES, ®);
- + if (ret)
- + return ret;
- +
- + if (axp20x_batt->data->has_fg_valid && !(reg & AXP22X_FG_VALID))
- + return -EINVAL;
- +
- + val1 = reg & AXP209_FG_PERCENT;
- + if (val1 > 90)
- + val1= 80;
- + else if (val1 < 10)
- + val1 = 0;
- + else
- + val1 -= 10;
- +
- + val->intval = val1 * 100000;
- + break;
- +
- default:
- return -EINVAL;
- }
- @@ -544,6 +580,8 @@ static enum power_supply_property axp20x_battery_props[] = {
- POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
- POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
- POWER_SUPPLY_PROP_CAPACITY,
- + POWER_SUPPLY_PROP_ENERGY_FULL,
- + POWER_SUPPLY_PROP_ENERGY_NOW,
- };
-
- static int axp20x_battery_prop_writeable(struct power_supply *psy,
- @@ -857,6 +895,12 @@ static int axp20x_power_probe(struct platform_device *pdev)
- goto warn_bat;
- }
-
- + regmap_update_bits(axp20x_batt->regmap, AXP20X_VBUS_IPSOUT_MGMT, 0x03, 0x03);
- + regmap_update_bits(axp20x_batt->regmap, AXP20X_OFF_CTRL, 0x08, 0x08);
- + regmap_update_bits(axp20x_batt->regmap, AXP20X_CHRG_CTRL2, 0x30, 0x20);
- + regmap_update_bits(axp20x_batt->regmap, AXP20X_PEK_KEY, 0x0f, 0x0b);
- + regmap_update_bits(axp20x_batt->regmap, AXP20X_GPIO0_CTRL, 0x07, 0x00);
- +
- return 0;
-
- warn_bat:
|