summaryrefslogtreecommitdiff
path: root/drivers/power/supply/qcom_pmi8998_charger.c
AgeCommit message (Collapse)AuthorFilesLines
2023-12-25power: supply: Fix null pointer dereference in smb2_probeKunwu Chan1-0/+4
devm_kasprintf and devm_kzalloc return a pointer to dynamically allocated memory which can be NULL upon failure. Fixes: 8648aeb5d7b7 ("power: supply: add Qualcomm PMI8998 SMB2 Charger driver") Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20231124075021.1335289-1-chentao@kylinos.cn Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-12power: supply: Remove redundant dev_err_probe() for platform_get_irq_byname()Ruan Jinjie1-2/+1
There is no need to call the dev_err_probe() function directly to print a custom message when handling an error from platform_get_irq_byname() function as it is going to display an appropriate error message in case of a failure. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Link: https://lore.kernel.org/r/20230727113550.2599335-1-ruanjinjie@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-08-03power: supply: qcom_pmi8998_charger: fix charger statusCaleb Connolly1-1/+1
The INHIBIT_CHARGE status bit means the battery has reached a pre-programmed charge limit which is some voltage offset below the target float voltage. This should be reported as a STATUS_FULL rather than UNKNOWN, fix it. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> Link: https://lore.kernel.org/r/20230802-pmi8998-charger-fixes-v1-2-a8f1e8b84c1e@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-08-03power: supply: qcom_pmi8998_charger: remove CHARGE_CONTROL_LIMIT_* propsCaleb Connolly1-8/+0
These property were intended to allow the power supply to be treated as a cooling device, however the cooling device interface has been dropped from the psy core code. They now just duplicate the CURRENT_NOW and CURRENT_MAX properties and are generally confusing, drop them. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> Link: https://lore.kernel.org/r/20230802-pmi8998-charger-fixes-v1-1-a8f1e8b84c1e@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-08-03power: supply: qcom_pmi8998_charger: fix uninitialized variableYu Liao1-1/+2
smatch warnings: drivers/power/supply/qcom_pmi8998_charger.c:565 smb2_status_change_work() error: uninitialized symbol 'usb_online'. usb_online is used uninitialized whenever smb2_get_prop_usb_online() returns a negative value. Thus, fix the issue by initializing usb_online to 0. Fixes: 8648aeb5d7b7 ("power: supply: add Qualcomm PMI8998 SMB2 Charger driver") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/r/202307280638.556PrzIS-lkp@intel.com/ Signed-off-by: Yu Liao <liaoyu15@huawei.com> Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org Link: https://lore.kernel.org/r/20230802023130.2516232-1-liaoyu15@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-06-09power: supply: add Qualcomm PMI8998 SMB2 Charger driverCaleb Connolly1-0/+1059
Add a driver for the SMB2 charger block found in the Qualcomm PMI8998 and PM660. This driver is capable of utilising Qualcomm's Automatic Power Source Detection (APSD) BC1.2 implementation, as well as Automatic Input Current Limiting (AICL) to configure the maximum input current limit of DCP (wall) chargers. Quick Charge is not currently supported. Most devices using the smb2 charger have a secondary dedicated charger chip which is used in parallel to enable faster charger without overheating. However, not all do, as a result to ensure safety until these are supported, the maximum current is limited to ~1A via the FAST_CHARGE_CURRENT_CFG register. Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org> Tested-by: Joel Selvaraj <joelselvaraj.oss@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>