From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Sat, 09 Dec 2023 07:24:11 +0000 Subject: [PATCH] add stmac read mac form eeprom --- kernel/drivers/power/supply/axp20x_battery.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/kernel/drivers/power/supply/axp20x_battery.c b/kernel/drivers/power/supply/axp20x_battery.c index e84b6e4..9fda98b 100644 --- a/kernel/drivers/power/supply/axp20x_battery.c +++ b/kernel/drivers/power/supply/axp20x_battery.c @@ -185,7 +185,6 @@ union power_supply_propval *val) { struct axp20x_batt_ps *axp20x_batt = power_supply_get_drvdata(psy); - struct iio_channel *chan; int ret = 0, reg, val1; switch (psp) { @@ -265,12 +264,12 @@ if (ret) return ret; - if (reg & AXP20X_PWR_STATUS_BAT_CHARGING) - chan = axp20x_batt->batt_chrg_i; - else - chan = axp20x_batt->batt_dischrg_i; - - ret = iio_read_channel_processed(chan, &val->intval); + if (reg & AXP20X_PWR_STATUS_BAT_CHARGING) { + ret = iio_read_channel_processed(axp20x_batt->batt_chrg_i, &val->intval); + } else { + ret = iio_read_channel_processed(axp20x_batt->batt_dischrg_i, &val1); + val->intval = -val1; + } if (ret) return ret; -- Gitblit v1.6.2