* [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements
@ 2015-12-23 10:58 Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions Paul Kocialkowski
` (5 more replies)
0 siblings, 6 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, devicetree, Rob Herring,
Benoît Cousson, Kumar Gala, linux-omap, linux-arm-kernel
This series introduces support for the LG Optimus Black, as described in the
patch adding devicetree support for the device.
In order to power the external mmc (mmc1), the lp872x regulator is used.
Its code had to be improved a bit to work on the device.
Note that the patch adding devicetree support for the device requires the
changes applied to the lp872x regulator, so all this is sent in one series
despite the fact they're different parts of the code.
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
@ 2015-12-23 10:58 ` Paul Kocialkowski
2015-12-28 1:04 ` Milo Kim
2015-12-23 10:58 ` [PATCH 2/6] regulator: lp872x: Get rid of duplicate reference to DVS GPIO Paul Kocialkowski
` (4 subsequent siblings)
5 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, Paul Kocialkowski,
devicetree, Rob Herring, Benoît Cousson, Kumar Gala,
linux-omap, linux-arm-kernel
In order to select the regulators via of_find_regulator_by_node (and thus use
them in devicetree), defining of_match for each regulator is required.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
drivers/regulator/lp872x.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index e5af072..9412353 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -520,6 +520,7 @@ static struct regulator_ops lp8725_buck_ops = {
static struct regulator_desc lp8720_regulator_desc[] = {
{
.name = "ldo1",
+ .of_match = of_match_ptr("ldo1"),
.id = LP8720_ID_LDO1,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -533,6 +534,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
},
{
.name = "ldo2",
+ .of_match = of_match_ptr("ldo2"),
.id = LP8720_ID_LDO2,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -546,6 +548,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
},
{
.name = "ldo3",
+ .of_match = of_match_ptr("ldo3"),
.id = LP8720_ID_LDO3,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -559,6 +562,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
},
{
.name = "ldo4",
+ .of_match = of_match_ptr("ldo4"),
.id = LP8720_ID_LDO4,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp8720_ldo4_vtbl),
@@ -572,6 +576,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
},
{
.name = "ldo5",
+ .of_match = of_match_ptr("ldo5"),
.id = LP8720_ID_LDO5,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -585,6 +590,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
},
{
.name = "buck",
+ .of_match = of_match_ptr("buck"),
.id = LP8720_ID_BUCK,
.ops = &lp8720_buck_ops,
.n_voltages = ARRAY_SIZE(lp8720_buck_vtbl),
@@ -599,6 +605,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
static struct regulator_desc lp8725_regulator_desc[] = {
{
.name = "ldo1",
+ .of_match = of_match_ptr("ldo1"),
.id = LP8725_ID_LDO1,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -612,6 +619,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "ldo2",
+ .of_match = of_match_ptr("ldo2"),
.id = LP8725_ID_LDO2,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -625,6 +633,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "ldo3",
+ .of_match = of_match_ptr("ldo3"),
.id = LP8725_ID_LDO3,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -638,6 +647,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "ldo4",
+ .of_match = of_match_ptr("ldo4"),
.id = LP8725_ID_LDO4,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -651,6 +661,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "ldo5",
+ .of_match = of_match_ptr("ldo5"),
.id = LP8725_ID_LDO5,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
@@ -664,6 +675,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "lilo1",
+ .of_match = of_match_ptr("lilo1"),
.id = LP8725_ID_LILO1,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp8725_lilo_vtbl),
@@ -677,6 +689,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "lilo2",
+ .of_match = of_match_ptr("lilo2"),
.id = LP8725_ID_LILO2,
.ops = &lp872x_ldo_ops,
.n_voltages = ARRAY_SIZE(lp8725_lilo_vtbl),
@@ -690,6 +703,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "buck1",
+ .of_match = of_match_ptr("buck1"),
.id = LP8725_ID_BUCK1,
.ops = &lp8725_buck_ops,
.n_voltages = ARRAY_SIZE(lp8725_buck_vtbl),
@@ -701,6 +715,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
{
.name = "buck2",
+ .of_match = of_match_ptr("buck2"),
.id = LP8725_ID_BUCK2,
.ops = &lp8725_buck_ops,
.n_voltages = ARRAY_SIZE(lp8725_buck_vtbl),
--
1.9.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 2/6] regulator: lp872x: Get rid of duplicate reference to DVS GPIO
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions Paul Kocialkowski
@ 2015-12-23 10:58 ` Paul Kocialkowski
2015-12-28 1:05 ` Milo Kim
2015-12-23 10:58 ` [PATCH 3/6] regulator: lp872x: Remove warning about invalid " Paul Kocialkowski
` (3 subsequent siblings)
5 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, Paul Kocialkowski,
devicetree, Rob Herring, Benoît Cousson, Kumar Gala,
linux-omap, linux-arm-kernel
The lp872x structure holds a reference to the DVS GPIO, but it is never actually
used anywhere, since a first reference exists from the lp872x_dvs structure.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
drivers/regulator/lp872x.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index 9412353..19d7584 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -108,7 +108,6 @@ struct lp872x {
struct lp872x_platform_data *pdata;
int num_regulators;
enum lp872x_dvs_state dvs_pin;
- int dvs_gpio;
};
/* LP8720/LP8725 shared voltage table for LDOs */
@@ -752,7 +751,6 @@ static int lp872x_init_dvs(struct lp872x *lp)
}
lp->dvs_pin = pinstate;
- lp->dvs_gpio = gpio;
return 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 3/6] regulator: lp872x: Remove warning about invalid DVS GPIO
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 2/6] regulator: lp872x: Get rid of duplicate reference to DVS GPIO Paul Kocialkowski
@ 2015-12-23 10:58 ` Paul Kocialkowski
2015-12-23 11:41 ` Mark Brown
2015-12-23 10:58 ` [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support Paul Kocialkowski
` (2 subsequent siblings)
5 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, Paul Kocialkowski,
devicetree, Rob Herring, Benoît Cousson, Kumar Gala,
linux-omap, linux-arm-kernel
Some devices don't hook the DVS pin to a GPIO but to ground or VCC.
In those cases, it is not a problem to have no DVS GPIO.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
drivers/regulator/lp872x.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index 19d7584..21c49d8 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -738,10 +738,8 @@ static int lp872x_init_dvs(struct lp872x *lp)
goto set_default_dvs_mode;
gpio = dvs->gpio;
- if (!gpio_is_valid(gpio)) {
- dev_warn(lp->dev, "invalid gpio: %d\n", gpio);
+ if (!gpio_is_valid(gpio))
goto set_default_dvs_mode;
- }
pinstate = dvs->init_state;
ret = devm_gpio_request_one(lp->dev, gpio, pinstate, "LP872X DVS");
--
1.9.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
` (2 preceding siblings ...)
2015-12-23 10:58 ` [PATCH 3/6] regulator: lp872x: Remove warning about invalid " Paul Kocialkowski
@ 2015-12-23 10:58 ` Paul Kocialkowski
[not found] ` <1450868319-20513-5-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
2015-12-23 10:58 ` [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 6/6] ARM: multi_v7_defconfig: Enable LP872x regulator support Paul Kocialkowski
5 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, Paul Kocialkowski,
devicetree, Rob Herring, Benoît Cousson, Kumar Gala,
linux-omap, linux-arm-kernel
LP872x regulators are made active via the EN pin, which might be hooked to a
GPIO. This adds support for driving the GPIO high when the driver is in use.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
.../devicetree/bindings/regulator/lp872x.txt | 1 +
drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
include/linux/regulator/lp872x.h | 2 ++
3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
index 7818318..0559c25 100644
--- a/Documentation/devicetree/bindings/regulator/lp872x.txt
+++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
@@ -28,6 +28,7 @@ Optional properties:
- ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
- ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
- ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
+ - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
Sub nodes for regulator_init_data
LP8720 has maximum 6 nodes. (child name: ldo1 ~ 5 and buck)
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index 21c49d8..c8855f3 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -726,6 +726,27 @@ static struct regulator_desc lp8725_regulator_desc[] = {
},
};
+static int lp872x_init_enable(struct lp872x *lp)
+{
+ int ret, gpio;
+
+ if (!lp->pdata)
+ return -EINVAL;
+
+ gpio = lp->pdata->enable_gpio;
+ if (!gpio_is_valid(gpio))
+ return 0;
+
+ /* Always set enable GPIO high. */
+ ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
+ if (ret) {
+ dev_err(lp->dev, "gpio request err: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
static int lp872x_init_dvs(struct lp872x *lp)
{
int ret, gpio;
@@ -763,14 +784,18 @@ static int lp872x_config(struct lp872x *lp)
int ret;
if (!pdata || !pdata->update_config)
- goto init_dvs;
+ goto init_dvs_enable;
ret = lp872x_write_byte(lp, LP872X_GENERAL_CFG, pdata->general_config);
if (ret)
return ret;
-init_dvs:
- return lp872x_init_dvs(lp);
+init_dvs_enable:
+ ret = lp872x_init_dvs(lp);
+ if (ret)
+ return ret;
+
+ return lp872x_init_enable(lp);
}
static struct regulator_init_data
@@ -875,6 +900,8 @@ static struct lp872x_platform_data
of_property_read_u8(np, "ti,dvs-state", &dvs_state);
pdata->dvs->init_state = dvs_state ? DVS_HIGH : DVS_LOW;
+ pdata->enable_gpio = of_get_named_gpio(np, "ti,enable-gpio", 0);
+
if (of_get_child_count(np) == 0)
goto out;
diff --git a/include/linux/regulator/lp872x.h b/include/linux/regulator/lp872x.h
index 132e05c..44316dd 100644
--- a/include/linux/regulator/lp872x.h
+++ b/include/linux/regulator/lp872x.h
@@ -79,12 +79,14 @@ struct lp872x_regulator_data {
* @update_config : if LP872X_GENERAL_CFG register is updated, set true
* @regulator_data : platform regulator id and init data
* @dvs : dvs data for buck voltage control
+ * @enable_gpio : gpio pin number for enable control
*/
struct lp872x_platform_data {
u8 general_config;
bool update_config;
struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
struct lp872x_dvs *dvs;
+ int enable_gpio;
};
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
` (3 preceding siblings ...)
2015-12-23 10:58 ` [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support Paul Kocialkowski
@ 2015-12-23 10:58 ` Paul Kocialkowski
[not found] ` <1450868319-20513-6-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
2015-12-23 16:03 ` Javier Martinez Canillas
2015-12-23 10:58 ` [PATCH 6/6] ARM: multi_v7_defconfig: Enable LP872x regulator support Paul Kocialkowski
5 siblings, 2 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, Paul Kocialkowski,
devicetree, Rob Herring, Benoît Cousson, Kumar Gala,
linux-omap, linux-arm-kernel
The LG Optimus Black (P970) codename sniper is a smartphone that was designed
and manufactured by LG Electronics (LGE) and released back in 2011.
It is using an OMAP3630 SoC, GP version.
This adds devicetree support for the device, with only a few basic features
supported, such as debug uart, i2c, internal emmc and external mmc.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/omap3-sniper.dts | 220 +++++++++++++++++++++++++++++++++++++
2 files changed, 221 insertions(+)
create mode 100644 arch/arm/boot/dts/omap3-sniper.dts
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 30bbc37..2c71106 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -447,6 +447,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \
omap3-sbc-t3517.dtb \
omap3-sbc-t3530.dtb \
omap3-sbc-t3730.dtb \
+ omap3-sniper.dtb \
omap3-thunder.dtb \
omap3-zoom3.dtb
dtb-$(CONFIG_SOC_TI81XX) += \
diff --git a/arch/arm/boot/dts/omap3-sniper.dts b/arch/arm/boot/dts/omap3-sniper.dts
new file mode 100644
index 0000000..6c2d99a
--- /dev/null
+++ b/arch/arm/boot/dts/omap3-sniper.dts
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "omap36xx.dtsi"
+
+/ {
+ model = "LG Optimus Black (P970)";
+ compatible = "lge,omap3-sniper", "ti,omap36xx", "ti,omap3";
+
+ cpus {
+ cpu@0 {
+ cpu0-supply = <&vcc>;
+ };
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x80000000 0x20000000>; /* 512 MB */
+ };
+};
+
+&omap3_pmx_core {
+ pinctrl-names = "default";
+
+ uart3_pins: pinmux_uart3_pins {
+ pinctrl-single,pins = <
+ 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx */
+ 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx */
+ >;
+ };
+
+ i2c1_pins: pinmux_i2c1_pins {
+ pinctrl-single,pins = <
+ 0x18a (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
+ 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
+ >;
+ };
+
+ i2c2_pins: pinmux_i2c2_pins {
+ pinctrl-single,pins = <
+ 0x18e (PIN_INPUT | MUX_MODE0) /* i2c2_scl */
+ 0x190 (PIN_INPUT | MUX_MODE0) /* i2c2_sda */
+ >;
+ };
+
+ i2c3_pins: pinmux_i2c3_pins {
+ pinctrl-single,pins = <
+ 0x192 (PIN_INPUT | MUX_MODE0) /* i2c3_scl */
+ 0x194 (PIN_INPUT | MUX_MODE0) /* i2c3_sda */
+ >;
+ };
+
+ lp8720_en_pin: pinmux_lp8720_en_pin {
+ pinctrl-single,pins = <
+ 0x80 (PIN_OUTPUT | MUX_MODE4) /* gpio_37 */
+ >;
+ };
+
+ mmc1_pins: pinmux_mmc1_pins {
+ pinctrl-single,pins = <
+ 0x114 (PIN_INPUT | MUX_MODE0) /* sdmmc1_clk */
+ 0x116 (PIN_INPUT | MUX_MODE0) /* sdmmc1_cmd */
+ 0x118 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat0 */
+ 0x11a (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat1 */
+ 0x11c (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat2 */
+ 0x11e (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat3 */
+ >;
+ };
+
+ mmc2_pins: pinmux_mmc2_pins {
+ pinctrl-single,pins = <
+ 0x128 (PIN_INPUT | MUX_MODE0) /* sdmmc2_clk */
+ 0x12a (PIN_INPUT | MUX_MODE0) /* sdmmc2_cmd */
+ 0x12c (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat0 */
+ 0x12e (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat1 */
+ 0x130 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat2 */
+ 0x132 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat3 */
+ 0x134 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat4 */
+ 0x136 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat5 */
+ 0x138 (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat6 */
+ 0x13a (PIN_INPUT | MUX_MODE0) /* sdmmc2_dat7 */
+ >;
+ };
+};
+
+&omap3_pmx_wkup {
+ pinctrl-names = "default";
+
+ mmc1_cd_pin: pinmux_mmc1_cd_pin {
+ pinctrl-single,pins = <
+ 0x1a (PIN_INPUT | MUX_MODE4) /* gpio_10 */
+ >;
+ };
+};
+
+&gpio1 {
+ ti,no-reset-on-init;
+};
+
+&gpio2 {
+ ti,no-reset-on-init;
+};
+
+&gpio3 {
+ ti,no-reset-on-init;
+};
+
+&gpio4 {
+ ti,no-reset-on-init;
+};
+
+&gpio5 {
+ ti,no-reset-on-init;
+};
+
+&gpio6 {
+ ti,no-reset-on-init;
+};
+
+&uart3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart3_pins>;
+
+ interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>;
+};
+
+&i2c1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+
+ clock-frequency = <2600000>;
+
+ twl: twl@48 {
+ reg = <0x48>;
+ interrupts = <7>; /* SYS_NIRQ cascaded to intc */
+ interrupt-parent = <&intc>;
+
+ twl_power: power {
+ compatible = "ti,twl4030-power";
+ ti,use_poweroff;
+ };
+ };
+};
+
+#include "twl4030.dtsi"
+#include "twl4030_omap3.dtsi"
+
+&i2c2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c2_pins>;
+
+ clock-frequency = <400000>;
+};
+
+&i2c3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c3_pins>;
+
+ clock-frequency = <400000>;
+
+ lp8720@7d {
+ pinctrl-names = "default";
+ pinctrl-0 = <&lp8720_en_pin>;
+
+ compatible = "ti,lp8720";
+ reg = <0x7d>;
+
+ ti,enable-gpio = <&gpio2 5 GPIO_ACTIVE_HIGH>; /* gpio_37 */
+
+ lp8720_ldo1: ldo1 {
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3000000>;
+ };
+ };
+};
+
+&mmc1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc1_pins &mmc1_cd_pin>;
+ vmmc-supply = <&lp8720_ldo1>;
+ cd-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; /* gpio 10 */
+ bus-width = <4>;
+};
+
+&mmc2 {
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc2_pins>;
+ vmmc-supply = <&vmmc2>;
+ ti,non-removable;
+ bus-width = <8>;
+};
+
+&mmc3 {
+ status = "disabled";
+};
+
+/*
+ * The TWL4030 VAUX2 and VDAC regulators power sensors that are slaves on I2C3.
+ * When not powered, these sensors cause the I2C3 clock to stay low at all times,
+ * making it impossible to reach other devices on I2C3.
+ */
+
+&vaux2 {
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
+ regulator-always-on;
+};
+
+&vdac {
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-always-on;
+};
--
1.9.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH 6/6] ARM: multi_v7_defconfig: Enable LP872x regulator support
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
` (4 preceding siblings ...)
2015-12-23 10:58 ` [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features Paul Kocialkowski
@ 2015-12-23 10:58 ` Paul Kocialkowski
5 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 10:58 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood, Paul Kocialkowski,
devicetree, Rob Herring, Benoît Cousson, Kumar Gala,
linux-omap, linux-arm-kernel
The LP872x regulator is used in the LG Optimus Black (P970) codename sniper
to supply the external mmc card.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
arch/arm/configs/multi_v7_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 69a22fd..e2c01f0 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -425,6 +425,7 @@ CONFIG_REGULATOR_RK808=y
CONFIG_REGULATOR_GPIO=y
CONFIG_MFD_SYSCON=y
CONFIG_POWER_RESET_SYSCON=y
+CONFIG_REGULATOR_LP872X=y
CONFIG_REGULATOR_MAX14577=m
CONFIG_REGULATOR_MAX8907=y
CONFIG_REGULATOR_MAX8973=y
--
1.9.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 3/6] regulator: lp872x: Remove warning about invalid DVS GPIO
2015-12-23 10:58 ` [PATCH 3/6] regulator: lp872x: Remove warning about invalid " Paul Kocialkowski
@ 2015-12-23 11:41 ` Mark Brown
2015-12-23 11:50 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Mark Brown @ 2015-12-23 11:41 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Tony Lindgren,
Liam Girdwood, Milo Kim, devicetree, linux-arm-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]
On Wed, Dec 23, 2015 at 11:58:36AM +0100, Paul Kocialkowski wrote:
> Some devices don't hook the DVS pin to a GPIO but to ground or VCC.
> In those cases, it is not a problem to have no DVS GPIO.
I would expect the driver at least needs to know how the pins or
strapped, or otherwise have configuration for ignoring the input on the
pins. This just deletes the warnings, it doesn't have any handling for
this case that I can see.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/6] regulator: lp872x: Remove warning about invalid DVS GPIO
2015-12-23 11:41 ` Mark Brown
@ 2015-12-23 11:50 ` Paul Kocialkowski
2015-12-23 11:58 ` Mark Brown
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 11:50 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Tony Lindgren,
Liam Girdwood, Milo Kim, devicetree, linux-arm-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]
Le mercredi 23 décembre 2015 à 11:41 +0000, Mark Brown a écrit :
> On Wed, Dec 23, 2015 at 11:58:36AM +0100, Paul Kocialkowski wrote:
> > Some devices don't hook the DVS pin to a GPIO but to ground or VCC.
> > In those cases, it is not a problem to have no DVS GPIO.
>
> I would expect the driver at least needs to know how the pins or
> strapped, or otherwise have configuration for ignoring the input on the
> pins. This just deletes the warnings, it doesn't have any handling for
> this case that I can see.
When the DVS GPIO is invalid, lp872x_init_dvs jumps to the
set_default_dvs_mode label, which instructs the chip not to use the DVS
pin at all and do it all in software instead (by clearing the
LP8720_EXT_DVS_M bit in the LP872X_GENERAL_CFG register).
That is reflected later in the code, when setting the bucks (the DVS pin
only applies to the bucks) by checking for the LP8720_EXT_DVS_M bit on
the LP872X_GENERAL_CFG register (in lp872x_select_buck_vout_addr) to
decide whether to use software or hardware DVS selection.
As far as I understood, everything goes well when the GPIO is invalid.
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <1450868319-20513-5-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
@ 2015-12-23 11:56 ` Mark Brown
2015-12-23 12:52 ` Paul Kocialkowski
` (2 more replies)
2015-12-28 0:34 ` Milo Kim
2015-12-29 20:02 ` Rob Herring
2 siblings, 3 replies; 42+ messages in thread
From: Mark Brown @ 2015-12-23 11:56 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood, Milo Kim,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> + gpio = lp->pdata->enable_gpio;
> + if (!gpio_is_valid(gpio))
> + return 0;
> +
> + /* Always set enable GPIO high. */
> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> + if (ret) {
> + dev_err(lp->dev, "gpio request err: %d\n", ret);
> + return ret;
> + }
This isn't really adding support for the enable GPIO as the changelog
suggests, it's requesting but not managing the GPIO. Since there is
core support for manging enable GPIOs this seems especially silly,
please tell the core about the GPIO and then it will work at runtime
too.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 3/6] regulator: lp872x: Remove warning about invalid DVS GPIO
2015-12-23 11:50 ` Paul Kocialkowski
@ 2015-12-23 11:58 ` Mark Brown
0 siblings, 0 replies; 42+ messages in thread
From: Mark Brown @ 2015-12-23 11:58 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood, Milo Kim,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
On Wed, Dec 23, 2015 at 12:50:20PM +0100, Paul Kocialkowski wrote:
> Le mercredi 23 décembre 2015 à 11:41 +0000, Mark Brown a écrit :
> > I would expect the driver at least needs to know how the pins or
> > strapped, or otherwise have configuration for ignoring the input on the
> > pins. This just deletes the warnings, it doesn't have any handling for
> > this case that I can see.
> When the DVS GPIO is invalid, lp872x_init_dvs jumps to the
> set_default_dvs_mode label, which instructs the chip not to use the DVS
> pin at all and do it all in software instead (by clearing the
> LP8720_EXT_DVS_M bit in the LP872X_GENERAL_CFG register).
> That is reflected later in the code, when setting the bucks (the DVS pin
> only applies to the bucks) by checking for the LP8720_EXT_DVS_M bit on
> the LP872X_GENERAL_CFG register (in lp872x_select_buck_vout_addr) to
> decide whether to use software or hardware DVS selection.
> As far as I understood, everything goes well when the GPIO is invalid.
So please put this analysis in the changelog so that the changelog
accurately reflects what the change is doing.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-23 11:56 ` Mark Brown
@ 2015-12-23 12:52 ` Paul Kocialkowski
[not found] ` <20151223115632.GS16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-12-28 0:56 ` Milo Kim
2 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-23 12:52 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Tony Lindgren,
Liam Girdwood, Milo Kim, devicetree, linux-arm-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]
Le mercredi 23 décembre 2015 à 11:56 +0000, Mark Brown a écrit :
> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
>
> > + gpio = lp->pdata->enable_gpio;
> > + if (!gpio_is_valid(gpio))
> > + return 0;
> > +
> > + /* Always set enable GPIO high. */
> > + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> > + if (ret) {
> > + dev_err(lp->dev, "gpio request err: %d\n", ret);
> > + return ret;
> > + }
>
> This isn't really adding support for the enable GPIO as the changelog
> suggests, it's requesting but not managing the GPIO. Since there is
> core support for manging enable GPIOs this seems especially silly,
> please tell the core about the GPIO and then it will work at runtime
> too.
You're right, I had clearly overlooked this, thanks for pointing it out.
Will send v2 using GPIO handling from core.
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features
[not found] ` <1450868319-20513-6-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
@ 2015-12-23 15:44 ` Tony Lindgren
2015-12-24 19:38 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Tony Lindgren @ 2015-12-23 15:44 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Liam Girdwood, Mark Brown, Milo Kim,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
Hi,
* Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org> [151223 03:00]:
> The LG Optimus Black (P970) codename sniper is a smartphone that was designed
> and manufactured by LG Electronics (LGE) and released back in 2011.
> It is using an OMAP3630 SoC, GP version.
>
> This adds devicetree support for the device, with only a few basic features
> supported, such as debug uart, i2c, internal emmc and external mmc.
Cool :)
> +&gpio1 {
> + ti,no-reset-on-init;
> +};
> +
> +&gpio2 {
> + ti,no-reset-on-init;
> +};
> +
> +&gpio3 {
> + ti,no-reset-on-init;
> +};
> +
> +&gpio4 {
> + ti,no-reset-on-init;
> +};
> +
> +&gpio5 {
> + ti,no-reset-on-init;
> +};
> +
> +&gpio6 {
> + ti,no-reset-on-init;
> +};
Care to try to narrow down exactly which GPIO(s) need to be preserved?
Chances are this will unnecessarily block deeper idle states in hardware
otherwise.
My guess is that the GPIO pins that need to be preserved if any are in
the GPIO bank 1 as that's always powered..
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features
2015-12-23 10:58 ` [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features Paul Kocialkowski
[not found] ` <1450868319-20513-6-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
@ 2015-12-23 16:03 ` Javier Martinez Canillas
[not found] ` <CABxcv=moAUEPo8sq5KhuLZChrQtwjF1aBeNvV1i8HvUnwDXMZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
1 sibling, 1 reply; 42+ messages in thread
From: Javier Martinez Canillas @ 2015-12-23 16:03 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Linux Kernel, Mark Rutland, Milo Kim, Russell King, Pawel Moll,
Ian Campbell, Tony Lindgren, Mark Brown, Liam Girdwood,
devicetree@vger.kernel.org, Rob Herring, Benoît Cousson,
Kumar Gala, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Hello Paul,
[snip]
> +
> +&omap3_pmx_core {
> + pinctrl-names = "default";
> +
> + uart3_pins: pinmux_uart3_pins {
> + pinctrl-single,pins = <
> + 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx */
> + 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx */
> + >;
Could you please use the IOPAD mux macros from
include/dt-bindings/pinctrl/omap.h instead?
We just did a massive cleanup on the OMAP DTS to use them instead of
an offset from the padconf registers.
Best regards,
Javier
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <20151223115632.GS16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-12-24 18:12 ` Paul Kocialkowski
2015-12-24 19:35 ` Mark Brown
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-24 18:12 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood, Milo Kim,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2342 bytes --]
Le mercredi 23 décembre 2015 à 11:56 +0000, Mark Brown a écrit :
> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
>
> > + gpio = lp->pdata->enable_gpio;
> > + if (!gpio_is_valid(gpio))
> > + return 0;
> > +
> > + /* Always set enable GPIO high. */
> > + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> > + if (ret) {
> > + dev_err(lp->dev, "gpio request err: %d\n", ret);
> > + return ret;
> > + }
>
> This isn't really adding support for the enable GPIO as the changelog
> suggests, it's requesting but not managing the GPIO. Since there is
> core support for manging enable GPIOs this seems especially silly,
> please tell the core about the GPIO and then it will work at runtime
> too.
It looks like the core bindings for GPIO can only be used instead of the
rdev->desc->ops->enable callback, not jointly, which doesn't fit my use
case, where both the GPIO and register write have to be used to enable
regulators.
I think it would be worth making it possible to use both in core, since
that situation is probably shared with other regulators. I suggest the
following diff (that would be split into a separate patch in v2 of this
series):
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e92f344..dd0674f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1963,7 +1963,6 @@ static int regulator_ena_gpio_ctrl(struct
regulator_dev *rdev, bool enable)
if (pin->enable_count == 0)
gpiod_set_value_cansleep(pin->gpiod,
!pin->ena_gpio_invert);
-
pin->enable_count++;
} else {
if (pin->enable_count > 1) {
@@ -2063,6 +2062,14 @@ static int _regulator_do_enable(struct
regulator_dev *rdev)
}
}
+ if (rdev->desc->ops->enable) {
+ ret = rdev->desc->ops->enable(rdev);
+ if (ret < 0)
+ return ret;
+ } else if (!rdev->ena_pin) {
+ return -EINVAL;
+ }
+
if (rdev->ena_pin) {
if (!rdev->ena_gpio_state) {
ret = regulator_ena_gpio_ctrl(rdev, true);
@@ -2070,10 +2077,6 @@ static int _regulator_do_enable(struct
regulator_dev *rdev)
return ret;
rdev->ena_gpio_state = 1;
}
- } else if (rdev->desc->ops->enable) {
- ret = rdev->desc->ops->enable(rdev);
- if (ret < 0)
- return ret;
} else {
return -EINVAL;
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-24 18:12 ` Paul Kocialkowski
@ 2015-12-24 19:35 ` Mark Brown
2015-12-24 20:05 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Mark Brown @ 2015-12-24 19:35 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, linux-kernel, Liam Girdwood, devicetree,
Rob Herring, Benoît Cousson, Kumar Gala, linux-omap,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1229 bytes --]
On Thu, Dec 24, 2015 at 07:12:53PM +0100, Paul Kocialkowski wrote:
> Le mercredi 23 décembre 2015 à 11:56 +0000, Mark Brown a écrit :
> > This isn't really adding support for the enable GPIO as the changelog
> > suggests, it's requesting but not managing the GPIO. Since there is
> > core support for manging enable GPIOs this seems especially silly,
> > please tell the core about the GPIO and then it will work at runtime
> > too.
> It looks like the core bindings for GPIO can only be used instead of the
> rdev->desc->ops->enable callback, not jointly, which doesn't fit my use
> case, where both the GPIO and register write have to be used to enable
> regulators.
> I think it would be worth making it possible to use both in core, since
> that situation is probably shared with other regulators. I suggest the
> following diff (that would be split into a separate patch in v2 of this
> series):
No, that's broken - the whole point with using a GPIO for enable control
on a lot of devices is that it is much faster than doing a register
write. What I would expect to happen in this case is that when
initialsing the GPIO we set the register to enabled and then only manage
the GPIO at runtime.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features
2015-12-23 15:44 ` Tony Lindgren
@ 2015-12-24 19:38 ` Paul Kocialkowski
0 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-24 19:38 UTC (permalink / raw)
To: Tony Lindgren
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Liam Girdwood,
Mark Brown, Milo Kim, devicetree, linux-arm-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1388 bytes --]
Hi,
Le mercredi 23 décembre 2015 à 07:44 -0800, Tony Lindgren a écrit :
> * Paul Kocialkowski <contact@paulk.fr> [151223 03:00]:
> > +&gpio1 {
> > + ti,no-reset-on-init;
> > +};
> > +
> > +&gpio2 {
> > + ti,no-reset-on-init;
> > +};
> > +
> > +&gpio3 {
> > + ti,no-reset-on-init;
> > +};
> > +
> > +&gpio4 {
> > + ti,no-reset-on-init;
> > +};
> > +
> > +&gpio5 {
> > + ti,no-reset-on-init;
> > +};
> > +
> > +&gpio6 {
> > + ti,no-reset-on-init;
> > +};
>
> Care to try to narrow down exactly which GPIO(s) need to be preserved?
> Chances are this will unnecessarily block deeper idle states in hardware
> otherwise.
>
> My guess is that the GPIO pins that need to be preserved if any are in
> the GPIO bank 1 as that's always powered..
Well, I actually need to keep the GPIOs handling backlight control,
buttons LEDs and the micro USB connector muxing (which can be set to
UART or USB). Those are spread accross gpio2, gpio5 and gpio6, so I'll
only enable these in v2.
Thanks for the review!
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features
[not found] ` <CABxcv=moAUEPo8sq5KhuLZChrQtwjF1aBeNvV1i8HvUnwDXMZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-12-24 19:38 ` Paul Kocialkowski
0 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-24 19:38 UTC (permalink / raw)
To: Javier Martinez Canillas
Cc: Linux Kernel, Mark Rutland, Milo Kim, Russell King, Pawel Moll,
Ian Campbell, Tony Lindgren, Mark Brown, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
Benoît Cousson, Kumar Gala,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]
Hi,
Le mercredi 23 décembre 2015 à 13:03 -0300, Javier Martinez Canillas a
écrit :
> Hello Paul,
>
> [snip]
>
> > +
> > +&omap3_pmx_core {
> > + pinctrl-names = "default";
> > +
> > + uart3_pins: pinmux_uart3_pins {
> > + pinctrl-single,pins = <
> > + 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx */
> > + 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx */
> > + >;
>
> Could you please use the IOPAD mux macros from
> include/dt-bindings/pinctrl/omap.h instead?
>
> We just did a massive cleanup on the OMAP DTS to use them instead of
> an offset from the padconf registers.
Sure thing, will do in v2.
Thanks for the review!
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-24 19:35 ` Mark Brown
@ 2015-12-24 20:05 ` Paul Kocialkowski
0 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-24 20:05 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Tony Lindgren,
Liam Girdwood, Milo Kim, devicetree, linux-arm-kernel, linux-omap
[-- Attachment #1: Type: text/plain, Size: 2123 bytes --]
Le jeudi 24 décembre 2015 à 19:35 +0000, Mark Brown a écrit :
> On Thu, Dec 24, 2015 at 07:12:53PM +0100, Paul Kocialkowski wrote:
> > Le mercredi 23 décembre 2015 à 11:56 +0000, Mark Brown a écrit :
>
> > > This isn't really adding support for the enable GPIO as the changelog
> > > suggests, it's requesting but not managing the GPIO. Since there is
> > > core support for manging enable GPIOs this seems especially silly,
> > > please tell the core about the GPIO and then it will work at runtime
> > > too.
>
> > It looks like the core bindings for GPIO can only be used instead of the
> > rdev->desc->ops->enable callback, not jointly, which doesn't fit my use
> > case, where both the GPIO and register write have to be used to enable
> > regulators.
>
> > I think it would be worth making it possible to use both in core, since
> > that situation is probably shared with other regulators. I suggest the
> > following diff (that would be split into a separate patch in v2 of this
> > series):
>
> No, that's broken - the whole point with using a GPIO for enable control
> on a lot of devices is that it is much faster than doing a register
> write. What I would expect to happen in this case is that when
> initialsing the GPIO we set the register to enabled and then only manage
> the GPIO at runtime.
That GPIO is shared with all regulators that the chip provides, so doing
things this way certainly won't work if we don't want all the regulators
powered at all times: in that case, the GPIO has precedence over the
regulator-specific registers.
Doing things the other way round would work and I suppose that chips
that can use a GPIO over registers just wouldn't register any
ops->enable callback in their description.
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <1450868319-20513-5-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
2015-12-23 11:56 ` Mark Brown
@ 2015-12-28 0:34 ` Milo Kim
2016-02-05 18:49 ` Paul Kocialkowski
2015-12-29 20:02 ` Rob Herring
2 siblings, 1 reply; 42+ messages in thread
From: Milo Kim @ 2015-12-28 0:34 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood, Mark Brown,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
Hi Paul,
Thanks for the patches. Please see my comments below.
On 23/12/15 19:58, Paul Kocialkowski wrote:
> LP872x regulators are made active via the EN pin, which might be hooked to a
> GPIO. This adds support for driving the GPIO high when the driver is in use.
EN pin is used for enabling HW logic like I2C block. It's not regulator
enable pin. Please check the block diagram in the datasheet.
All regulators of LP8720 and LP8725 are controlled through I2C
registers. Additionally, LP8725 provides external pin control for LDO3
and BUCK2. In this case, you can use 'regulator_config.ena_gpio' when a
regulator is registered.
>
> Signed-off-by: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
> ---
> .../devicetree/bindings/regulator/lp872x.txt | 1 +
> drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
> include/linux/regulator/lp872x.h | 2 ++
> 3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
> index 7818318..0559c25 100644
> --- a/Documentation/devicetree/bindings/regulator/lp872x.txt
> +++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
> @@ -28,6 +28,7 @@ Optional properties:
> - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
> - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
> - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
> + - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
Please use general property, "enable-gpios" instead of "ti,enable-gpio".
>
> Sub nodes for regulator_init_data
> LP8720 has maximum 6 nodes. (child name: ldo1 ~ 5 and buck)
> diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
> index 21c49d8..c8855f3 100644
> --- a/drivers/regulator/lp872x.c
> +++ b/drivers/regulator/lp872x.c
> @@ -726,6 +726,27 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> };
>
> +static int lp872x_init_enable(struct lp872x *lp)
lp872x_enable_hw() would be better.
> +{
> + int ret, gpio;
> +
> + if (!lp->pdata)
> + return -EINVAL;
> +
> + gpio = lp->pdata->enable_gpio;
> + if (!gpio_is_valid(gpio))
> + return 0;
> +
> + /* Always set enable GPIO high. */
> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> + if (ret) {
> + dev_err(lp->dev, "gpio request err: %d\n", ret);
> + return ret;
> + }
LP8720 device needs max 200usec for startup time.
LP8725 also requires enable time about 30ms.
Please use usleep_range() after EN pin control.
> +
> + return 0;
> +}
> +
> static int lp872x_init_dvs(struct lp872x *lp)
> {
> int ret, gpio;
> @@ -763,14 +784,18 @@ static int lp872x_config(struct lp872x *lp)
> int ret;
>
> if (!pdata || !pdata->update_config)
> - goto init_dvs;
> + goto init_dvs_enable;
>
> ret = lp872x_write_byte(lp, LP872X_GENERAL_CFG, pdata->general_config);
> if (ret)
> return ret;
>
> -init_dvs:
> - return lp872x_init_dvs(lp);
> +init_dvs_enable:
> + ret = lp872x_init_dvs(lp);
> + if (ret)
> + return ret;
> +
> + return lp872x_init_enable(lp);
> }
Logic should be enabled prior to DVS configuration. And please call
lp872x_enable_hw() in _probe().
>
> static struct regulator_init_data
> @@ -875,6 +900,8 @@ static struct lp872x_platform_data
> of_property_read_u8(np, "ti,dvs-state", &dvs_state);
> pdata->dvs->init_state = dvs_state ? DVS_HIGH : DVS_LOW;
>
> + pdata->enable_gpio = of_get_named_gpio(np, "ti,enable-gpio", 0);
> +
Please replace "ti,enable-gpio" with "enable-gpios".
Best regards,
Milo
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-23 11:56 ` Mark Brown
2015-12-23 12:52 ` Paul Kocialkowski
[not found] ` <20151223115632.GS16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-12-28 0:56 ` Milo Kim
[not found] ` <568088B4.6090207-l0cyMroinI0@public.gmane.org>
2 siblings, 1 reply; 42+ messages in thread
From: Milo Kim @ 2015-12-28 0:56 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, linux-kernel, Rob Herring, Liam Girdwood,
Mark Brown, Benoît Cousson, Kumar Gala, linux-omap,
linux-arm-kernel
Hi Paul,
On 23/12/15 20:56, Mark Brown wrote:
> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
>
>> + gpio = lp->pdata->enable_gpio;
>> + if (!gpio_is_valid(gpio))
>> + return 0;
>> +
>> + /* Always set enable GPIO high. */
>> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
>> + if (ret) {
>> + dev_err(lp->dev, "gpio request err: %d\n", ret);
>> + return ret;
>> + }
>
> This isn't really adding support for the enable GPIO as the changelog
> suggests, it's requesting but not managing the GPIO. Since there is
> core support for manging enable GPIOs this seems especially silly,
> please tell the core about the GPIO and then it will work at runtime
> too.
>
With reference to my previous mail, external GPIOs for LDO3 and BUCK2 in
LP8725 can be specified through regulator_config.ena_gpio. BUCK2 only
can be controlled by external pin when CONFIG pin is grounded.
Please see the description at page 5 of the datasheet.
http://www.ti.com/lit/ds/symlink/lp8725.pdf
Best regards,
Milo
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions
2015-12-23 10:58 ` [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions Paul Kocialkowski
@ 2015-12-28 1:04 ` Milo Kim
0 siblings, 0 replies; 42+ messages in thread
From: Milo Kim @ 2015-12-28 1:04 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Tony Lindgren,
Liam Girdwood, Mark Brown, devicetree, linux-arm-kernel,
linux-omap
On 23/12/15 19:58, Paul Kocialkowski wrote:
> In order to select the regulators via of_find_regulator_by_node (and thus use
> them in devicetree), defining of_match for each regulator is required.
>
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Milo Kim <milo.kim@ti.com>
> ---
> drivers/regulator/lp872x.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
> index e5af072..9412353 100644
> --- a/drivers/regulator/lp872x.c
> +++ b/drivers/regulator/lp872x.c
> @@ -520,6 +520,7 @@ static struct regulator_ops lp8725_buck_ops = {
> static struct regulator_desc lp8720_regulator_desc[] = {
> {
> .name = "ldo1",
> + .of_match = of_match_ptr("ldo1"),
> .id = LP8720_ID_LDO1,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -533,6 +534,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
> },
> {
> .name = "ldo2",
> + .of_match = of_match_ptr("ldo2"),
> .id = LP8720_ID_LDO2,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -546,6 +548,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
> },
> {
> .name = "ldo3",
> + .of_match = of_match_ptr("ldo3"),
> .id = LP8720_ID_LDO3,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -559,6 +562,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
> },
> {
> .name = "ldo4",
> + .of_match = of_match_ptr("ldo4"),
> .id = LP8720_ID_LDO4,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp8720_ldo4_vtbl),
> @@ -572,6 +576,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
> },
> {
> .name = "ldo5",
> + .of_match = of_match_ptr("ldo5"),
> .id = LP8720_ID_LDO5,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -585,6 +590,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
> },
> {
> .name = "buck",
> + .of_match = of_match_ptr("buck"),
> .id = LP8720_ID_BUCK,
> .ops = &lp8720_buck_ops,
> .n_voltages = ARRAY_SIZE(lp8720_buck_vtbl),
> @@ -599,6 +605,7 @@ static struct regulator_desc lp8720_regulator_desc[] = {
> static struct regulator_desc lp8725_regulator_desc[] = {
> {
> .name = "ldo1",
> + .of_match = of_match_ptr("ldo1"),
> .id = LP8725_ID_LDO1,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -612,6 +619,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "ldo2",
> + .of_match = of_match_ptr("ldo2"),
> .id = LP8725_ID_LDO2,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -625,6 +633,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "ldo3",
> + .of_match = of_match_ptr("ldo3"),
> .id = LP8725_ID_LDO3,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -638,6 +647,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "ldo4",
> + .of_match = of_match_ptr("ldo4"),
> .id = LP8725_ID_LDO4,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -651,6 +661,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "ldo5",
> + .of_match = of_match_ptr("ldo5"),
> .id = LP8725_ID_LDO5,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
> @@ -664,6 +675,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "lilo1",
> + .of_match = of_match_ptr("lilo1"),
> .id = LP8725_ID_LILO1,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp8725_lilo_vtbl),
> @@ -677,6 +689,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "lilo2",
> + .of_match = of_match_ptr("lilo2"),
> .id = LP8725_ID_LILO2,
> .ops = &lp872x_ldo_ops,
> .n_voltages = ARRAY_SIZE(lp8725_lilo_vtbl),
> @@ -690,6 +703,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "buck1",
> + .of_match = of_match_ptr("buck1"),
> .id = LP8725_ID_BUCK1,
> .ops = &lp8725_buck_ops,
> .n_voltages = ARRAY_SIZE(lp8725_buck_vtbl),
> @@ -701,6 +715,7 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> },
> {
> .name = "buck2",
> + .of_match = of_match_ptr("buck2"),
> .id = LP8725_ID_BUCK2,
> .ops = &lp8725_buck_ops,
> .n_voltages = ARRAY_SIZE(lp8725_buck_vtbl),
>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 2/6] regulator: lp872x: Get rid of duplicate reference to DVS GPIO
2015-12-23 10:58 ` [PATCH 2/6] regulator: lp872x: Get rid of duplicate reference to DVS GPIO Paul Kocialkowski
@ 2015-12-28 1:05 ` Milo Kim
0 siblings, 0 replies; 42+ messages in thread
From: Milo Kim @ 2015-12-28 1:05 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, linux-kernel, Liam Girdwood,
Rob Herring, Benoît Cousson, Kumar Gala, linux-omap,
linux-arm-kernel
On 23/12/15 19:58, Paul Kocialkowski wrote:
> The lp872x structure holds a reference to the DVS GPIO, but it is never actually
> used anywhere, since a first reference exists from the lp872x_dvs structure.
>
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Milo Kim <milo.kim@ti.com>
> ---
> drivers/regulator/lp872x.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
> index 9412353..19d7584 100644
> --- a/drivers/regulator/lp872x.c
> +++ b/drivers/regulator/lp872x.c
> @@ -108,7 +108,6 @@ struct lp872x {
> struct lp872x_platform_data *pdata;
> int num_regulators;
> enum lp872x_dvs_state dvs_pin;
> - int dvs_gpio;
> };
>
> /* LP8720/LP8725 shared voltage table for LDOs */
> @@ -752,7 +751,6 @@ static int lp872x_init_dvs(struct lp872x *lp)
> }
>
> lp->dvs_pin = pinstate;
> - lp->dvs_gpio = gpio;
>
> return 0;
>
>
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <568088B4.6090207-l0cyMroinI0@public.gmane.org>
@ 2015-12-28 22:49 ` Paul Kocialkowski
2015-12-29 0:45 ` Milo Kim
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-28 22:49 UTC (permalink / raw)
To: Milo Kim
Cc: Mark Brown, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2807 bytes --]
Hi Milo, thanks for the review,
Le lundi 28 décembre 2015 à 09:56 +0900, Milo Kim a écrit :
> Hi Paul,
>
> On 23/12/15 20:56, Mark Brown wrote:
> > On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> >
> >> + gpio = lp->pdata->enable_gpio;
> >> + if (!gpio_is_valid(gpio))
> >> + return 0;
> >> +
> >> + /* Always set enable GPIO high. */
> >> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> >> + if (ret) {
> >> + dev_err(lp->dev, "gpio request err: %d\n", ret);
> >> + return ret;
> >> + }
> >
> > This isn't really adding support for the enable GPIO as the changelog
> > suggests, it's requesting but not managing the GPIO. Since there is
> > core support for manging enable GPIOs this seems especially silly,
> > please tell the core about the GPIO and then it will work at runtime
> > too.
> >
>
> With reference to my previous mail, external GPIOs for LDO3 and BUCK2 in
> LP8725 can be specified through regulator_config.ena_gpio. BUCK2 only
> can be controlled by external pin when CONFIG pin is grounded.
>
> Please see the description at page 5 of the datasheet.
>
> http://www.ti.com/lit/ds/symlink/lp8725.pdf
After reading the datasheets thoroughly, it seems to me that for the
lp8720, the EN pin is used to enable the regulators output, which is a
good fit for the core regulator GPIO framework, as there is no reason to
keep it on when no regulator is in use. The serial interface is already
available when EN=0 and regulators can be configured in that state. The
lp8725 seems seems to behave the same when CONFIG=0 (the datasheet
clearly states: "CONFIG=0: EN=1 turns on outputs or standby mode if
EN=0"). On the other hand, it is indeed used as a power-on pin when
CONFIG=1.
Since my intent here is to cover the lp8720 use case, I suggest that we
implement this using the core regulator GPIO framework (I have patches
ready for that) and leave out the case where CONFIG=1, which could be
dealt with later by providing that piece of information via platform
data (and devicetree) and then either use the regulator GPIO framework
(when CONFIG=0 and default) or register the GPIO within the driver and
keep it on at all times (when CONFIG=1).
I could most certainly implement that behaviour, but I'd rather leave it
to someone else (or at least the testing) since I don't have any lp8725
to play with.
What do you think?
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-28 22:49 ` Paul Kocialkowski
@ 2015-12-29 0:45 ` Milo Kim
2015-12-29 11:13 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Milo Kim @ 2015-12-29 0:45 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, linux-kernel, Rob Herring, Liam Girdwood,
Mark Brown, Benoît Cousson, Kumar Gala, linux-omap,
linux-arm-kernel
Hi Paul,
On 29/12/15 07:49, Paul Kocialkowski wrote:
> Hi Milo, thanks for the review,
>
> Le lundi 28 décembre 2015 à 09:56 +0900, Milo Kim a écrit :
>> Hi Paul,
>>
>> On 23/12/15 20:56, Mark Brown wrote:
>>> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
>>>
>>>> + gpio = lp->pdata->enable_gpio;
>>>> + if (!gpio_is_valid(gpio))
>>>> + return 0;
>>>> +
>>>> + /* Always set enable GPIO high. */
>>>> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
>>>> + if (ret) {
>>>> + dev_err(lp->dev, "gpio request err: %d\n", ret);
>>>> + return ret;
>>>> + }
>>>
>>> This isn't really adding support for the enable GPIO as the changelog
>>> suggests, it's requesting but not managing the GPIO. Since there is
>>> core support for manging enable GPIOs this seems especially silly,
>>> please tell the core about the GPIO and then it will work at runtime
>>> too.
>>>
>>
>> With reference to my previous mail, external GPIOs for LDO3 and BUCK2 in
>> LP8725 can be specified through regulator_config.ena_gpio. BUCK2 only
>> can be controlled by external pin when CONFIG pin is grounded.
>>
>> Please see the description at page 5 of the datasheet.
>>
>> http://www.ti.com/lit/ds/symlink/lp8725.pdf
>
> After reading the datasheets thoroughly, it seems to me that for the
> lp8720, the EN pin is used to enable the regulators output, which is a
> good fit for the core regulator GPIO framework, as there is no reason to
> keep it on when no regulator is in use. The serial interface is already
> available when EN=0 and regulators can be configured in that state. The
> lp8725 seems seems to behave the same when CONFIG=0 (the datasheet
> clearly states: "CONFIG=0: EN=1 turns on outputs or standby mode if
> EN=0"). On the other hand, it is indeed used as a power-on pin when
> CONFIG=1.
I think it's different use case. LP8720/5 are designed for system PMU,
so some regulators are enabled by default after the device is on. EN pin
is used for turning on/off the chip. This pin does not control regulator
outputs directly. It's separate functional block in the silicon.
On the other hand, 'ena_gpio' is used for each regulator control itself.
For example, WM8994 has two LDOs which are controlled by external pins.
LDOs are enabled/disabled through LDO1ENA and LDO2ENA pins. In this
case, 'ena_gpio' is used.
http://www.cirrus.com/en/pubs/proDatasheet/WM8994_v4.4.pdf
(please refer to page 224 and 225)
Best regards,
Milo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-29 0:45 ` Milo Kim
@ 2015-12-29 11:13 ` Paul Kocialkowski
2015-12-30 0:22 ` Milo Kim
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-29 11:13 UTC (permalink / raw)
To: Milo Kim
Cc: Mark Brown, linux-kernel, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Benoît Cousson,
Tony Lindgren, Liam Girdwood, devicetree, linux-arm-kernel,
linux-omap
[-- Attachment #1: Type: text/plain, Size: 3861 bytes --]
Hi Milo,
Le mardi 29 décembre 2015 à 09:45 +0900, Milo Kim a écrit :
> Hi Paul,
>
> On 29/12/15 07:49, Paul Kocialkowski wrote:
> > Hi Milo, thanks for the review,
> >
> > Le lundi 28 décembre 2015 à 09:56 +0900, Milo Kim a écrit :
> >> Hi Paul,
> >>
> >> On 23/12/15 20:56, Mark Brown wrote:
> >>> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> >>>
> >>>> + gpio = lp->pdata->enable_gpio;
> >>>> + if (!gpio_is_valid(gpio))
> >>>> + return 0;
> >>>> +
> >>>> + /* Always set enable GPIO high. */
> >>>> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> >>>> + if (ret) {
> >>>> + dev_err(lp->dev, "gpio request err: %d\n", ret);
> >>>> + return ret;
> >>>> + }
> >>>
> >>> This isn't really adding support for the enable GPIO as the changelog
> >>> suggests, it's requesting but not managing the GPIO. Since there is
> >>> core support for manging enable GPIOs this seems especially silly,
> >>> please tell the core about the GPIO and then it will work at runtime
> >>> too.
> >>>
> >>
> >> With reference to my previous mail, external GPIOs for LDO3 and BUCK2 in
> >> LP8725 can be specified through regulator_config.ena_gpio. BUCK2 only
> >> can be controlled by external pin when CONFIG pin is grounded.
> >>
> >> Please see the description at page 5 of the datasheet.
> >>
> >> http://www.ti.com/lit/ds/symlink/lp8725.pdf
> >
> > After reading the datasheets thoroughly, it seems to me that for the
> > lp8720, the EN pin is used to enable the regulators output, which is a
> > good fit for the core regulator GPIO framework, as there is no reason to
> > keep it on when no regulator is in use. The serial interface is already
> > available when EN=0 and regulators can be configured in that state. The
> > lp8725 seems seems to behave the same when CONFIG=0 (the datasheet
> > clearly states: "CONFIG=0: EN=1 turns on outputs or standby mode if
> > EN=0"). On the other hand, it is indeed used as a power-on pin when
> > CONFIG=1.
>
> I think it's different use case. LP8720/5 are designed for system PMU,
> so some regulators are enabled by default after the device is on. EN pin
> is used for turning on/off the chip. This pin does not control regulator
> outputs directly. It's separate functional block in the silicon.
Well, I really don't understand why the EN pin would turn on/off the
chip. All it does it enable the regulators outputs (by entering IDLE
mode), the serial block is already available in STANDBY state.
If we want some regulators enabled at boot, the best thing to do seems
to be to request the GPIO with the GPIOF_INIT_HIGH flag, as done in e.g.
the max8952 regulator driver:
if (pdata->reg_data->constraints.boot_on)
config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
> On the other hand, 'ena_gpio' is used for each regulator control itself.
> For example, WM8994 has two LDOs which are controlled by external pins.
> LDOs are enabled/disabled through LDO1ENA and LDO2ENA pins. In this
> case, 'ena_gpio' is used.
Of course, but the ena_gpio feature is also a good fit for a global
enable pin, as the GPIO can be shared by multiple regulators of the same
chip, which is what we have here.
In my opinion, using the ena_gpio feature is a good fit, as we don't
need to keep the EN pin high when no regulator is used.
> http://www.cirrus.com/en/pubs/proDatasheet/WM8994_v4.4.pdf
> (please refer to page 224 and 225)
Cheers,
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <1450868319-20513-5-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
2015-12-23 11:56 ` Mark Brown
2015-12-28 0:34 ` Milo Kim
@ 2015-12-29 20:02 ` Rob Herring
2015-12-29 21:26 ` Paul Kocialkowski
2 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2015-12-29 20:02 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Milo Kim,
Russell King, Pawel Moll, Ian Campbell, Tony Lindgren, Mark Brown,
Liam Girdwood, devicetree-u79uwXL29TY76Z2rM5mHXA,
Benoît Cousson, Kumar Gala,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> LP872x regulators are made active via the EN pin, which might be hooked to a
> GPIO. This adds support for driving the GPIO high when the driver is in use.
>
> Signed-off-by: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
> ---
> .../devicetree/bindings/regulator/lp872x.txt | 1 +
> drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
> include/linux/regulator/lp872x.h | 2 ++
> 3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
> index 7818318..0559c25 100644
> --- a/Documentation/devicetree/bindings/regulator/lp872x.txt
> +++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
> @@ -28,6 +28,7 @@ Optional properties:
> - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
> - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
> - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
> + - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
Should be "-gpios" instead of "-gpio".
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-29 20:02 ` Rob Herring
@ 2015-12-29 21:26 ` Paul Kocialkowski
2015-12-29 21:55 ` Rob Herring
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-29 21:26 UTC (permalink / raw)
To: Rob Herring
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Milo Kim,
Russell King, Pawel Moll, Ian Campbell, Tony Lindgren, Mark Brown,
Liam Girdwood, devicetree-u79uwXL29TY76Z2rM5mHXA,
Benoît Cousson, Kumar Gala,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]
Le mardi 29 décembre 2015 à 14:02 -0600, Rob Herring a écrit :
> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> > LP872x regulators are made active via the EN pin, which might be hooked to a
> > GPIO. This adds support for driving the GPIO high when the driver is in use.
> >
> > Signed-off-by: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
> > ---
> > .../devicetree/bindings/regulator/lp872x.txt | 1 +
> > drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
> > include/linux/regulator/lp872x.h | 2 ++
> > 3 files changed, 33 insertions(+), 3 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
> > index 7818318..0559c25 100644
> > --- a/Documentation/devicetree/bindings/regulator/lp872x.txt
> > +++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
> > @@ -28,6 +28,7 @@ Optional properties:
> > - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
> > - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
> > - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
> > + - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
>
> Should be "-gpios" instead of "-gpio".
Care to comment why? There is only one GPIO that can be used here, since
there is only one single EN pin. I thought this matched what is done
already with "ti,dvs-gpio".
Thanks!
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-29 21:26 ` Paul Kocialkowski
@ 2015-12-29 21:55 ` Rob Herring
2016-02-05 18:48 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Rob Herring @ 2015-12-29 21:55 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Mark Brown, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Benoît Cousson, Kumar Gala, linux-omap,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
On Tue, Dec 29, 2015 at 3:26 PM, Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org> wrote:
> Le mardi 29 décembre 2015 à 14:02 -0600, Rob Herring a écrit :
>> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
>> > LP872x regulators are made active via the EN pin, which might be hooked to a
>> > GPIO. This adds support for driving the GPIO high when the driver is in use.
>> >
>> > Signed-off-by: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>
>> > ---
>> > .../devicetree/bindings/regulator/lp872x.txt | 1 +
>> > drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
>> > include/linux/regulator/lp872x.h | 2 ++
>> > 3 files changed, 33 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
>> > index 7818318..0559c25 100644
>> > --- a/Documentation/devicetree/bindings/regulator/lp872x.txt
>> > +++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
>> > @@ -28,6 +28,7 @@ Optional properties:
>> > - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
>> > - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
>> > - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
>> > + - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
>>
>> Should be "-gpios" instead of "-gpio".
>
> Care to comment why? There is only one GPIO that can be used here, since
> there is only one single EN pin. I thought this matched what is done
> already with "ti,dvs-gpio".
To be consistent. We use "clocks" and "interrupts" always whether one
or more for example.
-gpio is documented as deprecated now.
Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-29 11:13 ` Paul Kocialkowski
@ 2015-12-30 0:22 ` Milo Kim
2015-12-30 8:35 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Milo Kim @ 2015-12-30 0:22 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Mark Brown, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
Hi Paul,
On 29/12/15 20:13, Paul Kocialkowski wrote:
> Hi Milo,
>
> Le mardi 29 décembre 2015 à 09:45 +0900, Milo Kim a écrit :
>> Hi Paul,
>>
>> On 29/12/15 07:49, Paul Kocialkowski wrote:
>>> Hi Milo, thanks for the review,
>>>
>>> Le lundi 28 décembre 2015 à 09:56 +0900, Milo Kim a écrit :
>>>> Hi Paul,
>>>>
>>>> On 23/12/15 20:56, Mark Brown wrote:
>>>>> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
>>>>>
>>>>>> + gpio = lp->pdata->enable_gpio;
>>>>>> + if (!gpio_is_valid(gpio))
>>>>>> + return 0;
>>>>>> +
>>>>>> + /* Always set enable GPIO high. */
>>>>>> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
>>>>>> + if (ret) {
>>>>>> + dev_err(lp->dev, "gpio request err: %d\n", ret);
>>>>>> + return ret;
>>>>>> + }
>>>>>
>>>>> This isn't really adding support for the enable GPIO as the changelog
>>>>> suggests, it's requesting but not managing the GPIO. Since there is
>>>>> core support for manging enable GPIOs this seems especially silly,
>>>>> please tell the core about the GPIO and then it will work at runtime
>>>>> too.
>>>>>
>>>>
>>>> With reference to my previous mail, external GPIOs for LDO3 and BUCK2 in
>>>> LP8725 can be specified through regulator_config.ena_gpio. BUCK2 only
>>>> can be controlled by external pin when CONFIG pin is grounded.
>>>>
>>>> Please see the description at page 5 of the datasheet.
>>>>
>>>> http://www.ti.com/lit/ds/symlink/lp8725.pdf
>>>
>>> After reading the datasheets thoroughly, it seems to me that for the
>>> lp8720, the EN pin is used to enable the regulators output, which is a
>>> good fit for the core regulator GPIO framework, as there is no reason to
>>> keep it on when no regulator is in use. The serial interface is already
>>> available when EN=0 and regulators can be configured in that state. The
>>> lp8725 seems seems to behave the same when CONFIG=0 (the datasheet
>>> clearly states: "CONFIG=0: EN=1 turns on outputs or standby mode if
>>> EN=0"). On the other hand, it is indeed used as a power-on pin when
>>> CONFIG=1.
>>
>> I think it's different use case. LP8720/5 are designed for system PMU,
>> so some regulators are enabled by default after the device is on. EN pin
>> is used for turning on/off the chip. This pin does not control regulator
>> outputs directly. It's separate functional block in the silicon.
>
> Well, I really don't understand why the EN pin would turn on/off the
> chip. All it does it enable the regulators outputs (by entering IDLE
> mode), the serial block is already available in STANDBY state.
>
> If we want some regulators enabled at boot, the best thing to do seems
> to be to request the GPIO with the GPIOF_INIT_HIGH flag, as done in e.g.
> the max8952 regulator driver:
>
> if (pdata->reg_data->constraints.boot_on)
> config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
According to MAX8952 datasheet, output regulator is enabled/disabled
using EN pin, so ena_gpio is used correctly.
However, LP8720/5 regulators are enabled/disabled through I2C command.
Only few regulators of LP8725 can be on/off by separate external pins.
(B2_EN and LDO3_EN)
Please note that EN pin in LP8720/5 is not the control pin for
enabling/disabling regulators.
Best regards,
Milo
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-30 0:22 ` Milo Kim
@ 2015-12-30 8:35 ` Paul Kocialkowski
2015-12-30 16:33 ` Mark Brown
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-30 8:35 UTC (permalink / raw)
To: Milo Kim
Cc: Mark Brown, linux-kernel, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Benoît Cousson,
Tony Lindgren, Liam Girdwood, devicetree, linux-arm-kernel,
linux-omap
[-- Attachment #1: Type: text/plain, Size: 4570 bytes --]
Hi Milo,
Le mercredi 30 décembre 2015 à 09:22 +0900, Milo Kim a écrit :
> Hi Paul,
>
> On 29/12/15 20:13, Paul Kocialkowski wrote:
> > Hi Milo,
> >
> > Le mardi 29 décembre 2015 à 09:45 +0900, Milo Kim a écrit :
> >> Hi Paul,
> >>
> >> On 29/12/15 07:49, Paul Kocialkowski wrote:
> >>> Hi Milo, thanks for the review,
> >>>
> >>> Le lundi 28 décembre 2015 à 09:56 +0900, Milo Kim a écrit :
> >>>> Hi Paul,
> >>>>
> >>>> On 23/12/15 20:56, Mark Brown wrote:
> >>>>> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> >>>>>
> >>>>>> + gpio = lp->pdata->enable_gpio;
> >>>>>> + if (!gpio_is_valid(gpio))
> >>>>>> + return 0;
> >>>>>> +
> >>>>>> + /* Always set enable GPIO high. */
> >>>>>> + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> >>>>>> + if (ret) {
> >>>>>> + dev_err(lp->dev, "gpio request err: %d\n", ret);
> >>>>>> + return ret;
> >>>>>> + }
> >>>>>
> >>>>> This isn't really adding support for the enable GPIO as the changelog
> >>>>> suggests, it's requesting but not managing the GPIO. Since there is
> >>>>> core support for manging enable GPIOs this seems especially silly,
> >>>>> please tell the core about the GPIO and then it will work at runtime
> >>>>> too.
> >>>>>
> >>>>
> >>>> With reference to my previous mail, external GPIOs for LDO3 and BUCK2 in
> >>>> LP8725 can be specified through regulator_config.ena_gpio. BUCK2 only
> >>>> can be controlled by external pin when CONFIG pin is grounded.
> >>>>
> >>>> Please see the description at page 5 of the datasheet.
> >>>>
> >>>> http://www.ti.com/lit/ds/symlink/lp8725.pdf
> >>>
> >>> After reading the datasheets thoroughly, it seems to me that for the
> >>> lp8720, the EN pin is used to enable the regulators output, which is a
> >>> good fit for the core regulator GPIO framework, as there is no reason to
> >>> keep it on when no regulator is in use. The serial interface is already
> >>> available when EN=0 and regulators can be configured in that state. The
> >>> lp8725 seems seems to behave the same when CONFIG=0 (the datasheet
> >>> clearly states: "CONFIG=0: EN=1 turns on outputs or standby mode if
> >>> EN=0"). On the other hand, it is indeed used as a power-on pin when
> >>> CONFIG=1.
> >>
> >> I think it's different use case. LP8720/5 are designed for system PMU,
> >> so some regulators are enabled by default after the device is on. EN pin
> >> is used for turning on/off the chip. This pin does not control regulator
> >> outputs directly. It's separate functional block in the silicon.
> >
> > Well, I really don't understand why the EN pin would turn on/off the
> > chip. All it does it enable the regulators outputs (by entering IDLE
> > mode), the serial block is already available in STANDBY state.
> >
> > If we want some regulators enabled at boot, the best thing to do seems
> > to be to request the GPIO with the GPIOF_INIT_HIGH flag, as done in e.g.
> > the max8952 regulator driver:
> >
> > if (pdata->reg_data->constraints.boot_on)
> > config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
>
> According to MAX8952 datasheet, output regulator is enabled/disabled
> using EN pin, so ena_gpio is used correctly.
> However, LP8720/5 regulators are enabled/disabled through I2C command.
> Only few regulators of LP8725 can be on/off by separate external pins.
> (B2_EN and LDO3_EN)
> Please note that EN pin in LP8720/5 is not the control pin for
> enabling/disabling regulators.
Oh, I should have mentionned that I also suggest making it possible to
use *both* an enable GPIO and registers to enable a regulator. You are
of course right in saying that the GPIO alone is not enough, and the
core regulator framework will currently only do GPIO or registers to
enable not both.
In my opinion, it would be more elegant to adapt the core regulator
framework to first enable the GPIO and then call the regulator enable
ops callback instead of handling the GPIO in the driver.
However, if that change is not welcome to the core regulator framework,
we'll have to deal with the GPIO in the driver (and probably keep it
enabled at all times there).
Cheers,
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-30 8:35 ` Paul Kocialkowski
@ 2015-12-30 16:33 ` Mark Brown
2015-12-30 18:37 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Mark Brown @ 2015-12-30 16:33 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Milo Kim, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
On Wed, Dec 30, 2015 at 09:35:21AM +0100, Paul Kocialkowski wrote:
> In my opinion, it would be more elegant to adapt the core regulator
> framework to first enable the GPIO and then call the regulator enable
> ops callback instead of handling the GPIO in the driver.
Why would we want to actively manage both things at runtime? It's more
work, what do we gain from it?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-30 16:33 ` Mark Brown
@ 2015-12-30 18:37 ` Paul Kocialkowski
2015-12-31 21:40 ` Mark Brown
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-30 18:37 UTC (permalink / raw)
To: Mark Brown
Cc: Milo Kim, linux-kernel, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Benoît Cousson,
Tony Lindgren, Liam Girdwood, devicetree, linux-arm-kernel,
linux-omap
[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]
Le mercredi 30 décembre 2015 à 16:33 +0000, Mark Brown a écrit :
> On Wed, Dec 30, 2015 at 09:35:21AM +0100, Paul Kocialkowski wrote:
>
> > In my opinion, it would be more elegant to adapt the core regulator
> > framework to first enable the GPIO and then call the regulator enable
> > ops callback instead of handling the GPIO in the driver.
>
> Why would we want to actively manage both things at runtime? It's more
> work, what do we gain from it?
Well, I figured that it would be best to disable the EN pin when we're
not using any of the regulators, since that allows the chip to enter
standby mode (and thus consume less power).
Implementing that logic in the driver seems very redundant when we're
one step away from doing it with the core regulator framework.
It is also likely that in the future, other chips will use and need to
handle a global enable pin for the same purpose, while allowing
regulator configuration and enable via registers.
It also doesn't hurt regulators that only use a GPIO for enable.
The diff to do this is very minimal, I already have a patch ready, that
I could send if there is a chance for it to get through.
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-30 18:37 ` Paul Kocialkowski
@ 2015-12-31 21:40 ` Mark Brown
[not found] ` <20151231214007.GC16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 42+ messages in thread
From: Mark Brown @ 2015-12-31 21:40 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Milo Kim, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]
On Wed, Dec 30, 2015 at 07:37:19PM +0100, Paul Kocialkowski wrote:
> Le mercredi 30 décembre 2015 à 16:33 +0000, Mark Brown a écrit :
> > On Wed, Dec 30, 2015 at 09:35:21AM +0100, Paul Kocialkowski wrote:
> > > In my opinion, it would be more elegant to adapt the core regulator
> > > framework to first enable the GPIO and then call the regulator enable
> > > ops callback instead of handling the GPIO in the driver.
> > Why would we want to actively manage both things at runtime? It's more
> > work, what do we gain from it?
> Well, I figured that it would be best to disable the EN pin when we're
> not using any of the regulators, since that allows the chip to enter
> standby mode (and thus consume less power).
This doesn't sound like it's anything to do with the regulators, that's
a chip wide power management function which should be implemented via
runtime PM if there's any value in implementing it at all (if the device
is a primary PMIC normally this would be handled by the CPU core when it
enters low power state without any software). It's not something we
should be considering on a per regulator basis since it's at the chip
level and on a per regulator basis it's not doing anything useful for
the reasons above.
> It also doesn't hurt regulators that only use a GPIO for enable.
It causes problems for any device with an optional GPIO, it means that
we end up mantaining both GPIO and register which as I've said a couple
of times now defeats the point of having the GPIO.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <20151231214007.GC16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-12-31 21:59 ` Paul Kocialkowski
2015-12-31 22:14 ` Mark Brown
0 siblings, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2015-12-31 21:59 UTC (permalink / raw)
To: Mark Brown
Cc: Milo Kim, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]
Le jeudi 31 décembre 2015 à 21:40 +0000, Mark Brown a écrit :
> On Wed, Dec 30, 2015 at 07:37:19PM +0100, Paul Kocialkowski wrote:
> > Le mercredi 30 décembre 2015 à 16:33 +0000, Mark Brown a écrit :
> > > On Wed, Dec 30, 2015 at 09:35:21AM +0100, Paul Kocialkowski wrote:
>
> > > > In my opinion, it would be more elegant to adapt the core regulator
> > > > framework to first enable the GPIO and then call the regulator enable
> > > > ops callback instead of handling the GPIO in the driver.
>
> > > Why would we want to actively manage both things at runtime? It's more
> > > work, what do we gain from it?
>
> > Well, I figured that it would be best to disable the EN pin when we're
> > not using any of the regulators, since that allows the chip to enter
> > standby mode (and thus consume less power).
>
> This doesn't sound like it's anything to do with the regulators, that's
> a chip wide power management function which should be implemented via
> runtime PM if there's any value in implementing it at all (if the device
> is a primary PMIC normally this would be handled by the CPU core when it
> enters low power state without any software). It's not something we
> should be considering on a per regulator basis since it's at the chip
> level and on a per regulator basis it's not doing anything useful for
> the reasons above.
I understand, thanks for pointing this out. Well, for my use case, there
is no use in disabling the chip at any point as it powers the external
mmc.
Would you agree to have the enable pin handled directly (and by that, I
mean enabled once, when requested, as I first suggested in the patchset)
in the driver then?
> > It also doesn't hurt regulators that only use a GPIO for enable.
>
> It causes problems for any device with an optional GPIO, it means that
> we end up mantaining both GPIO and register which as I've said a couple
> of times now defeats the point of having the GPIO.
Fair enough.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-31 21:59 ` Paul Kocialkowski
@ 2015-12-31 22:14 ` Mark Brown
[not found] ` <20151231221407.GF16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 42+ messages in thread
From: Mark Brown @ 2015-12-31 22:14 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Mark Rutland, Milo Kim, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, linux-kernel, Liam Girdwood, devicetree,
Rob Herring, Benoît Cousson, Kumar Gala, linux-omap,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 915 bytes --]
On Thu, Dec 31, 2015 at 10:59:06PM +0100, Paul Kocialkowski wrote:
> I understand, thanks for pointing this out. Well, for my use case, there
> is no use in disabling the chip at any point as it powers the external
> mmc.
Presumably someone might decide not to use the MMC in some case (perhaps
only mounting it when explicitly needed in order to save power for
example, or the MMC subsystem might figure out a way to power down an
idle MMC block device).
> Would you agree to have the enable pin handled directly (and by that, I
> mean enabled once, when requested, as I first suggested in the patchset)
> in the driver then?
That's probably fine, or do it via runtime PM (the framework is fairly
simple to use, I'll probably go add support in the core for it in the
next day or two as this seems like a sensible use case). I can't
remember if this device is a MFD or not and I'm just on my way out the
door.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <20151231221407.GF16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2016-01-03 10:19 ` Paul Kocialkowski
2016-01-16 7:32 ` Paul Kocialkowski
1 sibling, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2016-01-03 10:19 UTC (permalink / raw)
To: Mark Brown
Cc: Milo Kim, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1665 bytes --]
Le jeudi 31 décembre 2015 à 22:14 +0000, Mark Brown a écrit :
> On Thu, Dec 31, 2015 at 10:59:06PM +0100, Paul Kocialkowski wrote:
>
> > I understand, thanks for pointing this out. Well, for my use case, there
> > is no use in disabling the chip at any point as it powers the external
> > mmc.
>
> Presumably someone might decide not to use the MMC in some case (perhaps
> only mounting it when explicitly needed in order to save power for
> example, or the MMC subsystem might figure out a way to power down an
> idle MMC block device).
Makes sense, I'll keep that in mind.
> > Would you agree to have the enable pin handled directly (and by that, I
> > mean enabled once, when requested, as I first suggested in the patchset)
> > in the driver then?
>
> That's probably fine, or do it via runtime PM (the framework is fairly
> simple to use, I'll probably go add support in the core for it in the
> next day or two as this seems like a sensible use case). I can't
> remember if this device is a MFD or not and I'm just on my way out the
> door.
Runtime PM seems like a good fit (though I hadn't heard about it before:
you can guess I'm fairly new to kernel development), please let me know
whether you end up implementing it so I can try to handle the GPIO this
way.
Thanks!
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
[not found] ` <20151231221407.GF16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-01-03 10:19 ` Paul Kocialkowski
@ 2016-01-16 7:32 ` Paul Kocialkowski
2016-01-18 16:32 ` Mark Brown
1 sibling, 1 reply; 42+ messages in thread
From: Paul Kocialkowski @ 2016-01-16 7:32 UTC (permalink / raw)
To: Mark Brown
Cc: Milo Kim, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]
Le jeudi 31 décembre 2015 à 22:14 +0000, Mark Brown a écrit :
> On Thu, Dec 31, 2015 at 10:59:06PM +0100, Paul Kocialkowski wrote:
>
> > I understand, thanks for pointing this out. Well, for my use case, there
> > is no use in disabling the chip at any point as it powers the external
> > mmc.
>
> Presumably someone might decide not to use the MMC in some case (perhaps
> only mounting it when explicitly needed in order to save power for
> example, or the MMC subsystem might figure out a way to power down an
> idle MMC block device).
>
> > Would you agree to have the enable pin handled directly (and by that, I
> > mean enabled once, when requested, as I first suggested in the patchset)
> > in the driver then?
>
> That's probably fine, or do it via runtime PM (the framework is fairly
> simple to use, I'll probably go add support in the core for it in the
> next day or two as this seems like a sensible use case). I can't
> remember if this device is a MFD or not and I'm just on my way out the
> door.
Is there some git tree I can work with that has regulator runtime PM
support at this point? I'll certainly end up handling the GPIO in the
driver otherwise.
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2016-01-16 7:32 ` Paul Kocialkowski
@ 2016-01-18 16:32 ` Mark Brown
2016-02-05 18:48 ` Paul Kocialkowski
0 siblings, 1 reply; 42+ messages in thread
From: Mark Brown @ 2016-01-18 16:32 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: Milo Kim, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Russell King,
Benoît Cousson, Tony Lindgren, Liam Girdwood,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-omap-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
On Sat, Jan 16, 2016 at 08:32:13AM +0100, Paul Kocialkowski wrote:
> Is there some git tree I can work with that has regulator runtime PM
> support at this point? I'll certainly end up handling the GPIO in the
> driver otherwise.
No, the last week was much more busy than I was expecting. I'm hoping
for this week (or you could have a go at implementing it, it'd be adding
the PM operations in _regulator_enable() or _regulator_do_enable() if a
flag was set in the regulator_desc).
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2016-01-18 16:32 ` Mark Brown
@ 2016-02-05 18:48 ` Paul Kocialkowski
0 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2016-02-05 18:48 UTC (permalink / raw)
To: Mark Brown
Cc: Milo Kim, linux-kernel, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Russell King, Benoît Cousson,
Tony Lindgren, Liam Girdwood, devicetree, linux-arm-kernel,
linux-omap
[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]
Hi,
Le lundi 18 janvier 2016 à 16:32 +0000, Mark Brown a écrit :
> On Sat, Jan 16, 2016 at 08:32:13AM +0100, Paul Kocialkowski wrote:
>
> > Is there some git tree I can work with that has regulator runtime PM
> > support at this point? I'll certainly end up handling the GPIO in the
> > driver otherwise.
>
> No, the last week was much more busy than I was expecting. I'm hoping
> for this week (or you could have a go at implementing it, it'd be adding
> the PM operations in _regulator_enable() or _regulator_do_enable() if a
> flag was set in the regulator_desc).
I decided to go with a function simply requesting the GPIO for v2.
Support for runtime PM can be added later. I'll get back to you on this
on the thread related to your patches, since it appears to be somewhat
broken for now.
Thanks!
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: https://www.replicant.us/
Blog: https://blog.replicant.us/
Wiki/tracker/forums: https://redmine.replicant.us/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-29 21:55 ` Rob Herring
@ 2016-02-05 18:48 ` Paul Kocialkowski
0 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2016-02-05 18:48 UTC (permalink / raw)
To: Rob Herring
Cc: linux-kernel@vger.kernel.org, Mark Rutland, Milo Kim,
Russell King, Pawel Moll, Ian Campbell, Tony Lindgren, Mark Brown,
Liam Girdwood, devicetree@vger.kernel.org, Benoît Cousson,
Kumar Gala, linux-omap, linux-arm-kernel@lists.infradead.org
[-- Attachment #1: Type: text/plain, Size: 1995 bytes --]
Hi,
Le mardi 29 décembre 2015 à 15:55 -0600, Rob Herring a écrit :
> On Tue, Dec 29, 2015 at 3:26 PM, Paul Kocialkowski <contact@paulk.fr> wrote:
> > Le mardi 29 décembre 2015 à 14:02 -0600, Rob Herring a écrit :
> >> On Wed, Dec 23, 2015 at 11:58:37AM +0100, Paul Kocialkowski wrote:
> >> > LP872x regulators are made active via the EN pin, which might be hooked to a
> >> > GPIO. This adds support for driving the GPIO high when the driver is in use.
> >> >
> >> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> >> > ---
> >> > .../devicetree/bindings/regulator/lp872x.txt | 1 +
> >> > drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
> >> > include/linux/regulator/lp872x.h | 2 ++
> >> > 3 files changed, 33 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
> >> > index 7818318..0559c25 100644
> >> > --- a/Documentation/devicetree/bindings/regulator/lp872x.txt
> >> > +++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
> >> > @@ -28,6 +28,7 @@ Optional properties:
> >> > - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
> >> > - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
> >> > - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
> >> > + - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
> >>
> >> Should be "-gpios" instead of "-gpio".
Thanks for the review Rob, I have just submitted v2 with those
suggestions integrated.
> > Care to comment why? There is only one GPIO that can be used here, since
> > there is only one single EN pin. I thought this matched what is done
> > already with "ti,dvs-gpio".
>
> To be consistent. We use "clocks" and "interrupts" always whether one
> or more for example.
>
> -gpio is documented as deprecated now.
>
> Rob
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support
2015-12-28 0:34 ` Milo Kim
@ 2016-02-05 18:49 ` Paul Kocialkowski
0 siblings, 0 replies; 42+ messages in thread
From: Paul Kocialkowski @ 2016-02-05 18:49 UTC (permalink / raw)
To: Milo Kim
Cc: linux-kernel, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Kumar Gala, Russell King, Benoît Cousson, Tony Lindgren,
Liam Girdwood, Mark Brown, devicetree, linux-arm-kernel,
linux-omap
[-- Attachment #1: Type: text/plain, Size: 4174 bytes --]
Le lundi 28 décembre 2015 à 09:34 +0900, Milo Kim a écrit :
> Hi Paul,
>
> Thanks for the patches. Please see my comments below.
Thanks for the review Milo, I have just submitted v2 with those
suggestions integrated.
> On 23/12/15 19:58, Paul Kocialkowski wrote:
> > LP872x regulators are made active via the EN pin, which might be hooked to a
> > GPIO. This adds support for driving the GPIO high when the driver is in use.
>
> EN pin is used for enabling HW logic like I2C block. It's not regulator
> enable pin. Please check the block diagram in the datasheet.
>
> All regulators of LP8720 and LP8725 are controlled through I2C
> registers. Additionally, LP8725 provides external pin control for LDO3
> and BUCK2. In this case, you can use 'regulator_config.ena_gpio' when a
> regulator is registered.
>
> >
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> > .../devicetree/bindings/regulator/lp872x.txt | 1 +
> > drivers/regulator/lp872x.c | 33 ++++++++++++++++++++--
> > include/linux/regulator/lp872x.h | 2 ++
> > 3 files changed, 33 insertions(+), 3 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/regulator/lp872x.txt b/Documentation/devicetree/bindings/regulator/lp872x.txt
> > index 7818318..0559c25 100644
> > --- a/Documentation/devicetree/bindings/regulator/lp872x.txt
> > +++ b/Documentation/devicetree/bindings/regulator/lp872x.txt
> > @@ -28,6 +28,7 @@ Optional properties:
> > - ti,dvs-gpio: GPIO specifier for external DVS pin control of LP872x devices.
> > - ti,dvs-vsel: DVS selector. 0 = SEL_V1, 1 = SEL_V2.
> > - ti,dvs-state: initial DVS pin state. 0 = DVS_LOW, 1 = DVS_HIGH.
> > + - ti,enable-gpio: GPIO specifier for EN pin control of LP872x devices.
>
> Please use general property, "enable-gpios" instead of "ti,enable-gpio".
>
> >
> > Sub nodes for regulator_init_data
> > LP8720 has maximum 6 nodes. (child name: ldo1 ~ 5 and buck)
> > diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
> > index 21c49d8..c8855f3 100644
> > --- a/drivers/regulator/lp872x.c
> > +++ b/drivers/regulator/lp872x.c
> > @@ -726,6 +726,27 @@ static struct regulator_desc lp8725_regulator_desc[] = {
> > },
> > };
> >
> > +static int lp872x_init_enable(struct lp872x *lp)
>
> lp872x_enable_hw() would be better.
>
> > +{
> > + int ret, gpio;
> > +
> > + if (!lp->pdata)
> > + return -EINVAL;
> > +
> > + gpio = lp->pdata->enable_gpio;
> > + if (!gpio_is_valid(gpio))
> > + return 0;
> > +
> > + /* Always set enable GPIO high. */
> > + ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
> > + if (ret) {
> > + dev_err(lp->dev, "gpio request err: %d\n", ret);
> > + return ret;
> > + }
>
> LP8720 device needs max 200usec for startup time.
> LP8725 also requires enable time about 30ms.
> Please use usleep_range() after EN pin control.
>
> > +
> > + return 0;
> > +}
> > +
> > static int lp872x_init_dvs(struct lp872x *lp)
> > {
> > int ret, gpio;
> > @@ -763,14 +784,18 @@ static int lp872x_config(struct lp872x *lp)
> > int ret;
> >
> > if (!pdata || !pdata->update_config)
> > - goto init_dvs;
> > + goto init_dvs_enable;
> >
> > ret = lp872x_write_byte(lp, LP872X_GENERAL_CFG, pdata->general_config);
> > if (ret)
> > return ret;
> >
> > -init_dvs:
> > - return lp872x_init_dvs(lp);
> > +init_dvs_enable:
> > + ret = lp872x_init_dvs(lp);
> > + if (ret)
> > + return ret;
> > +
> > + return lp872x_init_enable(lp);
> > }
>
> Logic should be enabled prior to DVS configuration. And please call
> lp872x_enable_hw() in _probe().
>
> >
> > static struct regulator_init_data
> > @@ -875,6 +900,8 @@ static struct lp872x_platform_data
> > of_property_read_u8(np, "ti,dvs-state", &dvs_state);
> > pdata->dvs->init_state = dvs_state ? DVS_HIGH : DVS_LOW;
> >
> > + pdata->enable_gpio = of_get_named_gpio(np, "ti,enable-gpio", 0);
> > +
>
> Please replace "ti,enable-gpio" with "enable-gpios".
>
> Best regards,
> Milo
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2016-02-05 18:49 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 10:58 [PATCH 0/6] LG Optimus Black (P970) codename sniper support and lp872x improvements Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 1/6] regulator: lp872x: Add missing of_match in regulators descriptions Paul Kocialkowski
2015-12-28 1:04 ` Milo Kim
2015-12-23 10:58 ` [PATCH 2/6] regulator: lp872x: Get rid of duplicate reference to DVS GPIO Paul Kocialkowski
2015-12-28 1:05 ` Milo Kim
2015-12-23 10:58 ` [PATCH 3/6] regulator: lp872x: Remove warning about invalid " Paul Kocialkowski
2015-12-23 11:41 ` Mark Brown
2015-12-23 11:50 ` Paul Kocialkowski
2015-12-23 11:58 ` Mark Brown
2015-12-23 10:58 ` [PATCH 4/6] regulator: lp872x: Add enable GPIO pin support Paul Kocialkowski
[not found] ` <1450868319-20513-5-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
2015-12-23 11:56 ` Mark Brown
2015-12-23 12:52 ` Paul Kocialkowski
[not found] ` <20151223115632.GS16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-12-24 18:12 ` Paul Kocialkowski
2015-12-24 19:35 ` Mark Brown
2015-12-24 20:05 ` Paul Kocialkowski
2015-12-28 0:56 ` Milo Kim
[not found] ` <568088B4.6090207-l0cyMroinI0@public.gmane.org>
2015-12-28 22:49 ` Paul Kocialkowski
2015-12-29 0:45 ` Milo Kim
2015-12-29 11:13 ` Paul Kocialkowski
2015-12-30 0:22 ` Milo Kim
2015-12-30 8:35 ` Paul Kocialkowski
2015-12-30 16:33 ` Mark Brown
2015-12-30 18:37 ` Paul Kocialkowski
2015-12-31 21:40 ` Mark Brown
[not found] ` <20151231214007.GC16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-12-31 21:59 ` Paul Kocialkowski
2015-12-31 22:14 ` Mark Brown
[not found] ` <20151231221407.GF16023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-01-03 10:19 ` Paul Kocialkowski
2016-01-16 7:32 ` Paul Kocialkowski
2016-01-18 16:32 ` Mark Brown
2016-02-05 18:48 ` Paul Kocialkowski
2015-12-28 0:34 ` Milo Kim
2016-02-05 18:49 ` Paul Kocialkowski
2015-12-29 20:02 ` Rob Herring
2015-12-29 21:26 ` Paul Kocialkowski
2015-12-29 21:55 ` Rob Herring
2016-02-05 18:48 ` Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 5/6] ARM: LG Optimus Black (P970) codename sniper support, with basic features Paul Kocialkowski
[not found] ` <1450868319-20513-6-git-send-email-contact-W9ppeneeCTY@public.gmane.org>
2015-12-23 15:44 ` Tony Lindgren
2015-12-24 19:38 ` Paul Kocialkowski
2015-12-23 16:03 ` Javier Martinez Canillas
[not found] ` <CABxcv=moAUEPo8sq5KhuLZChrQtwjF1aBeNvV1i8HvUnwDXMZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-24 19:38 ` Paul Kocialkowski
2015-12-23 10:58 ` [PATCH 6/6] ARM: multi_v7_defconfig: Enable LP872x regulator support Paul Kocialkowski
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).