summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)AuthorFilesLines
2022-10-01power: supply: ab8500: Remove unused struct ab8500_chargalg_sysfs_entryYuan Can1-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>
2022-10-01power: supply: mt6370: uses IIO interfaces, depends on IIORandy Dunlap1-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>
2022-10-01power: supply: max1721x: Fix spelling mistake "Gauage" -> "Gauge"Colin Ian King1-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>
2022-09-28power: supply: Add charger driver for Rockchip RK817Chris Morgan3-0/+1218
Add support for the Rockchip rk817 battery charger integrated into the rk817 PMIC. Signed-off-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20220827021623.23829-4-macroalpha82@gmail.com
2022-09-16power: supply: mt6370: Add MediaTek MT6370 charger driverChiaEn Wu3-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>
2022-09-14power: supply: bq25890: Fix enum conversion in ↵Nathan Chancellor1-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>
2022-09-11power: supply: bq27xxx: fix NULL vs 0 warningsBen Dooks1-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>
2022-09-11power: supply: bq27xxx: fix __be16 warningsBen Dooks1-3/+3
The bq27xxx_dm_reg_ptr() should return a __be16 as the result is being passed to be16_to_cpup() to convert to the proper cpu endian value. Move to using __be16 as appropriate to fix the following sparse warnings: drivers/power/supply/bq27xxx_battery.c:1293:26: warning: incorrect type in argument 1 (different base types) drivers/power/supply/bq27xxx_battery.c:1293:26: expected restricted __be16 const [usertype] *p drivers/power/supply/bq27xxx_battery.c:1293:26: got unsigned short [usertype] *prev drivers/power/supply/bq27xxx_battery.c:1304:17: warning: incorrect type in argument 1 (different base types) drivers/power/supply/bq27xxx_battery.c:1304:17: expected restricted __be16 const [usertype] *p drivers/power/supply/bq27xxx_battery.c:1304:17: got unsigned short [usertype] *prev drivers/power/supply/bq27xxx_battery.c:1316:15: warning: incorrect type in assignment (different base types) drivers/power/supply/bq27xxx_battery.c:1316:15: expected unsigned short [usertype] drivers/power/supply/bq27xxx_battery.c:1316:15: got restricted __be16 [usertype] Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: bq25890: Add support for setting IINLIMMarek Vasut1-0/+29
Let user set input current limit via sysfs. This is useful in case there are multiple chargers connected to the device, each of which with its own arbitrary maximum current which it can provide, some of which may provide more than the default 500mA. In that case, userspace can listen for plug events generated by each charger and adjust the current limit accordingly, e.g. to permit battery to charge faster. Note that the IINLIM is reset every time the bq25890 is disconnected from a charger, so the userspace must adjust the limit repeatly on every plug event. 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>
2022-09-11power: supply: bq25890: Disable PUMPX_EN on errorsHans de Goede1-0/+1
When bq25890_pump_express_work encounters an errors disable the PUMPX_EN flag, just like the work does on a successful exit. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: Fix repeated word in commentsJules Maselbas1-1/+1
Remove redundant word `the`. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: adp5061: show unknown capacity_level as textWei Yongjun1-0/+3
adp5061_get_battery_status() only defined show chg_status <= 4, others will be show as '-1731902199' from /sys/class/power_supply/xx/capacity_level. switch to show them as 'Unknown'. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()Wei Yongjun1-3/+3
ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements beyond the end of the adp5061_chg_type[] array. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: tps65217: Fix comments typoShaomin Deng1-1/+1
Delete the unneeded word "the" in comments. Signed-off-by: Shaomin Deng <dengshaomin@cdjrlc.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: reset: qcom-pon: add support for qcom,pmk8350-pon compatible stringAnjelique Melendez1-0/+1
Add support for the new "qcom,pmk8350-pon" comptaible string. Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: cw2015: Use device managed API to simplify the codeZheyu Ma1-11/+3
Use devm_delayed_work_autocancel() instead of the INIT_DELAYED_WORK() to remove the cw_bat_remove() function. And power_supply_put_battery_info() can also be removed because the power_supply_get_battery_info() uses device managed memory allocation. Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-09-11power: supply: cpcap-charger: fix repeated words in commentswangjianli1-1/+1
Delete the redundant word 'on'. Signed-off-by: wangjianli <wangjianli@cdjrlc.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-08-16i2c: Make remove callback return voidUwe Kleine-König12-34/+12
The value returned by an i2c driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com> Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Crt Mori <cmo@melexis.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013 Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/* Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5 Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860 Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-08-12Merge tag 'for-v6.0' of ↵Linus Torvalds17-595/+334
git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: "No core patches, only driver updates: - pwr-mlxbf: new reset driver for Mellanox BlueField - at91-reset: SAMA7G5 support - ab8500: continue refurbishing - misc minor fixes" * tag 'for-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (29 commits) power: supply: olpc_battery: Hold the reference returned by of_find_compatible_node power: supply: ab8500: add missing destroy_workqueue in ab8500_charger_bind power: supply: ab8500: Remove flush_scheduled_work() call. power: supply: ab8500_fg: drop duplicated 'is' in comment power: supply: ab8500: Drop external charger leftovers power: supply: ab8500: Add MAINTAINERS entry dt-bindings: power: reset: qcom,pshold: convert to dtschema power: supply: Fix typo in power_supply_check_supplies power: reset: pwr-mlxbf: change rst_pwr_hid and low_pwr_hid from global to local variables power: reset: pwr-mlxbf: add missing include power: reset: at91-reset: add support for SAMA7G5 power: reset: at91-reset: add reset_controller_dev support power: reset: at91-reset: add at91_reset_data power: reset: at91-reset: document structures and enums dt-bindings: reset: add sama7g5 definitions dt-bindings: reset: atmel,at91sam9260-reset: add sama7g5 bindings dt-bindings: reset: convert Atmel/Microchip reset controller to YAML power: reset: pwr-mlxbf: add BlueField SoC power control driver power: supply: ab8500: Exit maintenance if too low voltage power: supply: ab8500: Respect charge_restart_voltage_uv ...
2022-08-05Merge tag 'platform-drivers-x86-v6.0-1' of ↵Linus Torvalds2-4/+4
git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 Pull x86 platform driver updates from Hans de Goede: - Microsoft Surface: - SSAM hot unplug support - Surface Pro 8 keyboard cover support - Tablet mode switch support for Surface Pro 8 and Surface Laptop Studio - thinkpad_acpi: - AMD Automatice Mode Transitions (AMT) support - Mellanox: - Vulcan chassis COMe NVSwitch management support - XH3000 support - New generic/shared Intel P2SB (Primary to Sideband) support - Lots of small cleanups - Various small bugfixes - Various new hardware ids / quirks additions * tag 'platform-drivers-x86-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (105 commits) platform/x86/intel/vsec: Fix wrong type for local status variables platform/x86: p2sb: Move out of X86_PLATFORM_DEVICES dependency platform/x86: pmc_atom: Fix comment typo platform/surface: gpe: Add support for 13" Intel version of Surface Laptop 4 platform/olpc: Fix uninitialized data in debugfs write platform/mellanox: mlxreg-lc: Fix error flow and extend verbosity platform/x86: pmc_atom: Match all Lex BayTrail boards with critclk_systems DMI table platform/x86: sony-laptop: Remove useless comparisons in sony_pic_read_possible_resource() tools/power/x86/intel-speed-select: Remove unneeded semicolon tools/power/x86/intel-speed-select: Fix off by one check platform/surface: tabletsw: Fix __le32 integer access Documentation/ABI: Add new attributes for mlxreg-io sysfs interfaces Documentation/ABI: mlxreg-io: Fix contact info platform/mellanox: mlxreg-io: Add locking for io operations platform/x86: mlx-platform: Add COME board revision register platform/x86: mlx-platform: Add support for new system XH3000 platform/x86: mlx-platform: Introduce support for COMe NVSwitch management module for Vulcan chassis platform/x86: mlx-platform: Add support for systems equipped with two ASICs platform/x86: mlx-platform: Add cosmetic changes for alignment platform/x86: mlx-platform: Make activation of some drivers conditional ...
2022-08-04Merge tag 'spdx-6.0-rc1' of ↵Linus Torvalds3-33/+5
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx Pull SPDX updates from Greg KH: "Here is the set of SPDX comment updates for 6.0-rc1. Nothing huge here, just a number of updated SPDX license tags and cleanups based on the review of a number of common patterns in GPLv2 boilerplate text. Also included in here are a few other minor updates, two USB files, and one Documentation file update to get the SPDX lines correct. All of these have been in the linux-next tree for a very long time" * tag 'spdx-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx: (28 commits) Documentation: samsung-s3c24xx: Add blank line after SPDX directive x86/crypto: Remove stray comment terminator treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_406.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_398.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_391.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_390.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_385.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_319.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_318.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_298.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_292.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_179.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_168.RULE (part 2) treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_168.RULE (part 1) treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_160.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_152.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_149.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_147.RULE treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_133.RULE ...
2022-07-17power: supply: olpc_battery: Hold the reference returned by ↵Liang He1-1/+4
of_find_compatible_node In olpc_battery_probe(), we should hold the reference returned by of_find_compatible_node() and use it to call of_node_put() for refcount balance. Signed-off-by: Liang He <windhl@126.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-07-17power: supply: ab8500: add missing destroy_workqueue in ab8500_charger_bindZheng Bin1-0/+1
ab8500_charger_bind misses destroy_workqueue in error path, this patch fixes that. Signed-off-by: Zheng Bin <zhengbin13@huawei.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-07-17power: supply: ab8500: Remove flush_scheduled_work() call.Tetsuo Handa4-5/+0
It seems to me that ab8500 driver is using dedicated workqueues and is not calling schedule{,_delayed}_work{,_on}(). Then, there will be no work to flush using flush_scheduled_work(). Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-07-17power: supply: ab8500_fg: drop duplicated 'is' in commentJiang Jian1-1/+1
Fix word duplication typo 'is is' -> 'is'. Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com> [update commit message] Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-07-17power: supply: ab8500: Drop external charger leftoversLinus Walleij4-562/+2
Some leftover code for external chargers only used with unreleased ASIC revisions and the header file for the unsupported PM2301 was left behind in an earlier cleanup, fix it by deleting the remnants. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-07-17power: supply: Fix typo in power_supply_check_suppliesSchspa Shi1-2/+2
It seems to be a typo, there is no actual BUG, but it's better to fix it to avoid any possible BUG after we change the type of supplied_from. Signed-off-by: Schspa Shi <schspa@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-29power: reset: pwr-mlxbf: change rst_pwr_hid and low_pwr_hid from global to ↵Tom Rix1-3/+2
local variables sparse reports drivers/power/reset/pwr-mlxbf.c:19:12: warning: symbol 'rst_pwr_hid' was not declared. Should it be static? drivers/power/reset/pwr-mlxbf.c:20:12: warning: symbol 'low_pwr_hid' was not declared. Should it be static? Both rst_pwr_hid and low_pwr_hid are only used in a single function so they should be local variables. Fixes: a4c0094fcf76 ("power: reset: pwr-mlxbf: add BlueField SoC power control driver") Signed-off-by: Tom Rix <trix@redhat.com> Acked-by: Asmaa Mnebhi <asmaa@nvidia.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-29power: reset: pwr-mlxbf: add missing includeAsmaa Mnebhi1-0/+1
Add missing include for devm_work_autocancel to fix build error: drivers/power/reset/pwr-mlxbf.c: In function 'pwr_mlxbf_probe': drivers/power/reset/pwr-mlxbf.c:67:15: error: implicit declaration of function 'devm_work_autocancel' [-Werror=implicit-function-declaration] 67 | err = devm_work_autocancel(dev, &priv->send_work, pwr_mlxbf_send_work); | ^~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Fixes: a4c0094fcf76 ("power: reset: pwr-mlxbf: add BlueField SoC power control driver") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-17Merge tag 'at91-reset-sama7g5-signed' into psy-nextSebastian Reichel1-15/+169
This adds reset controller support for SAMA7G5 SoCs. Compared with previous version the reset controller embedded on SAMA7G5 is able to reset individual on SoC devices (e.g. USB PHY controllers). Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-17power: reset: at91-reset: add support for SAMA7G5Claudiu Beznea1-0/+13
Add support for SAMA7G5 including reset_controller_dev support for 3 lines (which are USB PHYs). Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-17power: reset: at91-reset: add reset_controller_dev supportClaudiu Beznea1-4/+102
SAMA7G5 reset controller has 5 extra lines that goes to different devices (3 lines to USB PHYs, 1 line to DDR controller, 1 line to DDR PHY controller). These reset lines could be requested by different controller drivers (e.g. USB PHY driver) and these controllers' drivers could assert/deassert these lines when necessary. Thus add support for reset_controller_dev which brings this functionality. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-17power: reset: at91-reset: add at91_reset_dataClaudiu Beznea1-11/+34
Add struct at91_reset_data to keep per platform related information. This is a prerequisite for adding reset_controller_dev support. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-17power: reset: at91-reset: document structures and enumsClaudiu Beznea1-0/+20
Document structures and enums. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-17power: reset: pwr-mlxbf: add BlueField SoC power control driverAsmaa Mnebhi3-0/+104
This driver supports handling 2 BlueField power states controlled by GPIO interrupts: 1) chip reset and 2) low power mode Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-13power/supply: surface_battery: Use client device wrappers for notifier ↵Maximilian Luz1-2/+2
registration Use newly introduced client device wrapper functions for notifier registration and unregistration. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20220527023447.2460025-7-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-06-13power/supply: surface_charger: Use client device wrappers for notifier ↵Maximilian Luz1-2/+2
registration Use newly introduced client device wrapper functions for notifier registration and unregistration. Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/r/20220527023447.2460025-6-luzmaximilian@gmail.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2022-06-10treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULEThomas Gleixner1-9/+1
Based on the normalized pattern: this program is free software you can redistribute it and/or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed as is without any warranty of any kind whether express or implied without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference. Reviewed-by: Allison Randal <allison@lohutok.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-10treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE ↵Thomas Gleixner2-24/+4
(part 2) Based on the normalized pattern: this program is free software you can redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation version 2 this program is distributed as is without any warranty of any kind whether express or implied without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference. Reviewed-by: Allison Randal <allison@lohutok.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09power: supply: ab8500: Exit maintenance if too low voltageLinus Walleij1-0/+16
The maintenance charging is supposedly designed such that the maintenance current compensates for the battery discharge curve, and as the charging progress from CC/CV -> maintenance A -> maintenance B states, we end up on a reasonable voltage to restart ordinary CC/CV charging after the safety timer at the maintenance B state exits. However: old batteries discharge quicker, and in an old battery we might not get to the expiration of the maintenance B timer before the battery is completely depleted and the system powers off with an empty battery. This is hardly the desire of anyone leaving their phone in the charger for a few days! Introduce a second clause in both maintenance states such that we exit the state and return to ordinary CC/CV charging if the voltage drops below charge_restart_voltage_uv or 95% if this is not defined for the battery. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: ab8500: Respect charge_restart_voltage_uvLinus Walleij1-1/+29
The battery info contains a voltage indicating when the voltage is so low that it is time to restart the CC/CV charging. Make the AB8500 respect and prioritize this setting over the hardcoded 95% threshold. Break out the check into its own function and add some safeguards so we do not run into unpredictable side effects. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: cros_peripheral: Use struct_size() helper in kzalloc()Xiaohui Zhang1-1/+1
Similar to the handling of cros_usbpd_charger_ec_command in commit 441d38c60fbe ("power: supply: cros_usbpd: Use struct_size() helper in kzalloc()"), we thought a patch might be needed here as well. Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worst scenario, could lead to heap overflows. Signed-off-by: Xiaohui Zhang <xiaohuizhang@ruc.edu.cn> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: bq24257: Fix syntax error in commentsXiang wangx1-1/+1
Delete the redundant word 'is'. Signed-off-by: Xiang wangx <wangxiang@cdjrlc.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: core: Fix boundary conditions in interpolationDorian Rudolph1-12/+12
The functions power_supply_temp2resist_simple and power_supply_ocv2cap_simple handle boundary conditions incorrectly. The change was introduced in a4585ba2050f460f749bbaf2b67bd56c41e30283 ("power: supply: core: Use library interpolation"). There are two issues: First, the lines "high = i - 1" and "high = i" in ocv2cap have the wrong order compared to temp2resist. As a consequence, ocv2cap sets high=-1 if ocv>table[0].ocv, which causes an out-of-bounds read. Second, the logic of temp2resist is also not correct. Consider the case table[] = {{20, 100}, {10, 80}, {0, 60}}. For temp=5, we expect a resistance of 70% by interpolation. However, temp2resist sets high=low=2 and returns 60. Cc: stable@vger.kernel.org Signed-off-by: Dorian Rudolph <mail@dorianrudolph.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Fixes: a4585ba2050f ("power: supply: core: Use library interpolation") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power/reset: arm-versatile: Fix refcount leak in versatile_reboot_probeMiaoqian Lin1-0/+1
of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 0e545f57b708 ("power: reset: driver for the Versatile syscon reboot") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: ab8500_fg: add missing destroy_workqueue in ab8500_fg_probeGao Chao1-1/+8
In ab8500_fg_probe, misses destroy_workqueue in error path, this patch fixes that. Fixes: 010ddb813f35 ("power: supply: ab8500_fg: Allocate wq in probe") Signed-off-by: Gao Chao <gaochao49@huawei.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: Remove unnecessary print function dev_err()Yang Li1-3/+1
The print function dev_err() is redundant because platform_get_irq() already prints an error. Eliminate the follow coccicheck warning: ./drivers/power/supply/goldfish_battery.c:225:2-9: line 225 is redundant because platform_get_irq() already prints an error Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: lp8788: fix typo in commentJulia Lawall1-1/+1
Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-09power: supply: max77976: update Luca Ceresoli's e-mail addressLuca Ceresoli1-2/+2
My Bootlin address is preferred from now on. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-06-03Merge tag 'char-misc-5.19-rc1' of ↵Linus Torvalds3-16/+16
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char / misc / other smaller driver subsystem updates from Greg KH: "Here is the large set of char, misc, and other driver subsystem updates for 5.19-rc1. The merge request for this has been delayed as I wanted to get lots of linux-next testing due to some late arrivals of changes for the habannalabs driver. Highlights of this merge are: - habanalabs driver updates for new hardware types and fixes and other updates - IIO driver tree merge which includes loads of new IIO drivers and cleanups and additions - PHY driver tree merge with new drivers and small updates to existing ones - interconnect driver tree merge with fixes and updates - soundwire driver tree merge with some small fixes - coresight driver tree merge with small fixes and updates - mhi bus driver tree merge with lots of updates and new device support - firmware driver updates - fpga driver updates - lkdtm driver updates (with a merge conflict, more on that below) - extcon driver tree merge with small updates - lots of other tiny driver updates and fixes and cleanups, full details in the shortlog. All of these have been in linux-next for almost 2 weeks with no reported problems" * tag 'char-misc-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (387 commits) habanalabs: use separate structure info for each error collect data habanalabs: fix missing handle shift during mmap habanalabs: remove hdev from hl_ctx_get args habanalabs: do MMU prefetch as deferred work habanalabs: order memory manager messages habanalabs: return -EFAULT on copy_to_user error habanalabs: use NULL for eventfd habanalabs: update firmware header habanalabs: add support for notification via eventfd habanalabs: add topic to memory manager buffer habanalabs: handle race in driver fini habanalabs: add device memory scrub ability through debugfs habanalabs: use unified memory manager for CB flow habanalabs: unified memory manager new code for CB flow habanalabs/gaudi: set arbitration timeout to a high value habanalabs: add put by handle method to memory manager habanalabs: hide memory manager page shift habanalabs: Add separate poll interval value for protocol habanalabs: use get_task_pid() to take PID habanalabs: add prefetch flag to the MAP operation ...