Skip to contentSkip to conversation

Add support for MAXIM MAX77620/MAX20024 PMIC

PATCH Superseded Laxman Dewangan 4 participants 19 messages Jan 19, 2016 – Jan 28, 2016

Subsystems (6)

v4 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add support for MAXIM MAX77620/MAX20024 PMIC

Add SW support for MAXIM Semiconductor's Power Management IC (PMIC) MAX77620/MAX20024. This PMIC supports DC-DC/LDOS, GPIOs, RTC, watchdog, clocks etc.

This series add respective driver for each of sub-modules.

---
Changes from V1:
DT DOC:
- Added units in some of properties.
- Change the boolean property to tristate type and detail some of properties.

RTC:
- Rename the file to rtc-max77xxx.c and make the generic implementation.
- Direct regmap apis are used for the register access.
- Decouped from max77620 driver.
- Taken care of cleanup comments form V1 version.

MFD:
- Code cleanups per review from V1.
- Move register acccess APIs from header to c file.
- Remove some of non required variable, remove duplication in error message and simplify some of function implementation.

GPIO:
- 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.

Pinctrl:
- Cleanup code based on comment received on mfd/rtc.
- Avoid duplication on error message.

Regulators:
- Cleanup code based on comment received on mfd/rtc.
- Avoid duplication on error message.
- Taken care of review comment from Mark.

Changes from V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- Drop RTC driver and its i2c client registartion.
- Refactor Regulator driver to use core API for DT parsing.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

Laxman Dewangan (5):
DT: mfd: add device-tree binding doc fro PMIC max77620/max20024
mfd: max77620: add core driver for MAX77620/MAX20024
pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024
gpio: max77620: add gpio driver for MAX77620/MAX20024
regulator: max77620: add regulator driver for max77620/max20024

 Documentation/devicetree/bindings/mfd/max77620.txt | 397 +++++++++
 drivers/gpio/Kconfig                               |   9 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-max77620.c                       | 292 +++++++
 drivers/mfd/Kconfig                                |  15 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/max77620.c                             | 871 ++++++++++++++++++++
 drivers/pinctrl/Kconfig                            |  10 +
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl-max77620.c                 | 693 ++++++++++++++++
 drivers/regulator/Kconfig                          |   9 +
 drivers/regulator/Makefile                         |   1 +
 drivers/regulator/max77620-regulator.c             | 883 +++++++++++++++++++++
 include/dt-bindings/mfd/max77620.h                 |  38 +
 include/linux/mfd/max77620.h                       | 404 ++++++++++
 15 files changed, 3625 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/max77620.txt
 create mode 100644 drivers/gpio/gpio-max77620.c
 create mode 100644 drivers/mfd/max77620.c
 create mode 100644 drivers/pinctrl/pinctrl-max77620.c
 create mode 100644 drivers/regulator/max77620-regulator.c
 create mode 100644 include/dt-bindings/mfd/max77620.h
 create mode 100644 include/linux/mfd/max77620.h
Signature · 1 line
2.1.4
#1 lore raw

PATCH v4 1/5 DT: mfd: add device-tree binding doc fro PMIC max77620/max20024

The MAXIM PMIC MAX77620 and MAX20024 are power management IC which supports RTC, GPIO, DCDC/LDO regulators, interrupt, watchdog etc.

Add DT binding document for the different functionality of this device.

---
Changes from V1:
- Added units in some of properties.
- Change the boolean property to tristate type and detail some of properties.

Change from V2:
- added unit in period related dt property.

Change from V3: None
Added Rob's ack.

 Documentation/devicetree/bindings/mfd/max77620.txt | 397 +++++++++++++++++++++
 include/dt-bindings/mfd/max77620.h                 |  38 ++
 2 files changed, 435 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/max77620.txt
 create mode 100644 include/dt-bindings/mfd/max77620.h
Documentation/devicetree/bindings/mfd/max77620.txt new file +397 -0
new file mode 100644
index 0000000..46f6aac
@@ -0,0 +1,397 @@
+* MAX77620 Power management IC from Maxim Semiconductor.
+
+Required properties:
+-------------------
+- compatible: Must be one of
+		"maxim,max77620" or
+		"maxim,max20024".
+- reg: I2C device address.
+- interrupt-controller: MAX77620 has internal interrupt controller which
+  takes the interrupt request from internal sub-blocks like RTC,
+  regulators, GPIOs as well as external input.
+- #interrupt-cells: Should be set to 2 for IRQ number and flags.
+  The first cell is the IRQ number. IRQ numbers for different interrupt
+  source of MAX77620 are defined at dt-bindings/mfd/max77620.h
+  The second cell is the flags, encoded as the trigger masks from binding
+  document interrupts.txt, using dt-bindings/irq.
+
+Optional properties:
+-------------------
+This device also supports the power OFF of system.
+Following properties are used for this purpose:
+- system-power-controller: Boolean, This device will be use as
+	system power controller and used for power OFF of system.
+	Host issue necessary command to PMIC.
+
+
+Optional submodule and their properties:
+=======================================
+
+Flexible power sequence configuration
+====================================
+This sub-node configures the Flexible Power Sequnece(FPS) for power ON slot,
+power OFF slot and slot period of the device. Device has 3 FPS as FPS0,
+FPS1 and FPS2. The details of FPS configuration is provided through
+subnode "fps". The details of FPS0, FPS1, FPS2 are provided through the
+child node under this subnodes. The FPS number is provided via reg property.
+
+The property for fps child nodes as:
+Required properties:
+	-reg: FPS number like 0, 1, 2 for FPS0, FPS1 and FPS2 respectively.
+Optinal properties:
+	-maxim,active-fps-time-period-us: Active state FPS time period in
+		microseconds.
+	-maxim,suspend-fps-time-period-us: Suspend state FPS time period in
+		microseconds.
+	-maxim,fps-enable-input: FPS enable source like EN0, EN1 or SW. The
+			macros are defined on dt-bindings/mfd/max77620.h for
+			different enable source.
+				FPS_EN_SRC_EN0 for EN0 enable source.
+				FPS_EN_SRC_EN1 for En1 enable source.
+				FPS_EN_SRC_SW for SW based control.
+	-maxim,fps-sw-enable: Boolean, applicable if enable input is SW.
+			If this property present then enable the FPS else
+			disable FPS.
+	-maxim,enable-sleep: Boolean, enable sleep when the external control
+			goes from HIGH to LOW.
+	-maxim,enable-global-lpm: Boolean, enable global LPM when the external
+			control goes from HIGH to LOW.
+
+Here supported time periods by device in microseconds are as follows:
+MAX77620 supports 40, 80, 160, 320, 640, 1280, 2560 and 5120 microseconds.
+MAX20024 supports 20, 40, 80, 160, 320, 640, 1280 and 2540 microseconds.
+
+Pinmux and GPIO:
+===============
+Device has 8 GPIO pins which can be configured as GPIO as well as the
+special IO functions.
+
+Please refer to pinctrl-bindings.txt for details of the common pinctrl
+bindings used by client devices, including the meaning of the phrase
+"pin configuration node".
+
+Following are properties which is needed if GPIO and pinmux functionality
+is required:
+    Required properties:
+    -------------------
+	- gpio-controller: Marks the device node as a GPIO controller.
+	- #gpio-cells: Number of GPIO cells. Refer to binding document
+			gpio/gpio.txt
+
+    Optional properties:
+    --------------------
+	Following properties are require if pin control setting is required
+	at boot.
+	- pinctrl-names: A pinctrl state named "default" be defined, using
+		the bindings in pinctrl/pinctrl-binding.txt.
+	- pinctrl[0...n]: Properties to contain the phandle that refer to
+		different nodes of pin control settings. These nodes
+		represents the pin control setting of state 0 to state n.
+		Each of these nodes contains different subnodes to
+		represents some desired configuration for a list of pins.
+		This configuration can include the mux function to select
+		on those pin(s), and various pin configuration parameters,
+		such as pull-up, open drain.
+
+		Each subnode 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:
+			function, drive-push-pull, drive-open-drain,
+			bias-pull-up, bias-pull-down.
+				Definitions are in the pinmux dt binding
+			devicetree/bindings/pinctrl/pinctrl-bindings.txt
+			Absence of properties will leave the configuration
+			on default.
+
+			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 property for the GPIO1,
+				GPIO2 and GPIO3.
+			- maxim,active-fps-source: FPS source for the gpios in
+				active state of the GPIO. Valid values are
+				FPS_SRC_0, FPS_SRC_1, FPS_SRC_2 and
+				FPS_SRC_NONE. Absence of this property will
+				leave the pin on default.
+			- maxim,active-fps-power-up-slot: Power up slot on
+				given FPS for acive state.Valid values are 0
+				to 7.
+			- maxim,active-fps-power-down-slot: Power down slot
+				on given FPS for active state. Valid values
+				are 0 t  7.
+			- maxim,suspend-fps-source: Suspend state FPS source.
+			- maxim,suspend-fps-power-down-slot: Suspend state
+				power down slot.
+			- maxim,suspend-fps-power-up-slot: Suspend state power
+				up slot.
+
+Regulators:
+===========
+Device has multiple DCDC(sd[0-3] and LDOs(ldo[0-8]). The node "regulators"
+is require if regulator functionality is needed.
+
+Following are properties of regulator subnode.
+
+    Optional properties:
+    -------------------
+	The input supply of regulators are the optional properties on the
+	regulator node. The input supply of these regulators are provided
+	through following properties:
+		in-sd0-supply: Input supply for SD0, INA-SD0 or INB-SD0 pins.
+		in-sd1-supply: Input supply for SD1.
+		in-sd2-supply: Input supply for SD2.
+		in-sd3-supply: Input supply for SD3.
+		in-ldo0-1-supply: Input supply for LDO0 and LDO1.
+		in-ldo2-supply: Input supply for LDO2.
+		in-ldo3-5-supply: Input supply for LDO3 and LDO5
+		in-ldo4-6-supply: Input supply for LDO4 and LDO6.
+		in-ldo7-8-supply: Input supply for LDO7 and LDO8.
+
+
+    Optional sub nodes for regulators:
+    ---------------------------------
+	The subnodes name is the name of regulator and it must be one of:
+	sd[0-3], ldo[0-8]
+
+	Each sub-node should contain the constraints and initialization
+	information for that regulator. See regulator.txt for a description
+	of standard properties for these sub-nodes.
+	Additional optional custom properties  are listed below.
+		maxim,active-fps-source: FPS source. The macros are defined at
+			dt-bindings/mfd/max77620.h
+		maxim,shutdown-fps-source: Same as maxim,fps-source, but it
+			will apply during shutdown of system.
+		maxim,active-fps-power-up-slot: Active state Power up slot for
+			rail on given FPS.
+		maxim,active-fps-power-down-slot: Active state Power down slot
+			for rail on given FPS.
+		maxim,suspend-fps-source: Suspend state FPS source of rail.
+		maxim,suspend-fps-power-up-slot: Suspend state FPS power
+			up slot.
+		maxim,suspend-fps-power-down-slot: Suspend state FPS power
+			down slot.
+		maxim,enable-group-low-power: Enable Group low power mode.
+		maxim,enable-sd0-en2-control: Enable EN2 pincontrol for SD0.
+			This property is only applicable for SD0.
+		maxim,disable-remote-sense-on-suspend: Boolean, disable
+			remote sense on suspend and re-enable on resume.
+			If this property is not there then no change on
+			configuration.
+
+Backup Battery:
+==============
+This sub-node configure charging backup battery of the device. Device
+has support of charging the backup battery. The subnode name is
+"backup-battery".
+
+The property for backup-battery child nodes as:
+Presense of this child node will enable the backup battery charging.
+
+Optinal properties:
+	-maxim,bb-charging-current-microamp: Charging current
+			setting.
+			The device supports 50/100/200/400/600/800uA.
+			If this property is unavailable then it will
+			charge with 50uA.
+	-maxim,bb-charging-voltage-microvolt: Charging Voltage Limit Setting.
+			Device supports 2500000/3000000/3300000/350000uV.
+			Default will be set to 2500mV. The voltage will be roundoff
+			to nearest lower side if other than above is configured.
+	-maxim,bb-output-resister-ohm: Output resistor on Ohm.
+			Device supports 100/1000/3000/6000 Ohms.
+
+Low-Battery Monitor:
+==================
+This sub-node configure low battery monitor configuration registers.
+Device has support for low-battery monitor configuration through
+child DT node "low-battery-monitor".
+
+Optinal properties:
+	- maxim,low-battery-dac: Tristate, enable/disable low battery DAC.
+			0 for disable,
+			1 for enable,
+			absence will left configuration to default.
+	- maxim,low-battery-shutdown: Tristate, enable/disable low battery
+		shutdown.
+			0 for disable,
+			1 for enable,
+			absence will left configuration to default.
+	- maxim,low-battery-reset: Tristate, enable/disable low battery reset.
+			0 for disable,
+			1 for enable,
+			absence will left configuration to default.
+
+Example:
+--------
+#include <dt-bindings/mfd/max77620.h>
+...
+max77620@3c {
+	compatible = "maxim,max77620";
+	reg = <0x3c>;
+
+	interrupt-parent = <&intc>;
+	interrupts = <0 86 IRQ_TYPE_NONE>;
+
+
+Example:
+--------
+#include <dt-bindings/mfd/max77620.h>
+...
+max77620@3c {
+	compatible = "maxim,max77620";
+	reg = <0x3c>;
+
+	interrupt-parent = <&intc>;
+	interrupts = <0 86 IRQ_TYPE_NONE>;
+
+	interrupt-controller;
+	#interrupt-cells = <2>;
+
+	gpio-controller;
+	#gpio-cells = <2>;
+
+	backup-battery {
+		maxim,bb-charging-current-microamp = <100>;
+		maxim,bb-charging-voltage-microvolt = <3000000>;
+		maxim,bb-output-resister-ohm = <100>;
+	};
+
+	fps {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		fps@0 {
+			reg = <0>;
+			maxim,fps-time-period-us = <1280>;
+			maxim,fps-enable-input = <FPS_EN_SRC_EN0>;
+		};
+
+		fps@1 {
+			reg = <1>;
+			maxim,fps-time-period-us = <2560>;
+			maxim,fps-enable-input = <FPS_EN_SRC_EN1>;
+		};
+
+		fps@2 {
+			reg = <2>;
+			maxim,fps-time-period-us = <640>;
+			maxim,fps-enable-input = <FPS_EN_SRC_SW>;
+		};
+	};
+
+	regulators {
+		in-ldo0-1-supply = <&max77620_sd2>;
+		in-ldo7-8-supply = <&max77620_sd2>;
+
+		max77620_sd0: sd0 {
+			regulator-name = "vdd-core";
+			regulator-min-microvolt = <600000>;
+			regulator-max-microvolt = <1400000>;
+			regulator-boot-on;
+			regulator-always-on;
+			maxim,fps-source = <FPS_SRC_1>;
+			regulator-init-mode = <REGULATOR_MODE_NORMAL>;
+		};
+
+		max77620_sd1: sd1 {
+			regulator-name = "vddio-ddr";
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			regulator-always-on;
+			regulator-boot-on;
+			regulator-init-mode = <REGULATOR_MODE_NORMAL>;
+			maxim,fps-source = <FPS_SRC_0>;
+		};
+
+		max77620_sd2: sd2 {
+			regulator-name = "vdd-pre-reg";
+			regulator-min-microvolt = <1350000>;
+			regulator-max-microvolt = <1350000>;
+			maxim,fps-source = <FPS_SRC_1>;
+		};
+
+		max77620_sd3: sd3 {
+			regulator-name = "vdd-1v8";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_0>;
+			regulator-init-mode = <REGULATOR_MODE_NORMAL>;
+		};
+
+		max77620_ldo0: ldo0 {
+			regulator-name = "avdd-sys";
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo1: ldo1 {
+			regulator-name = "vdd-pex";
+			regulator-min-microvolt = <1050000>;
+			regulator-max-microvolt = <1050000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo2: ldo2 {
+			regulator-name = "vddio-sdmmc3";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo3: ldo3 {
+			regulator-name = "vdd-cam-hv";
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo4: ldo4 {
+			regulator-name = "vdd-rtc";
+			regulator-min-microvolt = <1250000>;
+			regulator-max-microvolt = <1250000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_0>;
+		};
+
+		max77620_ldo5: ldo5 {
+			regulator-name = "avdd-ts-hv";
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3000000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo6: ldo6 {
+			regulator-name = "vdd-ts";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo7: ldo7 {
+			regulator-name = "vdd-gen-pll-edp";
+			regulator-min-microvolt = <1050000>;
+			regulator-max-microvolt = <1050000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_1>;
+		};
+
+		max77620_ldo8: ldo8 {
+			regulator-name = "vdd-hdmi-dp";
+			regulator-min-microvolt = <1050000>;
+			regulator-max-microvolt = <1050000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+	};
+};
include/dt-bindings/mfd/max77620.h new file +38 -0
new file mode 100644
index 0000000..8423d1d
@@ -0,0 +1,38 @@
+/*
+ * This header provides macros for MAXIM MAX77620 device bindings.
+ *
+ * Copyright (c) 2016, NVIDIA Corporation.
+ *
+ * Author: Laxman Dewangan <[email protected]>
+ *
+ */
+
+#ifndef _DT_BINDINGS_MFD_MAX77620_H
+#define _DT_BINDINGS_MFD_MAX77620_H
+
+/* MAX77620 interrupts */
+#define MAX77620_IRQ_TOP_GLBL		0 /* Low-Battery */
+#define MAX77620_IRQ_TOP_SD		1 /* SD power fail */
+#define MAX77620_IRQ_TOP_LDO		2 /* LDO power fail */
+#define MAX77620_IRQ_TOP_GPIO		3 /* GPIO internal int to MAX77620 */
+#define MAX77620_IRQ_TOP_RTC		4 /* RTC */
+#define MAX77620_IRQ_TOP_32K		5 /* 32kHz oscillator */
+#define MAX77620_IRQ_TOP_ONOFF		6 /* ON/OFF oscillator */
+#define MAX77620_IRQ_LBT_MBATLOW	7 /* Thermal alarm status, > 120C */
+#define MAX77620_IRQ_LBT_TJALRM1	8 /* Thermal alarm status, > 120C */
+#define MAX77620_IRQ_LBT_TJALRM2	9 /* Thermal alarm status, > 140C */
+
+/* FPS enable -inputs */
+#define FPS_EN_SRC_EN0	0
+#define FPS_EN_SRC_EN1	1
+#define FPS_EN_SRC_SW	2
+#define FPS_EN_SRC_RSVD	3
+
+/* FPS source */
+#define FPS_SRC_0	0
+#define FPS_SRC_1	1
+#define FPS_SRC_2	2
+#define FPS_SRC_NONE	3
+#define FPS_SRC_DEF	4
+
+#endif
Signature · 1 line
2.1.4
#7 lore raw

PATCH v4 2/5 mfd: max77620: add core driver for MAX77620/MAX20024

In reply to Laxman Dewangan

MAX77620/MAX20024 are Power Management IC from the MAXIM. It supports RTC, multiple GPIOs, multiple DCDC and LDOs, watchdog, clock etc.

Add MFD drier to provides common support for accessing the device; additional drivers is developed on respected subsystem in order to use the functionality of the device.

---
Changes from V1:
- Code cleanups per review from V1.
- Move register acccess APIs from header to c file.
- Remove some of non required variable, remove duplication in error message and simplify some of function implementation.
- Register RTC driver such that it can get the regmap handle form parent device

Changes from V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- Drop RTC driver and its i2c client registration.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

 drivers/mfd/Kconfig          |  15 +
 drivers/mfd/Makefile         |   1 +
 drivers/mfd/max77620.c       | 871 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/max77620.h | 404 ++++++++++++++++++++
 4 files changed, 1291 insertions(+)
 create mode 100644 drivers/mfd/max77620.c
 create mode 100644 include/linux/mfd/max77620.h
drivers/mfd/Kconfig +15 -0
index 9581ebb..edeb85c 100644
@@ -492,6 +492,21 @@ config MFD_MAX14577
 	  additional drivers must be enabled in order to use the functionality
 	  of the device.
 
+config MFD_MAX77620
+	bool "Maxim Semiconductor MAX77620 and MAX20024 PMIC Support"
+	depends on I2C=y
+	depends on OF
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	select IRQ_DOMAIN
+	help
+	  Say yes here to add support for Maxim Semiconductor MAX77620 and
+	  MAX20024 which are Power Management IC with General purpose pins,
+	  RTC, regulators, clock generator, watchdog etc. This driver
+	  provides common support for accessing the device; additional drivers
+	  must be enabled in order to use the functionality of the device.
+
 config MFD_MAX77686
 	bool "Maxim Semiconductor MAX77686/802 PMIC Support"
 	depends on I2C=y
drivers/mfd/Makefile +1 -0
index 0f230a6..97910ed 100644
@@ -123,6 +123,7 @@ obj-$(CONFIG_MFD_DA9063)	+= da9063.o
 obj-$(CONFIG_MFD_DA9150)	+= da9150-core.o
 
 obj-$(CONFIG_MFD_MAX14577)	+= max14577.o
+obj-$(CONFIG_MFD_MAX77620)	+= max77620.o
 obj-$(CONFIG_MFD_MAX77686)	+= max77686.o
 obj-$(CONFIG_MFD_MAX77693)	+= max77693.o
 obj-$(CONFIG_MFD_MAX77843)	+= max77843.o
drivers/mfd/max77620.c new file +871 -0

871 lines not on this page · raw message

include/linux/mfd/max77620.h new file +404 -0

404 lines not on this page · raw message

Signature · 1 line
2.1.4
#12 lore raw

PATCH v4 3/5 pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024

In reply to 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 pincontrol driver to configure these parameters through pincontrol APIs.

---
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.

 drivers/pinctrl/Kconfig            |  10 +
 drivers/pinctrl/Makefile           |   1 +
 drivers/pinctrl/pinctrl-max77620.c | 693 +++++++++++++++++++++++++++++++++++++
 3 files changed, 704 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-max77620.c
drivers/pinctrl/Kconfig +10 -0
index 99a4c10..b6d2d23 100644
@@ -227,6 +227,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
+	bool "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
index bf1b5ca..72833e3 100644
@@ -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_PISTACHIO)	+= pinctrl-pistachio.o
 obj-$(CONFIG_PINCTRL_ROCKCHIP)	+= pinctrl-rockchip.o
drivers/pinctrl/pinctrl-max77620.c new file +693 -0

693 lines not on this page · raw message

Signature · 1 line
2.1.4
#15 lore raw

PATCH v4 4/5 gpio: max77620: add gpio driver for MAX77620/MAX20024

In reply to 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.

---
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.

 drivers/gpio/Kconfig         |   9 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/gpio-max77620.c | 292 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 302 insertions(+)
 create mode 100644 drivers/gpio/gpio-max77620.c
drivers/gpio/Kconfig +9 -0
index f2b7160..b96a80c 100644
@@ -797,6 +797,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
+	bool "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
index ece7d7c..f676a2d 100644
@@ -57,6 +57,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_MC33880)	+= gpio-mc33880.o
 obj-$(CONFIG_GPIO_MC9S08DZ60)	+= gpio-mc9s08dz60.o
drivers/gpio/gpio-max77620.c new file +292 -0

292 lines not on this page · raw message

Signature · 1 line
2.1.4
#17 lore raw

PATCH v4 5/5 regulator: max77620: add regulator driver for max77620/max20024

In reply to Laxman Dewangan

MAXIM Semiconductor's PMIC, MAX77620 and MAX20024 have the multiple DCDC and LDOs. This supplies the power to different components of the system.
Also these rails has configuration for ramp time, flexible power sequence, slew rate etc.

Add regulator driver to access these rails via regulator APIs.

---
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.
- Refactor Regulator driver to use core API for DT parsing.
- Update based on API changes.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

 drivers/regulator/Kconfig              |   9 +
 drivers/regulator/Makefile             |   1 +
 drivers/regulator/max77620-regulator.c | 883 +++++++++++++++++++++++++++++++++
 3 files changed, 893 insertions(+)
 create mode 100644 drivers/regulator/max77620-regulator.c
drivers/regulator/Kconfig +9 -0
index 8155e80..b92214b 100644
@@ -343,6 +343,15 @@ config REGULATOR_MAX1586
 	  regulator via I2C bus. The provided regulator is suitable
 	  for PXA27x chips to control VCC_CORE and VCC_USIM voltages.
 
+config REGULATOR_MAX77620
+	tristate "Maxim 77620/MAX20024 voltage regulator"
+	depends on MFD_MAX77620
+	help
+	  This driver controls Maxim MAX77620 voltage output regulator
+	  via I2C bus. The provided regulator is suitable for Tegra
+	  chip to control Step-Down DC-DC and LDOs. Say Y here to
+	  enable the regulator driver.
+
 config REGULATOR_MAX8649
 	tristate "Maxim 8649 voltage regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index 980b194..2564c00 100644
@@ -46,6 +46,7 @@ obj-$(CONFIG_REGULATOR_LP8755) += lp8755.o
 obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o
 obj-$(CONFIG_REGULATOR_MAX14577) += max14577.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
+obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o
 obj-$(CONFIG_REGULATOR_MAX8649)	+= max8649.o
 obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
 obj-$(CONFIG_REGULATOR_MAX8907) += max8907-regulator.o
drivers/regulator/max77620-regulator.c new file +883 -0

883 lines not on this page · raw message

Signature · 1 line
2.1.4
Reviewed-by on v4 2/5
#8 lore raw

Re: [PATCH V4 2/5] mfd: max77620: add core driver for MAX77620/MAX20024

In reply to Laxman Dewangan
Quoted 27 lines · Laxman Dewangan

MAX77620/MAX20024 are Power Management IC from the MAXIM. It supports RTC, multiple GPIOs, multiple DCDC and LDOs, watchdog, clock etc.

Add MFD drier to provides common support for accessing the device; additional drivers is developed on respected subsystem in order to use the functionality of the device.

---
Changes from V1:
- Code cleanups per review from V1.
- Move register acccess APIs from header to c file.
- Remove some of non required variable, remove duplication in error message and simplify some of function implementation.
- Register RTC driver such that it can get the regmap handle form parent device

Changes from V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- Drop RTC driver and its i2c client registration.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

Quoted 8 lines
 drivers/mfd/Kconfig          |  15 +
 drivers/mfd/Makefile         |   1 +
 drivers/mfd/max77620.c       | 871 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/max77620.h | 404 ++++++++++++++++++++
 4 files changed, 1291 insertions(+)
 create mode 100644 drivers/mfd/max77620.c
 create mode 100644 include/linux/mfd/max77620.h

Best regards,
Krzysztof

Reviewed-by on v4 5/5
#18 lore raw

Re: [PATCH V4 5/5] regulator: max77620: add regulator driver for max77620/max20024

In reply to Laxman Dewangan
Quoted 24 lines · Laxman Dewangan

MAXIM Semiconductor's PMIC, MAX77620 and MAX20024 have the multiple DCDC and LDOs. This supplies the power to different components of the system.
Also these rails has configuration for ramp time, flexible power sequence, slew rate etc.

Add regulator driver to access these rails via regulator APIs.

---
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.
- Refactor Regulator driver to use core API for DT parsing.
- Update based on API changes.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

Quoted 5 lines
 drivers/regulator/Kconfig              |   9 +
 drivers/regulator/Makefile             |   1 +
 drivers/regulator/max77620-regulator.c | 883 +++++++++++++++++++++++++++++++++
 3 files changed, 893 insertions(+)
 create mode 100644 drivers/regulator/max77620-regulator.c

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH V4 2/5] mfd: max77620: add core driver for MAX77620/MAX20024

In reply to Krzysztof Kozlowski

Thanks Krzysztof for review.

Hi Lee,
Are you taking the patches from your tree? Or will go in individual subsystem?

Thanks,
Laxman

Quoted 42 lines · Krzysztof Kozlowski
Quoted 27 lines · Laxman Dewangan

MAX77620/MAX20024 are Power Management IC from the MAXIM. It supports RTC, multiple GPIOs, multiple DCDC and LDOs, watchdog, clock etc.

Add MFD drier to provides common support for accessing the device; additional drivers is developed on respected subsystem in order to use the functionality of the device.

---
Changes from V1:
- Code cleanups per review from V1.
- Move register acccess APIs from header to c file.
- Remove some of non required variable, remove duplication in error message and simplify some of function implementation.
- Register RTC driver such that it can get the regmap handle form parent device

Changes from V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- Drop RTC driver and its i2c client registration.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

Quoted 8 lines
  drivers/mfd/Kconfig          |  15 +
  drivers/mfd/Makefile         |   1 +
  drivers/mfd/max77620.c       | 871 +++++++++++++++++++++++++++++++++++++++++++
  include/linux/mfd/max77620.h | 404 ++++++++++++++++++++
  4 files changed, 1291 insertions(+)

create mode 100644 drivers/mfd/max77620.c
create mode 100644 include/linux/mfd/max77620.h

Best regards,
Krzysztof

#11 lore raw

Re: [PATCH V4 2/5] mfd: max77620: add core driver for MAX77620/MAX20024

In reply to Lee Jones
Quoted 11 lines · Lee Jones
Quoted 5 lines · Laxman Dewangan

Thanks Krzysztof for review.

Hi Lee,
Are you taking the patches from your tree? Or will go in individual subsystem?

I can take the set if there are build dependencies. If there aren't, then they should be routed via their respective subsystem trees.

All drivers include the header of max77620 which is part of mfd patch. Hence it has build dependency. However, config of sub module will only be enabled if MFD config enabled.

#10 lore raw

Re: [PATCH V4 2/5] mfd: max77620: add core driver for MAX77620/MAX20024

In reply to Laxman Dewangan
Quoted 5 lines · Laxman Dewangan

Thanks Krzysztof for review.

Hi Lee,
Are you taking the patches from your tree? Or will go in individual subsystem?

I can take the set if there are build dependencies. If there aren't, then they should be routed via their respective subsystem trees.

Quoted 44 lines · Krzysztof Kozlowski
Quoted 42 lines · Laxman Dewangan
Quoted 27 lines

MAX77620/MAX20024 are Power Management IC from the MAXIM. It supports RTC, multiple GPIOs, multiple DCDC and LDOs, watchdog, clock etc.

Add MFD drier to provides common support for accessing the device; additional drivers is developed on respected subsystem in order to use the functionality of the device.

---
Changes from V1:
- Code cleanups per review from V1.
- Move register acccess APIs from header to c file.
- Remove some of non required variable, remove duplication in error message and simplify some of function implementation.
- Register RTC driver such that it can get the regmap handle form parent device

Changes from V2:
- Run coccicheck and checkpatch in strict mode for the alignment.
- Drop RTC driver and its i2c client registration.

Changes from V3:
- Change all sys initcall to module driver.
- change the max77620_read argument to unisgned int from u8.

Quoted 8 lines
 drivers/mfd/Kconfig          |  15 +
 drivers/mfd/Makefile         |   1 +
 drivers/mfd/max77620.c       | 871 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/max77620.h | 404 ++++++++++++++++++++
 4 files changed, 1291 insertions(+)
 create mode 100644 drivers/mfd/max77620.c
 create mode 100644 include/linux/mfd/max77620.h

Best regards,
Krzysztof

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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
#2 lore raw

Re: [PATCH V4 1/5] DT: mfd: add device-tree binding doc fro PMIC max77620/max20024

In reply to Laxman Dewangan
Quoted 35 lines · Laxman Dewangan

The MAXIM PMIC MAX77620 and MAX20024 are power management IC which supports RTC, GPIO, DCDC/LDO regulators, interrupt, watchdog etc.

Add DT binding document for the different functionality of this device.

---
Changes from V1:
- Added units in some of properties.
- Change the boolean property to tristate type and detail some of properties.

Change from V2:
- added unit in period related dt property.

Change from V3: None
Added Rob's ack.

 Documentation/devicetree/bindings/mfd/max77620.txt | 397 +++++++++++++++++++++
 include/dt-bindings/mfd/max77620.h                 |  38 ++
 2 files changed, 435 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/max77620.txt
 create mode 100644 include/dt-bindings/mfd/max77620.h
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
new file mode 100644
index 0000000..46f6aac
@@ -0,0 +1,397 @@
+* MAX77620 Power management IC from Maxim Semiconductor.

Documentation/devicetree/bindings/mfd/max77620.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +10 -0
+
+Required properties:
+-------------------
+- compatible: Must be one of
+		"maxim,max77620" or
+		"maxim,max20024".
+- reg: I2C device address.
+- interrupt-controller: MAX77620 has internal interrupt controller which
+  takes the interrupt request from internal sub-blocks like RTC,
+  regulators, GPIOs as well as external input.

This is how interrupt-controllers usually work. I don't think there is any need to explain this. I'd just link to ../interrupt-controller/interrupts.txt instead.

Documentation/devicetree/bindings/mfd/max77620.txt line 16

Quoted 5 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +5 -0
+- #interrupt-cells: Should be set to 2 for IRQ number and flags.
+  The first cell is the IRQ number. IRQ numbers for different interrupt
+  source of MAX77620 are defined at dt-bindings/mfd/max77620.h
+  The second cell is the flags, encoded as the trigger masks from binding
+  document interrupts.txt, using dt-bindings/irq.

This is a very lengthy read for such little information. Please make it more succinct. Take a look at other files for examples. Also, tell use where interrupts.txt is
i.e. ../interrupt-controller/interrupts.txt.

These are so much easier to read if you tab out from the property name to the description.

- reg: I2C device address.
- interrupt-controller: MAX77620 has internal interrupt controller which
takes the interrupt request from internal sub-blocks like RTC, regulators, GPIOs as well as external input.
- #interrupt-cells: Should be set to 2 for IRQ number and flags.
The first cell is the IRQ number. IRQ numbers for different interrupt source of MAX77620 are defined at dt-bindings/mfd/max77620.h The second cell is the flags, encoded as the trigger masks from binding document interrupts.txt, using dt-bindings/irq.

... don't you think?

Documentation/devicetree/bindings/mfd/max77620.txt line 20

Quoted 3 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +3 -0
+Optional properties:
+-------------------
+This device also supports the power OFF of system.

What is the "power OFF of system"?

Documentation/devicetree/bindings/mfd/max77620.txt line 22

Quoted 2 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +2 -0
+Following properties are used for this purpose:
+- system-power-controller: Boolean, This device will be use as

You don't describe the type of each property, so why is this one special?

s/use/used/

Documentation/devicetree/bindings/mfd/max77620.txt line 23

Quoted 1 line
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
+	system power controller and used for power OFF of system.

Again, what is the "power OFF of system". Find another example of other people describing this well and copy/paste.

Documentation/devicetree/bindings/mfd/max77620.txt line 24

Quoted 1 line
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
+	Host issue necessary command to PMIC.

s/issue/issues/

Documentation/devicetree/bindings/mfd/max77620.txt line 28

Quoted 2 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +2 -0
+Optional submodule and their properties:
+=======================================

s/submodule/sub-modules/ ... or sub-modes even.

Documentation/devicetree/bindings/mfd/max77620.txt line 32

Quoted 3 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +3 -0
+Flexible power sequence configuration
+====================================
+This sub-node configures the Flexible Power Sequnece(FPS) for power ON slot,

s/Sequnece(FPS)/Sequnece (FPS)/

Documentation/devicetree/bindings/mfd/max77620.txt line 40

Quoted 8 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +8 -0
+power OFF slot and slot period of the device. Device has 3 FPS as FPS0,
+FPS1 and FPS2. The details of FPS configuration is provided through
+subnode "fps". The details of FPS0, FPS1, FPS2 are provided through the
+child node under this subnodes. The FPS number is provided via reg property.
+
+The property for fps child nodes as:
+Required properties:
+	-reg: FPS number like 0, 1, 2 for FPS0, FPS1 and FPS2 respectively.

I'm surprised Rob Acked this. We don't usually do device numbers in DT.

Documentation/devicetree/bindings/mfd/max77620.txt line 37

Quoted 1 line
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
+Optinal properties:

Spelling.

Documentation/devicetree/bindings/mfd/max77620.txt line 53

Quoted 12 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +12 -0
+	-maxim,active-fps-time-period-us: Active state FPS time period in
+		microseconds.
+	-maxim,suspend-fps-time-period-us: Suspend state FPS time period in
+		microseconds.
+	-maxim,fps-enable-input: FPS enable source like EN0, EN1 or SW. The
+			macros are defined on dt-bindings/mfd/max77620.h for
+			different enable source.
+				FPS_EN_SRC_EN0 for EN0 enable source.
+				FPS_EN_SRC_EN1 for En1 enable source.
+				FPS_EN_SRC_SW for SW based control.
+	-maxim,fps-sw-enable: Boolean, applicable if enable input is SW.
+			If this property present then enable the FPS else

"property is present"

If this enables/disables FPS, why does it matter if it's SW or not? Why can't you just cal it maxim,fps-enable? Also, is there a case where you would supply this sub-node, have FPS enabled and this property not present? If not, can't you just remove the entire node? Or am I missing something?

Documentation/devicetree/bindings/mfd/max77620.txt line 57

Quoted 4 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +4 -0
+			disable FPS.
+	-maxim,enable-sleep: Boolean, enable sleep when the external control
+			goes from HIGH to LOW.
+	-maxim,enable-global-lpm: Boolean, enable global LPM when the external

LPM?

Documentation/devicetree/bindings/mfd/max77620.txt line 58

Quoted 1 line
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
+			control goes from HIGH to LOW.

Please format these as I suggested above.

Documentation/devicetree/bindings/mfd/max77620.txt line 65

Quoted 6 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +6 -0
+Here supported time periods by device in microseconds are as follows:
+MAX77620 supports 40, 80, 160, 320, 640, 1280, 2560 and 5120 microseconds.
+MAX20024 supports 20, 40, 80, 160, 320, 640, 1280 and 2540 microseconds.
+
+Pinmux and GPIO:
+===============

I think this whole section needs moving to ../pinctrl and needs to be reviewed by Linus W.

Quoted 58 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +58 -0
+Device has 8 GPIO pins which can be configured as GPIO as well as the
+special IO functions.
+
+Please refer to pinctrl-bindings.txt for details of the common pinctrl
+bindings used by client devices, including the meaning of the phrase
+"pin configuration node".
+
+Following are properties which is needed if GPIO and pinmux functionality
+is required:
+    Required properties:
+    -------------------
+	- gpio-controller: Marks the device node as a GPIO controller.
+	- #gpio-cells: Number of GPIO cells. Refer to binding document
+			gpio/gpio.txt
+
+    Optional properties:
+    --------------------
+	Following properties are require if pin control setting is required
+	at boot.
+	- pinctrl-names: A pinctrl state named "default" be defined, using
+		the bindings in pinctrl/pinctrl-binding.txt.
+	- pinctrl[0...n]: Properties to contain the phandle that refer to
+		different nodes of pin control settings. These nodes
+		represents the pin control setting of state 0 to state n.
+		Each of these nodes contains different subnodes to
+		represents some desired configuration for a list of pins.
+		This configuration can include the mux function to select
+		on those pin(s), and various pin configuration parameters,
+		such as pull-up, open drain.
+
+		Each subnode 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:
+			function, drive-push-pull, drive-open-drain,
+			bias-pull-up, bias-pull-down.
+				Definitions are in the pinmux dt binding
+			devicetree/bindings/pinctrl/pinctrl-bindings.txt
+			Absence of properties will leave the configuration
+			on default.
+
+			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 property for the GPIO1,
+				GPIO2 and GPIO3.
+			- maxim,active-fps-source: FPS source for the gpios in
+				active state of the GPIO. Valid values are
+				FPS_SRC_0, FPS_SRC_1, FPS_SRC_2 and
+				FPS_SRC_NONE. Absence of this property will
+				leave the pin on default.
+			- maxim,active-fps-power-up-slot: Power up slot on
+				given FPS for acive state.Valid values are 0
+				to 7.
+			- maxim,active-fps-power-down-slot: Power down slot

Documentation/devicetree/bindings/mfd/max77620.txt line 133

Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +10 -0
+				on given FPS for active state. Valid values
+				are 0 t  7.
+			- maxim,suspend-fps-source: Suspend state FPS source.
+			- maxim,suspend-fps-power-down-slot: Suspend state
+				power down slot.
+			- maxim,suspend-fps-power-up-slot: Suspend state power
+				up slot.
+
+Regulators:
+===========

I think this whole section needs moving to ../regulator and needs to be reviewed by Mark B.

Quoted 43 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +43 -0
+Device has multiple DCDC(sd[0-3] and LDOs(ldo[0-8]). The node "regulators"
+is require if regulator functionality is needed.
+
+Following are properties of regulator subnode.
+
+    Optional properties:
+    -------------------
+	The input supply of regulators are the optional properties on the
+	regulator node. The input supply of these regulators are provided
+	through following properties:
+		in-sd0-supply: Input supply for SD0, INA-SD0 or INB-SD0 pins.
+		in-sd1-supply: Input supply for SD1.
+		in-sd2-supply: Input supply for SD2.
+		in-sd3-supply: Input supply for SD3.
+		in-ldo0-1-supply: Input supply for LDO0 and LDO1.
+		in-ldo2-supply: Input supply for LDO2.
+		in-ldo3-5-supply: Input supply for LDO3 and LDO5
+		in-ldo4-6-supply: Input supply for LDO4 and LDO6.
+		in-ldo7-8-supply: Input supply for LDO7 and LDO8.
+
+
+    Optional sub nodes for regulators:
+    ---------------------------------
+	The subnodes name is the name of regulator and it must be one of:
+	sd[0-3], ldo[0-8]
+
+	Each sub-node should contain the constraints and initialization
+	information for that regulator. See regulator.txt for a description
+	of standard properties for these sub-nodes.
+	Additional optional custom properties  are listed below.
+		maxim,active-fps-source: FPS source. The macros are defined at
+			dt-bindings/mfd/max77620.h
+		maxim,shutdown-fps-source: Same as maxim,fps-source, but it
+			will apply during shutdown of system.
+		maxim,active-fps-power-up-slot: Active state Power up slot for
+			rail on given FPS.
+		maxim,active-fps-power-down-slot: Active state Power down slot
+			for rail on given FPS.
+		maxim,suspend-fps-source: Suspend state FPS source of rail.
+		maxim,suspend-fps-power-up-slot: Suspend state FPS power
+			up slot.
+		maxim,suspend-fps-power-down-slot: Suspend state FPS power
+			down slot.

Documentation/devicetree/bindings/mfd/max77620.txt line 186

Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +10 -0
+		maxim,enable-group-low-power: Enable Group low power mode.
+		maxim,enable-sd0-en2-control: Enable EN2 pincontrol for SD0.
+			This property is only applicable for SD0.
+		maxim,disable-remote-sense-on-suspend: Boolean, disable
+			remote sense on suspend and re-enable on resume.
+			If this property is not there then no change on
+			configuration.
+
+Backup Battery:
+==============

I think this whole section needs moving to ../power and needs to be reviewed by Sebastian R.

Quoted 12 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +12 -0
+This sub-node configure charging backup battery of the device. Device
+has support of charging the backup battery. The subnode name is
+"backup-battery".
+
+The property for backup-battery child nodes as:
+Presense of this child node will enable the backup battery charging.
+
+Optinal properties:
+	-maxim,bb-charging-current-microamp: Charging current
+			setting.
+			The device supports 50/100/200/400/600/800uA.
+			If this property is unavailable then it will

Documentation/devicetree/bindings/mfd/max77620.txt line 208

Quoted 10 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +10 -0
+			charge with 50uA.
+	-maxim,bb-charging-voltage-microvolt: Charging Voltage Limit Setting.
+			Device supports 2500000/3000000/3300000/350000uV.
+			Default will be set to 2500mV. The voltage will be roundoff
+			to nearest lower side if other than above is configured.
+	-maxim,bb-output-resister-ohm: Output resistor on Ohm.
+			Device supports 100/1000/3000/6000 Ohms.
+
+Low-Battery Monitor:
+==================

As above.

Quoted 195 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +189 -0
+This sub-node configure low battery monitor configuration registers.
+Device has support for low-battery monitor configuration through
+child DT node "low-battery-monitor".
+
+Optinal properties:
+	- maxim,low-battery-dac: Tristate, enable/disable low battery DAC.
+			0 for disable,
+			1 for enable,
+			absence will left configuration to default.
+	- maxim,low-battery-shutdown: Tristate, enable/disable low battery
+		shutdown.
+			0 for disable,
+			1 for enable,
+			absence will left configuration to default.
+	- maxim,low-battery-reset: Tristate, enable/disable low battery reset.
+			0 for disable,
+			1 for enable,
+			absence will left configuration to default.
+
+Example:
+--------
+#include <dt-bindings/mfd/max77620.h>
+...
+max77620@3c {
+	compatible = "maxim,max77620";
+	reg = <0x3c>;
+
+	interrupt-parent = <&intc>;
+	interrupts = <0 86 IRQ_TYPE_NONE>;
+
+
+Example:
+--------
+#include <dt-bindings/mfd/max77620.h>
+...
+max77620@3c {
+	compatible = "maxim,max77620";
+	reg = <0x3c>;
+
+	interrupt-parent = <&intc>;
+	interrupts = <0 86 IRQ_TYPE_NONE>;
+
+	interrupt-controller;
+	#interrupt-cells = <2>;
+
+	gpio-controller;
+	#gpio-cells = <2>;
+
+	backup-battery {
+		maxim,bb-charging-current-microamp = <100>;
+		maxim,bb-charging-voltage-microvolt = <3000000>;
+		maxim,bb-output-resister-ohm = <100>;
+	};
+
+	fps {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		fps@0 {
+			reg = <0>;
+			maxim,fps-time-period-us = <1280>;
+			maxim,fps-enable-input = <FPS_EN_SRC_EN0>;
+		};
+
+		fps@1 {
+			reg = <1>;
+			maxim,fps-time-period-us = <2560>;
+			maxim,fps-enable-input = <FPS_EN_SRC_EN1>;
+		};
+
+		fps@2 {
+			reg = <2>;
+			maxim,fps-time-period-us = <640>;
+			maxim,fps-enable-input = <FPS_EN_SRC_SW>;
+		};
+	};
+
+	regulators {
+		in-ldo0-1-supply = <&max77620_sd2>;
+		in-ldo7-8-supply = <&max77620_sd2>;
+
+		max77620_sd0: sd0 {
+			regulator-name = "vdd-core";
+			regulator-min-microvolt = <600000>;
+			regulator-max-microvolt = <1400000>;
+			regulator-boot-on;
+			regulator-always-on;
+			maxim,fps-source = <FPS_SRC_1>;
+			regulator-init-mode = <REGULATOR_MODE_NORMAL>;
+		};
+
+		max77620_sd1: sd1 {
+			regulator-name = "vddio-ddr";
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			regulator-always-on;
+			regulator-boot-on;
+			regulator-init-mode = <REGULATOR_MODE_NORMAL>;
+			maxim,fps-source = <FPS_SRC_0>;
+		};
+
+		max77620_sd2: sd2 {
+			regulator-name = "vdd-pre-reg";
+			regulator-min-microvolt = <1350000>;
+			regulator-max-microvolt = <1350000>;
+			maxim,fps-source = <FPS_SRC_1>;
+		};
+
+		max77620_sd3: sd3 {
+			regulator-name = "vdd-1v8";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_0>;
+			regulator-init-mode = <REGULATOR_MODE_NORMAL>;
+		};
+
+		max77620_ldo0: ldo0 {
+			regulator-name = "avdd-sys";
+			regulator-min-microvolt = <1200000>;
+			regulator-max-microvolt = <1200000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo1: ldo1 {
+			regulator-name = "vdd-pex";
+			regulator-min-microvolt = <1050000>;
+			regulator-max-microvolt = <1050000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo2: ldo2 {
+			regulator-name = "vddio-sdmmc3";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <3300000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo3: ldo3 {
+			regulator-name = "vdd-cam-hv";
+			regulator-min-microvolt = <2800000>;
+			regulator-max-microvolt = <2800000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo4: ldo4 {
+			regulator-name = "vdd-rtc";
+			regulator-min-microvolt = <1250000>;
+			regulator-max-microvolt = <1250000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_0>;
+		};
+
+		max77620_ldo5: ldo5 {
+			regulator-name = "avdd-ts-hv";
+			regulator-min-microvolt = <3000000>;
+			regulator-max-microvolt = <3000000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo6: ldo6 {
+			regulator-name = "vdd-ts";
+			regulator-min-microvolt = <1800000>;
+			regulator-max-microvolt = <1800000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+
+		max77620_ldo7: ldo7 {
+			regulator-name = "vdd-gen-pll-edp";
+			regulator-min-microvolt = <1050000>;
+			regulator-max-microvolt = <1050000>;
+			regulator-always-on;
+			regulator-boot-on;
+			maxim,fps-source = <FPS_SRC_1>;
+		};
+
+		max77620_ldo8: ldo8 {
+			regulator-name = "vdd-hdmi-dp";
+			regulator-min-microvolt = <1050000>;
+			regulator-max-microvolt = <1050000>;
+			maxim,fps-source = <FPS_SRC_NONE>;
+		};
+	};
+};
include/dt-bindings/mfd/max77620.h new file +0 -0
new file mode 100644
index 0000000..8423d1d

include/dt-bindings/mfd/max77620.h line 7

Quoted 7 lines
include/dt-bindings/mfd/max77620.h new file +7 -0
@@ -0,0 +1,38 @@
+/*
+ * This header provides macros for MAXIM MAX77620 device bindings.
+ *
+ * Copyright (c) 2016, NVIDIA Corporation.
+ *
+ * Author: Laxman Dewangan <[email protected]>
+ *

Remove this line.

Quoted 31 lines
include/dt-bindings/mfd/max77620.h new file +30 -0
+ */
+
+#ifndef _DT_BINDINGS_MFD_MAX77620_H
+#define _DT_BINDINGS_MFD_MAX77620_H
+
+/* MAX77620 interrupts */
+#define MAX77620_IRQ_TOP_GLBL		0 /* Low-Battery */
+#define MAX77620_IRQ_TOP_SD		1 /* SD power fail */
+#define MAX77620_IRQ_TOP_LDO		2 /* LDO power fail */
+#define MAX77620_IRQ_TOP_GPIO		3 /* GPIO internal int to MAX77620 */
+#define MAX77620_IRQ_TOP_RTC		4 /* RTC */
+#define MAX77620_IRQ_TOP_32K		5 /* 32kHz oscillator */
+#define MAX77620_IRQ_TOP_ONOFF		6 /* ON/OFF oscillator */
+#define MAX77620_IRQ_LBT_MBATLOW	7 /* Thermal alarm status, > 120C */
+#define MAX77620_IRQ_LBT_TJALRM1	8 /* Thermal alarm status, > 120C */
+#define MAX77620_IRQ_LBT_TJALRM2	9 /* Thermal alarm status, > 140C */
 
+/* FPS enable -inputs */
+#define FPS_EN_SRC_EN0	0
+#define FPS_EN_SRC_EN1	1
+#define FPS_EN_SRC_SW	2
+#define FPS_EN_SRC_RSVD	3
+
+/* FPS source */
+#define FPS_SRC_0	0
+#define FPS_SRC_1	1
+#define FPS_SRC_2	2
+#define FPS_SRC_NONE	3
+#define FPS_SRC_DEF	4
+
+#endif
Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Re: [PATCH V4 1/5] DT: mfd: add device-tree binding doc fro PMIC max77620/max20024

Thanks Lee for your review. I will take care of most of comment on my next patch.

I have reply on some comment and seeking more details for few comments as follows.

Quoted 8 lines · Lee Jones

Documentation/devicetree/bindings/mfd/max77620.txt line 11

Quoted 3 lines · Laxman Dewangan

+- interrupt-controller: MAX77620 has internal interrupt controller which

Documentation/devicetree/bindings/mfd/max77620.txt new file +2 -0
+  takes the interrupt request from internal sub-blocks like RTC,
+  regulators, GPIOs as well as external input.

This is how interrupt-controllers usually work. I don't think there is any need to explain this. I'd just link to ../interrupt-controller/interrupts.txt instead.

Something similar to (just to confirm)
- interrupt-controller: describes the 88pm860x as an interrupt controller (has its own domain)

Quoted 8 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 16

Quoted 6 lines

+- #interrupt-cells: Should be set to 2 for IRQ number and flags.

Documentation/devicetree/bindings/mfd/max77620.txt new file +4 -0
+  The first cell is the IRQ number. IRQ numbers for different interrupt
+  source of MAX77620 are defined at dt-bindings/mfd/max77620.h
+  The second cell is the flags, encoded as the trigger masks from binding
+  document interrupts.txt, using dt-bindings/irq.

This is a very lengthy read for such little information. Please make it more succinct. Take a look at other files for examples.

I started with as3722.txt and it seems I am carrying forward the complexity here. Originally, as3722 is posted by me only. Any good file example which I can refer?

Quoted 20 lines

Also,
tell use where interrupts.txt is
i.e. ../interrupt-controller/interrupts.txt.

These are so much easier to read if you tab out from the property name to the description.

- reg: I2C device address.
- interrupt-controller: MAX77620 has internal interrupt controller which
takes the interrupt request from internal sub-blocks like RTC, regulators, GPIOs as well as external input.
- #interrupt-cells: Should be set to 2 for IRQ number and flags.
The first cell is the IRQ number. IRQ numbers for different interrupt source of MAX77620 are defined at dt-bindings/mfd/max77620.h The second cell is the flags, encoded as the trigger masks from binding document interrupts.txt, using dt-bindings/irq.

Quoted 1 line

... don't you think?

Agree, I can make indenting. And will do whatever places it needs in this document.

Quoted 5 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +3 -0
+Optional properties:
+-------------------
+This device also supports the power OFF of system.

What is the "power OFF of system"?

PMIC supplies the power. So once PMIC is in OFF state, it turns off all its rail and hence no SW execution on system. Still external supply will keep supply to PMIC.

Quoted 5 lines
Quoted 3 lines

+Following properties are used for this purpose:
+- system-power-controller: Boolean, This device will be use as

You don't describe the type of each property, so why is this one special?

Hmm. I describe the boolean and tristate only. Do I need to define type for integer,string also?

Quoted 9 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 40

Quoted 8 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +8 -0
+power OFF slot and slot period of the device. Device has 3 FPS as FPS0,
+FPS1 and FPS2. The details of FPS configuration is provided through
+subnode "fps". The details of FPS0, FPS1, FPS2 are provided through the
+child node under this subnodes. The FPS number is provided via reg property.
+
+The property for fps child nodes as:
+Required properties:
+	-reg: FPS number like 0, 1, 2 for FPS0, FPS1 and FPS2 respectively.

I'm surprised Rob Acked this. We don't usually do device numbers in DT.

What is best way to make the child node for FPS and differentiate FPS0,1, 2? What is your suggestion here?

Quoted 14 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 53

Quoted 12 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +12 -0
+	-maxim,active-fps-time-period-us: Active state FPS time period in
+		microseconds.
+	-maxim,suspend-fps-time-period-us: Suspend state FPS time period in
+		microseconds.
+	-maxim,fps-enable-input: FPS enable source like EN0, EN1 or SW. The
+			macros are defined on dt-bindings/mfd/max77620.h for
+			different enable source.
+				FPS_EN_SRC_EN0 for EN0 enable source.
+				FPS_EN_SRC_EN1 for En1 enable source.
+				FPS_EN_SRC_SW for SW based control.
+	-maxim,fps-sw-enable: Boolean, applicable if enable input is SW.
+			If this property present then enable the FPS else

"property is present"

Quoted 5 lines

If this enables/disables FPS, why does it matter if it's SW or not? Why can't you just cal it maxim,fps-enable? Also, is there a case where you would supply this sub-node, have FPS enabled and this property not present? If not, can't you just remove the entire node? Or am I missing something?

Here, my need is to connect different FPS source inputs EN0, EN1 or SW. They can connected to any inputs. That's why fps-enable-input select the related digital input for given FPS. However, I can reduce the need of "fps-sw-enable" and make this always enable if fps-enable-input= <SW>.

Here is excerpt from datasheet:
B3:B1: SRCFPSx[1:0]
Enable Source. Specifies the enable source for the sequencer.
0b00=EN0 hardware input
0b01=EN1 hardware input
0b10=ENFPSx software bit
0b11=reserved
B0 ENFPSx

    Software Enable
    0=Disable FPSx
    1=Enable FPSx
    X=ENFPSx is a don’t care if SRCFPSx[1:0] != 0b10
Quoted 3 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 57

Quoted 2 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
+	-maxim,enable-global-lpm: Boolean, enable global LPM when the external

LPM?

Low Power Mode (LPM). I will add details.

Quoted 4 lines

+Pinmux and GPIO:
+===============
I think this whole section needs moving to ../pinctrl and needs to be reviewed by Linus W.

Is this mean I need to create DT binding doc for the each subsystem differently? Actually during AS3722, I had different understanding to have single file.

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH V4 1/5] DT: mfd: add device-tree binding doc fro PMIC max77620/max20024

Quoted 13 lines · Laxman Dewangan

Thanks Lee for your review. I will take care of most of comment on my next patch.

I have reply on some comment and seeking more details for few comments as follows.

Quoted 5 lines · Lee Jones
Quoted 3 lines · Laxman Dewangan

+- interrupt-controller: MAX77620 has internal interrupt controller which

Documentation/devicetree/bindings/mfd/max77620.txt new file +2 -0
+  takes the interrupt request from internal sub-blocks like RTC,
+  regulators, GPIOs as well as external input.
Quoted 7 lines
Quoted 3 lines

This is how interrupt-controllers usually work. I don't think there is any need to explain this. I'd just link to ../interrupt-controller/interrupts.txt instead.

Something similar to (just to confirm)
- interrupt-controller: describes the 88pm860x as an interrupt controller (has its own domain)

IRQ domains are Linuxisums, which aren't allowed in DT.

I'd prefer something along the lines of:

"Identifies the node as an interrupt controller."

Quoted 10 lines
Quoted 7 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 16

Quoted 5 lines

+- #interrupt-cells: Should be set to 2 for IRQ number and flags.

Documentation/devicetree/bindings/mfd/max77620.txt new file +4 -0
+  The first cell is the IRQ number. IRQ numbers for different interrupt
+  source of MAX77620 are defined at dt-bindings/mfd/max77620.h
+  The second cell is the flags, encoded as the trigger masks from binding
+  document interrupts.txt, using dt-bindings/irq.

This is a very lengthy read for such little information. Please make it more succinct. Take a look at other files for examples.

I started with as3722.txt and it seems I am carrying forward the complexity here. Originally, as3722 is posted by me only. Any good file example which I can refer?

Just grep for #interrupt-cells in Documentation. There are plenty of nice, short examples.

Quoted 26 lines
Quoted 20 lines

Also,
tell use where interrupts.txt is
i.e. ../interrupt-controller/interrupts.txt.

These are so much easier to read if you tab out from the property name to the description.

- reg: I2C device address.
- interrupt-controller: MAX77620 has internal interrupt controller which
takes the interrupt request from internal sub-blocks like RTC, regulators, GPIOs as well as external input.
- #interrupt-cells: Should be set to 2 for IRQ number and flags.
The first cell is the IRQ number. IRQ numbers for different interrupt source of MAX77620 are defined at dt-bindings/mfd/max77620.h The second cell is the flags, encoded as the trigger masks from binding document interrupts.txt, using dt-bindings/irq.

Quoted 1 line

... don't you think?

Agree, I can make indenting. And will do whatever places it needs in this document.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 20

Quoted 3 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +3 -0
+Optional properties:
+-------------------
+This device also supports the power OFF of system.

What is the "power OFF of system"?

PMIC supplies the power. So once PMIC is in OFF state, it turns off all its rail and hence no SW execution on system. Still external supply will keep supply to PMIC.

"This device controls platform power" or something.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

+Following properties are used for this purpose:
+- system-power-controller: Boolean, This device will be use as

You don't describe the type of each property, so why is this one special?

Hmm. I describe the boolean and tristate only. Do I need to define type for integer,string also?

I wouldn't describe any of them. It's normally pretty obvious which properties are boolean by the lack of required cell description.

Quoted 11 lines
Quoted 9 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 40

Quoted 8 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +8 -0
+power OFF slot and slot period of the device. Device has 3 FPS as FPS0,
+FPS1 and FPS2. The details of FPS configuration is provided through
+subnode "fps". The details of FPS0, FPS1, FPS2 are provided through the
+child node under this subnodes. The FPS number is provided via reg property.
+
+The property for fps child nodes as:
+Required properties:
+	-reg: FPS number like 0, 1, 2 for FPS0, FPS1 and FPS2 respectively.

I'm surprised Rob Acked this. We don't usually do device numbers in DT.

What is best way to make the child node for FPS and differentiate FPS0,1, 2? What is your suggestion here?

There are lots of ways you can solve this and so many examples of others doing so. I suggest you have a look at some DTS files and figure it out. One possible solution is to use different compatible strings.

Quoted 20 lines
Quoted 14 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 53

Quoted 12 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +12 -0
+	-maxim,active-fps-time-period-us: Active state FPS time period in
+		microseconds.
+	-maxim,suspend-fps-time-period-us: Suspend state FPS time period in
+		microseconds.
+	-maxim,fps-enable-input: FPS enable source like EN0, EN1 or SW. The
+			macros are defined on dt-bindings/mfd/max77620.h for
+			different enable source.
+				FPS_EN_SRC_EN0 for EN0 enable source.
+				FPS_EN_SRC_EN1 for En1 enable source.
+				FPS_EN_SRC_SW for SW based control.
+	-maxim,fps-sw-enable: Boolean, applicable if enable input is SW.
+			If this property present then enable the FPS else

"property is present"

Quoted 5 lines

If this enables/disables FPS, why does it matter if it's SW or not? Why can't you just cal it maxim,fps-enable? Also, is there a case where you would supply this sub-node, have FPS enabled and this property not present? If not, can't you just remove the entire node? Or am I missing something?

Quoted 5 lines

Here, my need is to connect different FPS source inputs EN0, EN1 or SW. They can connected to any inputs. That's why fps-enable-input select the related digital input for given FPS.
However, I can reduce the need of "fps-sw-enable" and make this always enable if fps-enable-input= <SW>.

This is exactly how you need to think. Reducing the number of properties you introduce (and this device adds a lot more than I would normally expect by the way) needs to be top priority.

Quoted 19 lines

Here is excerpt from datasheet:
B3:B1: SRCFPSx[1:0]
Enable Source. Specifies the enable source for the sequencer.
0b00=EN0 hardware input
0b01=EN1 hardware input
0b10=ENFPSx software bit
0b11=reserved
B0 ENFPSx

    Software Enable
    0=Disable FPSx
    1=Enable FPSx
    X=ENFPSx is a don’t care if SRCFPSx[1:0] != 0b10
Quoted 3 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 57

Quoted 2 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +1 -0
+	-maxim,enable-global-lpm: Boolean, enable global LPM when the external

LPM?

Low Power Mode (LPM). I will add details.

Quoted 8 lines
Quoted 4 lines

+Pinmux and GPIO:
+===============
I think this whole section needs moving to ../pinctrl and needs to be reviewed by Linus W.

Is this mean I need to create DT binding doc for the each subsystem differently?
Actually during AS3722, I had different understanding to have single file.

Yes, that way you have each of the the subsystem experts review your documentation. You can then link to them from this document.

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Re: [PATCH V4 1/5] DT: mfd: add device-tree binding doc fro PMIC max77620/max20024

Quoted 7 lines · Lee Jones
Quoted 2 lines · Laxman Dewangan

Hmm. I describe the boolean and tristate only. Do I need to define type for integer,string also?

I wouldn't describe any of them. It's normally pretty obvious which properties are boolean by the lack of required cell description.

Rob suggested to use the type also for Boolean and tristate. I think it is good to have for all places that what type of values are valid.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 40

Quoted 3 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +3 -0
+The property for fps child nodes as:
+Required properties:
+	-reg: FPS number like 0, 1, 2 for FPS0, FPS1 and FPS2 respectively.

I'm surprised Rob Acked this. We don't usually do device numbers in DT.

What is best way to make the child node for FPS and differentiate FPS0,1, 2? What is your suggestion here?

There are lots of ways you can solve this and so many examples of others doing so. I suggest you have a look at some DTS files and figure it out. One possible solution is to use different compatible strings.

Here, I think I can go similar to regulators where child node name identifies the regulators.

    fps-config {
        fps0 {
            maxim,fps-time-period-us = <1280>;
            maxim,fps-enable-input = <FPS_EN_SRC_EN0>;
        };

        fps1 {
            maxim,fps-time-period-us = <2560>;
            maxim,fps-enable-input = <FPS_EN_SRC_EN1>;
        };

        fps2 {
            maxim,fps-time-period-us = <640>;
            maxim,fps-enable-input = <FPS_EN_SRC_SW>;
        };
    };

So node name gives the FPS name.

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

+Pinmux and GPIO:
+===============
I think this whole section needs moving to ../pinctrl and needs to be reviewed by Linus W.

Is this mean I need to create DT binding doc for the each subsystem differently?
Actually during AS3722, I had different understanding to have single file.

Yes, that way you have each of the the subsystem experts review your documentation. You can then link to them from this document.

OK, I will add different dt binding doc in respective driver and squash that with respected submodule drivers.

#6 lore raw

Re: [PATCH V4 1/5] DT: mfd: add device-tree binding doc fro PMIC max77620/max20024

Quoted 6 lines · Laxman Dewangan
Quoted 4 lines · Lee Jones
Quoted 2 lines · Laxman Dewangan

Hmm. I describe the boolean and tristate only. Do I need to define type for integer,string also?

Quoted 7 lines
Quoted 3 lines

I wouldn't describe any of them. It's normally pretty obvious which properties are boolean by the lack of required cell description.

Rob suggested to use the type also for Boolean and tristate. I think it is good to have for all places that what type of values are valid.

It's fine, and some people do describe them. I've just never seen the point, especially if you have a nice example of their use in the document. But if you insist, please ensure you are consistent, so *all* bools need to be described. That is not currently the case.

Quoted 30 lines
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Documentation/devicetree/bindings/mfd/max77620.txt line 40

Quoted 3 lines
Documentation/devicetree/bindings/mfd/max77620.txt new file +3 -0
+The property for fps child nodes as:
+Required properties:
+	-reg: FPS number like 0, 1, 2 for FPS0, FPS1 and FPS2 respectively.

I'm surprised Rob Acked this. We don't usually do device numbers in DT.

What is best way to make the child node for FPS and differentiate FPS0,1, 2? What is your suggestion here?

There are lots of ways you can solve this and so many examples of others doing so. I suggest you have a look at some DTS files and figure it out. One possible solution is to use different compatible strings.

Here, I think I can go similar to regulators where child node name identifies the regulators.

    fps-config {
        fps0 {
            maxim,fps-time-period-us = <1280>;
            maxim,fps-enable-input = <FPS_EN_SRC_EN0>;
        };

        fps1 {
            maxim,fps-time-period-us = <2560>;
            maxim,fps-enable-input = <FPS_EN_SRC_EN1>;
        };

        fps2 {
            maxim,fps-time-period-us = <640>;
            maxim,fps-enable-input = <FPS_EN_SRC_SW>;
        };
    };
Quoted 1 line

So node name gives the FPS name.

That is also an acceptable means to solve the issue.

As I said, there are many ways to skin a cat.

Quoted 12 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

+Pinmux and GPIO:
+===============
I think this whole section needs moving to ../pinctrl and needs to be reviewed by Linus W.

Is this mean I need to create DT binding doc for the each subsystem differently?
Actually during AS3722, I had different understanding to have single file.

Yes, that way you have each of the the subsystem experts review your documentation. You can then link to them from this document.

OK, I will add different dt binding doc in respective driver and squash that with respected submodule drivers.

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v4 3/5
#13 lore raw

Re: [PATCH V4 3/5] pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024

In reply to Laxman Dewangan
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 pincontrol driver to configure these parameters through pincontrol APIs.

Nice. This driver looks like a lot of hard work, but I think it's worth it.

I guess Lee will be merging this into the MTD tree.

(I still had those comments on the DT bindings but this driver part looks fine.)

Yours,
Linus Walleij

Reviewed-by on v4 4/5
#16 lore raw

Re: [PATCH V4 4/5] gpio: max77620: add gpio driver for MAX77620/MAX20024

In reply to Laxman Dewangan
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.

That's a fine driver, no doubt about that.

Same comment on merging through MFD etc as on the
pinctrl patch.

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

#14 lore raw

Re: [PATCH V4 3/5] pinctrl: max77620: add pincontrol driver for MAX77620/MAX20024

In reply to Linus Walleij
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 8 lines
Quoted 5 lines

Add pincontrol driver to configure these parameters through pincontrol APIs.

Nice. This driver looks like a lot of hard work, but I think it's worth it.

Thank you very much for acknowledgement.

Quoted 6 lines

I guess Lee will be merging this into the MTD tree.

(I still had those comments on the DT bindings but this driver part looks fine.)

I have posted patch V5 for enhancing DT binding doc as suggested by you and Lee. Request you to help on review.

I am going to send V6 to separate out DT binding doc patch with the driver file which I did in V5 and so want to correct if there is any more pending on document enhancement.