summaryrefslogtreecommitdiff
path: root/drivers/power/supply/cw2015_battery.c
AgeCommit message (Collapse)Author
2022-02-01power: supply: core: fix application of sizeof to pointerYang Li
The coccinelle check report: ./drivers/power/supply/cw2015_battery.c:692:12-18: ERROR: application of sizeof to pointer Reported-by: Abaci Robot <abaci@linux.alibaba.com> Fixes: 25fd330370ac ("power: supply_core: Pass pointer to battery info") Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-01-03power: supply_core: Pass pointer to battery infoLinus Walleij
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-07-16power: supply: cw2015: use dev_err_probe to allow deferred probePeter Robinson
Deal with deferred probe using dev_err_probe so the error is handled and avoid logging lots probe defer information like the following: [ 9.125121] cw2015 4-0062: Failed to register power supply [ 9.211131] cw2015 4-0062: Failed to register power supply Fixes: b4c7715c10c1 ("power: supply: add CellWise cw2015 fuel gauge driver") Signed-off-by: Peter Robinson <pbrobinson@gmail.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-03-06power: supply: cw2015: Add CHARGE_NOW supportMartin Ashby
CHARGE_NOW is expected by some user software (such as waybar) instead of 'CAPACITY', in order to correctly calculate remaining battery life. Signed-off-by: Martin Ashby <martin@ashbysoft.com> Reviewed-by: Tobias Schramm <t.schramm@manjaro.org> Tested-by: Tobias Schramm <t.schramm@manjaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-06-06power: supply: cw2015: Attach OF ID table to the driverAndy Shevchenko
It appears that OF ID table was hanging around without being attached to the driver. Attach it properly. Fixes: b4c7715c10c1 ("power: supply: add CellWise cw2015 fuel gauge driver") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-By: Tobias Schramm <t.schramm@manjaro.org> Tested-By: Tobias Schramm <t.schramm@manjaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-09power: supply: cw2015: Make some symbols staticChenTao
Fix the following warning: drivers/power/supply/cw2015_battery.c:96:5: warning: 'cw_update_profile' was not declared. Should it be static? drivers/power/supply/cw2015_battery.c:712:1: warning: 'cw_bat_pm_ops' was not declared. Should it be static? Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: ChenTao <chentao107@huawei.com> Acked-by: Tobias Schramm <t.schramm@manjaro.org> Tested-by: Tobias Schramm <t.schramm@manjaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-05-03power: supply: add CellWise cw2015 fuel gauge driverTobias Schramm
This patch adds a driver for the CellWise cw2015 fuel gauge. The CellWise cw2015 is a shuntless, single-cell Li-Ion fuel gauge used in the pine64 Pinebook Pro laptop and some Raspberry Pi UPS HATs. Signed-off-by: Tobias Schramm <t.schramm@manjaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>