Commit Graph

419 Commits

Author SHA1 Message Date
Linus Torvalds
07b4382043 power supply and reset changes for the 6.17 series
* power-supply core
   - battery-info: replace any DT specific bits with fwnode usage
   - replace any device-tree code with generic fwnode based handling
  * power-supply drivers
   - ug3105_battery: use battery-info API
   - qcom_battmgr: report capacity
   - qcom_battmgr: support LiPo battery reporting
   - add missing missing power-supply ref to a bunch of DT bindings
   - update drivers regarding pm_runtime_autosuspend() usage
   - misc. minor fixes and cleanups
  * reset drivers
   - misc. minor cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmiMECsACgkQ2O7X88g7
 +pq18BAAgwWUJyV1YrzODAEC+GAIScV7E9aWHiWBYaR6huI6sXssgM9sUyQvSDw8
 IawbPGVeqgK2g7JHdLqduMILGrmNh268b2l3aJJzN0erM2bcIs9RtB2bMzJgSChH
 eDPOLKlQJJqR/PMQowHE4UEmbIep+8ISLP9GuiIa0e46ckdPWtAKnxWdReC3Pefs
 h9eRnzZof6A3dfoIhpCe182+RXPbVll7eHk8kvSYZgVUHHMfN509JDC7VMv6dG5p
 XOUiS6h2mebqoaNKBF7swr0nmkv4zLpLWBc//rreP+v26C97Ks+tfNrZ/fKrRR7E
 L7M1peg7KPLFooM3dQrngbaO2/h4am2kPb92YreXuDHMEBJQuauhOgAmrPOCFmJi
 l/nN2IbY4J9ArdsVbwATriFMPyem/N60xiq6Tr0F7DS9GBcO5dqX8g9iHY68Qu/g
 9HZAhiqrmxpUQ5cDUG1eYWSoK6YvdoP5bM7wJz8W5kbnIx2ngsMBhWPPh2fTmtoE
 c3qU7gSZK3jKUYAzu4vbFyL/htKc6ZO8ej2VDwjBb2OjVx+leYeC7kasRPDy5MkO
 G8Zuq9DZ1QAPp9aYAFVmZbHH1bTMD0UeYNMnSW/KaJZ5WecbUlzUkgCJvnH3JcYm
 5JbKDFykvItcyiS7+c6fflrJuv510Hf3R3degaqqXby4v80bMnY=
 =Lfxr
 -----END PGP SIGNATURE-----

Merge tag 'for-v6.17' of 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:
   - battery-info: replace any DT specific bits with fwnode usage
   - replace any device-tree code with generic fwnode based handling

  Power-supply drivers:
   - ug3105_battery: use battery-info API
   - qcom_battmgr: report capacity
   - qcom_battmgr: support LiPo battery reporting
   - add missing missing power-supply ref to a bunch of DT bindings
   - update drivers regarding pm_runtime_autosuspend() usage
   - misc minor fixes and cleanups

  Reset drivers:
   - misc minor cleanups"

* tag 'for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (32 commits)
  power: supply: core: fix static checker warning
  power: supply: twl4030_charger: Remove redundant pm_runtime_mark_last_busy() calls
  power: supply: bq24190: Remove redundant pm_runtime_mark_last_busy() calls
  MAINTAINERS: rectify file entry in QUALCOMM SMB CHARGER DRIVER
  power: supply: max1720x correct capacity computation
  MAINTAINERS: add myself as smbx charger driver maintainer
  power: supply: pmi8998_charger: rename to qcom_smbx
  power: supply: qcom_pmi8998_charger: fix wakeirq
  power: supply: max14577: Handle NULL pdata when CONFIG_OF is not set
  power: return the correct error code
  power: reset: POWER_RESET_TORADEX_EC should depend on ARCH_MXC
  power: supply: cpcap-charger: Fix null check for power_supply_get_by_name
  power: supply: bq25980_charger: Constify reg_default array
  power: supply: bq256xx_charger: Constify reg_default array
  power: reset: at91-sama5d2_shdwc: Refactor wake-up source logging to use dev_info
  power: reset: qcom-pon: Rename variables to use generic naming
  power: supply: qcom_battmgr: Add lithium-polymer entry
  power: supply: qcom_battmgr: Report battery capacity
  power: supply: bq24190: Free battery_info
  power: supply: ug3105_battery: Switch to power_supply_batinfo_ocv2cap()
  ...
2025-07-31 21:39:01 -07:00
Hector Martin
819687eb28 power: reset: macsmc-reboot: Add driver for rebooting via Apple SMC
This driver implements the reboot/shutdown support exposed by the SMC
on Apple Silicon machines, such as Apple M1 Macs.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sven Peter <sven@kernel.org>
Link: https://lore.kernel.org/r/20250610-smc-6-15-v7-7-556cafd771d3@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
2025-07-24 09:47:33 +01:00
Geert Uytterhoeven
22e4d29f08 power: reset: POWER_RESET_TORADEX_EC should depend on ARCH_MXC
The Toradex Embedded Controller is currently only present on Toradex
SMARC iMX8MP and iMX95 SoMs.  Hence add a dependency on ARCH_MXC, to
prevent asking the user about this driver when configuring a kernel
without NXP i.MX SoC family support.

Fixes: 18672fe123 ("power: reset: add Toradex Embedded Controller")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/1ef0beb1e09bf914650f9f9885a33af06772540d.1746536287.git.geert+renesas@glider.be
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-06-22 19:24:55 +02:00
Mihai Sain
6af8ffab2d power: reset: at91-sama5d2_shdwc: Refactor wake-up source logging to use dev_info
Use dev_info() instead of pr_info() for more consistent
logging in the driver.

[root@sam9x75eb ~]$ dmesg | grep power
[    1.678542] at91-shdwc fffffe10.poweroff: Wake-Up source: WKUP pin

Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
Link: https://lore.kernel.org/r/20250610124545.175492-3-mihai.sain@microchip.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-06-22 03:04:51 +02:00
Taeyoung Kwon
e4ab1bfc3f power: reset: qcom-pon: Rename variables to use generic naming
The qcom-pon driver was originally implemented for the PM8916 PMIC, and
as a result, several internal variable names still refer to 'pm8916'.
However, the driver has since been extended to support other PMICs as
well.

This patch renames those variables to use more generic and consistent
names, improving clarity and reducing confusion for non-PM8916 devices.

Signed-off-by: Taeyoung Kwon <Taeyoung.Kwon@telit.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250521131116.2664-1-Taeyoung.Kwon@telit.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-06-22 03:00:26 +02:00
André Draszik
8c7cf0fc8c power: reset: syscon-reboot: add gs101-specific reset
Linux supports a couple different reset modes, but this driver here
doesn't distinguish between them and issues the same syscon register
write irrespective of the reset mode requested by the kernel.

Since DTs should not encode register writes (see e.g. [1]), update this
driver to support different reset modes based on DT compatible match.

At the same time, add support for Google GS101, which does support
cold, hard, warm, and soft.

As an example why this is useful, other than properly supporting the
Linux reboot= kernel command line option or sysfs entry, this change
allows gs101-platforms to default to a more secure cold-reset, but also
to warm-reset in case RAM contents needs to be retained across the
reset.

Link: https://lore.kernel.org/all/20250227132644.GA1924628-robh@kernel.org/ [1]
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250401-syscon-reboot-reset-mode-v5-2-5b9357442363@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-05-01 00:41:31 +02:00
Emanuele Ghidoli
18672fe123 power: reset: add Toradex Embedded Controller
Toradex SMARC iMX8MP and SMARC iMX95 SoM modules use a small Embedded
Controller (EC) to manage power and reset functions and related SMARC
signals.

This driver implements power-off and reboot handlers, communicating with
the EC via I2C to issue the appropriate power management commands.

