Commit 94a8ee19 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull power supply fixes from Sebastian Reichel:
 "rt5033:
   - fix driver regression causing kernel oops

  axp288-charger:
   - fix charge voltage setup

  qcom-battmgr:
   - fix thermal zone spamming errors
   - fix init on Qualcomm X Elite"

* tag 'for-v6.11-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power: supply: qcom_battmgr: Ignore extra __le32 in info payload
  power: supply: qcom_battmgr: return EAGAIN when firmware service is not up
  power: supply: axp288_charger: Round constant_charge_voltage writes down
  power: supply: axp288_charger: Fix constant_charge_voltage writes
  power: supply: rt5033: Bring back i2c_set_clientdata
parents d4560686 d6cca763
...@@ -178,18 +178,18 @@ static inline int axp288_charger_set_cv(struct axp288_chrg_info *info, int cv) ...@@ -178,18 +178,18 @@ static inline int axp288_charger_set_cv(struct axp288_chrg_info *info, int cv)
u8 reg_val; u8 reg_val;
int ret; int ret;
if (cv <= CV_4100MV) { if (cv >= CV_4350MV) {
reg_val = CHRG_CCCV_CV_4100MV; reg_val = CHRG_CCCV_CV_4350MV;
cv = CV_4100MV; cv = CV_4350MV;
} else if (cv <= CV_4150MV) { } else if (cv >= CV_4200MV) {
reg_val = CHRG_CCCV_CV_4150MV;
cv = CV_4150MV;
} else if (cv <= CV_4200MV) {
reg_val = CHRG_CCCV_CV_4200MV; reg_val = CHRG_CCCV_CV_4200MV;
cv = CV_4200MV; cv = CV_4200MV;
} else if (cv >= CV_4150MV) {
reg_val = CHRG_CCCV_CV_4150MV;
cv = CV_4150MV;
} else { } else {
reg_val = CHRG_CCCV_CV_4350MV; reg_val = CHRG_CCCV_CV_4100MV;
cv = CV_4350MV; cv = CV_4100MV;
} }
reg_val = reg_val << CHRG_CCCV_CV_BIT_POS; reg_val = reg_val << CHRG_CCCV_CV_BIT_POS;
...@@ -337,8 +337,8 @@ static int axp288_charger_usb_set_property(struct power_supply *psy, ...@@ -337,8 +337,8 @@ static int axp288_charger_usb_set_property(struct power_supply *psy,
} }
break; break;
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
scaled_val = min(val->intval, info->max_cv); scaled_val = DIV_ROUND_CLOSEST(val->intval, 1000);
scaled_val = DIV_ROUND_CLOSEST(scaled_val, 1000); scaled_val = min(scaled_val, info->max_cv);
ret = axp288_charger_set_cv(info, scaled_val); ret = axp288_charger_set_cv(info, scaled_val);
if (ret < 0) { if (ret < 0) {
dev_warn(&info->pdev->dev, "set charge voltage failed\n"); dev_warn(&info->pdev->dev, "set charge voltage failed\n");
......
...@@ -486,7 +486,7 @@ static int qcom_battmgr_bat_get_property(struct power_supply *psy, ...@@ -486,7 +486,7 @@ static int qcom_battmgr_bat_get_property(struct power_supply *psy,
int ret; int ret;
if (!battmgr->service_up) if (!battmgr->service_up)
return -ENODEV; return -EAGAIN;
if (battmgr->variant == QCOM_BATTMGR_SC8280XP) if (battmgr->variant == QCOM_BATTMGR_SC8280XP)
ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);
...@@ -683,7 +683,7 @@ static int qcom_battmgr_ac_get_property(struct power_supply *psy, ...@@ -683,7 +683,7 @@ static int qcom_battmgr_ac_get_property(struct power_supply *psy,
int ret; int ret;
if (!battmgr->service_up) if (!battmgr->service_up)
return -ENODEV; return -EAGAIN;
ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);
if (ret) if (ret)
...@@ -748,7 +748,7 @@ static int qcom_battmgr_usb_get_property(struct power_supply *psy, ...@@ -748,7 +748,7 @@ static int qcom_battmgr_usb_get_property(struct power_supply *psy,
int ret; int ret;
if (!battmgr->service_up) if (!battmgr->service_up)
return -ENODEV; return -EAGAIN;
if (battmgr->variant == QCOM_BATTMGR_SC8280XP) if (battmgr->variant == QCOM_BATTMGR_SC8280XP)
ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);
...@@ -867,7 +867,7 @@ static int qcom_battmgr_wls_get_property(struct power_supply *psy, ...@@ -867,7 +867,7 @@ static int qcom_battmgr_wls_get_property(struct power_supply *psy,
int ret; int ret;
if (!battmgr->service_up) if (!battmgr->service_up)
return -ENODEV; return -EAGAIN;
if (battmgr->variant == QCOM_BATTMGR_SC8280XP) if (battmgr->variant == QCOM_BATTMGR_SC8280XP)
ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp); ret = qcom_battmgr_bat_sc8280xp_update(battmgr, psp);
...@@ -1007,7 +1007,9 @@ static void qcom_battmgr_sc8280xp_callback(struct qcom_battmgr *battmgr, ...@@ -1007,7 +1007,9 @@ static void qcom_battmgr_sc8280xp_callback(struct qcom_battmgr *battmgr,
battmgr->error = 0; battmgr->error = 0;
break; break;
case BATTMGR_BAT_INFO: case BATTMGR_BAT_INFO:
if (payload_len != sizeof(resp->info)) { /* some firmware versions report an extra __le32 at the end of the payload */
if (payload_len != sizeof(resp->info) &&
payload_len != (sizeof(resp->info) + sizeof(__le32))) {
dev_warn(battmgr->dev, dev_warn(battmgr->dev,
"invalid payload length for battery information request: %zd\n", "invalid payload length for battery information request: %zd\n",
payload_len); payload_len);
......
...@@ -159,6 +159,7 @@ static int rt5033_battery_probe(struct i2c_client *client) ...@@ -159,6 +159,7 @@ static int rt5033_battery_probe(struct i2c_client *client)
return -EINVAL; return -EINVAL;
} }
i2c_set_clientdata(client, battery);
psy_cfg.of_node = client->dev.of_node; psy_cfg.of_node = client->dev.of_node;
psy_cfg.drv_data = battery; psy_cfg.drv_data = battery;
......
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