mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
Power Supply Fixes for 6.1 cycle
Fixes for the 6.1 cycle: * rk817: Two error handling fixes * ip5xxx: fix inter overflow in current calculation * ab8500: fix thermal zone probing -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmOBZXQACgkQ2O7X88g7 +pqq8hAAod1RmFosXcbIoAxGkblosmq9PYCCYp2eBbbqUSbawjCEH4NzOGTIQZlK xc6kJPOX0/2Z56pCWr9sfbj/cPbM0wTS067RyxA9Lh7e2bmPsHe19VXEKYfQf+xC D8q0IFZVdQSxtJMbMK2WhutH38y2vDN35h/HpG1Tkial6ZEMJMBpuZEB8GkVddgr mm7o+218U4WViMKcFUtLk/4ZTKiMRoHy89p3COe8Z9Cl9FdumIF2LHULDcqbXkOs ytQ8kKGgd9SANJ8YXWAxPW9Y9v5rl6+0A8KRNltnBpqXkXOtnTI7IltXODuLdfPm k6veoy+SLR0l1gtEMczZiw+833kmJWSFj3oIzdslQpZjJJrsRBStJsiukmkgzQCq 7fb3EmUDUR5dwfUKryWu/qbHXVnJ67zHodUT4xZmqsC6NS4UdDjJ4LNVx44rCUTa FP+4+vHumY1rQWE6fcX2Nt6TjCO8RTVDp6uTCxjvkyVUsu/CTST0/COIu67anbJP 0L2rICgb0v7Nadc1AOWasx+PeCw92jUNCO/Q0s2dEnSzpo+HmSy3PqXwU07FNApv f4Y+bwD041q0I+/TrSUVbJjFc4bOyShXTfPxUM8cLV+dhBZy1DM/CeVwRsaa05JK oPSkHldAeKO/bEmaMvnfI3IH+YAp40kFv494kEfSi+665LWLE9o= =Iplg -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
644e952438
|
@ -725,7 +725,14 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
|
|||
/* Get thermal zone and ADC */
|
||||
di->tz = thermal_zone_get_zone_by_name("battery-thermal");
|
||||
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");
|
||||
}
|
||||
di->bat_ctrl = devm_iio_channel_get(dev, "bat_ctrl");
|
||||
|
|
|
@ -352,7 +352,7 @@ static int ip5xxx_battery_get_property(struct power_supply *psy,
|
|||
ret = ip5xxx_battery_read_adc(ip5xxx, IP5XXX_BATIADC_DAT0,
|
||||
IP5XXX_BATIADC_DAT1, &raw);
|
||||
|
||||
val->intval = DIV_ROUND_CLOSEST(raw * 745985, 1000);
|
||||
val->intval = DIV_ROUND_CLOSEST(raw * 149197, 200);
|
||||
return 0;
|
||||
|
||||
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
|
||||
|
|
|
@ -121,7 +121,7 @@ struct rk817_charger {
|
|||
#define ADC_TO_CHARGE_UAH(adc_value, 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)
|
||||
return CHG_3_5A;
|
||||
|
@ -864,8 +864,8 @@ static int rk817_battery_init(struct rk817_charger *charger,
|
|||
{
|
||||
struct rk808 *rk808 = charger->rk808;
|
||||
u32 tmp, max_chg_vol_mv, max_chg_cur_ma;
|
||||
u8 max_chg_vol_reg, chg_term_i_reg, max_chg_cur_reg;
|
||||
int ret, chg_term_ma;
|
||||
u8 max_chg_vol_reg, chg_term_i_reg;
|
||||
int ret, chg_term_ma, max_chg_cur_reg;
|
||||
u8 bulk_reg[2];
|
||||
|
||||
/* Get initial plug state */
|
||||
|
@ -1116,14 +1116,12 @@ static int rk817_charger_probe(struct platform_device *pdev)
|
|||
|
||||
charger->bat_ps = devm_power_supply_register(&pdev->dev,
|
||||
&rk817_bat_desc, &pscfg);
|
||||
|
||||
charger->chg_ps = devm_power_supply_register(&pdev->dev,
|
||||
&rk817_chg_desc, &pscfg);
|
||||
|
||||
if (IS_ERR(charger->chg_ps))
|
||||
if (IS_ERR(charger->bat_ps))
|
||||
return dev_err_probe(dev, -EINVAL,
|
||||
"Battery failed to probe\n");
|
||||
|
||||
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,
|
||||
"Charger failed to probe\n");
|
||||
|
|
Loading…
Reference in a new issue