During probe, the driver logs the Embedded Controller ID (unique ID for
each SMARC board supported) in hex format along with the firmware version.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20250414171455.155155-3-francesco@dolcini.it
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-04-29 01:13:10 +02:00
André Draszik
ca3d2ea523 power: reset: reboot-mode: better compatibility with DT (replace ' ,/')
This driver's purpose is to parse boot modes described in DT, via key
(node name) / value pairs, and to match them to a reboot mode requested
by the kernel. Unfortunately, DT node names can not contain certain
characters, like space ' ' or comma ',' or slash '/', while the
requested reboot mode may.

This is a problem because it makes it impossible to match reboot modes
containing any of those characters.

For example, this makes it impossible to communicate DM verity errors
to the boot loader - DM verity errors trigger a reboot with mode
"dm-verity device corrupted" in drivers/md/dm-verity-target.c and
devices typically have to take action in that case [1]. Changing this
string itself is not feasible, see e.g. discussion in [2], but would
also just cover this one case.

Another example is Android, which may use comma in the reboot mode
string, e.g. as "shutdown,thermal" in [3].

The kernel also shouldn't prescribe what characters are allowed inside
the boot mode string for a user to set. It hasn't done this so far, and
introducing such a restriction would be an interface break and
arbitrarily enforce a random new policy.

Therefore, update this driver to do another round of string matching,
after replacing the common characters mentioned above with dash '-', if
a match hasn't been found without doing said replacement.
This now allows us to have DT entries of e.g.:

    mode-dm-verity-device-corrupted = <...>

and so on.

Link: https://cs.android.com/android/kernel/superproject/+/android14-gs-pixel-6.1:private/google-modules/power/reset/exynos-gs101-reboot.c;l=144 [1]
Link: https://lore.kernel.org/all/CAAFS_9FuSb7PZwQ2itUh_H7ZdhvAEiiX7fhxJ4kmmv9JCaHmkA@mail.gmail.com/ [2]
Link: https://cs.android.com/android/platform/superproject/main/+/main:system/core/init/reboot_utils.cpp;drc=79ad1e2e9bf1628c141c8cd2fbb4f3df61a6ba75;l=122 [3]
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250307-reboot-mode-chars-v1-1-d83ff95da524@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-04-28 00:05:31 +02:00
Alexander Shiyan
62d48983f2 power: reset: at91-reset: Optimize at91_reset()
This patch adds a small optimization to the low-level at91_reset()
function, which includes:
- Removes the extra branch, since the following store operations
  already have proper condition checks.
- Removes the definition of the clobber register r4, since it is
  no longer used in the code.

Fixes: fcd0532fac ("power: reset: at91-reset: make at91sam9g45_restart() generic")
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20250307053809.20245-1-eagle.alexander923@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-04-27 23:59:08 +02:00
Linus Torvalds
556f1b4874 power supply and reset changes for the 6.15 series
* power-supply core
   - remove unused set_charged infrastructure
   - drop of_node from power_supply struct
  * power-supply drivers
   - axp717: support devices without thermistors
   - bq27xxx: support max design voltage for bq270x0 and bq27x10
   - pcf50633: drop charger driver
   - max1720x: add battery health support
   - switch all power-supply devices from of_node to fwnode
   - convert regmap users to maple tree register cache
   - convert drivers to devm_kmemdup_array
   - misc cleanups and fixes
  * reset drivers
   - at91-sama5d2_shdwc: add sama7d65 support
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmfmAhAACgkQ2O7X88g7
 +pqUVA//QoohKXgC1WOsias7WU0pw+D+zjpGUtiCTyw0EVBjEGcRiK1Fa2mhgn0x
 jQnB84K0WbNZN9uuquMZXBBU7lMQIX/Lltjsy04Y0ZpEdvaO7XpbHXfumy/O5q/3
 xqQzJm+sscE/jBLABauLchSu3Ro3/RlazG9N6XWA8MS9cqUx0wJqsXaITLvrFAsP
 mgV+Ybnusnd1oHjbceccPZzUHqWeBVHE5+fpJlB8HfrmovG3jvfjRtaUabsmhHVM
 afpDXHx7amGJVU3Ild8CRp7UGM0w3RXk7HT3e98o6lzVsULP6JwyCBKq7pUivjF8
 xnGROrpyuYl8yZ8U55cROk0kxEu984o7h1b+SU6ZEXtXwOCUn6Cb+eOSxNUmCKi4
 orl8iEdO/Elxe+L6LnbQUcSgnGg3w6Ugl9rAb+MJ/8R6srrFpghAv7WnnRgJFmKW
 Yt58NtQzCs6yLtgMcnhE98sGgBCD/uBV8xxqtntiKXReTREfVy+dFGlRCJJCSmBN
 TNg49PgOKUyAOYR/7NBBlco9YKMgsKzb3vfOmoO+o3VQy0WYRrC3wOOGkUTQVfTb
 oPXdB3H4hD+eZ5SvGtwSm3E23LWhBlLfb8Zoo45oRpYzqmfQ3vUekKuuzGlScgPY
 Anpua874fJk07SYyz8nE/VMR2BjVyz3Jf98zKdO0Gw35FXDcaTQ=
 =C0aa
 -----END PGP SIGNATURE-----

