Skip to contentSkip to conversation

pv88080: PV88080 driver submission

PATCH Superseded Eric Jeong 5 participants 17 messages Oct 27, 2016 – Nov 8, 2016

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
author
#1 lore raw

PATCH v2 1/4 Documentation: pv88080: Move binding document

In reply to Eric Jeong

From: Eric Jeong <[email protected]>

The change is to move pv88080 binding document from the regulator directory to mfd binding directory for PV88080 PMIC MFD support.

---
This patch applies against linux-next and next-20161026

Hi,

Change since PATCH V1
- Patch separated from PATCH V1

Regards,
Eric Jeong, Dialog Semiconductor Ltd.

 Documentation/devicetree/bindings/mfd/pv88080.txt  |   63 ++++++++++++++++++++
 .../devicetree/bindings/regulator/pv88080.txt      |   62 -------------------
 2 files changed, 63 insertions(+), 62 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/pv88080.txt
 delete mode 100644 Documentation/devicetree/bindings/regulator/pv88080.txt
Documentation/devicetree/bindings/mfd/pv88080.txt new file +63 -0
new file mode 100644
index 0000000..7b556b1
@@ -0,0 +1,63 @@
+* Powerventure Semiconductor PV88080 PMIC
+
+Required properties:
+- compatible: Must be one of the following, depending on the
+  silicon version:
+	- "pvs,pv88080" (DEPRECATED)
+
+	- "pvs,pv88080-aa" for PV88080 AA or AB silicon
+	- "pvs,pv88080-ba" for PV88080 BA or BB silicon
+  NOTE: The use of the compatibles with no silicon version is deprecated.
+- reg: I2C slave address, usually 0x49
+- interrupts: the interrupt outputs of the controller
+- regulators: A node that houses a sub-node for each regulator within the
+  device. Each sub-node is identified using the node's name, with valid
+  values listed below. The content of each sub-node is defined by the
+  standard binding for regulators; see regulator.txt.
+  BUCK1, BUCK2, BUCK3 and HVBUCK.
+
+Optional properties:
+- Any optional property defined in regulator.txt
+  and gpio.txt for more information.
+
+Example:
+
+	pmic: pv88080@49 {
+		compatible = "pvs,pv88080-ba";
+		reg = <0x49>;
+		interrupt-parent = <&gpio>;
+		interrupts = <24 24>;
+
+		regulators {
+			BUCK1 {
+				regulator-name = "buck1";
+				regulator-min-microvolt = < 600000>;
+				regulator-max-microvolt = <1393750>;
+				regulator-min-microamp 	= < 220000>;
+				regulator-max-microamp 	= <7040000>;
+			};
+
+			BUCK2 {
+				regulator-name = "buck2";
+				regulator-min-microvolt = < 600000>;
+				regulator-max-microvolt = <1393750>;
+				regulator-min-microamp 	= <1496000>;
+				regulator-max-microamp 	= <4189000>;
+			};
+
+			BUCK3 {
+				regulator-name = "buck3";
+				regulator-min-microvolt = <1400000>;
+				regulator-max-microvolt = <2193750>;
+				regulator-min-microamp 	= <1496000>;
+				regulator-max-microamp 	= <4189000>;
+			};
+
+			HVBUCK {
+				regulator-name = "hvbuck";
+				regulator-min-microvolt = <   5000>;
+				regulator-max-microvolt = <1275000>;
+ 			};
+		};
+	};
+
Documentation/devicetree/bindings/regulator/pv88080.txt deleted +0 -62

62 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V2
author
#4 lore raw

PATCH v2 2/4 mfd: pv88080: MFD core support

In reply to Eric Jeong

From: Eric Jeong <[email protected]>

This patch adds supports for PV88080 MFD core device.

It provides communication through the I2C interface. It contains the following components:
- Regulators
- Configurable GPIOs

Kconfig and Makefile are updated to reflect support for PV88080 PMIC.

---
This patch applies against linux-next and next-20161026

Hi,

This patch adds MFD core driver for PV88080 PMIC.
This is done as part of the existing PV88080 regulator driver by expending the driver for GPIO function support.

Change since PATCH V1
- Patch separated from PATCH V1

Regards,
Eric Jeong, Dialog Semiconductor Ltd.

 drivers/mfd/Kconfig         |   12 ++
 drivers/mfd/Makefile        |    2 +
 drivers/mfd/pv88080-core.c  |  270 +++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/pv88080-i2c.c   |   99 ++++++++++++++++
 include/linux/mfd/pv88080.h |  236 +++++++++++++++++++++++++++++++++++++
 5 files changed, 619 insertions(+)
 create mode 100644 drivers/mfd/pv88080-core.c
 create mode 100644 drivers/mfd/pv88080-i2c.c
 create mode 100644 include/linux/mfd/pv88080.h
drivers/mfd/Kconfig +12 -0
index c6df644..d69edf4 100644
@@ -775,6 +775,18 @@ config MFD_PM8921_CORE
 	  Say M here if you want to include support for PM8921 chip as a module.
 	  This will build a module called "pm8921-core".
 
+config MFD_PV88080
+	bool "Powerventure Semiconductor PV88080 PMIC Support"
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	depends on I2C
+	help
+	  Say yes here for support for the Powerventure Semiconductor PV88080 PMIC.
+	  This includes the I2C driver and core APIs.
+	  Additional drivers must be enabled in order to use the functionality
+	  of the device.
+
 config MFD_QCOM_RPM
 	tristate "Qualcomm Resource Power Manager (RPM)"
 	depends on ARCH_QCOM && OF
drivers/mfd/Makefile +2 -0
index 9834e66..6248e0b 100644
@@ -173,6 +173,8 @@ obj-$(CONFIG_MFD_SI476X_CORE)	+= si476x-core.o
 obj-$(CONFIG_MFD_CS5535)	+= cs5535-mfd.o
 obj-$(CONFIG_MFD_OMAP_USB_HOST)	+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE) 	+= pm8921-core.o ssbi.o
+pv88080-objs := pv88080-core.o pv88080-i2c.o
+obj-$(CONFIG_MFD_PV88080)	+= pv88080.o
 obj-$(CONFIG_MFD_QCOM_RPM)	+= qcom_rpm.o
 obj-$(CONFIG_MFD_SPMI_PMIC)	+= qcom-spmi-pmic.o
 obj-$(CONFIG_TPS65911_COMPARATOR)	+= tps65911-comparator.o
drivers/mfd/pv88080-core.c new file +270 -0

270 lines not on this page · raw message

drivers/mfd/pv88080-i2c.c new file +99 -0

99 lines not on this page · raw message

include/linux/mfd/pv88080.h new file +236 -0

236 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V2
author
#10 lore raw

PATCH v2 3/4 regulator: pv88080: Update Regulator driver for MFD support

In reply to Eric Jeong

From: Eric Jeong <[email protected]>

This change convert from using struct i2c_clinet to using struct platform_device for MFD structure. And, the declaration of of_device_id and regmap_config are also move to MFD driver.

The configuration for MASK registers is moved
to MFD core.

Kconfig is updated to reflect support for PV88080 regulator.

---
This patch applies against linux-next and next-20161026

Hi,

The existing PV88080 regulstor driver is updated to support MFD structure by adding GPIO function.
Most of changes are related with MFD structure support.

Change since PATCH V1
- Patch separated from PATCH V1

Regards,
Eric Jeong, Dialog Semiconductor Ltd.

 drivers/regulator/Kconfig             |    5 +-
 drivers/regulator/pv88080-regulator.c |  202 +++++++++++++--------------------
 drivers/regulator/pv88080-regulator.h |  118 -------------------
 3 files changed, 81 insertions(+), 244 deletions(-)
 delete mode 100644 drivers/regulator/pv88080-regulator.h
drivers/regulator/Kconfig +2 -3
index 936f7cc..217d568 100644
@@ -576,9 +576,8 @@ config REGULATOR_PV88060
 	  PV88060
 
 config REGULATOR_PV88080
-	tristate "Powerventure Semiconductor PV88080 regulator"
-	depends on I2C
-	select REGMAP_I2C
+	bool "Powerventure Semiconductor PV88080 regulator"
+	depends on MFD_PV88080
 	help
 	  Say y here to support the buck convertors on PV88080
 
drivers/regulator/pv88080-regulator.c +79 -123

323 lines not on this page · raw message

drivers/regulator/pv88080-regulator.h deleted +0 -118

118 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V2

Eric Jeong

author
#0 lore raw

v2 cover pv88080: PV88080 driver submission

From: Eric Jeong <[email protected]>

This patch set adds support for the PV88080 PMIC.
And, this patch is done as part of the existing PV88080 Regulator driver by expanding the driver for GPIO function support.

In this patch set the following is provided:

[PATCH V2 1/4] Move binding document
[PATCH V2 2/4] MFD core support
[PATCH V2 3/4] Update regulator driver for MFD support [PATCH V2 4/4] Add GPIO function support

This patch applies against linux-next and next-20161026

Thank you,
Eric Jeong, Dialog Semiconductor Ltd.

Eric Jeong (4):
Documentation: pv88080: Move binding document
mfd: pv88080: MFD core support
regulator: pv88080: Update Regulator driver for MFD support
gpio: pv88080: Add GPIO function support

 Documentation/devicetree/bindings/mfd/pv88080.txt  |   63 +++++
 .../devicetree/bindings/regulator/pv88080.txt      |   62 -----
 drivers/gpio/Kconfig                               |   11 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-pv88080.c                        |  195 ++++++++++++++
 drivers/mfd/Kconfig                                |   12 +
 drivers/mfd/Makefile                               |    2 +
 drivers/mfd/pv88080-core.c                         |  270 ++++++++++++++++++++
 drivers/mfd/pv88080-i2c.c                          |   99 +++++++
 drivers/regulator/Kconfig                          |    5 +-
 drivers/regulator/pv88080-regulator.c              |  202 ++++++---------
 drivers/regulator/pv88080-regulator.h              |  118 ---------
 include/linux/mfd/pv88080.h                        |  236 +++++++++++++++++
 13 files changed, 970 insertions(+), 306 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/pv88080.txt
 delete mode 100644 Documentation/devicetree/bindings/regulator/pv88080.txt
 create mode 100644 drivers/gpio/gpio-pv88080.c
 create mode 100644 drivers/mfd/pv88080-core.c
 create mode 100644 drivers/mfd/pv88080-i2c.c
 delete mode 100644 drivers/regulator/pv88080-regulator.h
 create mode 100644 include/linux/mfd/pv88080.h
Signature · 1 line
end-of-patch for PATCH V2
author
#14 lore raw

PATCH v2 4/4 gpio: pv88080: Add GPIO function support

From: Eric Jeong <[email protected]>

This patch adds support for PV88080 PMIC GPIOs.
PV88080 has two configurable GPIOs.

Kconfig and Makefile are updated to reflect support for PV88080 PMIC GPIO.

---
This patch applies against linux-next and next-20161026

Hi,

Change since PATCH V1
- Patch separated from PATCH V1

Regards,
Eric Jeong, Dialog Semiconductor Ltd.

 drivers/gpio/Kconfig        |   11 +++
 drivers/gpio/Makefile       |    1 +
 drivers/gpio/gpio-pv88080.c |  195 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 207 insertions(+)
 create mode 100644 drivers/gpio/gpio-pv88080.c
drivers/gpio/Kconfig +11 -0
index a9a1c8a..c43e89c 100644
@@ -949,6 +949,17 @@ config GPIO_PALMAS
 	  Select this option to enable GPIO driver for the TI PALMAS
 	  series chip family.
 
+config GPIO_PV88080
+	bool "Powerventure Semiconductor PV88080 GPIO"
+	depends on MFD_PV88080
+	help
+	  Support for GPIO pins on PV88080 PMIC.
+
+	  Say yes here to enable the GPIO driver for the PV88080 chip.
+
+	  The Powerventure PMIC chip has 2 GPIO pins that can be
+	  controlled by this driver.
+
 config GPIO_RC5T583
 	bool "RICOH RC5T583 GPIO"
 	depends on MFD_RC5T583
drivers/gpio/Makefile +1 -0
index 8043a95..2a2311e 100644
@@ -92,6 +92,7 @@ obj-$(CONFIG_GPIO_PCF857X)	+= gpio-pcf857x.o
 obj-$(CONFIG_GPIO_PCH)		+= gpio-pch.o
 obj-$(CONFIG_GPIO_PISOSR)	+= gpio-pisosr.o
 obj-$(CONFIG_GPIO_PL061)	+= gpio-pl061.o
+obj-$(CONFIG_GPIO_PV88080)	+= gpio-pv88080.o
 obj-$(CONFIG_GPIO_PXA)		+= gpio-pxa.o
 obj-$(CONFIG_GPIO_RC5T583)	+= gpio-rc5t583.o
 obj-$(CONFIG_GPIO_RDC321X)	+= gpio-rdc321x.o
drivers/gpio/gpio-pv88080.c new file +195 -0

