mbox series

[v2,0/7] Add support for MAX7360

Message ID 20241223-mdb-max7360-support-v2-0-37a8d22c36ed@bootlin.com (mailing list archive)
Headers show
Series Add support for MAX7360 | expand

Message

Mathieu Dubois-Briand Dec. 23, 2024, 4:42 p.m. UTC
This series implements a set of drivers allowing to support the Maxim
Integrated MAX7360 device.

The MAX7360 is an I2C key-switch and led controller, with following
functionalities:
- Keypad controller for a key matrix of up to 8 rows and 8 columns.
- Rotary encoder support, for a single rotary encoder.
- Up to 8 PWM outputs.
- Up to 8 GPIOs with support for interrupts and 6 GPOs.

Chipset pins are shared between all functionalities, so all cannot be
used at the same time.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
Changes in v2:
- Removing device tree subnodes for keypad, rotary encoder and pwm
  functionalities.
- Fixed dt-bindings syntax and naming.
- Fixed missing handling of requested period in PWM driver.
- Cleanup of the code
- Link to v1: https://lore.kernel.org/r/20241219-mdb-max7360-support-v1-0-8e8317584121@bootlin.com

---
Kamel Bouhara (2):
      mfd: Add max7360 support
      pwm: max7360: Add MAX7360 PWM support

Mathieu Dubois-Briand (5):
      dt-bindings: mfd: gpio: Add MAX7360
      gpio: max7360: Add MAX7360 gpio support
      input: keyboard: Add support for MAX7360 keypad
      input: misc: Add support for MAX7360 rotary
      MAINTAINERS: Add entry on MAX7360 driver

 .../bindings/gpio/maxim,max7360-gpio.yaml          |  80 ++++
 .../devicetree/bindings/mfd/maxim,max7360.yaml     | 107 +++++
 MAINTAINERS                                        |  12 +
 drivers/gpio/Kconfig                               |  11 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-max7360.c                        | 455 +++++++++++++++++++++
 drivers/input/keyboard/Kconfig                     |  12 +
 drivers/input/keyboard/Makefile                    |   1 +
 drivers/input/keyboard/max7360-keypad.c            | 289 +++++++++++++
 drivers/input/misc/Kconfig                         |  11 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/max7360-rotary.c                | 185 +++++++++
 drivers/mfd/Kconfig                                |  12 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/max7360.c                              | 296 ++++++++++++++
 drivers/pwm/Kconfig                                |  11 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-max7360.c                          | 219 ++++++++++
 include/linux/mfd/max7360.h                        | 109 +++++
 19 files changed, 1814 insertions(+)
---
base-commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
change-id: 20241219-mdb-max7360-support-223a8ce45ba3

Best regards,

Comments

Uwe Kleine-König Dec. 23, 2024, 5:05 p.m. UTC | #1
Hello Mathieu,

On Mon, Dec 23, 2024 at 05:42:32PM +0100, Mathieu Dubois-Briand wrote:
> - Removing device tree subnodes for keypad, rotary encoder and pwm
>   functionalities.

How did you test the pwm? Just using sysfs? Without a node there is
hardly any other usage left, because you cannot pass the pwm to e.g. a
pwm-fan node. So it might be sensible to drop the nodes for keypad and
rotary encoder, but I think you better keep the pwm one.

Best regards
Uwe
Uwe Kleine-König Dec. 23, 2024, 5:09 p.m. UTC | #2
Hello Mathieu,

On Mon, Dec 23, 2024 at 06:05:39PM +0100, Uwe Kleine-König wrote:
> On Mon, Dec 23, 2024 at 05:42:32PM +0100, Mathieu Dubois-Briand wrote:
> > - Removing device tree subnodes for keypad, rotary encoder and pwm
> >   functionalities.
> 
> How did you test the pwm? Just using sysfs? Without a node there is
> hardly any other usage left, because you cannot pass the pwm to e.g. a
> pwm-fan node. So it might be sensible to drop the nodes for keypad and
> rotary encoder, but I think you better keep the pwm one.

I think I was to quick here. It might just work ...

Best regards
Uwe
Mathieu Dubois-Briand Dec. 23, 2024, 5:53 p.m. UTC | #3
On Mon Dec 23, 2024 at 6:09 PM CET, Uwe Kleine-König wrote:
> Hello Mathieu,
>
> On Mon, Dec 23, 2024 at 06:05:39PM +0100, Uwe Kleine-König wrote:
> > On Mon, Dec 23, 2024 at 05:42:32PM +0100, Mathieu Dubois-Briand wrote:
> > > - Removing device tree subnodes for keypad, rotary encoder and pwm
> > >   functionalities.
> > 
> > How did you test the pwm? Just using sysfs? Without a node there is
> > hardly any other usage left, because you cannot pass the pwm to e.g. a
> > pwm-fan node. So it might be sensible to drop the nodes for keypad and
> > rotary encoder, but I think you better keep the pwm one.
>
> I think I was to quick here. It might just work ...
>
> Best regards
> Uwe

Hi Uwe,

I also had some doubt here, keeping the node might be bit more clear but
I thought you wanted me to drop it.

And yes, as you said, it does work. For reference, I test it using some
pwm-led:

pwm-leds {
	compatible = "pwm-leds";

	battery {
		label = "battery";
		pwms = <&max7360 0 2000000 0>;
		max-brightness = <128>;
		linux,default-trigger = "heartbeat";
	};
};

Where &max7360 is a reference to the root node (io-expander@38 in the
binding example).

Best regards,
Mathieu