Merge tag 'for-v6.15' of 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:
   - remove unused set_charged infrastructure
   - drop of_node from power_supply struct

  Power-supply drivers:
   - axp717: support devices without thermistors
   - bq27xxx: support max design voltage for bq270x0 and bq27x10
   - pcf50633: drop charger driver
   - max1720x: add battery health support
   - switch all power-supply devices from of_node to fwnode
   - convert regmap users to maple tree register cache
   - convert drivers to devm_kmemdup_array
   - misc cleanups and fixes

  Reset drivers:
   - at91-sama5d2_shdwc: add sama7d65 support

* tag 'for-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (30 commits)
  power: supply: mt6370: Remove redundant 'flush_workqueue()' calls
  Revert "power: supply: bq27xxx: do not report bogus zero values"
  power: supply: max77693: Fix wrong conversion of charge input threshold value
  power: supply: pcf50633: Remove charger
  power: supply: all: switch psy_cfg from of_node to fwnode
  power: supply: core: get rid of of_node
  power: reset: at91-sama5d2_shdwc: Add sama7d65 PMC
  power: supply: smb347: convert to use maple tree register cache
  power: supply: rt9455: convert to use maple tree register cache
  power: supply: max1720x: convert to use maple tree register cache
  power: supply: ltc4162l: convert to use maple tree register cache
  power: supply: bq25980: convert to use maple tree register cache
  power: supply: bq25890: convert to use maple tree register cache
  power: supply: bq2515x: convert to use maple tree register cache
  power: supply: bq24257: convert to use maple tree register cache
  power: supply: bd99954: convert to use maple tree register cache
  power: supply: Remove unused set_charged method
  power: supply: ds2760: Remove unused ds2760_battery_set_charged
  power: supply: core: Remove unused power_supply_set_battery_charged
  power: supply: sc27xx: use devm_kmemdup_array()
  ...
2025-03-29 18:11:12 -07:00
Ryan Wanner
2fc78cd0a3 power: reset: at91-sama5d2_shdwc: Add sama7d65 PMC
Add sama7d65-pmc compatible string to the list of valid PMC IDs.

Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
Link: https://lore.kernel.org/r/c5fa1d88a072d79db4f1a6b99ad69632a83e8f8d.1740671156.git.Ryan.Wanner@microchip.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-03-08 01:36:33 +01:00
Nam Cao
563608c204 power: reset: ltc2952-poweroff: Switch to use hrtimer_setup()
hrtimer_setup() takes the callback function pointer as argument and
initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of
hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/all/75ef5206f52f194b9c51653628cd2d0b083a482f.1738746904.git.namcao@linutronix.de
2025-02-18 11:19:04 +01:00
Krzysztof Kozlowski
81312ea9b8 power: reset: keystone: Use syscon_regmap_lookup_by_phandle_args
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over
syscon_regmap_lookup_by_phandle() combined with getting the syscon
argument.  Except simpler code this annotates within one line that given
phandle has arguments, so grepping for code would be easier.

