The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Lee Jones <lee@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mfd: rohm: Factor out power button registration
Date: Mon, 6 Jul 2026 15:27:35 -0700	[thread overview]
Message-ID: <akwpyqPJLKRHX8na@google.com> (raw)
In-Reply-To: <9ec0928a-4fe9-426b-96e1-d90b30c1ef74@gmail.com>

Hi Matti,

On Fri, Jun 26, 2026 at 10:35:19AM +0300, Matti Vaittinen wrote:
> On 25/06/2026 21:33, Dmitry Torokhov wrote:
> > Hi Matti,
> > 
> > On Thu, Jun 25, 2026 at 11:00:08AM +0300, Matti Vaittinen wrote:
> > > On 18/06/2026 21:58, Dmitry Torokhov wrote:
> > > > 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.
> > > > 
> > > > Suggested-by: Lee Jones <lee@kernel.org>
> > > > Assisted-by: Antigravity:gemini-3.5-flash
> > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > 
> > > Thanks a lot Dmitry. I like the idea of having generic helpers for crearting
> > > the swnodes for the power-button!
> > > 
> > > > ---
> > > >    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(-)
> > > > 
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index f1caa6e5198b..40c46a7363fb 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -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
> > > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > > index 763ce6a34782..8d04e1b1f8c8 100644
> > > > --- a/drivers/mfd/Kconfig
> > > > +++ b/drivers/mfd/Kconfig
> > > > @@ -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
> > > 
> > > I would drop the MFD dependency from the helper. It'd be nice to be able to
> > > add the SW-nodes representing power-button(s) outside MFD as well.
> > 
> > Do you have potential users in mind for this? I mean specifically
> > single IRQ-backed buttons besides these 2 ROHM controllers?
> 
> I don't think it needs to be a single IRQ backed? There are quite a few IRQs
> in these PMICs. But no, I don't have concrete users for you (as of now), but
> a power-button which generates and IRQ does really sound like a very generic
> concept to me.
> 
> > I would prefer no over-generalize if there are no users. Kernel modules
> > are not totally free.
> 
> I suppose these IRQ backed power-buttons would in most cases be handled by
> the GPIO_KEYS. Perhaps you could consider exporting the helper from it
> instead of having it in MFD(?)

I want through drivers for similar buttons and I currently do not see
any other candidates for the conversion besides the 2 ROHM drivers. This
is because the rest of the power button drivers implement true tracking
of the button state (instead of only detecting press via an IRQ and
simulating release). 

The only potential users of the helper would be new drivers, but new
drivers outside of MFD realm will use ACPI/DT and not static device
properties as they will handle new devices on new boards. It is only
within the context of MFD that I can see slight possibility of more
drivers using this mechanism (and not regular DT configuration) and that
is why I do not think putting the helper in gpio-keys would make sense.

Additionally putting it in gpio-keys will add unwanted (IMO) dependency
(module-load-wise).

Thanks.

-- 
Dmitry

      reply	other threads:[~2026-07-06 22:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 18:58 [PATCH] mfd: rohm: Factor out power button registration Dmitry Torokhov
2026-06-19  9:02 ` Lee Jones
2026-06-25  8:00 ` Matti Vaittinen
2026-06-25 18:33   ` Dmitry Torokhov
2026-06-26  7:35     ` Matti Vaittinen
2026-07-06 22:27       ` Dmitry Torokhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=akwpyqPJLKRHX8na@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox