From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
To: "Krzysztof Kozlowski" <krzk@kernel.org>,
"Lee Jones" <lee@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Kamel Bouhara" <kamel.bouhara@bootlin.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-input@vger.kernel.org,
linux-pwm@vger.kernel.org,
"Grégory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 2/8] dt-bindings: Add MAX7360 subdevices
Date: Tue, 24 Dec 2024 13:10:56 +0100 [thread overview]
Message-ID: <D6JX5D6SX41A.2GFEDU0WMH5ZC@bootlin.com> (raw)
In-Reply-To: <b1d541c1-296a-4b56-bea3-52e5becadf0e@kernel.org>
On Tue Dec 24, 2024 at 10:00 AM CET, Krzysztof Kozlowski wrote:
> On 23/12/2024 16:20, Mathieu Dubois-Briand wrote:
> > On Sat Dec 21, 2024 at 9:34 PM CET, Krzysztof Kozlowski wrote:
> >> On 19/12/2024 17:21, Mathieu Dubois-Briand wrote:
> >>> ---
> >>> diff --git a/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> >>> new file mode 100644
> >>> index 000000000000..3c006dc0380b
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> >>> @@ -0,0 +1,96 @@
> >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>> +%YAML 1.2
> >>> +---
> >>> +$id: http://devicetree.org/schemas/gpio/max7360-gpio.yaml#
> >>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >>> +
> >>> +title: Maxim MAX7360 GPIO controller
> >>> +
> >>> +maintainers:
> >>> + - Kamel Bouhara <kamel.bouhara@bootlin.com>
> >>> + - Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> >>> +
> >>> +description: |
> >>> + Maxim MAX7360 GPIO controller, in MAX7360 MFD
> >>> + https://www.analog.com/en/products/max7360.html
> >>> +
> >>> +properties:
> >>> + compatible:
> >>> + enum:
> >>> + - maxim,max7360-gpio
> >>> + - maxim,max7360-gpo
> >>
> >> Why? What are the differences?
> >>
> >
> > Ok, so maybe my approach here is completely wrong. I'm not sure what
> > would be the best way to describe the device here, if you have any
> > suggestion I would be happy to use it. Let me try to summarize the GPIO
> > setup of the chip.
> >
> > First we have two series of GPIOs on the chips, which I tend to think
> > about as two separate "banks". Thus two separate subnodes of the max7360
> > node.
>
> First, splitting MFD device into multiple children is pretty often wrong
> approach because it tries to mimic Linux driver design.
>
> Such split in DT makes sense if these are really separate blocks, e.g.
> separate I2C addresses, re-usable on different designs.
>
> In this case Functional Block Diagram shows separate blocks, but still
> the same I2C block. This can be one device. This can be also two devices
> if that's easier to represent in DT.
Ok, I get it. So I could try to remove the children, but I'm not really
sure about the way to go:
- About the two series of GPIOs, how should I represent them? In a
continuous way, like 0-7 is gpios and 8+ is gpos? Or maybe setting
#gpio-cells to 3 and using the added cell to select between gpios and
gpos ?
- About the interrupt-controller: today we have a children where all
gpios have a corresponding interrupt and another one without any
interrupt. If I remove the children, we will have a mix of both. I
don't think there is anything preventing to do this, but is this ok?
So I'm keeping the two children for now, but I'm open to the possibility
of removing them.
>
> But in any case binding description should explain this.
>
Ok, I will add some documentation.
> >
> > - On one side we have what I refer to as GPIOs, here with
> > maxim,max7360-gpio:
> > - PORT0 to PORT7 pins of the chip.
> > - Shared with PWM and rotary encoder functionalities. Functionality
> > selection can be made independently for each pin. This selection is
> > not described here. Runtime will have to ensure the same pin is not
> > used by two drivers at the same time. E.g. we cannot have at the
> > same time GPIO4 and PWM4.
> > - Supports input and interrupts.
> > - Outputs may be configured as constant current.
> > - 8 GPIOS supported, so ngpios maximum is 8. Thinking about it now, we
> > should probably also set minimum to 8, I don't see any reason to
> > have ngpios set to something less.
> >
> > On the other side, we have what I refer to as GPOs, here with
> > maxim,max7360-gpo compatible:
> > - COL2 to COL7 pins of the chip.
> > - Shared with the keypad functionality. Selections is made by
> > partitioning the pins: first pins for keypad columns, last pins for
> > GPOs. Partition is described here by ngpios and on keypad node by
> > keypad,num-columns. Runtime will have to ensure values are coherent
> > and configure the chip accordingly.
> > - Only support outputs.
> > - No support for constant current mode.
> > - Supports 0 to 6 GPOs, so ngpios maximum is 6.
> >
> >>> +
> >>> + gpio-controller: true
> >>> +
> >>> + "#gpio-cells":
> >>> + const: 2
> >>> +
> >>> + ngpios:
> >>> + minimum: 0
> >>> + maximum: 8
> >>
> >> Why this is flexible?
> >>
> >
> > I believe this makes sense, as this keypad/gpos partition really changes
> > the actual number of GPIOS. Yet we could argue that this is just runtime
> > configuration. Tell me what you think about it, if you think this should
> > be a fixed value, I will find a way.
>
> Depends whether this is actual runtime configuration. If you configure
> keypad in DT, then the pins go away from GPIOs (especially considering
> that board might have these pins really connected to keypad). Anyway,
> explain this briefly in binding description.
Keypad is configured in DT and yes, the pins partition is a consequence
of the hardware implementation on the board. So on second thought I
believe this is cannot be a runtime configuration and should be
described in the DT.
I will add some documentation about it.
>
> >
> Best regards,
> Krzysztof
Thanks again for your review.
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-12-24 12:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 16:21 [PATCH 0/8] Add support for MAX7360 multifunction device Mathieu Dubois-Briand
2024-12-19 16:21 ` [PATCH 1/8] dt-bindings: Add MAX7360 MFD device Mathieu Dubois-Briand
2024-12-21 20:28 ` Krzysztof Kozlowski
2024-12-19 16:21 ` [PATCH 2/8] dt-bindings: Add MAX7360 subdevices Mathieu Dubois-Briand
2024-12-19 21:54 ` Uwe Kleine-König
2024-12-21 20:34 ` Krzysztof Kozlowski
2024-12-23 15:20 ` Mathieu Dubois-Briand
2024-12-24 9:00 ` Krzysztof Kozlowski
2024-12-24 12:10 ` Mathieu Dubois-Briand [this message]
2024-12-19 16:21 ` [PATCH 3/8] mfd: Add max7360 support mathieu.dubois-briand
2024-12-20 23:01 ` kernel test robot
2024-12-19 16:21 ` [PATCH 4/8] pwm: max7360: Add MAX7360 PWM support mathieu.dubois-briand
2024-12-19 21:53 ` Uwe Kleine-König
2024-12-23 15:26 ` Mathieu Dubois-Briand
2024-12-20 5:51 ` Uwe Kleine-König
2024-12-21 20:35 ` Krzysztof Kozlowski
2024-12-19 16:21 ` [PATCH 5/8] gpio: max7360: Add MAX7360 gpio support Mathieu Dubois-Briand
2024-12-20 15:54 ` kernel test robot
2024-12-20 16:39 ` kernel test robot
2024-12-19 16:21 ` [PATCH 6/8] input: keyboard: Add support for MAX7360 keypad Mathieu Dubois-Briand
2024-12-19 19:35 ` Dmitry Torokhov
2024-12-23 15:38 ` Mathieu Dubois-Briand
2024-12-20 17:12 ` kernel test robot
2024-12-19 16:21 ` [PATCH 7/8] input: misc: Add support for MAX7360 rotary Mathieu Dubois-Briand
2024-12-19 16:21 ` [PATCH 8/8] MAINTAINERS: Add entry on MAX7360 driver Mathieu Dubois-Briand
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=D6JX5D6SX41A.2GFEDU0WMH5ZC@bootlin.com \
--to=mathieu.dubois-briand@bootlin.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=kamel.bouhara@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=ukleinek@kernel.org \
/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