There is also no real benefit in printing errors on missing syscon
argument, because this is done just too late: runtime check on
static/build-time data.  Dtschema and Devicetree bindings offer the
static/build-time check for this already.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250111185358.183725-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2025-01-15 21:51:39 +01:00
Nobuhiro Iwamatsu
156fb706f9 power: reset: as3722-poweroff: Remove unnecessary return in as3722_poweroff_probe
The return is executed on the devm_register_sys_off_handler() line in
as3722_poweroff_probe, so the last return line is unnecessary. Remove it.

Fixes: 348fde771c ("power: reset: as3722-poweroff: Use devm_register_sys_off_handler(POWER_OFF)")
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20241117053443.1148902-1-iwamatsu@nigauri.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-12-19 00:38:11 +01:00
Varshini Rajendran
250bbd612b power: reset: at91-reset: add sdhwc support for sam9x7 SoC
Add shutdown controller support for SAM9X7 SoC.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20241010120414.92993-1-varshini.rajendran@microchip.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-12-13 00:03:14 +01:00
Varshini Rajendran
ef4f3ac4be power: reset: at91-reset: add reset support for sam9x7 SoC
Add power reset support for SAM9X7 SoC.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20241010120410.92942-1-varshini.rajendran@microchip.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-12-13 00:03:11 +01:00
Varshini Rajendran
2a16675e25 power: reset: at91-poweroff: lookup for proper pmc dt node for sam9x7
Use sam9x7 pmc's compatible to lookup for in the SHDWC driver.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20241010120404.92893-1-varshini.rajendran@microchip.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-12-13 00:03:08 +01:00
Fabio Estevam
8a1c099f36 power: reset: gpio-poweroff: Clarify the warning message
When gpio-poweroff fails, a WARN_ON() is triggered without
an explanation to the user about the failure.

