linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add support of nxp pf8x00 regulator
@ 2020-12-14 22:58 Adrien Grassein
  2020-12-14 22:58 ` [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC Adrien Grassein
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Adrien Grassein @ 2020-12-14 22:58 UTC (permalink / raw)
  Cc: lgirdwood, broonie, robh+dt, linux-kernel, devicetree,
	troy.kisky, gary.bisson, Adrien Grassein

Hello,

this set of patch intends to add the support of the pf8x00 PMIC
regulators. This family of PMIC contains 12 regulators (7 bucks
converters, 4 LDO, 1 RTC supply). All these 12 regulators are
configurable via an OTP memory and by i2c at runtime for some
specific properties.

1: Adds the dt-binding corresponding to the new driver;
2: Adds the driver itself. 

This is th 3rd version of the patch set. In this version I fixed:
  - Bad default values were described in the description;
  - The configuration is now done at parsing time;
  - The code doesn't attempt to parse the regulator properties;
  - Remove the unnecessary new "nxp,illim-microamp" property;
  - Use the "regulator-max-microamp" of the regulator instead;
  - Cut the code in multiple function to obtain a better readability.
  - Rework some code part;

Thanks,

Adrien Grassein (2):
  dt-bindings: regulator: add pf8x00 PMIC
  regulator: pf8x00: add support of nxp pf8x00 regulator

 .../regulator/nxp,pf8x00-regulator.yaml       | 220 +++++
 MAINTAINERS                                   |   7 +
 drivers/regulator/Kconfig                     |  12 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/pf8x00-regulator.c          | 798 ++++++++++++++++++
 5 files changed, 1038 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
 create mode 100644 drivers/regulator/pf8x00-regulator.c

-- 
2.20.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC
  2020-12-14 22:58 [PATCH v3 0/2] Add support of nxp pf8x00 regulator Adrien Grassein
@ 2020-12-14 22:58 ` Adrien Grassein
  2020-12-15 14:26   ` Rob Herring
  2020-12-15 15:00   ` Rob Herring
  2020-12-14 22:58 ` [PATCH v3 2/2] regulator: pf8x00: add support of nxp pf8x00 regulator Adrien Grassein
  2020-12-15 13:06 ` [PATCH v3 0/2] Add " Mark Brown
  2 siblings, 2 replies; 11+ messages in thread
From: Adrien Grassein @ 2020-12-14 22:58 UTC (permalink / raw)
  Cc: lgirdwood, broonie, robh+dt, linux-kernel, devicetree,
	troy.kisky, gary.bisson, Adrien Grassein

Add a devicetree binding documentation for the pf8x00 regulator driver.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
---
 .../regulator/nxp,pf8x00-regulator.yaml       | 220 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 226 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml

diff --git a/Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml b/Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
new file mode 100644
index 000000000000..a17ab3b22913
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
@@ -0,0 +1,220 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/nxp,pf8x00-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP PF8x00 Power Management Integrated Circuit regulators
+
+maintainers:
+  - Adrien Grassein <adrien.grassein@gmail.com>
+
+description:
+  pf8x00 are a 12-chanel regulator PMIC family. Regulators nodes should
+  be named to ldo<>, sw<> and vnss. The definition for each of these nodes
+  is defined using the standard binding for regulators at
+  Documentation/devicetree/bindings/regulator/regulator.txt.
+  Datasheet is available at https://www.nxp.com/docs/en/data-sheet/PF8100_PF8200.pdf
+
+properties:
+  compatible:
+    enum:
+      - nxp,pf8100
+      - nxp,pf8121a
+      - nxp,pf8200
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description:
+      list of regulators provided by this controller
+
+    patternProperties:
+      "^ldo[1-4]$":
+        type: object
+        $ref: regulator.yaml#
+        description:
+          Properties for single LDO regulator.
+
+        properties:
+          nxp,hw-en:
+            $ref: /schemas/types.yaml#definitions/flag
+            description:
+              Only available for ldo2. If present, use LDO2EN input pin
+              to enable or disable ldo2. (LDO2EN should be in HIGH state
+              to enable LDO2 if nxp,hw-en is specified).
+
+          nxp,vselect-en:
+            $ref: /schemas/types.yaml#definitions/flag
+            description:
+              Only available for ldo2. When specified, use the VSELECT
+              input pin of the chip to control the output voltage of the
+              ldo02 regulator. (3.3V if VSELECT is LOW, 1.8V if HIGH).
+
+        unevaluatedProperties: false
+
+      "^sw[1-7]$":
+        type: object
+        $ref: regulator.yaml#
+        description:
+          Properties for single SW regulator.
+
+        properties:
+          nxp,phase:
+            $ref: /schemas/types.yaml#definitions/uint32
+            minimum: 0
+            maximum: 315
+            enum: [ 0, 45, 90, 135, 180, 225, 270, 315 ]
+            description:
+               This controls the phase shift of the switching frequency.
+               Default value is the one written in the OTP configuration.
+
+          nxp,fast-slew:
+            $ref: /schemas/types.yaml#definitions/flag
+            description:
+              Enables the fast DVS ramp of the regulator.
+              Default is slow DVS ramp.
+              Not available for sw7 regulator.
+              Default value is the one written in the OTP configuration.
+
+          nxp,dual-phase:
+            $ref: /schemas/types.yaml#definitions/flag
+            description:
+              This allow regulators  sw1 and sw2, sw3 and sw4, sw5 and sw6,
+              to work together to deliver a maximum 5A current.
+              Should be only specified for sw1, sw3 and sw5.
+              If set, sw2, sw4 and sw6 configuration will be totally ignored.
+              This is not a configuration property. It's only used to control
+              the consistency of the OTP confguration.
+
+          nxp,quad-phase:
+            $ref: /schemas/types.yaml#definitions/flag
+            description:
+              This allow regulators  sw1, sw2, sw3 and sw4 to work together
+              to deliver a maximum 10A current. Should be only specified for
+              sw1. If set, sw2, sw3 and sw4 configuration will be totally ignored.
+              This is not a configuration property. It's only used to control
+              the consistency of the OTP confguration.
+
+        unevaluatedProperties: false
+
+    properties:
+      vsnvs:
+        type: object
+        $ref: regulator.yaml#
+        description:
+          Properties for vsnvs regulator.
+
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      pmic@8 {
+        compatible = "nxp,pf8100";
+        reg = <0x08>;
+
+        regulators {
+            reg_ldo1: ldo1 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <5000000>;
+              regulator-min-microvolt = <1500000>;
+            };
+
+            reg_ldo2: ldo2 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <5000000>;
+              regulator-min-microvolt = <1500000>;
+            };
+
+            reg_ldo3: ldo3 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <5000000>;
+              regulator-min-microvolt = <1500000>;
+            };
+
+            reg_ldo4: ldo4 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <5000000>;
+              regulator-min-microvolt = <1500000>;
+            };
+
+            reg_sw1: sw1 {
+              nxp,phase = <0>;
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <1800000>;
+              regulator-min-microvolt = <400000>;
+              regulator-max-microamp  = <4500000>;
+            };
+
+            reg_sw2: sw2 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <1800000>;
+              regulator-min-microvolt =  <400000>;
+            };
+
+            reg_sw3: sw3 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <1800000>;
+              regulator-min-microvolt =  <400000>;
+              nxp,fast-slew;
+            };
+
+            reg_sw4: sw4 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <1800000>;
+              regulator-min-microvolt =  <400000>;
+              nxp,fast-slew;
+            };
+
+            reg_sw5: sw5 {
+              regulator-always-on;
+              regulator-boot-on;
+              regulator-max-microvolt = <1800000>;
+              regulator-min-microvolt =  <400000>;
+            };
+
+           reg_sw6: sw6 {
+             regulator-always-on;
+             regulator-boot-on;
+             regulator-max-microvolt = <1800000>;
+             regulator-min-microvolt =  <400000>;
+           };
+
+           reg_sw7: sw7 {
+             regulator-always-on;
+             regulator-boot-on;
+             regulator-max-microvolt = <4100000>;
+             regulator-min-microvolt = <1000000>;
+           };
+
+          reg_vsnvs: vsnvs {
+            regulator-always-on;
+            regulator-boot-on;
+            regulator-max-microvolt = <3300000>;
+            regulator-min-microvolt = <1800000>;
+          };
+        };
+      };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index fb75813e23d4..878e6f25aab7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13804,6 +13804,12 @@ S:	Maintained
 F:	include/linux/personality.h
 F:	include/uapi/linux/personality.h
 
+PF8x00 PMIC REGULATORS DRIVERS
+M:	Adrien Grassein <adrien.grassein@gmail.com>
+L:	linux-kernel@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
+
 PHOENIX RC FLIGHT CONTROLLER ADAPTER
 M:	Marcus Folkesson <marcus.folkesson@gmail.com>
 L:	linux-input@vger.kernel.org
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 2/2] regulator: pf8x00: add support of nxp pf8x00 regulator
  2020-12-14 22:58 [PATCH v3 0/2] Add support of nxp pf8x00 regulator Adrien Grassein
  2020-12-14 22:58 ` [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC Adrien Grassein
@ 2020-12-14 22:58 ` Adrien Grassein
  2020-12-15 13:06 ` [PATCH v3 0/2] Add " Mark Brown
  2 siblings, 0 replies; 11+ messages in thread
From: Adrien Grassein @ 2020-12-14 22:58 UTC (permalink / raw)
  Cc: lgirdwood, broonie, robh+dt, linux-kernel, devicetree,
	troy.kisky, gary.bisson, Adrien Grassein

NXP pf8100 and pf8200 are 12-channel
PMIC for high performance applications.

This driver introduces the support of the 12
regulators available on the PMIC.

Imported from Boundary Devices kernel
with some modifications.

This driver was teste using a Boundary Nitrogen 8M Mini
board that features this PMIC.

Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
---
 MAINTAINERS                          |   1 +
 drivers/regulator/Kconfig            |  12 +
 drivers/regulator/Makefile           |   1 +
 drivers/regulator/pf8x00-regulator.c | 798 +++++++++++++++++++++++++++
 4 files changed, 812 insertions(+)
 create mode 100644 drivers/regulator/pf8x00-regulator.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 878e6f25aab7..a7b40ac6a671 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13809,6 +13809,7 @@ M:	Adrien Grassein <adrien.grassein@gmail.com>
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
+F:	drivers/regulator/pf8x00-regulator.c
 
 PHOENIX RC FLIGHT CONTROLLER ADAPTER
 M:	Marcus Folkesson <marcus.folkesson@gmail.com>
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 020a00d6696b..d2aba4b487f4 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -791,6 +791,18 @@ config REGULATOR_PCF50633
 	 Say Y here to support the voltage regulators and converters
 	 on PCF50633
 
+config REGULATOR_PF8X00
+	tristate "NXP PF8x00 regulator driver"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	 Say y here to support the regulators found on the NXP
+	 PF8100/PF8200 PMIC
+
+	 Say M here if you want to include support for tte regulators found
+	 on the NXP PF8100/PF8200 PMIC. The module will be named
+	 "pf8x00-regulator".
+
 config REGULATOR_PFUZE100
 	tristate "Freescale PFUZE100/200/3000/3001 regulator driver"
 	depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 6ebae516258e..a9fb449a0dc8 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_REGULATOR_QCOM_SPMI) += qcom_spmi-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o
 obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
 obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o
+obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o
 obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o
 obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
 obj-$(CONFIG_REGULATOR_PV88080) += pv88080-regulator.o
diff --git a/drivers/regulator/pf8x00-regulator.c b/drivers/regulator/pf8x00-regulator.c
new file mode 100644
index 000000000000..35e7d234180a
--- /dev/null
+++ b/drivers/regulator/pf8x00-regulator.c
@@ -0,0 +1,798 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+// Copyright 2017 NXP
+// Copyright 2019 Boundary Devices
+
+#define DEBUG 1
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regulator/of_regulator.h>
+#include <linux/platform_device.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/regmap.h>
+
+#define PF8X00_DEVICEID		0x00
+#define PF8X00_REVID		0x01
+#define PF8X00_EMREV		0x02
+#define PF8X00_PROGID		0x03
+
+#define PF8X00_IMS_INT		0x04
+#define PF8X00_IMS_THERM	0x07
+#define PF8X00_SW_MODE_INT	0x0a
+#define PF8X00_SW_MODE_MASK	0x0b
+
+#define IMS_INT			0
+#define IMS_STATUS		0
+#define IMS_MASK		1
+#define IMS_SENSE		2
+
+#define PF8X00_IMS_SW_ILIM	0x12
+#define PF8X00_IMS_LDO_ILIM	0x15
+#define PF8X00_IMS_SW_UV	0x18
+#define PF8X00_IMS_SW_OV	0x1b
+#define PF8X00_IMS_LDO_UV	0x1e
+#define PF8X00_IMS_LDO_OV	0x21
+#define PF8X00_IMS_PWRON	0x24
+#define PF8X00_SYS_INT		0x27
+
+#define PF8X00_HARD_FAULT	0x29
+#define PF8X00_FSOB_FLAGS	0x2a
+#define PF8X00_FSOB_SELECT	0x2b
+#define PF8X00_ABIST_OV1	0x2c
+#define PF8X00_ABIST_OV2	0x2d
+#define PF8X00_ABIST_UV1	0x2e
+#define PF8X00_ABIST_UV2	0x2f
+#define PF8X00_TEST_FLAGS	0x30
+#define PF8X00_ABIST_RUN	0x31
+
+#define PF8X00_RANDOM_GEN	0x33
+#define PF8X00_RANDOM_CHK	0x34
+#define PF8X00_VMONEN1		0x35
+#define PF8X00_VMONEN2		0x36
+#define PF8X00_CTRL1		0x37
+#define PF8X00_CTRL2		0x38
+#define PF8X00_CTRL3		0x39
+#define PF8X00_PWRUP_CTRL	0x3a
+
+#define PF8X00_RESETBMCU	0x3c
+#define PF8X00_PGOOD		0x3d
+#define PF8X00_PWRDN_DLY1	0x3e
+#define PF8X00_PWRDN_DLY2	0x3f
+#define PF8X00_FREQ_CTRL	0x40
+#define PF8X00_COINCELL_CTRL	0x41
+#define PF8X00_PWRON		0x42
+#define PF8X00_WD_CONFIG	0x43
+#define PF8X00_WD_CLEAR		0x44
+#define PF8X00_WD_EXPIRE	0x45
+#define PF8X00_WD_COUNTER	0x46
+#define PF8X00_FAULT_COUNTER	0x47
+#define PF8X00_FSAFE_COUNTER	0x48
+#define PF8X00_FAULT_TIMER	0x49
+#define PF8X00_AMUX		0x4a
+
+#define SW_CONFIG1	0
+#define SW_CONFIG2	1
+#define SW_PWRUP	2
+#define SW_MODE1	3
+#define SW_RUN_VOLT	4
+#define SW_STBY_VOLT	5
+
+/* i is in REG_SW1..REG_SW7 */
+#define PF8X00_SW(i)		(8 * (i - REG_SW1) + 0x4d)
+
+#define LDO_CONFIG1	0
+#define LDO_CONFIG2	1
+#define LDO_PWRUP	2
+#define LDO_RUN_VOLT	3
+#define LDO_STBY_VOLT	4
+
+/* i is in REG_LDO1..REG_LDO4 */
+#define PF8X00_LDO(i)		(6 * (i - REG_LDO1) + 0x85)
+
+#define PF8X00_VSNVS_CONFIG1	0x9d
+
+#define PF8X00_PAGE_SELECT	0x9f
+#define PF8X00_OTP_FSOB_SELECT	0xa0
+#define PF8X00_OTP_I2C		0xa1
+#define PF8X00_OTP_CTRL1	0xa2
+#define PF8X00_OTP_CTRL2	0xa3
+#define PF8X00_OTP_CTRL3	0xa4
+
+#define PF8X00_OTP_FREQ_CTRL	0xa5
+#define PF8X00_OTP_COINCELL	0xa6
+#define PF8X00_OTP_PWRON	0xa7
+#define PF8X00_OTP_WD_CONFIG	0xa8
+#define PF8X00_OTP_WD_EXPIRE	0xa9
+#define PF8X00_OTP_WD_COUNTER	0xaa
+#define PF8X00_OTP_FAULT_COUNTER 0xab
+#define PF8X00_OTP_FAULT_TIMER	0xac
+#define PF8X00_OTP_PWRDN_DLY1	0xad
+#define PF8X00_OTP_PWRDN_DLY2	0xae
+#define PF8X00_OTP_PWRUP_CTRL	0xaf
+#define PF8X00_OTP_RESETBMCU	0xb0
+#define PF8X00_OTP_PGOOD	0xb1
+
+#define OTP_SW_VOLT	0
+#define OTP_SW_PWRUP	1
+#define OTP_SW_CONFIG1	2
+#define OTP_SW_CONFIG2	3
+
+/* i is in REG_SW1..REG_SW7 */
+#define PF8X00_OTP_SW(i)	(4 * (i - REG_SW1) + 0xb2)
+
+#define OTP_LDO_VOLT	0
+#define OTP_LDO_PWRUP	1
+#define OTP_LDO_CONFIG	2
+
+/* i is in REG_LDO1..REG_LDO4 */
+#define PF8X00_OTP_LDO(i)	(3 * (i - REG_LDO1) + 0xce)
+
+#define PF8X00_OTP_VSNVS_CONFIG	0xda
+#define PF8X00_OTP_OV_BYPASS1	0xdb
+#define PF8X00_OTP_OV_BYPASS2	0xdc
+#define PF8X00_OTP_UV_BYPASS1	0xdd
+#define PF8X00_OTP_UV_BYPASS2	0xde
+#define PF8X00_OTP_ILIM_BYPASS1	0xdf
+#define PF8X00_OTP_ILIM_BYPASS2	0xe0
+
+#define PF8X00_OTP_DEBUG1	0xe3
+#define PF8X_NUMREGS		0xe4
+
+#define REG_LDO1		0
+#define REG_LDO2		1
+#define REG_LDO3		2
+#define REG_LDO4		3
+#define REG_SW1			4
+#define REG_SW2			5
+#define REG_SW3			6
+#define REG_SW4			7
+#define REG_SW5			8
+#define REG_SW6			9
+#define REG_SW7			10
+#define REG_VSNVS		11
+#define REG_NUM_REGULATORS	(4 + 7 + 1)
+
+enum chips {
+	PF8100 = 0x40,
+	PF8121A = 0x42,
+	PF8200 = 0x48,
+};
+
+struct id_name {
+	enum chips id;
+	const char *name;
+};
+
+struct pf8x_regulator {
+	struct regulator_desc desc;
+	unsigned char quad_phase;
+	unsigned char dual_phase;
+	unsigned char fast_slew;
+};
+
+struct pf8x_chip {
+	int	chip_id;
+	int	prog_id;
+	int	clk_freq;
+	struct regmap *regmap;
+	struct device *dev;
+	struct regulator_dev *regulators[REG_NUM_REGULATORS];
+};
+
+/* Output: 1.5V to 5.0V, LDO2 can use VSELECT */
+static const int pf8x00_ldo_voltages[] = {
+	1500000, 1600000, 1800000, 1850000, 2150000, 2500000, 2800000, 3000000,
+	3100000, 3150000, 3200000, 3300000, 3350000, 4000000, 4900000, 5000000,
+};
+
+/* Output: 0.4V to 1.8V */
+#define PF8XOO_SW1_6_VOLTAGE_NUM 0xB2
+static const struct linear_range pf8x00_sw1_to_6_voltages[] = {
+	REGULATOR_LINEAR_RANGE(400000, 0x00, 0xB0, 6250),
+	REGULATOR_LINEAR_RANGE(1800000, 0xB1, 0xB1, 0),
+};
+
+/* Output: 2.1A to 4.5A */
+static const unsigned int pf8x00_sw_current_table[] = {
+	2100000, 2600000, 3000000, 4500000,
+};
+
+/* Output: 1.0V to 4.1V */
+static const int pf8x00_sw7_voltages[] = {
+	1000000, 1100000, 1200000, 1250000, 1300000, 1350000, 1500000, 1600000,
+	1800000, 1850000, 2000000, 2100000, 2150000, 2250000, 2300000, 2400000,
+	2500000, 2800000, 3150000, 3200000, 3250000, 3300000, 3350000, 3400000,
+	3500000, 3800000, 4000000, 4100000, 4100000, 4100000, 4100000, 4100000,
+};
+
+/* Output: 1.8V, 3.0V, or 3.3V */
+static const int pf8x00_vsnvs_voltages[] = {
+	0, 1800000, 3000000, 3300000,
+};
+
+static const struct i2c_device_id pf8x_device_id[] = {
+	{.name = "pf8x00",},
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, pf8x_device_id);
+
+static const struct of_device_id pf8x_dt_ids[] = {
+	{ .compatible = "nxp,pf8100",},
+	{ .compatible = "nxp,pf8121a",},
+	{ .compatible = "nxp,pf8200",},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, pf8x_dt_ids);
+
+const struct id_name id_list[] = {
+	{PF8100, "PF8100"},
+	{PF8121A, "PF8121A"},
+	{PF8200, "PF8200"},
+};
+
+static const struct id_name *get_id_name(enum chips id)
+{
+	const struct id_name *p = id_list;
+
+	while (p->id) {
+		if (p->id == id)
+			break;
+		p++;
+	}
+	return p;
+}
+
+struct dvs_ramp {
+	unsigned short up_down_slow_fast[4];
+};
+
+/* Units uV/uS */
+struct dvs_ramp ramp_table[] = {
+/*			up_slow,	down_slow,	up_fast,	down_fast */
+	[0]  = {{ 7813,		5208,		15625,		10417 }},
+	[1]  = {{ 8203,		5469,		16406,		10938 }},
+	[2]  = {{ 8594,		5729,		17188,		11458 }},
+	[3]  = {{ 8984,		5990,		17969,		11979 }},
+	[4]  = {{ 9375,		6250,		18750,		12500 }},
+	[9]  = {{ 6250,		4167,		12500,		 8333 }},
+	[10] = {{ 6641,		4427,		13281,		 8854 }},
+	[11] = {{ 7031,		4688,		14063,		 9375 }},
+	[12] = {{ 7422,		4948,		14844,		 9896 }},
+};
+
+static int pf8x00_regulator_common_set_voltage_time_sel(struct regulator_dev *rdev,
+		int old_v, int new_v)
+{
+	struct pf8x_chip *pf = rdev_get_drvdata(rdev);
+	struct pf8x_regulator *rdesc = container_of(rdev->desc, struct pf8x_regulator, desc);
+	unsigned int index = 0;
+	unsigned int slew;
+	int change = new_v - old_v;
+
+	if (rdesc->fast_slew)
+		index = 2;
+
+	if (change < 0)
+		index++;
+
+	slew = ramp_table[pf->clk_freq].up_down_slow_fast[index];
+
+	return DIV_ROUND_UP(abs(change), slew);
+}
+
+static int pf8x00_regulator1_6_set_voltage_time_sel(struct regulator_dev *rdev,
+		unsigned int old_sel, unsigned int new_sel)
+{
+	struct pf8x_regulator *rdesc = container_of(rdev->desc, struct pf8x_regulator, desc);
+	int old_v = regulator_desc_list_voltage_linear_range(&rdesc->desc, old_sel);
+	int new_v = regulator_desc_list_voltage_linear_range(&rdesc->desc, new_sel);
+
+	return pf8x00_regulator_common_set_voltage_time_sel(rdev, old_v, new_v);
+}
+
+static int pf8x00_regulator7_set_voltage_time_sel(struct regulator_dev *rdev,
+		unsigned int old_sel, unsigned int new_sel)
+{
+	const unsigned int *volt_table = rdev->desc->volt_table;
+	int old_v = volt_table[old_sel];
+	int new_v = volt_table[new_sel];
+
+	return pf8x00_regulator_common_set_voltage_time_sel(rdev, old_v, new_v);
+}
+
+static int encode_phase(struct pf8x_chip *pf, int phase)
+{
+	int ph;
+
+	if (phase < 0)
+		return -1;
+
+	ph = phase / 45;
+	if ((ph * 45) != phase) {
+		dev_err(pf->dev, "ignoring, illegal phase %d\n", phase);
+		return -1;
+	}
+
+	if (ph == 0)
+		ph = 7;
+	else
+		ph -= 1;
+
+	return ph;
+}
+
+static int pf8x00_check_dtb_configuration(struct pf8x_chip *pf, int id,
+		unsigned char dual_phase, unsigned char quad_phase,
+		int phase, unsigned char fast_slew,
+		unsigned char hw_en, unsigned char vselect_en)
+{
+	int ret = 0;
+
+	if ((id != REG_SW1) && quad_phase) {
+		dev_warn(pf->dev, "ignoring, only sw1 can use quad-phase\n");
+		ret = 1;
+	}
+
+	if ((id != REG_SW1) && (id != REG_SW3) && (id != REG_SW5) && dual_phase) {
+		dev_warn(pf->dev, "ignoring, only sw1, sw3 and sw5 can use dual-phase\n");
+		ret = 1;
+	}
+
+	if ((id != REG_LDO2) && vselect_en) {
+		dev_warn(pf->dev, "ignoring, only ldo2 can use vselect-en\n");
+		ret = 1;
+	}
+
+	if ((id != REG_LDO2) && hw_en) {
+		dev_warn(pf->dev, "ignoring, only ldo2 can use hw-en\n");
+		ret = 1;
+	}
+
+	if ((id < REG_SW1) && (id >= REG_SW7) && phase >= 0) {
+		dev_warn(pf->dev, "ignoring, only sw1-6 can use phase\n");
+		ret = 1;
+	}
+
+	return ret;
+}
+
+static int pf8x00_configure_sw_regulator(struct pf8x_chip *pf,
+			int id, int phase, unsigned char fast_slew)
+{
+	int ret = 0;
+	unsigned int mask = 0;
+	unsigned int val = 0;
+	unsigned int reg = PF8X00_SW(id) + SW_CONFIG2;
+
+	dev_dbg(pf->dev, "Configuring SW%d: phase = %d,  fast_slew = %u\n",
+		id - 3, phase, fast_slew);
+
+	if (phase >= 0) {
+		mask |= 7;
+		val |= phase;
+	}
+
+	if (fast_slew) {
+		mask |= 1 << 5;
+		val |= fast_slew << 5;
+	}
+
+	if (mask)
+		ret = regmap_update_bits(pf->regmap, reg, mask, val);
+
+	return ret;
+}
+
+static int pf8x00_configure_ld02_regulator(struct pf8x_chip *pf,
+	unsigned char hw_en,  unsigned char vselect_en)
+{
+	unsigned int val = 0;
+
+	dev_dbg(pf->dev, "Configuring ld02: hw_en=%u vselect_en=%u\n",
+		hw_en, vselect_en);
+
+	if (vselect_en)
+		val |= 0x08;
+
+	if (hw_en)
+		val |= 0x10;
+
+	return regmap_update_bits(pf->regmap,
+		PF8X00_LDO(REG_LDO2) + LDO_CONFIG2, 0x18, val);
+}
+
+static int pf8x00_of_parse_cb(struct device_node *np,
+		const struct regulator_desc *desc,
+		struct regulator_config *config)
+{
+	struct pf8x_chip *pf = config->driver_data;
+	struct pf8x_regulator *rdesc = container_of(desc, struct pf8x_regulator, desc);
+
+	unsigned char hw_en = 0;
+	unsigned char vselect_en = 0;
+	unsigned char quad_phase = 0;
+	unsigned char dual_phase = 0;
+	unsigned char fast_slew = 0;
+	int phase = -1;
+	int ret = 0;
+
+	if (!of_property_read_u32(np, "nxp,phase", &phase))
+		phase = encode_phase(pf, phase);
+	if (of_get_property(np, "nxp,fast-slew", NULL))
+		fast_slew = 1;
+	if (of_get_property(np, "nxp,hw-en", NULL))
+		hw_en = 1;
+	if (of_get_property(np, "nxp,quad-phase", NULL))
+		quad_phase = 1;
+	if (of_get_property(np, "nxp,dual-phase", NULL))
+		dual_phase = 1;
+	if (of_get_property(np, "nxp,vselect-en", NULL))
+		vselect_en = 1;
+
+	/* Ignore the return of the check, this will just print warnings */
+	pf8x00_check_dtb_configuration(pf, desc->id, dual_phase, quad_phase,
+		phase, fast_slew, hw_en, vselect_en);
+
+	rdesc->dual_phase = dual_phase;
+	rdesc->quad_phase = quad_phase;
+	rdesc->fast_slew  = fast_slew;
+
+	if ((desc->id >= REG_SW1) && (desc->id <= REG_SW7))
+		ret = pf8x00_configure_sw_regulator(pf, desc->id,
+			phase, fast_slew);
+	else if (desc->id == REG_LDO2)
+		ret = pf8x00_configure_ld02_regulator(pf, hw_en, vselect_en);
+
+	return ret;
+}
+
+static const struct regulator_ops pf8x00_ldo_regulator_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.list_voltage = regulator_list_voltage_table,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+};
+
+static const struct regulator_ops pf8x00_sw1_6_regulator_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.list_voltage = regulator_list_voltage_linear_range,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_time_sel = pf8x00_regulator1_6_set_voltage_time_sel,
+	.get_current_limit = regulator_get_current_limit_regmap,
+	.set_current_limit = regulator_set_current_limit_regmap,
+};
+
+static const struct regulator_ops pf8x00_sw7_regulator_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.list_voltage = regulator_list_voltage_table,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_time_sel = pf8x00_regulator7_set_voltage_time_sel,
+};
+
+static const struct regulator_ops pf8x00_vsnvs_regulator_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.list_voltage = regulator_list_voltage_table,
+	.map_voltage = regulator_map_voltage_ascend,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+};
+
+#define STRUCT_LDO_REG(_id, _name, base)		\
+	[_id] = {						\
+		.desc = {					\
+			.name = #_name,				\
+			.of_match = of_match_ptr(#_name),	\
+			.regulators_node = of_match_ptr("regulators"), \
+			.of_parse_cb = pf8x00_of_parse_cb,	\
+			.n_voltages = ARRAY_SIZE(pf8x00_ldo_voltages),	\
+			.ops = &pf8x00_ldo_regulator_ops,	\
+			.type = REGULATOR_VOLTAGE,		\
+			.id = _id,				\
+			.owner = THIS_MODULE,			\
+			.volt_table = pf8x00_ldo_voltages,			\
+			.vsel_reg = (base) + LDO_RUN_VOLT,	\
+			.vsel_mask = 0xff,			\
+			.enable_reg = (base) + LDO_CONFIG2,	\
+			.enable_val = 0x2,			\
+			.disable_val = 0x0,			\
+			.enable_mask = 2,			\
+		},						\
+	}
+
+#define STRUCT_SW_REG(_id, _name, base)		\
+	[_id] = {						\
+		.desc = {					\
+			.name = #_name,				\
+			.of_match = of_match_ptr(#_name),	\
+			.regulators_node = of_match_ptr("regulators"), \
+			.of_parse_cb = pf8x00_of_parse_cb,	\
+			.n_voltages = PF8XOO_SW1_6_VOLTAGE_NUM, \
+			.ops = &pf8x00_sw1_6_regulator_ops,	\
+			.type = REGULATOR_VOLTAGE,		\
+			.id = _id,				\
+			.owner = THIS_MODULE,			\
+			.linear_ranges = pf8x00_sw1_to_6_voltages, \
+			.n_linear_ranges = \
+				ARRAY_SIZE(pf8x00_sw1_to_6_voltages), \
+			.vsel_reg = (base) + SW_RUN_VOLT,	\
+			.vsel_mask = 0xff,			\
+			.curr_table = pf8x00_sw_current_table, \
+			.n_current_limits = \
+				ARRAY_SIZE(pf8x00_sw_current_table), \
+			.csel_reg = (base) + SW_CONFIG2,	\
+			.csel_mask = 0x18,	\
+			.enable_reg = (base) + SW_MODE1,	\
+			.enable_val = 0x3,			\
+			.disable_val = 0x0,			\
+			.enable_mask = 0x3,			\
+			.enable_time = 500,			\
+		},						\
+	}
+
+#define STRUCT_SW7_REG(_id, _name, base)		\
+	[_id] = {						\
+		.desc = {					\
+			.name = #_name,				\
+			.of_match = of_match_ptr(#_name),	\
+			.regulators_node = of_match_ptr("regulators"), \
+			.of_parse_cb = pf8x00_of_parse_cb,	\
+			.n_voltages = ARRAY_SIZE(pf8x00_sw7_voltages),	\
+			.ops = &pf8x00_sw7_regulator_ops,	\
+			.type = REGULATOR_VOLTAGE,		\
+			.id = _id,				\
+			.owner = THIS_MODULE,			\
+			.volt_table = pf8x00_sw7_voltages,			\
+			.vsel_reg = (base) + SW_RUN_VOLT,	\
+			.vsel_mask = 0xff,			\
+			.enable_reg = (base) + SW_MODE1,	\
+			.enable_val = 0x3,			\
+			.disable_val = 0x0,			\
+			.enable_mask = 0x3,			\
+			.enable_time = 500,			\
+		},						\
+	}
+
+
+#define STRUCT_VSNVS_REG(_id, _name, base)		\
+	[_id] = {						\
+		.desc = {					\
+			.name = #_name,				\
+			.of_match = of_match_ptr(#_name),	\
+			.regulators_node = of_match_ptr("regulators"), \
+			.of_parse_cb = pf8x00_of_parse_cb,	\
+			.n_voltages = ARRAY_SIZE(pf8x00_vsnvs_voltages),	\
+			.ops = &pf8x00_vsnvs_regulator_ops,	\
+			.type = REGULATOR_VOLTAGE,		\
+			.id = _id,				\
+			.owner = THIS_MODULE,			\
+			.volt_table = pf8x00_vsnvs_voltages,			\
+			.vsel_reg = (base),			\
+			.vsel_mask = 0x3,			\
+		},						\
+	}
+
+static struct pf8x_regulator pf8x00_regulators[] = {
+	STRUCT_LDO_REG(REG_LDO1, ldo1, PF8X00_LDO(REG_LDO1)),
+	STRUCT_LDO_REG(REG_LDO2, ldo2, PF8X00_LDO(REG_LDO2)),
+	STRUCT_LDO_REG(REG_LDO3, ldo3, PF8X00_LDO(REG_LDO3)),
+	STRUCT_LDO_REG(REG_LDO4, ldo4, PF8X00_LDO(REG_LDO4)),
+	STRUCT_SW_REG(REG_SW1, sw1, PF8X00_SW(REG_SW1)),
+	STRUCT_SW_REG(REG_SW2, sw2, PF8X00_SW(REG_SW2)),
+	STRUCT_SW_REG(REG_SW3, sw3, PF8X00_SW(REG_SW3)),
+	STRUCT_SW_REG(REG_SW4, sw4, PF8X00_SW(REG_SW4)),
+	STRUCT_SW_REG(REG_SW5, sw5, PF8X00_SW(REG_SW5)),
+	STRUCT_SW_REG(REG_SW6, sw6, PF8X00_SW(REG_SW6)),
+	STRUCT_SW7_REG(REG_SW7, sw7, PF8X00_SW(REG_SW7)),
+	STRUCT_VSNVS_REG(REG_VSNVS, vsnvs, PF8X00_VSNVS_CONFIG1),
+};
+
+static int pf8x_identify(struct pf8x_chip *pf)
+{
+	const struct id_name *p;
+	unsigned int value, id1, id2;
+	int ret;
+
+	ret = regmap_read(pf->regmap, PF8X00_DEVICEID, &value);
+	if (ret)
+		return ret;
+
+	pf->chip_id = value;
+	p = get_id_name(value);
+	if (p->id != value) {
+		dev_warn(pf->dev, "Illegal ID: %x\n", value);
+		return -ENODEV;
+	}
+
+	ret = regmap_read(pf->regmap, PF8X00_REVID, &value);
+	if (ret)
+		value = 0;
+	ret = regmap_read(pf->regmap, PF8X00_EMREV, &id1);
+	if (ret)
+		id1 = 0;
+	ret = regmap_read(pf->regmap, PF8X00_PROGID, &id2);
+	if (ret)
+		id2 = 0;
+	pf->prog_id = (id1 << 8) | id2;
+
+	dev_info(pf->dev, "%s: Full layer: %x, Metal layer: %x, prog_id=0x%04x\n",
+		 p->name, (value & 0xf0) >> 4, value & 0x0f, pf->prog_id);
+
+	return 0;
+}
+
+static const struct regmap_config pf8x_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = PF8X_NUMREGS - 1,
+	.cache_type = REGCACHE_RBTREE,
+};
+
+struct otp_reg_lookup {
+	unsigned short prog_id;
+	unsigned char reg;
+	unsigned char value;
+};
+
+static const struct otp_reg_lookup otp_map[] = {
+	{ 0x401c, PF8X00_OTP_CTRL3, 0 },
+	{ 0x4008, PF8X00_OTP_CTRL3, 0x04 },
+	{ 0x301d, PF8X00_OTP_CTRL3, 0x04 },	/* test only */
+	{ 0, 0, 0 },
+};
+
+static int get_otp_reg(struct pf8x_chip *pf, unsigned char reg)
+{
+	const struct otp_reg_lookup *p = otp_map;
+
+	while (p->reg) {
+		if ((pf->prog_id == p->prog_id) && (reg == p->reg))
+			return p->value;
+		p++;
+	}
+
+	dev_err(pf->dev, "reg(0x%02x) not found for 0x%04x\n",
+		 reg, pf->prog_id);
+	return -EINVAL;
+}
+
+static int pf8x00_check_otp_configuration(struct pf8x_chip *pf)
+{
+	unsigned char quad_phase;
+	unsigned char dual_phase;
+	int ctrl3;
+	const char *format = NULL;
+	int ret = 0;
+
+	ctrl3 = get_otp_reg(pf, PF8X00_OTP_CTRL3);
+	if (ctrl3 >= 0) {
+		quad_phase = pf8x00_regulators[REG_SW1].quad_phase;
+		dual_phase = pf8x00_regulators[REG_SW1].dual_phase;
+		if (quad_phase) {
+			if ((ctrl3 & 3) != 2)
+				format = "sw1 quad_phase not set in otp_ctrl3 %x\n";
+
+		} else if (dual_phase) {
+			if ((ctrl3 & 3) != 1)
+				format = "sw1 dual_phase not set in otp_ctrl3 %x\n";
+		} else if (ctrl3 & 3) {
+			format = "sw1 single_phase not set in otp_ctrl3 %x\n";
+		}
+		if (!quad_phase) {
+			dual_phase = pf8x00_regulators[REG_SW4].dual_phase;
+			if (dual_phase) {
+				if ((ctrl3 & 0x0c) != 4)
+					format = "sw4 dual_phase not set in otp_ctrl3 %x\n";
+			} else if (ctrl3 & 0x0c) {
+				format = "sw4 single_phase not set in otp_ctrl3 %x\n";
+			}
+		}
+		dual_phase = pf8x00_regulators[REG_SW5].dual_phase;
+		if (dual_phase) {
+			if ((ctrl3 & 0x30) != 0x10)
+				format = "sw5 dual_phase not set in otp_ctrl3 %x\n";
+		} else if (ctrl3 & 0x30) {
+			format = "sw5 single_phase not set in otp_ctrl3 %x\n";
+		}
+		if (format) {
+			dev_err(pf->dev, format, ctrl3);
+			dev_err(pf->dev, "!!!try updating u-boot, boot.scr, or pmic\n");
+			ret = -EINVAL;
+		}
+	}
+	return ret;
+}
+
+static int pf8x00_regulator_probe(struct i2c_client *client,
+				    const struct i2c_device_id *id)
+{
+	struct pf8x_chip *pf;
+	struct regulator_config config = { 0 };
+	int i, ret;
+	u32 num_regulators;
+	unsigned int clk_freq = 0;
+
+	pf = devm_kzalloc(&client->dev, sizeof(*pf),
+			GFP_KERNEL);
+	if (!pf)
+		return -ENOMEM;
+
+	i2c_set_clientdata(client, pf);
+	pf->dev = &client->dev;
+
+	pf->regmap = devm_regmap_init_i2c(client, &pf8x_regmap_config);
+	if (IS_ERR(pf->regmap)) {
+		ret = PTR_ERR(pf->regmap);
+		dev_err(&client->dev,
+			"regmap allocation failed with err %d\n", ret);
+		return ret;
+	}
+
+	ret = pf8x_identify(pf);
+	if (ret)
+		return ret;
+
+	dev_info(&client->dev, "%s found.\n",
+		get_id_name(pf->chip_id)->name);
+
+	config.dev = &client->dev;
+	config.driver_data = pf;
+
+	ret = regmap_read(pf->regmap, PF8X00_FREQ_CTRL, &clk_freq);
+	clk_freq &= 0xf;
+	if (ret < 0)
+		clk_freq = 0;
+	if (((clk_freq & 7) > 4) || (clk_freq == 8))
+		clk_freq = 0;
+	pf->clk_freq = clk_freq;
+
+	num_regulators = ARRAY_SIZE(pf8x00_regulators);
+	for (i = 0; i < num_regulators; i++) {
+		struct regulator_desc *desc;
+
+		desc = &pf8x00_regulators[i].desc;
+
+		pf->regulators[i] =
+			devm_regulator_register(&client->dev, desc, &config);
+		if (IS_ERR(pf->regulators[i])) {
+			dev_err(&client->dev, "register regulator%s failed\n",
+				desc->name);
+			return PTR_ERR(pf->regulators[i]);
+		}
+	}
+
+	return pf8x00_check_otp_configuration(pf);
+}
+
+static struct i2c_driver pf8x_driver = {
+	.id_table = pf8x_device_id,
+	.driver = {
+		.name = "pf8x00-regulator",
+		.of_match_table = pf8x_dt_ids,
+	},
+	.probe = pf8x00_regulator_probe,
+};
+
+module_i2c_driver(pf8x_driver);
+
+MODULE_AUTHOR("Troy Kisky <troy.kisky@boundarydevices.com>");
+MODULE_AUTHOR("Adrien Grassein <adrien.grassein@gmail.com>");
+MODULE_DESCRIPTION("Regulator Driver for NXP's PF8100/PF8200 PMIC");
+MODULE_LICENSE("GPL v2");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] Add support of nxp pf8x00 regulator
  2020-12-14 22:58 [PATCH v3 0/2] Add support of nxp pf8x00 regulator Adrien Grassein
  2020-12-14 22:58 ` [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC Adrien Grassein
  2020-12-14 22:58 ` [PATCH v3 2/2] regulator: pf8x00: add support of nxp pf8x00 regulator Adrien Grassein
@ 2020-12-15 13:06 ` Mark Brown
  2020-12-15 13:14   ` Adrien Grassein
  2020-12-15 20:17   ` Jagan Teki
  2 siblings, 2 replies; 11+ messages in thread
From: Mark Brown @ 2020-12-15 13:06 UTC (permalink / raw)
  To: Adrien Grassein
  Cc: lgirdwood, robh+dt, linux-kernel, devicetree, troy.kisky,
	gary.bisson, Jagan Teki

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]

On Mon, Dec 14, 2020 at 11:58:49PM +0100, Adrien Grassein wrote:

> this set of patch intends to add the support of the pf8x00 PMIC
> regulators. This family of PMIC contains 12 regulators (7 bucks
> converters, 4 LDO, 1 RTC supply). All these 12 regulators are
> configurable via an OTP memory and by i2c at runtime for some
> specific properties.

This looks to have raced with the addition of support for the same
device by Jagan Teki - unfortunately I didn't register that I'd seen
other patches for the same driver go past so I applied Jagan's version
(both look to be based on original work by Troy), sorry about that.
Could you please take a look at what got merged and send incremental
improvements on top of it - I do notice that I missed the use of the
wildcard compatible in there so that needs fixing at least.  :/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] Add support of nxp pf8x00 regulator
  2020-12-15 13:06 ` [PATCH v3 0/2] Add " Mark Brown
@ 2020-12-15 13:14   ` Adrien Grassein
  2020-12-15 13:20     ` Fabio Estevam
  2020-12-15 20:17   ` Jagan Teki
  1 sibling, 1 reply; 11+ messages in thread
From: Adrien Grassein @ 2020-12-15 13:14 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, Rob Herring, linux-kernel, DTML, troy.kisky,
	Gary Bisson, Jagan Teki

Le mar. 15 déc. 2020 à 14:06, Mark Brown <broonie@kernel.org> a écrit :
>
> On Mon, Dec 14, 2020 at 11:58:49PM +0100, Adrien Grassein wrote:
>
> > this set of patch intends to add the support of the pf8x00 PMIC
> > regulators. This family of PMIC contains 12 regulators (7 bucks
> > converters, 4 LDO, 1 RTC supply). All these 12 regulators are
> > configurable via an OTP memory and by i2c at runtime for some
> > specific properties.
>
> This looks to have raced with the addition of support for the same
> device by Jagan Teki - unfortunately I didn't register that I'd seen
> other patches for the same driver go past so I applied Jagan's version
> (both look to be based on original work by Troy), sorry about that.
> Could you please take a look at what got merged and send incremental
> improvements on top of it - I do notice that I missed the use of the
> wildcard compatible in there so that needs fixing at least.  :/

No problem for me, I learned many things about trying to upstream this driver :)

Could you please tell me where this driver was merged?
I checked the main kernel Linux and I can find out this one.



Thanks again,
Adrien

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] Add support of nxp pf8x00 regulator
  2020-12-15 13:14   ` Adrien Grassein
@ 2020-12-15 13:20     ` Fabio Estevam
  2020-12-15 13:24       ` Mark Brown
  0 siblings, 1 reply; 11+ messages in thread
From: Fabio Estevam @ 2020-12-15 13:20 UTC (permalink / raw)
  To: Adrien Grassein
  Cc: Mark Brown, Liam Girdwood, Rob Herring, linux-kernel, DTML,
	Troy Kisky, Gary Bisson, Jagan Teki

Hi Adrien,

On Tue, Dec 15, 2020 at 10:16 AM Adrien Grassein
<adrien.grassein@gmail.com> wrote:

> Could you please tell me where this driver was merged?
> I checked the main kernel Linux and I can find out this one.

It is in the linux-next tree:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers?h=next-20201215&id=d3795d6321ecaa55d94dc24c3b1e3cce608aabd6

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] Add support of nxp pf8x00 regulator
  2020-12-15 13:20     ` Fabio Estevam
@ 2020-12-15 13:24       ` Mark Brown
  2020-12-15 13:33         ` Adrien Grassein
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2020-12-15 13:24 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Adrien Grassein, Liam Girdwood, Rob Herring, linux-kernel, DTML,
	Troy Kisky, Gary Bisson, Jagan Teki

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

On Tue, Dec 15, 2020 at 10:20:02AM -0300, Fabio Estevam wrote:
> On Tue, Dec 15, 2020 at 10:16 AM Adrien Grassein
> <adrien.grassein@gmail.com> wrote:

> > Could you please tell me where this driver was merged?
> > I checked the main kernel Linux and I can find out this one.

> It is in the linux-next tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers?h=next-20201215&id=d3795d6321ecaa55d94dc24c3b1e3cce608aabd6

Coming to there from my for-next branch - it's also already been sent in
a pull request to Linus so will hopefully be hitting his tree soonish.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] Add support of nxp pf8x00 regulator
  2020-12-15 13:24       ` Mark Brown
@ 2020-12-15 13:33         ` Adrien Grassein
  0 siblings, 0 replies; 11+ messages in thread
From: Adrien Grassein @ 2020-12-15 13:33 UTC (permalink / raw)
  To: Mark Brown
  Cc: Fabio Estevam, Liam Girdwood, Rob Herring, linux-kernel, DTML,
	Troy Kisky, Gary Bisson, Jagan Teki

I just cloned the linux-next repo.

I will try to fix things Mark tells me to fix on my own driver.

Thanks again,


Adrien



Le mar. 15 déc. 2020 à 14:24, Mark Brown <broonie@kernel.org> a écrit :
>
> On Tue, Dec 15, 2020 at 10:20:02AM -0300, Fabio Estevam wrote:
> > On Tue, Dec 15, 2020 at 10:16 AM Adrien Grassein
> > <adrien.grassein@gmail.com> wrote:
>
> > > Could you please tell me where this driver was merged?
> > > I checked the main kernel Linux and I can find out this one.
>
> > It is in the linux-next tree:
> > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers?h=next-20201215&id=d3795d6321ecaa55d94dc24c3b1e3cce608aabd6
>
> Coming to there from my for-next branch - it's also already been sent in
> a pull request to Linus so will hopefully be hitting his tree soonish.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC
  2020-12-14 22:58 ` [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC Adrien Grassein
@ 2020-12-15 14:26   ` Rob Herring
  2020-12-15 15:00   ` Rob Herring
  1 sibling, 0 replies; 11+ messages in thread
From: Rob Herring @ 2020-12-15 14:26 UTC (permalink / raw)
  To: Adrien Grassein
  Cc: lgirdwood, linux-kernel, robh+dt, devicetree, troy.kisky,
	broonie, gary.bisson

On Mon, 14 Dec 2020 23:58:50 +0100, Adrien Grassein wrote:
> Add a devicetree binding documentation for the pf8x00 regulator driver.
> 
> Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
> ---
>  .../regulator/nxp,pf8x00-regulator.yaml       | 220 ++++++++++++++++++
>  MAINTAINERS                                   |   6 +
>  2 files changed, 226 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml:71:16: [warning] wrong indentation: expected 14 but found 15 (indentation)

dtschema/dtc warnings/errors:

See https://patchwork.ozlabs.org/patch/1416222

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC
  2020-12-14 22:58 ` [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC Adrien Grassein
  2020-12-15 14:26   ` Rob Herring
@ 2020-12-15 15:00   ` Rob Herring
  1 sibling, 0 replies; 11+ messages in thread
From: Rob Herring @ 2020-12-15 15:00 UTC (permalink / raw)
  To: Adrien Grassein
  Cc: linux-kernel, devicetree, robh+dt, broonie, gary.bisson,
	lgirdwood, troy.kisky

On Mon, 14 Dec 2020 23:58:50 +0100, Adrien Grassein wrote:
> Add a devicetree binding documentation for the pf8x00 regulator driver.
> 
> Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com>
> ---
>  .../regulator/nxp,pf8x00-regulator.yaml       | 220 ++++++++++++++++++
>  MAINTAINERS                                   |   6 +
>  2 files changed, 226 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml
> 

With the whitespace fixed,

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 0/2] Add support of nxp pf8x00 regulator
  2020-12-15 13:06 ` [PATCH v3 0/2] Add " Mark Brown
  2020-12-15 13:14   ` Adrien Grassein
@ 2020-12-15 20:17   ` Jagan Teki
  1 sibling, 0 replies; 11+ messages in thread
From: Jagan Teki @ 2020-12-15 20:17 UTC (permalink / raw)
  To: Mark Brown, Adrien Grassein
  Cc: Liam Girdwood, Rob Herring, linux-kernel, devicetree, Troy Kisky,
	Gary Bisson

On Tue, Dec 15, 2020 at 6:36 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Dec 14, 2020 at 11:58:49PM +0100, Adrien Grassein wrote:
>
> > this set of patch intends to add the support of the pf8x00 PMIC
> > regulators. This family of PMIC contains 12 regulators (7 bucks
> > converters, 4 LDO, 1 RTC supply). All these 12 regulators are
> > configurable via an OTP memory and by i2c at runtime for some
> > specific properties.
>
> This looks to have raced with the addition of support for the same
> device by Jagan Teki - unfortunately I didn't register that I'd seen
> other patches for the same driver go past so I applied Jagan's version
> (both look to be based on original work by Troy), sorry about that.
> Could you please take a look at what got merged and send incremental
> improvements on top of it - I do notice that I missed the use of the
> wildcard compatible in there so that needs fixing at least.  :/

Sorry, I'm unable to understand the pharse here.  is there any issue
with the existing patchset?

Thanks,
Jagan.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-15 20:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 22:58 [PATCH v3 0/2] Add support of nxp pf8x00 regulator Adrien Grassein
2020-12-14 22:58 ` [PATCH v3 1/2] dt-bindings: regulator: add pf8x00 PMIC Adrien Grassein
2020-12-15 14:26   ` Rob Herring
2020-12-15 15:00   ` Rob Herring
2020-12-14 22:58 ` [PATCH v3 2/2] regulator: pf8x00: add support of nxp pf8x00 regulator Adrien Grassein
2020-12-15 13:06 ` [PATCH v3 0/2] Add " Mark Brown
2020-12-15 13:14   ` Adrien Grassein
2020-12-15 13:20     ` Fabio Estevam
2020-12-15 13:24       ` Mark Brown
2020-12-15 13:33         ` Adrien Grassein
2020-12-15 20:17   ` Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).