Power Supply Fixes for 6.8 cycle

* qcom_battmgr: revert broken fix
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmW8Dx0ACgkQ2O7X88g7
 +ppx8A/+ODXMyMp8ZlnAD+mqaRwNOYRHcjK1UFSfGu5Te397rBQUU3moDGOulDeg
 fdel2NCE0Y4RHBiM8M/UcgRUgv9w2R2ZBac4BQHhd9eNaxf+obo6WnCuStNfhpXy
 vX4DOENPh0XZ6MKBHSPKNuRIuKgDxsRiPTeb9wyQnGu/lSEGk+abqD9j+KdVYYfF
 Viq+ur9kwRy/g+6cD1tnL8ORkjDUejX7TCeWNSl3LnCJQcDyD7+ElZhsHxJSlIsi
 qoPcgZJ3p0X8dGV2Uzb6vH/xEBSp838wkyzndZ41Dyh1Eqm0YXHm9azK1j+hf+o/
 OnwphkNgxJGr2rR7Tw2ktesi4KfrqHIuhMV1qfGLyS629Upeyq0O9CuPffcfXeTj
 joUg+OnXUE26Nga/8/6Fkgp8ZpK299NoyXJL9jcLKxCMmD/5wucM2ct0pAVoMPBO
 Bi2ZhfxAePGcH4p9l1nGKCxFQiK+85hE6lomtZHrAJP+Gytq+fRnYHGVuqP90G9/
 4Vbn2IOW40mQ/uPJoqbHgNbJVjI3bK6IIz2oAVTZ+NlW3hY7ztlNMSV71Bx5R8N4
 inrZX56/QSgKu+c2cbX1QkhdNDrEFHtOPhGpZ8R8GEwjFRNoZIcwNGPd36GzNURK
 5A10/DAkSZJ8i/11fg+hkSxBzh71qM/P1VbG+uXcD7I2AYJ0gD4=
 =kZXY
 -----END PGP SIGNATURE-----

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

Pull power supply fix from Sebastian Reichel:

 - qcom_battmgr: revert broken fix

* tag 'for-v6.8-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  Revert "power: supply: qcom_battmgr: Register the power supplies after PDR is up"
This commit is contained in:
Linus Torvalds 2024-02-02 12:46:35 -08:00
commit 79837a7c0f

View File

@ -282,7 +282,6 @@ struct qcom_battmgr_wireless {
struct qcom_battmgr {
struct device *dev;
struct auxiliary_device *adev;
struct pmic_glink_client *client;
enum qcom_battmgr_variant variant;
@ -1294,69 +1293,11 @@ static void qcom_battmgr_enable_worker(struct work_struct *work)
dev_err(battmgr->dev, "failed to request power notifications\n");
}
static char *qcom_battmgr_battery[] = { "battery" };
static void qcom_battmgr_register_psy(struct qcom_battmgr *battmgr)
{
struct power_supply_config psy_cfg_supply = {};
struct auxiliary_device *adev = battmgr->adev;
struct power_supply_config psy_cfg = {};
struct device *dev = &adev->dev;
psy_cfg.drv_data = battmgr;
psy_cfg.of_node = adev->dev.of_node;
psy_cfg_supply.drv_data = battmgr;
psy_cfg_supply.of_node = adev->dev.of_node;
psy_cfg_supply.supplied_to = qcom_battmgr_battery;
psy_cfg_supply.num_supplicants = 1;
if (battmgr->variant == QCOM_BATTMGR_SC8280XP) {
battmgr->bat_psy = devm_power_supply_register(dev, &sc8280xp_bat_psy_desc, &psy_cfg);
if (IS_ERR(battmgr->bat_psy))
dev_err(dev, "failed to register battery power supply (%ld)\n",
PTR_ERR(battmgr->bat_psy));
battmgr->ac_psy = devm_power_supply_register(dev, &sc8280xp_ac_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->ac_psy))
dev_err(dev, "failed to register AC power supply (%ld)\n",
PTR_ERR(battmgr->ac_psy));
battmgr->usb_psy = devm_power_supply_register(dev, &sc8280xp_usb_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->usb_psy))
dev_err(dev, "failed to register USB power supply (%ld)\n",
PTR_ERR(battmgr->usb_psy));
battmgr->wls_psy = devm_power_supply_register(dev, &sc8280xp_wls_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->wls_psy))
dev_err(dev, "failed to register wireless charing power supply (%ld)\n",
PTR_ERR(battmgr->wls_psy));
} else {
battmgr->bat_psy = devm_power_supply_register(dev, &sm8350_bat_psy_desc, &psy_cfg);
if (IS_ERR(battmgr->bat_psy))
dev_err(dev, "failed to register battery power supply (%ld)\n",
PTR_ERR(battmgr->bat_psy));
battmgr->usb_psy = devm_power_supply_register(dev, &sm8350_usb_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->usb_psy))
dev_err(dev, "failed to register USB power supply (%ld)\n",
PTR_ERR(battmgr->usb_psy));
battmgr->wls_psy = devm_power_supply_register(dev, &sm8350_wls_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->wls_psy))
dev_err(dev, "failed to register wireless charing power supply (%ld)\n",
PTR_ERR(battmgr->wls_psy));
}
}
static void qcom_battmgr_pdr_notify(void *priv, int state)
{
struct qcom_battmgr *battmgr = priv;
if (state == SERVREG_SERVICE_STATE_UP) {
if (!battmgr->bat_psy)
qcom_battmgr_register_psy(battmgr);
battmgr->service_up = true;
schedule_work(&battmgr->enable_work);
} else {
@ -1371,9 +1312,13 @@ static const struct of_device_id qcom_battmgr_of_variants[] = {
{}
};
static char *qcom_battmgr_battery[] = { "battery" };
static int qcom_battmgr_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{
struct power_supply_config psy_cfg_supply = {};
struct power_supply_config psy_cfg = {};
const struct of_device_id *match;
struct qcom_battmgr *battmgr;
struct device *dev = &adev->dev;
@ -1383,7 +1328,14 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
return -ENOMEM;
battmgr->dev = dev;
battmgr->adev = adev;
psy_cfg.drv_data = battmgr;
psy_cfg.of_node = adev->dev.of_node;
psy_cfg_supply.drv_data = battmgr;
psy_cfg_supply.of_node = adev->dev.of_node;
psy_cfg_supply.supplied_to = qcom_battmgr_battery;
psy_cfg_supply.num_supplicants = 1;
INIT_WORK(&battmgr->enable_work, qcom_battmgr_enable_worker);
mutex_init(&battmgr->lock);
@ -1395,6 +1347,43 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
else
battmgr->variant = QCOM_BATTMGR_SM8350;
if (battmgr->variant == QCOM_BATTMGR_SC8280XP) {
battmgr->bat_psy = devm_power_supply_register(dev, &sc8280xp_bat_psy_desc, &psy_cfg);
if (IS_ERR(battmgr->bat_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->bat_psy),
"failed to register battery power supply\n");
battmgr->ac_psy = devm_power_supply_register(dev, &sc8280xp_ac_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->ac_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->ac_psy),
"failed to register AC power supply\n");
battmgr->usb_psy = devm_power_supply_register(dev, &sc8280xp_usb_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->usb_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->usb_psy),
"failed to register USB power supply\n");
battmgr->wls_psy = devm_power_supply_register(dev, &sc8280xp_wls_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->wls_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->wls_psy),
"failed to register wireless charing power supply\n");
} else {
battmgr->bat_psy = devm_power_supply_register(dev, &sm8350_bat_psy_desc, &psy_cfg);
if (IS_ERR(battmgr->bat_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->bat_psy),
"failed to register battery power supply\n");
battmgr->usb_psy = devm_power_supply_register(dev, &sm8350_usb_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->usb_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->usb_psy),
"failed to register USB power supply\n");
battmgr->wls_psy = devm_power_supply_register(dev, &sm8350_wls_psy_desc, &psy_cfg_supply);
if (IS_ERR(battmgr->wls_psy))
return dev_err_probe(dev, PTR_ERR(battmgr->wls_psy),
"failed to register wireless charing power supply\n");
}
battmgr->client = devm_pmic_glink_register_client(dev,
PMIC_GLINK_OWNER_BATTMGR,
qcom_battmgr_callback,