summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
...
| * power: supply: sbs-manager: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sbs: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rt9455: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rt5033_battery: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max17042_battery: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max17040: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max14656: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: ltc4162-l: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: ltc2941: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: lp8727: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-2/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: ds2782: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25980: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq256xx: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq2515x: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq24735: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq24257: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq24190: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq2415x: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+3
| | | | | | | | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: adp5061: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-201-3/+2
| | | | | | | | | | | | | | | | The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: 88pm860x: simplify using devmMatti Vaittinen2022-11-171-29/+9
| | | | | | | | | | | | | | | | Use devm variants for requesting threaded IRQ and for power-supply registration. Clean up error path and remove the .remove-callback. Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: fix residue sysfs file in error handle route of ↵Zeng Heng2022-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __power_supply_register() If device_add() succeeds, we should call device_del() when want to get rid of it, so move it into proper jump symbol. Otherwise, when __power_supply_register() returns fail and goto wakeup_init_failed to exit, there is still residue device file in sysfs. When attempt to probe device again, sysfs would complain as below: sysfs: cannot create duplicate filename '/devices/platform/i2c/i2c-0/0-001c/power_supply/adp5061' Call Trace: dump_stack_lvl+0x68/0x85 sysfs_warn_dup.cold+0x1c/0x29 sysfs_create_dir_ns+0x1b1/0x1d0 kobject_add_internal+0x143/0x390 kobject_add+0x108/0x170 Fixes: 80c6463e2fa3 ("power_supply: Fix Oops from NULL pointer dereference from wakeup_source_activate") Signed-off-by: Zeng Heng <zengheng4@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: mt6360: Use LINEAR_RANGE_IDX()Matti Vaittinen2022-11-011-9/+6
| | | | | | | | | | | | | | | | Do minor clean-up by using the newly inroduced LINEAR_RANGE_IDX() initialization macro. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bd99954: Use LINEAR_RANGE()Matti Vaittinen2022-11-011-71/+13
| | | | | | | | | | | | | | | | Do minor clean-up by using newly inroduced LINEAR_RANGE() initialization macro. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: repair kernel-doc for power_supply_vbat2ri()Lukas Bulwahn2022-10-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function power_supply_vbat2ri() does not have a parameter called table, despite it being mentioned in the kernel-doc comment. The table is actually obtained from the info parameter, the battery information container. Hence, ./scripts/kernel-doc -none drivers/power/supply/power_supply_core.c warns about this excess function parameter. Adjust the kernel-doc comment for power_supply_vbat2ri() for make W=1 happiness. Fixes: e9e7d165b4b0 ("power: supply: Support VBAT-to-Ri lookup tables") Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Add Vsys regulatorMarek Vasut2022-10-291-0/+32
| | | | | | | | | | | | | | | | | | | | The chip is capable of reporting Vsys voltage supplied to the system. Add regulator which represents the Vsys supply. This can be used e.g. as a supply for system PMIC input. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Add get_voltage support to Vbus regulatorMarek Vasut2022-10-291-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The chip is capable of reporting Vbus voltage, add .get_voltage implementation to Vbus regulator to report current Vbus voltage. This requires for the Vbus regulator to be registered always instead of the current state where the regulator is registered only in case USB PHY is not found. Do not provide Vbus regulator enable/disable ops in case USB PHY is present, as they would race with USB PHY notifier which is also used to toggle OTG boost mode. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Factor out regulator registration codeMarek Vasut2022-10-291-16/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Pull the regulator registration code into separate function, so it can be extended to register more regulators later. Currently this is only moving ifdeffery into one place and other preparatory changes. The dev_err_probe() output string is changed to explicitly list vbus regulator failure, so that once more regulators are registered, it would be clear which one failed. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Add support for setting user charge current and ↵Marek Vasut2022-10-291-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | voltage limit Let user set battery charge current and voltage limit via sysfs. This is useful in case the user space needs to reduce charge current to keep the system within thermal limits. The maximum charge current and voltage are still limited to "ti,charge-current" and "ti,battery-regulation-voltage" values to avoid damaging the hardware in case too high values are set by user space. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Clean up POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGEMarek Vasut2022-10-291-27/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up misuse of POWER_SUPPLY_PROP_VOLTAGE, POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX and POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE and document what exactly each value means. The POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE content is newly read back from hardware, while POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX is reported as the maximum value set in DT. The POWER_SUPPLY_PROP_VOLTAGE is newly used to report immediate value of battery voltage V_BAT, which is what this property was intended to report and which has been thus far misused to report the charger chip output voltage V_SYS. The V_SYS is no longer reported as there is currently no suitable property to report V_SYS. V_SYS reporting will be reinstated in subsequent patch. Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Clean up POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENTMarek Vasut2022-10-291-16/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up misuse of POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT and POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX and document what exactly each value means. The POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT content is newly read back from hardware, while POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX is reported as the maximum value set in DT. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Document POWER_SUPPLY_PROP_CURRENT_NOWMarek Vasut2022-10-291-1/+8
| | | | | | | | | | | | | | | | | | | | Document that POWER_SUPPLY_PROP_CURRENT_NOW really does refer to ADC-sampled immediate battery charge current I_BAT , since the meaning is not clear with all the currents which might be measured by charger chips. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power/supply: fix repeated words in commentswangjianli2022-10-281-1/+1
| | | | | | | | | | | | | | Delete the redundant word 'the'. Signed-off-by: wangjianli <wangjianli@cdjrlc.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: lp8788: make const array name staticColin Ian King2022-10-281-1/+1
| | | | | | | | | | | | | | | | | | Don't populate the read-only array name on the stack but instead make it static. Since the data and the pointers don't change also add in a missing const. Also makes the object code a little smaller. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | Merge tag 'driver-core-6.2-rc1' of ↵Linus Torvalds2022-12-162-5/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the set of driver core and kernfs changes for 6.2-rc1. The "big" change in here is the addition of a new macro, container_of_const() that will preserve the "const-ness" of a pointer passed into it. The "problem" of the current container_of() macro is that if you pass in a "const *", out of it can comes a non-const pointer unless you specifically ask for it. For many usages, we want to preserve the "const" attribute by using the same call. For a specific example, this series changes the kobj_to_dev() macro to use it, allowing it to be used no matter what the const value is. This prevents every subsystem from having to declare 2 different individual macros (i.e. kobj_const_to_dev() and kobj_to_dev()) and having the compiler enforce the const value at build time, which having 2 macros would not do either. The driver for all of this have been discussions with the Rust kernel developers as to how to properly mark driver core, and kobject, objects as being "non-mutable". The changes to the kobject and driver core in this pull request are the result of that, as there are lots of paths where kobjects and device pointers are not modified at all, so marking them as "const" allows the compiler to enforce this. So, a nice side affect of the Rust development effort has been already to clean up the driver core code to be more obvious about object rules. All of this has been bike-shedded in quite a lot of detail on lkml with different names and implementations resulting in the tiny version we have in here, much better than my original proposal. Lots of subsystem maintainers have acked the changes as well. Other than this change, included in here are smaller stuff like: - kernfs fixes and updates to handle lock contention better - vmlinux.lds.h fixes and updates - sysfs and debugfs documentation updates - device property updates All of these have been in the linux-next tree for quite a while with no problems" * tag 'driver-core-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (58 commits) device property: Fix documentation for fwnode_get_next_parent() firmware_loader: fix up to_fw_sysfs() to preserve const usb.h: take advantage of container_of_const() device.h: move kobj_to_dev() to use container_of_const() container_of: add container_of_const() that preserves const-ness of the pointer driver core: fix up missed drivers/s390/char/hmcdrv_dev.c class.devnode() conversion. driver core: fix up missed scsi/cxlflash class.devnode() conversion. driver core: fix up some missing class.devnode() conversions. driver core: make struct class.devnode() take a const * driver core: make struct class.dev_uevent() take a const * cacheinfo: Remove of_node_put() for fw_token device property: Add a blank line in Kconfig of tests device property: Rename goto label to be more precise device property: Move PROPERTY_ENTRY_BOOL() a bit down device property: Get rid of __PROPERTY_ENTRY_ARRAY_EL*SIZE*() kernfs: fix all kernel-doc warnings and multiple typos driver core: pass a const * into of_device_uevent() kobject: kset_uevent_ops: make name() callback take a const * kobject: kset_uevent_ops: make filter() callback take a const * kobject: make kobject_namespace take a const * ...
| * | driver core: make struct class.dev_uevent() take a const *Greg Kroah-Hartman2022-11-242-5/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dev_uevent() in struct class should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Cc: Jens Axboe <axboe@kernel.dk> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Russ Weight <russell.h.weight@intel.com> Cc: Jean Delvare <jdelvare@suse.com> Cc: Johan Hovold <johan@kernel.org> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@kernel.org> Cc: Karsten Keil <isdn@linux-pingi.de> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Keith Busch <kbusch@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Sagi Grimberg <sagi@grimberg.me> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: Raed Salem <raeds@nvidia.com> Cc: Chen Zhongjin <chenzhongjin@huawei.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Avihai Horon <avihaih@nvidia.com> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Colin Ian King <colin.i.king@gmail.com> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Jakob Koschel <jakobkoschel@gmail.com> Cc: Antoine Tenart <atenart@kernel.org> Cc: Frederic Weisbecker <frederic@kernel.org> Cc: Wang Yufen <wangyufen@huawei.com> Cc: linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-media@vger.kernel.org Cc: linux-nvme@lists.infradead.org Cc: linux-pm@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20221123122523.1332370-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | power: supply: ab8500: Defer thermal zone probeLinus Walleij2022-11-011-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The call thermal_zone_get_zone_by_name() used to return the thermal zone right away, but recent refactorings in the thermal core has changed this so the thermal zone used by the battery is probed later, and the call returns -ENODEV. This was always quite fragile. If we get -ENODEV, then return a -EPROBE_DEFER and try again later. Cc: phone-devel@vger.kernel.org Fixes: 2b0e7ac0841b ("power: supply: ab8500: Integrate thermal zone") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: ip5xxx: Fix integer overflow in current_now calculationOndrej Jirman2022-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When current is larger than ~2A, the multiplication in current_now property overflows and the kernel reports invalid negative current value. Change the numerator and denominator while preserving their ratio to allow up to +-6A before the overflow. Fixes: 75853406fa27 ("power: supply: Add a driver for Injoinic power bank ICs") Signed-off-by: Ondrej Jirman <megi@xff.cz> Reviewed-by: Samuel Holland <samuel@sholland.org> [use 149197/200 instead of 261095/350 as suggested by Samuel] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: rk817: Change rk817_chg_cur_to_reg to intChris Morgan2022-10-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Change return value of rk817_chg_cur_to_reg from u8 to int. If the function fails to find a suitable value it returns a -EINVAL, but defined as a u8 it would not return correctly. Additionally, change defined variable that stores return value from u8 to int. Fixes: 11cb8da0189b ("power: supply: Add charger driver for Rockchip RK817") Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: rk817: check correct variableDan Carpenter2022-10-201-5/+3
|/ | | | | | | | | This code checks "->chg_ps" twice when it was supposed to check "->bat_ps". Fixes: 11cb8da0189b ("power: supply: Add charger driver for Rockchip RK817") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* Merge tag 'for-v6.1' of ↵Linus Torvalds2022-10-0713-55/+1051
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: - new maintenance charging documentation - mt6370: new charger driver - bq25890: support input current limit - added Qualcomm PMK8350 PON support - misc minor fixes * tag 'for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (22 commits) power: supply: ab8500: remove unused static local variable power: supply: mt6370: Fix return value check in mt6370_chg_probe() power: supply: ab8500: Remove unused struct ab8500_chargalg_sysfs_entry power: supply: mt6370: uses IIO interfaces, depends on IIO power: supply: max1721x: Fix spelling mistake "Gauage" -> "Gauge" power: supply: mt6370: Add MediaTek MT6370 charger driver dt-bindings: power: supply: Add MediaTek MT6370 Charger lib: add linear range index macro power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property() power: supply: bq27xxx: fix NULL vs 0 warnings power: supply: bq27xxx: fix __be16 warnings power: supply: bq25890: Add support for setting IINLIM power: supply: bq25890: Disable PUMPX_EN on errors power: supply: Fix repeated word in comments power: supply: adp5061: show unknown capacity_level as text power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() power: supply: tps65217: Fix comments typo power: reset: qcom-pon: add support for qcom,pmk8350-pon compatible string dt-bindings: power: reset: qcom-pon: Add new compatible "qcom,pmk8350-pon" power: supply: cw2015: Use device managed API to simplify the code ...
| * power: supply: ab8500: remove unused static local variableTom Rix2022-10-051-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | cpp_check reports [drivers/power/supply/ab8500_chargalg.c:493]: (style) Variable 'ab8500_chargalg_ex_ac_enable_toggle' is assigned a value that is never used. From inspection, this variable is never used. So remove it. Fixes: 6c50a08d9dd3 ("power: supply: ab8500: Drop external charger leftovers") Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Chen Lifu <chenlifu@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: mt6370: Fix return value check in mt6370_chg_probe()Yang Yingliang2022-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | If create_singlethread_workqueue() fails, it returns a null pointer, replace IS_ERR() check with NULL pointer check. Fixes: 233cb8a47d65 ("power: supply: mt6370: Add MediaTek MT6370 charger driver") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: ChiaEn Wu <chiaen_wu@richtek.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: ab8500: Remove unused struct ab8500_chargalg_sysfs_entryYuan Can2022-10-011-6/+0
| | | | | | | | | | | | | | | | After commit 75ee3f6f0c1a("power: supply: ab8500_chargalg: Drop enable/disable sysfs"), no one use struct ab8500_chargalg_sysfs_entry, so remove it. Signed-off-by: Yuan Can <yuancan@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: mt6370: uses IIO interfaces, depends on IIORandy Dunlap2022-10-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mt6370-charger driver uses IIO interfaces and produces build errors when CONFIG_IIO is not set, so it should depend on IIO. ERROR: modpost: "iio_read_channel_processed" [drivers/power/supply/mt6370-charger.ko] undefined! ERROR: modpost: "devm_iio_channel_get_all" [drivers/power/supply/mt6370-charger.ko] undefined! Fixes: 233cb8a47d65 ("power: supply: mt6370: Add MediaTek MT6370 charger driver") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: ChiaEn Wu <chiaen_wu@richtek.com> Cc: Sebastian Reichel <sebastian.reichel@collabora.com> Cc: linux-pm@vger.kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: max1721x: Fix spelling mistake "Gauage" -> "Gauge"Colin Ian King2022-10-011-1/+1
| | | | | | | | | | | | | | There is a spelling mistake in the module description. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: mt6370: Add MediaTek MT6370 charger driverChiaEn Wu2022-09-163-0/+976
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaTek MT6370 is a SubPMIC consisting of a single cell battery charger with ADC monitoring, RGB LEDs, dual channel flashlight, WLED backlight driver, display bias voltage supply, one general purpose LDO, and the USB Type-C & PD controller complies with the latest USB Type-C and PD standards. Add support for the MediaTek MT6370 Charger driver. The charger module of MT6370 supports High-Accuracy Voltage/Current Regulation, Average Input Current Regulation, Battery Temperature Sensing, Over-Temperature Protection, DPDM Detection for BC1.2. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq25890: Fix enum conversion in ↵Nathan Chancellor2022-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bq25890_power_supply_set_property() Clang warns: drivers/power/supply/bq25890_charger.c:625:40: error: implicit conversion from enumeration type 'enum bq25890_fields' to different enumeration type 'enum bq25890_table_ids' [-Werror,-Wenum-conversion] lval = bq25890_find_idx(val->intval, F_IINLIM); ~~~~~~~~~~~~~~~~ ^~~~~~~~ 1 error generated. Use the proper value from the right enumerated type, TBL_IINLIM, so there is no more implcit conversion. The numerical values of F_IINLIM and TBL_IINLIM happen to be the same so there is no change in behavior. Fixes: 4a4748f28b0b ("power: supply: bq25890: Add support for setting IINLIM") Link: https://github.com/ClangBuiltLinux/linux/issues/1707 Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: fix NULL vs 0 warningsBen Dooks2022-09-111-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver has a lot of sparse warnings for using 0 as a NULL pointer when NULL would be appropriate. Change the 0 values to NULL to fix the warnings, some of which are shown here: drivers/power/supply/bq27xxx_battery.c:984:23: warning: Using plain integer as NULL pointer drivers/power/supply/bq27xxx_battery.c:985:23: warning: Using plain integer as NULL pointer drivers/power/supply/bq27xxx_battery.c:986:23: warning: Using plain integer as NULL pointer drivers/power/supply/bq27xxx_battery.c:987:23: warning: Using plain integer as NULL pointer drivers/power/supply/bq27xxx_battery.c:988:23: warning: Using plain integer as NULL pointer Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>