Skip to contentSkip to conversation

mfd: rohm: Factor out power button registration

PATCH Applied Dmitry Torokhov 3 participants 4 messages Jul 6 – Jul 16

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mfd: rohm: Factor out power button registration

Factor out the power button registration logic using software nodes from rohm-bd718x7 and rohm-bd71828 drivers into a shared module rohm-pwrbutton.

This reduces duplication and makes it easier to support other ROHM PMICs with similar power button configurations.

Assisted-by Antigravity:gemini-3.5-flash

---

v2: dropped "mfd" suffixes from helper names (per Lee's request)

 MAINTAINERS                  |   2 +
 drivers/mfd/Kconfig          |   6 ++
 drivers/mfd/Makefile         |   1 +
 drivers/mfd/rohm-bd71828.c   |  84 ++------------------------
 drivers/mfd/rohm-bd718x7.c   |  84 ++------------------------
 drivers/mfd/rohm-pwrbutton.c | 112 +++++++++++++++++++++++++++++++++++
 drivers/mfd/rohm-pwrbutton.h |  12 ++++
 7 files changed, 141 insertions(+), 160 deletions(-)
MAINTAINERS +2 -0
index f1caa6e5198b..40c46a7363fb 100644
@@ -23524,6 +23524,8 @@ F:	drivers/mfd/rohm-bd71828.c
 F:	drivers/mfd/rohm-bd718x7.c
 F:	drivers/mfd/rohm-bd9576.c
 F:	drivers/mfd/rohm-bd96801.c
+F:	drivers/mfd/rohm-pwrbutton.c
+F:	drivers/mfd/rohm-pwrbutton.h
 F:	drivers/regulator/bd71815-regulator.c
 F:	drivers/regulator/bd71828-regulator.c
 F:	drivers/regulator/bd718x7-regulator.c
drivers/mfd/Kconfig +6 -0
index 763ce6a34782..8d04e1b1f8c8 100644
@@ -2208,6 +2208,10 @@ config MFD_STW481X
 	  in various ST Microelectronics and ST-Ericsson embedded
 	  Nomadik series.
 
+config MFD_ROHM_PWRBUTTON
+	tristate
+	select MFD_CORE
+
 config MFD_ROHM_BD718XX
 	tristate "ROHM BD71837 Power Management IC"
 	depends on I2C=y
@@ -2215,6 +2219,7 @@ config MFD_ROHM_BD718XX
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	select MFD_CORE
+	select MFD_ROHM_PWRBUTTON
 	help
 	  Select this option to get support for the ROHM BD71837
 	  Power Management ICs. BD71837 is designed to power processors like
@@ -2228,6 +2233,7 @@ config MFD_ROHM_BD71828
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	select MFD_CORE
+	select MFD_ROHM_PWRBUTTON
 	help
 	  Select this option to get support for the ROHM BD71815, BD71828,
 	  BD71879, BD72720 and BD73900 Power Management ICs (PMICs). These are
drivers/mfd/Makefile +1 -0
index dd4bb7e77c33..72d3944b0ad8 100644
@@ -273,6 +273,7 @@ obj-$(CONFIG_MFD_STM32_TIMERS) 	+= stm32-timers.o
 obj-$(CONFIG_MFD_MXS_LRADC)     += mxs-lradc.o
 obj-$(CONFIG_MFD_SC27XX_PMIC)	+= sprd-sc27xx-spi.o
 obj-$(CONFIG_RAVE_SP_CORE)	+= rave-sp.o
+obj-$(CONFIG_MFD_ROHM_PWRBUTTON)	+= rohm-pwrbutton.o
 obj-$(CONFIG_MFD_ROHM_BD71828)	+= rohm-bd71828.o
 obj-$(CONFIG_MFD_ROHM_BD718XX)	+= rohm-bd718x7.o
 obj-$(CONFIG_MFD_ROHM_BD957XMUF)	+= rohm-bd9576.o
drivers/mfd/rohm-bd71828.c +4 -80

112 lines not on this page · raw message

drivers/mfd/rohm-bd718x7.c +4 -80

112 lines not on this page · raw message

drivers/mfd/rohm-pwrbutton.c new file +112 -0

112 lines not on this page · raw message

drivers/mfd/rohm-pwrbutton.h new file +12 -0
new file mode 100644
index 000000000000..47ae5c9d1e90
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef __LINUX_MFD_ROHM_PWRBUTTON_H__
+#define __LINUX_MFD_ROHM_PWRBUTTON_H__
+
+struct device;
+struct irq_domain;
+
+int rohm_register_pwrbutton(struct device *dev, int irq, const char *name,
+			    bool wakeup, struct irq_domain *irq_domain);
+
+#endif /* __LINUX_MFD_ROHM_PWRBUTTON_H__ */
Signature · 5 lines
2.55.0.rc2.803.g1fd1e6609c-goog


-- 
Dmitry
maintainer Reviewed-by on v2 1/1
#1 lore raw

ti 7.7.2026 klo 2.24 Dmitry Torokhov ([email protected]) kirjoitti:

Quoted 11 lines

Factor out the power button registration logic using software nodes from rohm-bd718x7 and rohm-bd71828 drivers into a shared module rohm-pwrbutton.

This reduces duplication and makes it easier to support other ROHM PMICs with similar power button configurations.

Assisted-by Antigravity:gemini-3.5-flash

Thanks again!

Yours,
-- Matti

Signature · 8 lines
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

Discuss - Estimate - Plan - Report and finally accomplish this:
void do_work(int time) __attribute__ ((const));
#2 lore raw
Quoted 9 lines · Matti Vaittinen

ti 7.7.2026 klo 2.24 Dmitry Torokhov ([email protected]) kirjoitti:

Quoted 8 lines

Factor out the power button registration logic using software nodes from rohm-bd718x7 and rohm-bd71828 drivers into a shared module rohm-pwrbutton.

This reduces duplication and makes it easier to support other ROHM PMICs with similar power button configurations.

Quoted 7 lines
Quoted 3 lines
Assisted-by Antigravity:gemini-3.5-flash

Thanks again!

Thank you Matti!

Signature · 1 line
Dmitry
maintainer Applied
#3 lore raw

Re: (subset) [PATCH v2] mfd: rohm: Factor out power button registration

In reply to Dmitry Torokhov
Quoted 8 lines · Dmitry Torokhov

Factor out the power button registration logic using software nodes from rohm-bd718x7 and rohm-bd71828 drivers into a shared module rohm-pwrbutton.

This reduces duplication and makes it easier to support other ROHM PMICs with similar power button configurations.

[...]

Applied, thanks!

[1/1] mfd: rohm: Factor out power button registration

      commit: 5a288c855164d45640d97bbba0744d02d18fdcdd

--
Lee Jones [李琼斯]