195 lines not on this page · raw message

Signature · 1 line
end-of-patch for PATCH V2
maintainer
#11 lore raw

Re: [PATCH V2 3/4] regulator: pv88080: Update Regulator driver for MFD support

In reply to Eric Jeong

drivers/regulator/Kconfig config REGULATOR_PV88060 · line 580

Quoted 6 lines · Eric Jeong

config REGULATOR_PV88080

drivers/regulator/Kconfig +2 -3
-	tristate "Powerventure Semiconductor PV88080 regulator"
-	depends on I2C
-	select REGMAP_I2C
+	bool "Powerventure Semiconductor PV88080 regulator"
+	depends on MFD_PV88080

Forcing the driver to be built in looks like a regression, why would we want to do that?

drivers/regulator/pv88080-regulator.c static irqreturn_t pv88080_irq_handler(int irq, void *data) · line 431

Quoted 5 lines
drivers/regulator/pv88080-regulator.c +4 -0
+	irq = platform_get_irq_byname(pdev, "regulator-irq");
+	if (irq < 0) {
+		dev_err(&pdev->dev, "Failed to get IRQ.\n");
+		return irq;
 	}

What's the _byname() adding here given that the name is so generic? It feels like if the name ever becomes important then this particular name is going to be a problem.

drivers/regulator/pv88080-regulator.c static int pv88080_i2c_probe(struct i2c_client *i2c, · line 566

Quoted 6 lines
drivers/regulator/pv88080-regulator.c +5 -1
-module_i2c_driver(pv88080_regulator_driver);
+static int __init pv88080_regulator_init(void)
+{
+	return platform_driver_register(&pv88080_regulator_driver);
+}
+subsys_initcall(pv88080_regulator_init);

Why are you converting this to subsys_initcall()? This looks like another regression.

#5 lore raw

Re: [PATCH V2 2/4] mfd: pv88080: MFD core support

In reply to Eric Jeong
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Eric,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.9-rc2 next-20161027]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Eric-Jeong/Documentation-pv88080-Move-binding-document/20161027-091356
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: alpha-allmodconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=alpha

All errors (new ones prefixed by >>):

drivers/built-in.o: In function `pv88080_i2c_probe':

>> drivers/mfd/pv88080-i2c.o:(.text+0x11652c): undefined reference to `__devm_regmap_init_i2c'
   drivers/mfd/pv88080-i2c.o:(.text+0x116548): undefined reference to `__devm_regmap_init_i2c'
   drivers/built-in.o: In function `pv88080_i2c_driver_init':
>> drivers/mfd/pv88080-i2c.o:(.init.text+0xa010): undefined reference to `i2c_register_driver'

drivers/mfd/pv88080-i2c.o:(.init.text+0xa020): undefined reference to `i2c_register_driver'

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw

Re: [PATCH V2 2/4] mfd: pv88080: MFD core support

In reply to Eric Jeong
Quoted 12 lines · Eric Jeong

From: Eric Jeong <[email protected]>

This patch adds supports for PV88080 MFD core device.

It provides communication through the I2C interface. It contains the following components:
- Regulators
- Configurable GPIOs

Kconfig and Makefile are updated to reflect support for PV88080 PMIC.

(...)

Quoted 1 line
 drivers/mfd/pv88080-i2c.c   |   99 ++++++++++++++++

This looks like a pure I2C driver.

Why is it not in drivers/i2c/busses/i2c-pv88080.c?

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

#15 lore raw

Re: [PATCH V2 4/4] gpio: pv88080: Add GPIO function support

In reply to Eric Jeong
Quoted 9 lines · Eric Jeong

From: Eric Jeong <[email protected]>

This patch adds support for PV88080 PMIC GPIOs.
PV88080 has two configurable GPIOs.

Kconfig and Makefile are updated to reflect support for PV88080 PMIC GPIO.

(...)

drivers/gpio/gpio-pv88080.c line 63

Quoted 12 lines
drivers/gpio/gpio-pv88080.c new file +12 -0
+static int pv88080_gpio_direction_input(struct gpio_chip *gc,
+                               unsigned int offset)
+{
+       struct pv88080_gpio *priv = gpiochip_get_data(gc);
+       struct pv88080 *chip = priv->chip;
+       int ret;
+
+       /* Set the initial value */
+       ret = regmap_update_bits(chip->regmap, priv->gpio_base_reg + offset,
+                                       PV88080_GPIO_OUTPUT_MASK, 0);
+       if (ret)
+               return ret;

So you set the initial value when we change the pin to *input*...

Quoted 5 lines
drivers/gpio/gpio-pv88080.c new file +5 -0
+
+       return regmap_update_bits(chip->regmap, priv->gpio_base_reg + offset,
+                               PV88080_GPIO_DIRECTION_MASK, 0);
+}
+

