summaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/sc2731_charger.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-03power: supply_core: Pass pointer to battery infoLinus Walleij1-4/+4
The function to retrieve battery info (from the device tree) assumes we have a static info struct that gets populated by calling into power_supply_get_battery_info(). This is awkward since I want to support tables of static battery info by just assigning a pointer to all info based on e.g. a compatible value in the device tree. We also have a mixture of static and dynamically allocated variables here. Bite the bullet and let power_supply_get_battery_info() allocate also the memory used for the very top level struct power_supply_battery_info container. Pass pointers around and lifecycle this with the psy device just like the stuff we allocate inside it. Change all current users over. As part of the change, initializers need to be added to some previously uninitialized fields in struct power_supply_battery_info. Reviewed-By: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-05-13power: supply: sc2731_charger: Add missing MODULE_DEVICE_TABLEZou Wei1-0/+1
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zou Wei <zou_wei@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-05power: supply: sc2731_charger: Free battery informationBaolin Wang1-0/+2
Free battery information in case of adding battery OCV tables. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-05power: supply: sc2731_charger: Avoid repeated charge/dischargeBaolin Wang1-2/+2
Add info->charging validation to avoid repeated charge or discharge operation. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-05power: supply: sc2731_charger: Add charger status detectionBaolin Wang1-0/+20
The USB charger status can be notified before the charger driver registers the USB phy notifier, so we should check the charger status in probe() in case we missed the USB charger notification. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-05power: supply: sc2731_charger: Add one work to charge/dischargeBaolin Wang1-8/+22
Since the USB notifier context is atomic, we can not start or stop charging in atomic context. Thus this patch adds one work to help to charge or discharge. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-09-20power: supply: Add Spreadtrum SC2731 charger supportBaolin Wang1-0/+504
This patch adds the SC2731 PMIC switch charger support. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>