Add some comments explaining that the attempt to poweroff the system
via gpio-poweroff failed and convert it to a WARN() message with a
bit of context to provide some hint to the user.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20241212130456.580197-1-festevam@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-12-12 23:34:50 +01:00
Arnd Bergmann
b6d445f672 power: reset: ep93xx: add AUXILIARY_BUS dependency
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: 9fa7cdb436 ("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>
2024-11-12 00:07:00 +01:00
Ba Jing
7263d7df05 reset: keystone-reset: remove unused macros
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>
2024-11-11 22:56:35 +01:00
Uwe Kleine-König
83bce34420 power: Switch back to struct platform_driver::remove()
After commit 0edb555a65 ("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>
2024-10-21 15:51:42 +02:00
Chris Packham
ce38cdc908 power: reset: syscon-reboot: Accept reg property
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>
2024-10-16 22:26:20 +02:00
Linus Torvalds
075dbe9f6e soc: convert ep93xx to devicetree
This concludes a long journey towards replacing the old
 board files with devictree description on the Cirrus Logic
 EP93xx platform.
 
 Nikita Shubin has been working on this for a long time,
 for details see the last post on
 https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmb1croACgkQYKtH/8kJ
 UicY0g//XXEXcBgE2CLfKzGimN3gREIElEqFCpd7v32XWGIQNFdS7StiGqNx1MeU
 UYdILm97ldgpx+NnHd3Cb9HbLQ1CTIIvAZ2ngFLDeeZO+wgzBVxWTrdUUp57ZIBn
 5Fq0hNaR1bfqSr+J+ZbgizH5N96EvLr3OPz/eJetY7egVBUID/0OpwssPJxW1Ns0
 f+W+yIc7BomVa71xGgI+RkHrG/5DSaoFtrB+ESt7q1nNUIeMn32JqBYqE0U2iCRN
 ADO8I+WfAjIcO1uN5n3KM3tigZI3GKSrBdllByr8wWNbp9l5rMYfFAPEaI109iyI
 7PFrB6qhAlY9LckXMNhwLyjlnWt6qrI0B+tyg+3tW6+4OwFnpPN0cIhszFPOmrhv
 njsDSvybp0q9V6Mn7f394H6v9sk9RHr68mpu12hO65UBP7Qe7mrdl3snnFcm0FHL
 jCLnvjdmCSqRlV6YFsKDHuDzZOG88sAwH0mySKd3c/CVvgaNDsaJduelPGpuXlXX
 P7op6D8kyKFKfmwK0kz3t+3+2ozgYq3nu4amI7rJ72MOvJKBocTwwqpAesIuegde
 bn3ZN30yZDTbfEFuveOAzx7rqDlZYX/tN0uspL4VBN0rdayxBng5hneV2PypTtW0
 wE9ptz5qIz8AssJ7NInwpgRTDjEut4SY3m3CS2/66V08B4EznAA=
 =Y3Cd
 -----END PGP SIGNATURE-----

Merge tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull SoC update from Arnd Bergmann:
 "Convert ep93xx to devicetree

  This concludes a long journey towards replacing the old board files
  with devictree description on the Cirrus Logic EP93xx platform.

  Nikita Shubin has been working on this for a long time, for details
  see the last post on

    https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/"

* tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (47 commits)
  dt-bindings: gpio: ep9301: Add missing "#interrupt-cells" to examples
  MAINTAINERS: Update EP93XX ARM ARCHITECTURE maintainer
  soc: ep93xx: drop reference to removed EP93XX_SOC_COMMON config
  net: cirrus: use u8 for addr to calm down sparse
  dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0
  dmaengine: ep93xx: Fix a NULL vs IS_ERR() check in probe()
  pinctrl: ep93xx: Fix raster pins typo
  spi: ep93xx: update kerneldoc comments for ep93xx_spi
  clk: ep93xx: Fix off by one in ep93xx_div_recalc_rate()
  clk: ep93xx: add module license
  dmaengine: cirrus: remove platform code
  ASoC: cirrus: edb93xx: Delete driver
  ARM: ep93xx: soc: drop defines
  ARM: ep93xx: delete all boardfiles
  ata: pata_ep93xx: remove legacy pinctrl use
  pwm: ep93xx: drop legacy pinctrl
  ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms
  ARM: dts: ep93xx: Add EDB9302 DT
  ARM: dts: ep93xx: add ts7250 board
  ARM: dts: add Cirrus EP93XX SoC .dtsi
  ...
2024-09-26 12:00:25 -07:00
Nikita Shubin
9fa7cdb436 power: reset: Add a driver for the ep93xx reset
Implement the reset behaviour of the various EP93xx SoCS
in drivers/power/reset.

It used to be located in arch/arm/mach-ep93xx.

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Acked-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-09-12 14:33:10 +00:00
Andrew Davis
cf8c39b00e power: reset: brcmstb: Do not go into infinite loop if reset fails
There may be other backup reset methods available, do not halt
here so that other reset methods can be tried.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240610142836.168603-5-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-08-27 19:35:23 +02:00
Andrew Davis
ad87aee5cb power: reset: brcmstb: Use devm_register_sys_off_handler()
Function register_restart_handler() is deprecated. Using this new API
removes our need to keep and manage a struct notifier_block.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240610142836.168603-4-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-08-27 19:35:23 +02:00
Andrew Davis
a4ceaab660 power: reset: brcmstb: Use syscon_regmap_lookup_by_phandle_args() helper
Simplify probe by fetching the regmap and its arguments in one call.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240610142836.168603-3-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-08-27 19:35:04 +02:00
Andrew Davis
cf37f16a60 power: reset: brcmstb: Use device_get_match_data() for matching
Use device_get_match_data() for finding the matching node and fetching
the match data all in one.

Signed-off-by: Andrew Davis <afd@ti.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240610142836.168603-2-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-08-27 19:34:01 +02:00
Andrew Davis
0174d12f9b power: reset: brcmstb: Use normal driver register function
The platform_driver_probe() helper is useful when the probe function
is in the _init section, that is not the case here. Use the normal
platform_driver_register() function.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240610142836.168603-1-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-08-27 19:34:01 +02:00
Asmaa Mnebhi
292fe42c34 power: reset: pwr-mlxbf: support graceful shutdown
The OCP board used a BlueField's GPIO pin for entering
low power mode. That board was not commercialized and
has been dropped from production so all its code is unused.
The new hardware requirement is to trigger a graceful shutdown
when that GPIO pin is toggled. So replace the unused low power
mode with a graceful shutdown.

Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Reviewed-by: David Thompson <davthompson@nvidia.com>
Link: https://lore.kernel.org/r/20240611134327.30975-1-asmaa@nvidia.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-08-27 19:31:19 +02:00
Jeff Johnson
b498ddb6f2 power: reset: piix4: add missing MODULE_DESCRIPTION() macro
make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/power/reset/piix4-poweroff.o

Add the missing invocation of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20240608-md-drivers-power-reset-v1-1-08dbc1a546a2@quicinc.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-06-26 19:28:28 +02:00
Geert Uytterhoeven
3da8d71754 power: reset: rmobile-reset: Make sysc_base2 local
The static global variable sysc_base2 is no longer used outside the
probe method and the reset handler, so it can be converted to a local
variable, and passed to the reset handler via its callback data.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/35f04935c48ae55dc562071e0a1d6fca65234a58.1708944642.git.geert+renesas@glider.be
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-26 15:09:11 +01:00
Geert Uytterhoeven
6f005ab7f5 power: reset: rmobile-reset: Map correct MMIO resource
The registers related to reset generation are located in the second
register block.  However, the conversion to device life-cycle managed
ioremap function accidentally changed the mapping to the first register
block.

Fixes: 0867276eb1 ("power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helper")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/3b267fb1b303f63248934a1a77bee319e1c44879.1708458882.git.geert+renesas@glider.be
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-21 21:17:58 +01:00
Dan Carpenter
62f4b33bf2 power: reset: xgene-reboot: Fix a NULL vs IS_ERR() test
The devm_platform_ioremap_resource() function returns error points.  It
never returns NULL.  Update the check accordingly.

Fixes: 7ddfd33c6e ("power: reset: xgene-reboot: Use devm_platform_ioremap_resource() helper")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/fe1b90d0-7234-4e03-accc-69a119f6a7eb@moroto.mountain
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-21 21:13:37 +01:00
Andrew Davis
14c5678720 power: reset: syscon-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

This also makes our data struct per-device and not global, which allows
for more than one instance of this device.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-20-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
ffa2128312 power: reset: syscon-poweroff: Move device data into a struct
Currently all these device data elements are top level global variables.
Move these into a struct. This will be used in the next patch when
the global variable usage is removed. Doing this in two steps makes
the patches easier to read.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-19-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
c3ede0b6f7 power: reset: restart-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-18-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
b6475c3f81 power: reset: gemini-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-17-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
348fde771c power: reset: as3722-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-16-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
77b61173c2 power: reset: regulator-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-15-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
00ae86ebf8 power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-14-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
b5711ff917 power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use this helper to register sys_off handler. Drivers should move away from
setting pm_power_off directly as it only allows for one handler. The new
way allows for trying multiple if the first one doesn't work.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-13-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
6ab9137719 power: reset: mt6323-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-12-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
ba1188ea8b power: reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-11-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
0867276eb1 power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helper
Use device life-cycle managed ioremap function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-10-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
ad8d7b8002 power: reset: axxia-reset: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-9-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
45079f206e power: reset: brcm-kona-reset: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240212162831.67838-8-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
11d2642e14 power: reset: tps65086-restart: Remove unneeded device data struct
We only need one member of the struct tps65086_restart, pass that
tps65086_restart_notify() directly. Remove that struct and its
allocation.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-7-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
e68b71812e power: reset: tps65086-restart: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-6-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
6af1ee0285 power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-5-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00