drivers/gpio/gpio-pv88080.c line 78

Quoted 10 lines
drivers/gpio/gpio-pv88080.c new file +10 -0
+static int pv88080_gpio_direction_output(struct gpio_chip *gc,
+                               unsigned int offset, int value)
+{
+       struct pv88080_gpio *priv = gpiochip_get_data(gc);
+       struct pv88080 *chip = priv->chip;
+       int ret;
+
+       ret = regmap_update_bits(chip->regmap, priv->gpio_base_reg + offset,
+                       PV88080_GPIO_DIRECTION_MASK,
+                       PV88080_GPIO_DIRECTION_MASK);

But do nothing when we change the pin to *output*?

It seems like you switched the two function implementations or something?

Quoted 11 lines
drivers/gpio/gpio-pv88080.c new file +11 -0
+static int pv88080_gpio_get(struct gpio_chip *gc, unsigned int offset)
+{
+       struct pv88080_gpio *priv = gpiochip_get_data(gc);
+       struct pv88080 *chip = priv->chip;
+       unsigned int reg = 0, direction;
+       int ret;
+
+       ret = regmap_read(chip->regmap, priv->gpio_base_reg + offset, &reg);
+       if (ret)
+               return ret;
+

drivers/gpio/gpio-pv88080.c line 103

Quoted 10 lines
drivers/gpio/gpio-pv88080.c new file +10 -0
+       direction = (reg & PV88080_GPIO_DIRECTION_MASK);
+       if (direction == PV88080_PORT_DIRECTION_OUTPUT) {
+               if (reg & PV88080_GPIO_OUTPUT_EN)
+                       return 1;
+               ret = 0;
+       } else {
+               ret = regmap_read(chip->regmap, priv->input_reg, &reg);
+               if (ret < 0)
+                       return ret;
+               ret = (reg & (PV88080_GPIO_INPUT_MASK << offset)) >> offset;

Isn't this what you want to do?

#include <linux/bitops.h>

ret = !!(reg & BIT(offset));

The mask is 0x01. No point in making things more complicated than they are.

Quoted 5 lines
drivers/gpio/gpio-pv88080.c new file +5 -0
+static void pv88080_gpio_set(struct gpio_chip *gc, unsigned int offset,
+                               int value)
+{
+       struct pv88080_gpio *priv = gpiochip_get_data(gc);
+       struct pv88080 *chip = priv->chip;

drivers/gpio/gpio-pv88080.c line 123

Quoted 10 lines
drivers/gpio/gpio-pv88080.c new file +10 -0
+
+       if (value)
+               regmap_update_bits(chip->regmap, priv->gpio_base_reg + offset,
+                               PV88080_GPIO_OUTPUT_MASK,
+                               PV88080_GPIO_OUTPUT_EN);
+       else
+               regmap_update_bits(chip->regmap, priv->gpio_base_reg + offset,
+                               PV88080_GPIO_OUTPUT_MASK,
+                               PV88080_GPIO_OUTPUT_DIS);
+}

Looks good, output is more complicated.

drivers/gpio/gpio-pv88080.c line 135

Quoted 11 lines
drivers/gpio/gpio-pv88080.c new file +11 -0
+static const struct gpio_chip template_gpio = {
+       .label = "pv88080-gpio",
+       .owner = THIS_MODULE,
+       .get_direction = pv88080_gpio_get_direction,
+       .direction_input = pv88080_gpio_direction_input,
+       .direction_output = pv88080_gpio_direction_output,
+       .get = pv88080_gpio_get,
+       .set = pv88080_gpio_set,
+       .base = -1,
+       .ngpio = DEFAULT_PIN_NUMBER,
+};

Why even have a #define for DEFAULT_PIN_NUMBER?
Just hardcode it here.

drivers/gpio/gpio-pv88080.c line 151

Quoted 3 lines
drivers/gpio/gpio-pv88080.c new file +3 -0
+       priv->chip = chip;
+       priv->gpio_chip = template_gpio;
+       priv->gpio_chip.parent = chip->dev;

I slightly prefer that you fill in the priv->gpio_chip with code (one assignment per line) rather than
assigning a template like here, but it's your pick.

drivers/gpio/gpio-pv88080.c line 153

Quoted 2 lines
drivers/gpio/gpio-pv88080.c new file +2 -0
+       if (pdata && pdata->gpio_base)
+               priv->gpio_chip.base = pdata->gpio_base;

Give me any good reason to support this. Please just drop this platform data. Use -1 like in the template and get dynamic assignment of GPIO numbers.

Yours,
Linus Walleij

#8 lore raw

Re: [PATCH V2 2/4] mfd: pv88080: MFD core support

In reply to Eric Jeong

drivers/mfd/pv88080-i2c.c line 34

Quoted 9 lines · Eric Jeong

+++ b/drivers/mfd/pv88080-i2c.c

drivers/mfd/pv88080-i2c.c new file +8 -0
+
+static const struct of_device_id pv88080_of_match_table[] = {
+       { .compatible = "pvs,pv88080",    .data = (void *)TYPE_PV88080_AA },
+       { .compatible = "pvs,pv88080-aa", .data = (void *)TYPE_PV88080_AA },
+       { .compatible = "pvs,pv88080-ba", .data = (void *)TYPE_PV88080_BA },
+       { },
+};
+MODULE_DEVICE_TABLE(of, pv88080_of_match_table);

Actually you are doing something weird.

The only thing you put in your device tree is this I guess.

That means that the GPIO chip does *not* have a device tree entry, so you cannot reference the GPIOs there with &phandle notation.

Please look around a bit to see how other OF-MFDs do it: they register and populate by struct mfd_cell using the .of_compatible member so that subdevices get
their own DT nodes, which is necessary for nodes providing resources such as GPIOs, regulators and clocks, lest you cannot reference them in your device tree!

Therefore I think all your subdevices should instantiate from device tree with compatible matching as well, not as platform devices.

include/linux/mfd/pv88080.h line 228

Quoted 4 lines
include/linux/mfd/pv88080.h new file +4 -0
+struct pv88080_pdata {
+       int (*init)(struct pv88080 *pv88080);
+       int irq_base;
+       int gpio_base;

NAK.

Get irq from the device tree, assign gpio base dynamically.

Quoted 1 line

+ struct regulator_init_data *regulators[PV88080_MAX_REGULATORS];

I suspect also this should come from the device tree.

Yours,
Linus Walleij

maintainer
#2 lore raw

Re: [PATCH V2 1/4] Documentation: pv88080: Move binding document

In reply to Eric Jeong
Quoted 22 lines · Eric Jeong

From: Eric Jeong <[email protected]>

The change is to move pv88080 binding document from the regulator directory to mfd binding directory for PV88080 PMIC MFD support.

---
This patch applies against linux-next and next-20161026

Hi,

Change since PATCH V1
- Patch separated from PATCH V1

Regards,
Eric Jeong, Dialog Semiconductor Ltd.

Quoted 5 lines
 Documentation/devicetree/bindings/mfd/pv88080.txt  |   63 ++++++++++++++++++++
 .../devicetree/bindings/regulator/pv88080.txt      |   62 -------------------
 2 files changed, 63 insertions(+), 62 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/pv88080.txt
 delete mode 100644 Documentation/devicetree/bindings/regulator/pv88080.txt

Please resend using git-format-patch -M option.

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

#12 lore raw

RE: [PATCH V2 3/4] regulator: pv88080: Update Regulator driver for MFD support

In reply to Mark Brown
Quoted 22 lines · Mark Brown

drivers/regulator/Kconfig config REGULATOR_PV88060 · line 580

Quoted 6 lines · Eric Jeong

config REGULATOR_PV88080

drivers/regulator/Kconfig +2 -3
-	tristate "Powerventure Semiconductor PV88080 regulator"
-	depends on I2C
-	select REGMAP_I2C
+	bool "Powerventure Semiconductor PV88080 regulator"
+	depends on MFD_PV88080

Forcing the driver to be built in looks like a regression, why would we want to do that?

drivers/regulator/pv88080-regulator.c static irqreturn_t pv88080_irq_handler(int irq, void *data) · line 431

Quoted 5 lines
drivers/regulator/pv88080-regulator.c +4 -0
+	irq = platform_get_irq_byname(pdev, "regulator-irq");
+	if (irq < 0) {
+		dev_err(&pdev->dev, "Failed to get IRQ.\n");
+		return irq;
 	}

What's the _byname() adding here given that the name is so generic? It feels like if the name ever becomes important then this particular name is going to be a problem.

Quoted 8 lines

drivers/regulator/pv88080-regulator.c static int pv88080_i2c_probe(struct i2c_client *i2c, · line 566

Quoted 5 lines
drivers/regulator/pv88080-regulator.c +4 -1
-module_i2c_driver(pv88080_regulator_driver);
+static int __init pv88080_regulator_init(void) {
+	return platform_driver_register(&pv88080_regulator_driver);
+}
+subsys_initcall(pv88080_regulator_init);

Why are you converting this to subsys_initcall()? This looks like another regression.

Thank you for the comments.
There was an internal request to release driver based on Kernel 3.18 for GPIO and MFD support. After that, the code has been kept. I will send a patch again after changes.

Regards
Eric
--
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

#7 lore raw

RE: [PATCH V2 2/4] mfd: pv88080: MFD core support

In reply to Linus Walleij
Quoted 16 lines · Linux Walleij
Quoted 12 lines · Eric Jeong

From: Eric Jeong <[email protected]>

This patch adds supports for PV88080 MFD core device.

It provides communication through the I2C interface. It contains the following components:
- Regulators
- Configurable GPIOs

Kconfig and Makefile are updated to reflect support for PV88080 PMIC.

(...)

Quoted 8 lines
Quoted 1 line
 drivers/mfd/pv88080-i2c.c   |   99 ++++++++++++++++

This looks like a pure I2C driver.

Why is it not in drivers/i2c/busses/i2c-pv88080.c?

Yours,
Linus Walleij

Ok. I agree with you. So, I will send patch again after combining the relevant files into one. Thank you.

Regards
Eric

#16 lore raw

RE: [PATCH V2 4/4] gpio: pv88080: Add GPIO function support

In reply to Linus Walleij

T24gRnJpZGF5LCBPY3RvYmVyIDI4LCAyMDE2IDk6MTEgUE0sIExpbnV4IFdhbGxlaWogd3JvdGU6 DQoNCj4gT24gVGh1LCBPY3QgMjcsIDIwMTYgYXQgMzowMyBBTSwgRXJpYyBKZW9uZw0KPiA8ZXJp Yy5qZW9uZy5vcGVuc291cmNlQGRpYXNlbWkuY29tPiB3cm90ZToNCj4gDQo+ID4gRnJvbTogRXJp YyBKZW9uZyA8ZXJpYy5qZW9uZy5vcGVuc291cmNlQGRpYXNlbWkuY29tPg0KPiA+DQo+ID4gVGhp cyBwYXRjaCBhZGRzIHN1cHBvcnQgZm9yIFBWODgwODAgUE1JQyBHUElPcy4NCj4gPiBQVjg4MDgw IGhhcyB0d28gY29uZmlndXJhYmxlIEdQSU9zLg0KPiA+DQo+ID4gS2NvbmZpZyBhbmQgTWFrZWZp bGUgYXJlIHVwZGF0ZWQgdG8gcmVmbGVjdCBzdXBwb3J0IGZvciBQVjg4MDgwIFBNSUMNCj4gPiBH UElPLg0KPiA+DQo+ID4gU2lnbmVkLW9mZi1ieTogRXJpYyBKZW9uZyA8ZXJpYy5qZW9uZy5vcGVu c291cmNlQGRpYXNlbWkuY29tPg0KPiAoLi4uKQ0KPiANCj4gPiArc3RhdGljIGludCBwdjg4MDgw X2dwaW9fZGlyZWN0aW9uX2lucHV0KHN0cnVjdCBncGlvX2NoaXAgKmdjLA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgdW5zaWduZWQgaW50IG9mZnNldCkgew0KPiA+ICsgICAg ICAgc3RydWN0IHB2ODgwODBfZ3BpbyAqcHJpdiA9IGdwaW9jaGlwX2dldF9kYXRhKGdjKTsNCj4g PiArICAgICAgIHN0cnVjd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Mg cGxhdGZvcm0gZGF0YS4NCj4gVXNlIC0xIGxpa2UgaW4gdGhlIHRlbXBsYXRlIGFuZCBnZXQgZHlu YW1pYyBhc3NpZ25tZW50IG9mIEdQSU8gbnVtYmVycy4NCj4gDQo+IFlvdXJzLA0KPiBMaW51cyBX YWxsZWlqDQoNClRoYW5rIHlvdSBmb3IgdGhlIGNvbW1lbnRzIGFuZCByZWNvbW1lbmRhdGlvbi4N Ckkgd2lsbCB0cnkgdG8gdXBkYXRlZCB0aGUgY29kZSBsaWtlIHlvdXIgcmVjb21tZW5kYXRpb24g YW5kIG1ha2UgaXQgc2ltcGxlLiAgVGhlbiwgSSB3aWxsIHNlbmQgcGF0Y2ggYWdhaW4uDQoNClJl Z2FyZHMNCkVyaWMNCg==
--
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

#9 lore raw

RE: [PATCH V2 2/4] mfd: pv88080: MFD core support

In reply to Linus Walleij
Quoted 38 lines · Linus Walleij

drivers/mfd/pv88080-i2c.c line 34

Quoted 9 lines · Eric Jeong

+++ b/drivers/mfd/pv88080-i2c.c

drivers/mfd/pv88080-i2c.c new file +8 -0
+
+static const struct of_device_id pv88080_of_match_table[] = {
+       { .compatible = "pvs,pv88080",    .data = (void *)TYPE_PV88080_AA },
+       { .compatible = "pvs,pv88080-aa", .data = (void *)TYPE_PV88080_AA },
+       { .compatible = "pvs,pv88080-ba", .data = (void *)TYPE_PV88080_BA },
+       { },
+};
+MODULE_DEVICE_TABLE(of, pv88080_of_match_table);

Actually you are doing something weird.

The only thing you put in your device tree is this I guess.

That means that the GPIO chip does *not* have a device tree entry, so you cannot reference the GPIOs there with &phandle notation.

Please look around a bit to see how other OF-MFDs do it: they register and populate by struct mfd_cell using the .of_compatible member so that subdevices get their own DT nodes, which is necessary for nodes providing resources such as GPIOs, regulators and clocks, lest you cannot reference them in your device tree!

Therefore I think all your subdevices should instantiate from device tree with compatible matching as well, not as platform devices.

include/linux/mfd/pv88080.h line 228

Quoted 4 lines
include/linux/mfd/pv88080.h new file +4 -0
+struct pv88080_pdata {
+       int (*init)(struct pv88080 *pv88080);
+       int irq_base;
+       int gpio_base;

NAK.

Get irq from the device tree, assign gpio base dynamically.

Quoted 7 lines
Quoted 2 lines

+ struct regulator_init_data
+ *regulators[PV88080_MAX_REGULATORS];

I suspect also this should come from the device tree.

Yours,
Linus Walleij

Thank you for the comments.
I will send patch again.

Regards
Eric

#3 lore raw

RE: [PATCH V2 1/4] Documentation: pv88080: Move binding document

In reply to Rob Herring
Quoted 30 lines · Rob Herring
Quoted 14 lines · Eric Jeong

From: Eric Jeong <[email protected]>

The change is to move pv88080 binding document from the regulator directory to mfd binding directory for PV88080 PMIC MFD support.

---
This patch applies against linux-next and next-20161026

Hi,

Quoted 8 lines

Change since PATCH V1
- Patch separated from PATCH V1

Regards,
Eric Jeong, Dialog Semiconductor Ltd.

 Documentation/devicetree/bindings/mfd/pv88080.txt  |   63

++++++++++++++++++++

Quoted 5 lines
 .../devicetree/bindings/regulator/pv88080.txt      |   62 -------------------
 2 files changed, 63 insertions(+), 62 deletions(-)  create mode
100644 Documentation/devicetree/bindings/mfd/pv88080.txt
 delete mode 100644

Documentation/devicetree/bindings/regulator/pv88080.txt

Quoted 3 lines

Please resend using git-format-patch -M option.

Rob

Thank you for the comments.
Maybe the document will be updated additionally.
I will send patch again.

Regards
Eric
--
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

maintainer
#13 lore raw

Re: [PATCH V2 3/4] regulator: pv88080: Update Regulator driver for MFD support

In reply to Eric Hyeung Dong Jeong
Quoted 3 lines · Eric Hyeung Dong Jeong

Thank you for the comments.
There was an internal request to release driver based on Kernel 3.18 for GPIO and MFD support. After that, the code has been kept. I will send a patch again after changes.

Please don't submit code for ancient kernels upstream, we can't merge anything that isn't for current kernels.