summaryrefslogtreecommitdiffstats
path: root/drivers/power (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * | power: ip5xxx_power: Add battery type for 4.4VCsókás, Bence2024-12-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | IP53xx series supports 4.4V batteries. Add support for it to compatible parts (that have `vbat_max` set to >= 4.4 V). Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu> Link: https://lore.kernel.org/r/20241119180741.2237692-4-csokas.bence@prolan.hu Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: ip5xxx_power: Allow for more parameters to be configuredCsókás, Bence2024-12-051-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other parts such as IP5306 may support other battery voltages and have different constants for input voltage regulation. Allow these to be passed from `struct ip5xxx_regfield_config`. Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu> Link: https://lore.kernel.org/r/20241119180741.2237692-3-csokas.bence@prolan.hu Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: ip5xxx_power: Use regmap_field APICsókás, Bence2024-12-051-158/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IP53xx series [1] has a much different register layout than the 51xx/52xx [2] currently supported by this driver. To accommodate supporting the former, refactor the code to use the flexible regmap_field API. [1] https://sharvielectronics.com/wp-content/uploads/2021/07/IP5306-I2C-registers.pdf [2] https://www.windworkshop.cn/wp-content/uploads/2022/04/IP5209-IP5109-IP5207-IP5108-I2C-registers.pdf Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu> Link: https://lore.kernel.org/r/20241119180741.2237692-1-csokas.bence@prolan.hu Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: ip5xxx_power: Fix return value on ADC read errorsCsókás, Bence2024-12-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If ADC read returns an error, the return value was silently ignored, execution continued and an uninitialized value and a return code of 0 was passed back to userspace. The only exception was POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT, which bailed out correctly. Fix returns for the other cases as well. Fixes: 75853406fa27 ("power: supply: Add a driver for Injoinic power bank ICs") Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu> Link: https://lore.kernel.org/r/20241119180741.2237692-2-csokas.bence@prolan.hu Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: sysfs: rework uevent property loopThomas Weißschuh2024-12-051-23/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of looping through all properties known to be supported by the psy, loop over all known properties and decide based on the return value of power_supply_get_property() whether the property existed. This makes the code shorter now and even more so when power supply extensions are added. It also simplifies the locking, as it can all happen inside power_supply_get_property(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-6-7240144daa8e@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: sysfs: prepare for power supply extensionsThomas Weißschuh2024-12-051-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upcoming extension API will add properties which are not part of the the power_supply_desc. Use power_supply_has_property() so the properties from extensions are also checked. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-5-7240144daa8e@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: hwmon: prepare for power supply extensionsThomas Weißschuh2024-12-051-26/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upcoming extension API will add properties which are not part of the the power_supply_desc. Use power_supply_has_property() so the properties from extensions are also checked. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-4-7240144daa8e@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: core: introduce power_supply_has_property()Thomas Weißschuh2024-12-052-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a helper to check if a power supply implements a certain property. It will be used by the sysfs and hwmon code to remove similar open-coded checks. It also paves the way for the extension API to hook into. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-3-7240144daa8e@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: core: rename psy_has_property() to psy_desc_has_property()Thomas Weißschuh2024-12-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function only takes a desc as parameter, align the naming. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-2-7240144daa8e@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: sysfs: print single value in uevent for ↵Thomas Weißschuh2024-12-051-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR Currently an uevent contains the same string representation of a property as sysfs. However for POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR this is specially formatted to indicate all possible values. This doesn't make sense for uevents and complicates parsing. Instead only include the currently active value in uevents. As currently no in-tree driver uses POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR this change is not a problem. Soon the property will actually be used so fix the formatting before that happens. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20241111-power-supply-extensions-v4-1-7240144daa8e@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: max1720x: add charge full propertyDimitri Fedrau2024-12-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Charge full holds the calculated full capacity of the cell based on all inputs from the ModelGauge m5 algorithm including empty compensation. A new full-capacity value is calculated continuously as application conditions change. Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com> Link: https://lore.kernel.org/r/20241203-max1720x-charge-full-prop-v1-1-b02776b43f17@liebherr.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2782: Use devm_delayed_work_autocancel() helperAndrew Davis2024-12-041-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed work init function. This helps prevent mistakes like canceling out of order in cleanup functions and forgetting to canceling on error paths. Note we move this to after the registering the power supply so that the cancel is called before unregistering. This was the last thing the .remove() function did, so remove that too. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20241202211519.199635-5-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2782: Use devm_power_supply_register() helperAndrew Davis2024-12-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the device lifecycle managed register function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20241202211519.199635-4-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2782: Use devm based memory allocatorsAndrew Davis2024-12-041-17/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use device lifecycle managed memory alloc helpers. This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on all error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20241202211519.199635-3-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2782: Free IDA with devm actionAndrew Davis2024-12-041-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This helps prevent mistakes like freeing out of order in cleanup functions and forgetting to free on error paths. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20241202211519.199635-2-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2782: Switch to simpler IDA interfaceAndrew Davis2024-12-041-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to specify any ranges when allocating IDs so we can switch to ida_alloc() and ida_free() instead of idr_*. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20241202211519.199635-1-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: olpc_battery: constify 'struct bin_attribute'Thomas Weißschuh2024-12-041-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-psy-v1-4-f846430b8b66@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2781: constify 'struct bin_attribute'Thomas Weißschuh2024-12-041-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-psy-v1-3-f846430b8b66@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2780: constify 'struct bin_attribute'Thomas Weißschuh2024-12-041-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-psy-v1-2-f846430b8b66@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * | power: supply: ds2760: constify 'struct bin_attribute'Thomas Weißschuh2024-12-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The sysfs core now allows instances of 'struct bin_attribute' to be moved into read-only memory. Make use of that to protect them against accidental or malicious modifications. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241202-sysfs-const-bin_attr-psy-v1-1-f846430b8b66@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | | Merge tag 'pwrseq-updates-for-v6.14-rc1' of ↵Linus Torvalds8 days1-0/+29
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull power sequencing updates from Bartosz Golaszewski: "We added support for another Qualcomm WCN model and a FIXME comment that explains why we still need to keep a GPIO workaround for now despite having merged a set of changes to the PCI code that seemingly fixed the underlying problem: - support a new model in the qcom-wcn pwrseq driver - explain the need to keep the WLAN_EN GPIO workaround for now with a FIXME comment" * tag 'pwrseq-updates-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: qcom-wcn: explain why we need the WLAN_EN GPIO hack power: sequencing: qcom-wcn: add support for the WCN6750 PMU
| * | | power: sequencing: qcom-wcn: explain why we need the WLAN_EN GPIO hackBartosz Golaszewski2025-01-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the recent rework of the PCI power control code, the workaround for the wlan-enable GPIO - where we don't set a default (low) state in the power sequencing driver, but instead request the pin as-is - should no longer be needed but some platforms still fail to probe the WLAN controller. This is caused by the Qcom PCIe controller and needs a workaround in the controller driver so add a FIXME to eventually remove the hack from this driver once this is done. Link: https://lore.kernel.org/r/20250102121530.26993-1-brgl@bgdev.pl Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
| * | | power: sequencing: qcom-wcn: add support for the WCN6750 PMUJanaki Ramaiah Thota2024-12-101-0/+22
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Enable support for controlling the power-up sequence of the PMU inside the WCN6750 model. Signed-off-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com> Link: https://lore.kernel.org/r/20241209103455.9675-5-quic_janathot@quicinc.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
* | / power: supply: bq24190: Fix BQ24296 Vbus regulator supportHans de Goede2024-12-191-3/+9
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 issues with bq24296_set_otg_vbus(): 1. When writing the OTG_CONFIG bit it uses POC_CHG_CONFIG_SHIFT which should be POC_OTG_CONFIG_SHIFT. 2. When turning the regulator off it never turns charging back on. Note this must be done through bq24190_charger_set_charge_type(), to ensure that the charge_type property value of none/trickle/fast is honored. Resolve both issues to fix BQ24296 Vbus regulator support not working. Fixes: b150a703b56f ("power: supply: bq24190_charger: Add support for BQ24296") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20241116203648.169100-2-hdegoede@redhat.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: cros_charge-control: hide start threshold on v2 cmdThomas Weißschuh2024-12-101-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ECs implementing the v2 command will not stop charging when the end threshold is reached. Instead they will begin discharging until the start threshold is reached, leading to permanent charge and discharge cycles. This defeats the point of the charge control mechanism. Avoid the issue by hiding the start threshold on v2 systems. Instead on those systems program the EC with start == end which forces the EC to reach and stay at that level. v1 does not support thresholds and v3 works correctly, at least judging from the code. Reported-by: Thomas Koch <linrunner@gmx.net> Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241208-cros_charge-control-v2-v1-3-8d168d0f08a3@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: cros_charge-control: allow start_threshold == end_thresholdThomas Weißschuh2024-12-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Allow setting the start and stop thresholds to the same value. There is no reason to disallow it. Suggested-by: Thomas Koch <linrunner@gmx.net> Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241208-cros_charge-control-v2-v1-2-8d168d0f08a3@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: cros_charge-control: add mutex for driver dataThomas Weißschuh2024-12-101-1/+17
| | | | | | | | | | | | | | | | | | | | | | Concurrent accesses through sysfs may lead to inconsistent state in the priv data. Introduce a mutex to avoid this. Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241208-cros_charge-control-v2-v1-1-8d168d0f08a3@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: gpio-charger: Fix set charge current limitsDimitri Fedrau2024-12-101-0/+8
|/ | | | | | | | | | | | | Fix set charge current limits for devices which allow to set the lowest charge current limit to be greater zero. If requested charge current limit is below lowest limit, the index equals current_limit_map_size which leads to accessing memory beyond allocated memory. Fixes: be2919d8355e ("power: supply: gpio-charger: add charge-current-limit feature") Cc: stable@vger.kernel.org Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com> Link: https://lore.kernel.org/r/20241209-fix-charge-current-limit-v1-1-760d9b8f2af3@liebherr.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* Merge tag 'for-v6.13' of ↵Linus Torvalds2024-11-2860-259/+882
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "Power-supply core: - replace power_supply_register_no_ws() with power_supply_register() and a new "no_wakeup_source" field in struct power_supply_config - constify battery info tables in the core and all drivers - switch back to remove callback for all platform drivers - allow power_supply_put() to be called from atomic context - mark attribute arrays read-only after init Power-supply drivers: - new driver for TWL6030 and TWL6032 - rk817: improve battery capacity calibration - misc small cleanups and fixes" * tag 'for-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (42 commits) power: reset: ep93xx: add AUXILIARY_BUS dependency dt-bindings: power: reset: Convert mode-.* properties to array power: supply: sc27xx: Fix battery detect GPIO probe dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio reset: keystone-reset: remove unused macros power: supply: axp20x_battery: Use scaled iio_read_channel power: supply: axp20x_usb_power: Use scaled iio_read_channel power: supply: generic-adc-battery: change my gmail power: supply: pmu_battery: Set power supply type to BATTERY power: Switch back to struct platform_driver::remove() power: supply: hwmon: move interface to private header power: supply: rk817: Update battery capacity calibration power: supply: rk817: stop updating info in suspend power: supply: rt9471: Use IC status regfield to report real charger status power: supply: rt9471: Fix wrong WDT function regfield declaration dt-bindings: power/supply: qcom,pmi8998-charger: Drop incorrect "#interrupt-cells" from example power: supply: core: mark attribute arrays as ro_after_init power: supply: core: unexport power_supply_property_is_writeable() power: supply: core: use device mutex wrappers power: supply: bq27xxx: Fix registers of bq27426 ...
| * power: reset: ep93xx: add AUXILIARY_BUS dependencyArnd Bergmann2024-11-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fails to link when compile-testing and the auxiliary bus is not built-in: x86_64-linux-ld: drivers/power/reset/ep93xx-restart.o: in function `ep93xx_reboot_driver_init': ep93xx-restart.c:(.init.text+0x11): undefined reference to `__auxiliary_driver_register' x86_64-linux-ld: drivers/power/reset/ep93xx-restart.o: in function `ep93xx_reboot_driver_exit': ep93xx-restart.c:(.exit.text+0x8): undefined reference to `auxiliary_driver_unregister' Add the appropriate dependency. Fixes: 9fa7cdb4368f ("power: reset: Add a driver for the ep93xx reset") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20241111104418.3891756-1-arnd@kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: sc27xx: Fix battery detect GPIO probeStanislav Jakubek2024-11-111-3/+7
| | | | | | | | | | | | | | | | | | | | The DT bindings specify the property as 'battery-detect-gpios', add handling for it. Keep fallback to the deprecated 'bat-detect-gpio' property to keep compatibility with older DTS. Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com> Link: https://lore.kernel.org/r/ca28b2f2037929c0011fc5c779c332c1d1ad5308.1730720720.git.stano.jakubek@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * reset: keystone-reset: remove unused macrosBa Jing2024-11-111-2/+0
| | | | | | | | | | | | | | | | | | After reviewing the code, it was found that these macros are never referenced in the code. Just remove them. Signed-off-by: Ba Jing <bajing@cmss.chinamobile.com> Link: https://lore.kernel.org/r/20241025090659.33458-1-bajing@cmss.chinamobile.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_battery: Use scaled iio_read_channelChris Morgan2024-11-111-16/+17
| | | | | | | | | | | | | | | | | | Change iio_read_channel_processed to iio_read_channel_processed_scale where appropriate. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://lore.kernel.org/r/20241023184800.109376-3-macroalpha82@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: axp20x_usb_power: Use scaled iio_read_channelChris Morgan2024-11-111-18/+15
| | | | | | | | | | | | | | | | | | Change iio_read_channel_processed to iio_read_channel_processed_scale where appropriate. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://lore.kernel.org/r/20241023184800.109376-2-macroalpha82@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: generic-adc-battery: change my gmailanish kumar2024-11-111-2/+2
| | | | | | | | | | | | | | | | change my contact in this driver. Signed-off-by: anish kumar <yesanishhere@gmail.com> Link: https://lore.kernel.org/r/20241023061126.7896-1-yesanishhere@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: pmu_battery: Set power supply type to BATTERYEd Robbins2024-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | If the power supply type is not set it defaults to "Unknown" and upower does not recognise it. In turn battery monitor applications do not see a battery. Setting to POWER_SUPPLY_TYPE_BATTERY fixes this. Signed-off-by: Ed Robbins <edd.robbins@gmail.com> Link: https://lore.kernel.org/r/IOFJLS.120OJ5KJG9R72@googlemail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: Switch back to struct platform_driver::remove()Uwe Kleine-König2024-10-2133-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers. Convert all platform drivers below drivers/power/ to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer. While touching these files, make indention of the struct initializer consistent in several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20241010203622.839625-6-u.kleine-koenig@baylibre.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: hwmon: move interface to private headerThomas Weißschuh2024-10-171-0/+17
| | | | | | | | | | | | | | | | | | | | The interface of power_supply_hwmon.c is only meant to be used by the psy core. Remove it from the public header file and use the private one instead. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241017-power-supply-cleanups-v2-1-cb0f5deab088@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rk817: Update battery capacity calibrationChris Morgan2024-10-161-46/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The battery capacity calibration function continues to be a source of bugs for end users, especially when coming out of suspend. This occurs when the device has incorrect readings for voltage, and causes the current code to set fully charged capacity incorrectly. Add checks to ensure we don't attempt a capacity calibration when we have invalid voltage values or no battery present, and remove the code that attempts to automatically set the fully charged capacity in lieu of making the value writeable. This way userspace is able to adjust the fully charged capacity for a degraded battery. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://lore.kernel.org/r/20240926144346.94630-3-macroalpha82@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rk817: stop updating info in suspendChris Morgan2024-10-161-1/+10
| | | | | | | | | | | | | | | | | | | | | | The driver has a thread that checks the battery every 8 seconds. Stop this thread during device suspend as while the device is suspended not all values seem to be read correctly (such as battery voltage). The resume function triggers the thread to start again. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Link: https://lore.kernel.org/r/20240926144346.94630-2-macroalpha82@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rt9471: Use IC status regfield to report real charger statusChiYuan Huang2024-10-161-17/+31
| | | | | | | | | | | | | | | | | | | | | | Use IC status regfield to rewrite the 'get_staus' function. The original one cannot cover some special scenario like as charger OTG or JEITA case. Fixes: 4a1a5f6781d8 ("power: supply: rt9471: Add Richtek RT9471 charger driver") Reported-by: Lucas Tsai <lucas_tsai@richtek.com> Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Link: https://lore.kernel.org/r/67ba92bb4a9c51d9cafadab30b788a3a2c3048e1.1727252762.git.cy_huang@richtek.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: rt9471: Fix wrong WDT function regfield declarationChiYuan Huang2024-10-161-2/+2
| | | | | | | | | | | | | | | | | | | | Fix F_WDT and F_WDT_RST wrong regfield declaration. Fixes: 4a1a5f6781d8 ("power: supply: rt9471: Add Richtek RT9471 charger driver") Reported-by: Lucas Tsai <lucas_tsai@richtek.com> Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Link: https://lore.kernel.org/r/f862e23f220612f01fabb6d8e76cfaf63756c22b.1727252762.git.cy_huang@richtek.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: mark attribute arrays as ro_after_initThomas Weißschuh2024-10-162-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The attribute arrays are only modified during the __init phase. To protect them against intentional or accidental modification, mark them as __ro_after_init. To make sure no modifications are introduced, also mark the return values of the accessors as const. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241005-power-supply-cleanups-v1-3-45303b2d0a4d@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: unexport power_supply_property_is_writeable()Thomas Weißschuh2024-10-163-1/+4
| | | | | | | | | | | | | | | | | | | | | | Since commit ("power: supply: Drop use_cnt check from power_supply_property_is_writeable()"), this function does not check use_cnt anymore, making it unsuitable for general usage. As it is only used by the psy core anyways, remove it from the public header and unexport it to avoid misusage. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241005-power-supply-cleanups-v1-2-45303b2d0a4d@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: core: use device mutex wrappersThomas Weißschuh2024-10-161-2/+2
| | | | | | | | | | | | | | | | | | The mutex is an implementation detail of struct device. Use the dedicated wrappers to access the field. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20241005-power-supply-cleanups-v1-1-45303b2d0a4d@weissschuh.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: bq27xxx: Fix registers of bq27426Barnabás Czémán2024-10-161-2/+35
| | | | | | | | | | | | | | | | | | | | | | Correct bq27426 registers, according to technical reference manual it does not have Design Capacity register so it is not register compatible with bq27421. Fixes: 5ef6a16033b47 ("power: supply: bq27xxx: Add support for BQ27426") Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> Link: https://lore.kernel.org/r/20241016-fix_bq27426-v2-1-aa6c0f51a9f6@mainlining.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: reset: syscon-reboot: Accept reg propertyChris Packham2024-10-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | For historical reasons syscon-reboot has used an 'offset' property. As a child on a MMIO bus having a 'reg' property is more appropriate. Accept 'reg' as an alternative to 'offset'. Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20241015225948.3971924-3-chris.packham@alliedtelesis.co.nz Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: initial support for TWL6030/32Andreas Kemnade2024-10-163-0/+592
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a driver for the charger in the TWL6030/32. For now it does not report much in sysfs but parameters are set up for USB, charging is enabled with the specified parameters. It stops charging when full and also restarts charging. This prevents ending up in a system setup where you run out of battery although a charger is plugged in after precharge completed. Battery voltage behavior was checked via the GPADC. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Link: https://lore.kernel.org/r/20241016080314.222674-3-andreas@kemnade.info Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: Fix a typoAndrew Kreimer2024-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | Fix a typo in comments. Reported-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Kreimer <algonell@gmail.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Link: https://lore.kernel.org/r/20240912125303.44118-1-algonell@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| * power: supply: Correct multiple typos in commentsShen Lichuan2024-10-157-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed some spelling errors, the details are as follows: -in the code comments: dettached->detached meausered->measured meausurement->measurement sholuld->should Tempreture->Temperature measuremnts->measurements detecing->detecting persent->percent Parallell->Parallel Signed-off-by: Shen Lichuan <shenlichuan@vivo.com> Link: https://lore.kernel.org/r/20240914085415.3886-1-shenlichuan@vivo.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>