Commit 644e9524 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-v6.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply fixes from Sebastian Reichel:

 - rk817: Two error handling fixes

 - ip5xxx: fix inter overflow in current calculation

 - ab8500: fix thermal zone probing

* tag 'for-v6.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power: supply: ab8500: Defer thermal zone probe
  power: supply: ip5xxx: Fix integer overflow in current_now calculation
  power: supply: rk817: Change rk817_chg_cur_to_reg to int
  power: supply: rk817: check correct variable
parents 990f3200 767e6843
...@@ -725,7 +725,14 @@ static int ab8500_btemp_probe(struct platform_device *pdev) ...@@ -725,7 +725,14 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
/* Get thermal zone and ADC */ /* Get thermal zone and ADC */
di->tz = thermal_zone_get_zone_by_name("battery-thermal"); di->tz = thermal_zone_get_zone_by_name("battery-thermal");
if (IS_ERR(di->tz)) { if (IS_ERR(di->tz)) {
return dev_err_probe(dev, PTR_ERR(di->tz), ret = PTR_ERR(di->tz);
/*
* This usually just means we are probing before the thermal
* zone, so just defer.
*/
if (ret == -ENODEV)
ret = -EPROBE_DEFER;
return dev_err_probe(dev, ret,
"failed to get battery thermal zone\n"); "failed to get battery thermal zone\n");
} }
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl"); di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");
......
...@@ -352,7 +352,7 @@ static int ip5xxx_battery_get_property(struct power_supply *psy, ...@@ -352,7 +352,7 @@ static int ip5xxx_battery_get_property(struct power_supply *psy,
ret = ip5xxx_battery_read_adc(ip5xxx, IP5XXX_BATIADC_DAT0, ret = ip5xxx_battery_read_adc(ip5xxx, IP5XXX_BATIADC_DAT0,
IP5XXX_BATIADC_DAT1, &raw); IP5XXX_BATIADC_DAT1, &raw);
val->intval = DIV_ROUND_CLOSEST(raw * 745985, 1000); val->intval = DIV_ROUND_CLOSEST(raw * 149197, 200);
return 0; return 0;
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
......
...@@ -121,7 +121,7 @@ struct rk817_charger { ...@@ -121,7 +121,7 @@ struct rk817_charger {
#define ADC_TO_CHARGE_UAH(adc_value, res_div) \ #define ADC_TO_CHARGE_UAH(adc_value, res_div) \
(adc_value / 3600 * 172 / res_div) (adc_value / 3600 * 172 / res_div)
static u8 rk817_chg_cur_to_reg(u32 chg_cur_ma) static int rk817_chg_cur_to_reg(u32 chg_cur_ma)
{ {
if (chg_cur_ma >= 3500) if (chg_cur_ma >= 3500)
return CHG_3_5A; return CHG_3_5A;
...@@ -864,8 +864,8 @@ static int rk817_battery_init(struct rk817_charger *charger, ...@@ -864,8 +864,8 @@ static int rk817_battery_init(struct rk817_charger *charger,
{ {
struct rk808 *rk808 = charger->rk808; struct rk808 *rk808 = charger->rk808;
u32 tmp, max_chg_vol_mv, max_chg_cur_ma; u32 tmp, max_chg_vol_mv, max_chg_cur_ma;
u8 max_chg_vol_reg, chg_term_i_reg, max_chg_cur_reg; u8 max_chg_vol_reg, chg_term_i_reg;
int ret, chg_term_ma; int ret, chg_term_ma, max_chg_cur_reg;
u8 bulk_reg[2]; u8 bulk_reg[2];
/* Get initial plug state */ /* Get initial plug state */
...@@ -1116,14 +1116,12 @@ static int rk817_charger_probe(struct platform_device *pdev) ...@@ -1116,14 +1116,12 @@ static int rk817_charger_probe(struct platform_device *pdev)
charger->bat_ps = devm_power_supply_register(&pdev->dev, charger->bat_ps = devm_power_supply_register(&pdev->dev,
&rk817_bat_desc, &pscfg); &rk817_bat_desc, &pscfg);
if (IS_ERR(charger->bat_ps))
charger->chg_ps = devm_power_supply_register(&pdev->dev,
&rk817_chg_desc, &pscfg);
if (IS_ERR(charger->chg_ps))
return dev_err_probe(dev, -EINVAL, return dev_err_probe(dev, -EINVAL,
"Battery failed to probe\n"); "Battery failed to probe\n");
charger->chg_ps = devm_power_supply_register(&pdev->dev,
&rk817_chg_desc, &pscfg);
if (IS_ERR(charger->chg_ps)) if (IS_ERR(charger->chg_ps))
return dev_err_probe(dev, -EINVAL, return dev_err_probe(dev, -EINVAL,
"Charger failed to probe\n"); "Charger failed to probe\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment