mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2026-03-20 02:42:41 +01:00
add devterm d1 patch files
This commit is contained in:
82
Code/patch/d1/power.patch
Normal file
82
Code/patch/d1/power.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
|
||||
index aa59496e4..45b09ce38 100644
|
||||
--- a/drivers/mfd/axp20x.c
|
||||
+++ b/drivers/mfd/axp20x.c
|
||||
@@ -976,6 +976,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 f74b0556b..3314f015f 100644
|
||||
--- a/drivers/power/supply/axp20x_ac_power.c
|
||||
+++ b/drivers/power/supply/axp20x_ac_power.c
|
||||
@@ -49,6 +49,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 ee86ae3d2..577ee4bbd 100755
|
||||
--- a/drivers/power/supply/axp20x_battery.c
|
||||
+++ b/drivers/power/supply/axp20x_battery.c
|
||||
@@ -326,6 +326,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;
|
||||
}
|
||||
@@ -486,6 +522,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,
|
||||
Reference in New Issue
Block a user