gpio: add DT binding doc for gpio of PMIC max77620/max20024
Subsystems (3)
PATCH v12 1/2 gpio: add DT binding doc for gpio of PMIC max77620/max20024
Maxim Semiconductor's PMIC MAX77620/MAX20024 has 8 GPIO pins which act as GPIO as well as special function mode.
Add DT binding document to support these pins in GPIO mode via GPIO framework.
---
This as part of the max77620 series and mfd patch are already applied. This can go in subsystem branch.
Changes from V4:
- Separate out from gpio driver
Changes from V5/V6/V7:
- None
Changes from V8:
- Collected Linus ack.
Changes from V9i/V10:
None
--- .../devicetree/bindings/gpio/gpio-max77620.txt | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-max77620.txt
Documentation/devicetree/bindings/gpio/gpio-max77620.txt new file +25 -0
@@ -0,0 +1,25 @@ +GPIO driver for MAX77620 Power management IC from Maxim Semiconductor. + +Device has 8 GPIO pins which can be configured as GPIO as well as the +special IO functions. + +Required properties: +------------------- +- gpio-controller : Marks the device node as a gpio controller. +- #gpio-cells : Should be two. The first cell is the pin number and + the second cell is used to specify the gpio polarity: + 0 = active high + 1 = active low +For more details, please refer generic GPIO DT binding document +<devicetree/bindings/gpio/gpio.txt>. + +Example: +-------- +#include <dt-bindings/mfd/max77620.h> +... +max77620@3c { + compatible = "maxim,max77620"; + + gpio-controller; + #gpio-cells = <2>; +};
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v12 1/2 pinctrl: add DT binding doc for pincontrol of PMIC max77620/max20024
Maxim Semiconductor's PMIC MAX77620/MAX20024 has 8 GPIO pins which act as GPIO as well as special function mode.
Add DT binding document to configure pins in function mode as well as pin configuration parameters.
---
This was part of the max77620 series and mfd is merged. So it can go in subsystem wise.
Changes from V4:
- Separate out from pincontrol driver
Changes from V5:
- Starting patch title with pinctrl instead of DT:pinctrl
Changes from V6/V7:
- None
Changes on V8:
- Collected Ack from Linus.
Changes from V9/10:
None
--- .../bindings/pinctrl/pinctrl-max77620.txt | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-max77620.txt
Documentation/devicetree/bindings/pinctrl/pinctrl-max77620.txt new file +127 -0
@@ -0,0 +1,127 @@ +Pincontrol driver for MAX77620 Power management IC from Maxim Semiconductor. + +Device has 8 GPIO pins which can be configured as GPIO as well as the +special IO functions. + +Please refer file <devicetree/bindings/pinctrl/pinctrl-bindings.txt> +for details of the common pinctrl bindings used by client devices, +including the meaning of the phrase "pin configuration node". + +Optional Pinmux properties: +-------------------------- +Following properties are required if default setting of pins are required +at boot. +- pinctrl-names: A pinctrl state named per <pinctrl-binding.txt>. +- pinctrl[0...n]: Properties to contain the phandle for pinctrl states per + <pinctrl-binding.txt>. + +The pin configurations are defined as child of the pinctrl states node. Each +sub-node have following properties: + +Required properties: +------------------ +- pins: List of pins. Valid values of pins properties are: + gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7. + +Optional properties: +------------------- +Following are optional properties defined as pinmux DT binding document +<pinctrl-bindings.txt>. Absence of properties will leave the configuration +on default. + function, + drive-push-pull, + drive-open-drain, + bias-pull-up, + bias-pull-down. + +Valid values for function properties are: + gpio, lpm-control-in, fps-out, 32k-out, sd0-dvs-in, sd1-dvs-in, + reference-out + +Theres is also customised properties for the GPIO1, GPIO2 and GPIO3. These +customised properties are required to configure FPS configuration parameters +of these GPIOs. Please refer <devicetree/bindings/mfd/max77620.txt> for more +detail of Flexible Power Sequence (FPS). + +- maxim,active-fps-source: FPS source for the GPIOs to get + enabled/disabled when system is in + active state. Valid values are: + - MAX77620_FPS_SRC_0, + FPS source is FPS0. + - MAX77620_FPS_SRC_1, + FPS source is FPS1 + - MAX77620_FPS_SRC_2 and + FPS source is FPS2 + - MAX77620_FPS_SRC_NONE. + GPIO is not controlled + by FPS events and it gets + enabled/disabled by register + access. + Absence of this property will leave + the FPS configuration register for that + GPIO to default configuration. + +- maxim,active-fps-power-up-slot: Sequencing event slot number on which + the GPIO get enabled when + master FPS input event set to HIGH. + Valid values are 0 to 7. + This is applicable if FPS source is + selected as FPS0, FPS1 or FPS2. + +- maxim,active-fps-power-down-slot: Sequencing event slot number on which + the GPIO get disabled when master + FPS input event set to LOW. + Valid values are 0 to 7. + This is applicable if FPS source is + selected as FPS0, FPS1 or FPS2. + +- maxim,suspend-fps-source: This is same as property + "maxim,active-fps-source" but value + get configured when system enters in + to suspend state. + +- maxim,suspend-fps-power-up-slot: This is same as property + "maxim,active-fps-power-up-slot" but + this value get configured into FPS + configuration register when system + enters into suspend. + This is applicable if suspend state + FPS source is selected as FPS0, FPS1 or + +- maxim,suspend-fps-power-down-slot: This is same as property + "maxim,active-fps-power-down-slot" but + this value get configured into FPS + configuration register when system + enters into suspend. + This is applicable if suspend state + FPS source is selected as FPS0, FPS1 or + FPS2. + +Example: +-------- +#include <dt-bindings/mfd/max77620.h> +... +max77620@3c { + + pinctrl-names = "default"; + pinctrl-0 = <&spmic_default>; + + spmic_default: pinmux@0 { + pin_gpio0 { + pins = "gpio0"; + function = "gpio"; + }; + + pin_gpio1 { + pins = "gpio1"; + function = "fps-out"; + maxim,active-fps-source = <MAX77620_FPS_SRC_0>; + }; + + pin_gpio2 { + pins = "gpio2"; + function = "fps-out"; + maxim,active-fps-source = <MAX77620_FPS_SRC_1>; + }; + }; +};
Signature · 1 line
2.1.4
Re: [PATCH V12 1/2] pinctrl: add DT binding doc for pincontrol of PMIC max77620/max20024
Quoted 9 lines · Laxman Dewangan
Maxim Semiconductor's PMIC MAX77620/MAX20024 has 8 GPIO pins which act as GPIO as well as special function mode.
Add DT binding document to configure pins in function mode as well as pin configuration parameters.
Signed-off-by Laxman Dewangan <[email protected]>Acked-by Rob Herring <[email protected]>Acked-by Linus Walleij <[email protected]>
Patch applied to the pin control tree.
Yours,
Linus Walleij
PATCH v12 2/2 gpio: max77620: add gpio driver for MAX77620/MAX20024
In reply to Laxman DewanganMAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins. It also supports interrupts from these pins.
Add GPIO driver for these pins to control via GPIO APIs.
---
This as part of the max77620 series and mfd patch are already applied. This can go in subsystem branch.
Changes from V1:
- Use the gpiochip_add_data and get the chip data from core APIs.
- Cleanups based on comment received on mfd/rtc.
- Avoid duplication on error message.
Changes form V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- update based on api changes from core.
Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.
Changes from V4:
- Added DT binding document as devicetree/bindings/gpio/gpio-max77620.txt
Changes from V5:
- Separate out DT binding doc for gpio.
- Added reviewed by for Linus W
Changes from V6/V7:
- None
Changes from V8:
- Run checkpatch --strict and fix error. Mostly to use unsigned int instead of unsigned.
- Use linux/gpio/driver.h
Changes from V9:
- Use devm_regmap_add_irq_chip() and devm_gpiochip_add_data()
Changes from V10:
None
Changes from V11:
- Change bool to tristate in CONFIG
--- drivers/gpio/Kconfig | 9 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-max77620.c | 238 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 drivers/gpio/gpio-max77620.c
drivers/gpio/Kconfig +9 -0
@@ -870,6 +870,15 @@ config GPIO_LP3943 LP3943 can be used as a GPIO expander which provides up to 16 GPIOs. Open drain outputs are required for this usage. +config GPIO_MAX77620 + tristate "GPIO support for PMIC MAX77620 and MAX20024" + depends on MFD_MAX77620 + help + GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor. + MAX77620 PMIC has 8 pins that can be configured as GPIOs. The + driver also provides interrupt support for each of the gpios. + Say yes here to enable the max77620 to be used as gpio controller. + config GPIO_MSIC bool "Intel MSIC mixed signal gpio support" depends on MFD_INTEL_MSIC
drivers/gpio/Makefile +1 -0
@@ -61,6 +61,7 @@ obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o obj-$(CONFIG_GPIO_MAX732X) += gpio-max732x.o +obj-$(CONFIG_GPIO_MAX77620) += gpio-max77620.o obj-$(CONFIG_GPIO_MB86S7X) += gpio-mb86s7x.o obj-$(CONFIG_GPIO_MENZ127) += gpio-menz127.o obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o
drivers/gpio/gpio-max77620.c new file +238 -0
238 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH V12 2/2] gpio: max77620: add gpio driver for MAX77620/MAX20024
Quoted 7 lines · Laxman Dewangan
MAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins. It also supports interrupts from these pins.
Add GPIO driver for these pins to control via GPIO APIs.
Signed-off-by Laxman Dewangan <[email protected]>Reviewed-by Linus Walleij <[email protected]>
PS, please add these optional features:
drivers/gpio/gpio-max77620.c line 187
Quoted 2 lines
drivers/gpio/gpio-max77620.c new file +2
-0+ mgpio->gpio_chip.direction_input = max77620_gpio_dir_input; + mgpio->gpio_chip.direction_output = max77620_gpio_dir_output;
Any chance you could send a patch to add a .get_direction() callback?
This is really useful for debugfs and the userspace ABI and I started to add it to drivers all over the place.
Also you have this:
#define MAX77620_CNFG_GPIO_DRV_MASK BIT(0) #define MAX77620_CNFG_GPIO_DRV_PUSHPULL BIT(0) #define MAX77620_CNFG_GPIO_DRV_OPENDRAIN 0
So it seems possible to add .set_single_ended() to this driver as well so it supports native open drain. Please consider this!
I am possibly adding .get_single_ended() to the API this next kernel cycle as well, but that is for later.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V12 2/2] gpio: max77620: add gpio driver for MAX77620/MAX20024
Quoted 7 lines · Linus Walleij
Quoted 5 lines · Laxman Dewangan
MAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins. It also supports interrupts from these pins.
Add GPIO driver for these pins to control via GPIO APIs.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Laxman Dewangan <[email protected]>Reviewed-by Linus Walleij <[email protected]>PS, please add these optional features:
drivers/gpio/gpio-max77620.c line 187
Quoted 2 lines
drivers/gpio/gpio-max77620.c new file +2
-0+ mgpio->gpio_chip.direction_input = max77620_gpio_dir_input; + mgpio->gpio_chip.direction_output = max77620_gpio_dir_output;Any chance you could send a patch to add a .get_direction() callback?
Sure, I will send the patch for this and also for the set_single_ended().
I will post the patch on top of this patch as a new patch as this is already applied in your tree. Later on, it can be squashed or added as new patch.
Re: [PATCH V12 2/2] gpio: max77620: add gpio driver for MAX77620/MAX20024
In reply to Laxman DewanganQuoted 7 lines · Laxman Dewangan
MAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins. It also supports interrupts from these pins.
Add GPIO driver for these pins to control via GPIO APIs.
Signed-off-by Laxman Dewangan <[email protected]>Reviewed-by Linus Walleij <[email protected]>
Patch applied to the GPIO tree.
Yours,
Linus Walleij
PATCH v12 2/2 pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024
In reply to Laxman DewanganMAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins which also act as the special function in alternate mode. Also there is configuration like push-pull, open drain, FPS timing etc for these pins.
Add pin control driver to configure these parameters through pin control APIs.
---
This was part of the max77620 series and mfd is merged. So it can go in subsystem wise.
Changes from V1:
- Cleanup code based on comment received on mfd/rtc.
- Avoid duplication on error message.
Changes form V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- update based on api changes from core.
Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.
Changes from V4:
- Added DT binding document as devicetree/bindings/pinctrl/pinctrl-max77620.txt
- Detail out properties as per review comment.
Changes from V5:
- Separate out DT binding doc for pincontrol.
- Added reviewed by for Linus W
Changes from V6:
- Use regmap APIs direct instead of max77620 abstraction APIs.
Changes from V7:
- None
Changes from V8:
- Run checkpatch --strict on final patch and fixes issue and changed unsigned to unsigned int.
Changes from V9:
None
Changes from V10:
Use new APIs for the dt_free_map.
Changes from V11:
- Change bool to tristate for the CONFIG.
- Use devm_pinctrl_tegister and get rid of remove callback.
--- drivers/pinctrl/Kconfig | 10 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-max77620.c | 678 +++++++++++++++++++++++++++++++++++++ 3 files changed, 689 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-max77620.c
drivers/pinctrl/Kconfig +10 -0
@@ -196,6 +196,16 @@ config PINCTRL_COH901 COH 901 335 and COH 901 571/3. They contain 3, 5 or 7 ports of 8 GPIO pins each. +config PINCTRL_MAX77620 + tristate "MAX77620/MAX20024 Pincontrol support" + depends on MFD_MAX77620 + select GENERIC_PINCONF + help + Say Yes here to enable Pin control support for Maxim PMIC MAX77620. + This PMIC has 8 GPIO pins that work as GPIO as well as special + function in alternate mode. This driver also configure push-pull, + open drain, FPS slots etc. + config PINCTRL_PALMAS bool "Pinctrl driver for the PALMAS Series MFD devices" depends on OF && MFD_PALMAS
drivers/pinctrl/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AMD) += pinctrl-amd.o obj-$(CONFIG_PINCTRL_DIGICOLOR) += pinctrl-digicolor.o obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o obj-$(CONFIG_PINCTRL_MESON) += meson/ +obj-$(CONFIG_PINCTRL_MAX77620) += pinctrl-max77620.o obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o obj-$(CONFIG_PINCTRL_PIC32) += pinctrl-pic32.o obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o
drivers/pinctrl/pinctrl-max77620.c new file +678 -0
678 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH V12 2/2] pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024
Quoted 10 lines · Laxman Dewangan
MAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins which also act as the special function in alternate mode. Also there is configuration like push-pull, open drain, FPS timing etc for these pins.
Add pin control driver to configure these parameters through pin control APIs.
Signed-off-by Laxman Dewangan <[email protected]>Reviewed-by Linus Walleij <[email protected]>
Patch applied for the next kernel cycle.
drivers/pinctrl/pinctrl-max77620.c line 293
Quoted 5 lines
drivers/pinctrl/pinctrl-max77620.c new file +5
-0+switch (param) { +case PIN_CONFIG_DRIVE_OPEN_DRAIN : +if (mpci->pin_info[pin].drv_type ==MAX77620_PIN_OD_DRV ) + arg =1 ; +break ;
Hmmmm OK is this one of those cases we discussed where you need to be able to tell the pin config back-end to do the open draining (etc) from the GPIO driver?
Yours,
Linus Walleij
Re: [PATCH V12 2/2] pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024
Quoted 7 lines · Linus Walleij
Quoted 5 lines · Laxman Dewangan
MAXIM Semiconductor's PMIC, MAX77620/MAX20024 has 8 GPIO pins which also act as the special function in alternate mode. Also there is configuration like push-pull, open drain, FPS timing etc for these pins.
Quoted 6 lines
Quoted 5 lines
Add pin control driver to configure these parameters through pin control APIs.
Signed-off-by Laxman Dewangan <[email protected]>Reviewed-by Linus Walleij <[email protected]>Patch applied for the next kernel cycle.
Thank you very much.
Quoted 9 lines
drivers/pinctrl/pinctrl-max77620.c line 293
Quoted 6 lines
drivers/pinctrl/pinctrl-max77620.c new file +5
-0+switch (param) { +case PIN_CONFIG_DRIVE_OPEN_DRAIN : +if (mpci->pin_info[pin].drv_type ==MAX77620_PIN_OD_DRV ) + arg =1 ; +break ;Hmmmm OK is this one of those cases we discussed where you need to be able to tell the pin config back-end to do the open draining (etc) from the GPIO driver?
The back end request was for tegra-gpio, not for this. On Tegra GPIO the open drain configurations are in different register space i.e. pin control register space instead of gpio controller.
In this driver, it is configuration via pinctrl. Here pincontrol and gpio driver share same registers.
Now, as we have the method to configure the open drain bit from the GPIO interface, we really dont need to do this from pinctrl framework.
For doing from GPIO framework, the client need to aware that gpio is open drain type.
Can we make something that open drain of pins can be provided via some common interface like DT of controller based on platforms configuration and client need not to worry about this? For client, it will be simple gpio calls.
Re: [PATCH V12 2/2] pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024
Quoted 4 lines · Laxman Dewangan
In this driver, it is configuration via pinctrl. Here pincontrol and gpio driver share same registers.
Now, as we have the method to configure the open drain bit from the GPIO interface, we really dont need to do this from pinctrl framework.
OK good that works too...
Quoted 7 lines
For doing from GPIO framework, the client need to aware that gpio is open drain type.
Can we make something that open drain of pins can be provided via some common interface like DT of controller based on platforms configuration and client need not to worry about this? For client, it will be simple gpio calls.
We have GPIO_OPEN_DRAIN in include/dt-bindings/gpio/gpio.h
that can be added on the consumer side of the GPIO line in the DT, it should work (just like GPIO_ACTIVE_LOW for example).
For descriptor tables include/linux/gpio/machine.h
provides the same mechanism with the flag GPIO_OPEN_DRAIN
Notice that in both cases it is the consumer that specifies that it needs the line to be set up as open drain, not the controller, as it is a resource, the consumer needs to request what it needs.
So this can be done already today. Unless there is some bug.
Yours,
Linus Walleij
Quoted 6 lines · Laxman Dewangan
Maxim Semiconductor's PMIC MAX77620/MAX20024 has 8 GPIO pins which act as GPIO as well as special function mode.
Add DT binding document to support these pins in GPIO mode via GPIO framework.
Quoted 7 lines
Signed-off-by Laxman Dewangan <[email protected]>Acked-by Rob Herring <[email protected]>Acked-by Linus Walleij <[email protected]>---
This as part of the max77620 series and mfd patch are already applied. This can go in subsystem branch.
Patch applied to the GPIO tree.
Yours,
Linus Walleij