* [PATCH 0/2] Model SMPS10 regulator @ 2013-06-20 8:37 Kishon Vijay Abraham I 2013-06-20 8:37 ` [PATCH 1/2] regulator: of: Added a property to indicate bypass mode support Kishon Vijay Abraham I 2013-06-20 8:37 ` [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators Kishon Vijay Abraham I 0 siblings, 2 replies; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-20 8:37 UTC (permalink / raw) To: ldewangan, broonie Cc: grant.likely, rob.herring, rob, lgirdwood, swarren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel, kishon Palmas has SMPS10 regulator which can generate two voltage level 3.75 and 5V. This SMPS10 has two outputs OUT1 and OUT2 and having one input IN1. SMPS10-OUT2 is always connected to SMPS10-IN1 via following logic: - Through parasitic diode (no sw control) - In bypass mode (bit configuration is there to enable/disable Bypass) - In Boost mode (bit configuration is there to enable/disable Boost mode) SMPS10-OUT1 is connected to the SMPS10-OUT2 pin through Switch (SW control for enabling/disabling this switch). There currently doesn't exist a property to indicate if the regulator supports bypass mode. So added a property to indicate if the regulator supports bypass mode. Also modified of_get_regulation_constraints() to check for that property and set appropriate constraints. The second patch models SMPS10 as two regulators, SMPS10-OUT1 and SMPS10-OUT2. Tested regulator enable of SMPS10-OUT1. Dint test bypass mode. Kishon Vijay Abraham I (2): regulator: of: Added a property to indicate bypass mode support regulator: palmas: model SMPS10 as two regulators .../devicetree/bindings/regulator/regulator.txt | 1 + drivers/regulator/of_regulator.c | 3 ++ drivers/regulator/palmas-regulator.c | 39 ++++++++++++++++++-- include/linux/mfd/palmas.h | 9 +++-- 4 files changed, 44 insertions(+), 8 deletions(-) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] regulator: of: Added a property to indicate bypass mode support 2013-06-20 8:37 [PATCH 0/2] Model SMPS10 regulator Kishon Vijay Abraham I @ 2013-06-20 8:37 ` Kishon Vijay Abraham I 2013-06-20 11:20 ` Mark Brown 2013-06-20 8:37 ` [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators Kishon Vijay Abraham I 1 sibling, 1 reply; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-20 8:37 UTC (permalink / raw) To: ldewangan, broonie Cc: grant.likely, rob.herring, rob, lgirdwood, swarren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel, kishon Added a property to indicate if the regulator supports bypass mode. Also modified of_get_regulation_constraints() to check for that property and set appropriate constraints. Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> --- Documentation/devicetree/bindings/regulator/regulator.txt | 1 + drivers/regulator/of_regulator.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt index ecfc6cc..48a3b8e 100644 --- a/Documentation/devicetree/bindings/regulator/regulator.txt +++ b/Documentation/devicetree/bindings/regulator/regulator.txt @@ -9,6 +9,7 @@ Optional properties: - regulator-max-microamp: largest current consumers may set - regulator-always-on: boolean, regulator should never be disabled - regulator-boot-on: bootloader/firmware enabled regulator +- regulator-allow-bypass: allow the regulator to go into bypass mode - <name>-supply: phandle to the parent supply/regulator node - regulator-ramp-delay: ramp delay for regulator(in uV/uS) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 66ca769..f3c8f8f 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -61,6 +61,9 @@ static void of_get_regulation_constraints(struct device_node *np, else /* status change should be possible if not always on. */ constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS; + if (of_property_read_bool(np, "regulator-allow-bypass")) + constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS; + ramp_delay = of_get_property(np, "regulator-ramp-delay", NULL); if (ramp_delay) constraints->ramp_delay = be32_to_cpu(*ramp_delay); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] regulator: of: Added a property to indicate bypass mode support 2013-06-20 8:37 ` [PATCH 1/2] regulator: of: Added a property to indicate bypass mode support Kishon Vijay Abraham I @ 2013-06-20 11:20 ` Mark Brown 0 siblings, 0 replies; 14+ messages in thread From: Mark Brown @ 2013-06-20 11:20 UTC (permalink / raw) To: Kishon Vijay Abraham I Cc: ldewangan, grant.likely, rob.herring, rob, lgirdwood, swarren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 270 bytes --] On Thu, Jun 20, 2013 at 02:07:37PM +0530, Kishon Vijay Abraham I wrote: > Added a property to indicate if the regulator supports bypass mode. > Also modified of_get_regulation_constraints() to check for that > property and set appropriate constraints. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 8:37 [PATCH 0/2] Model SMPS10 regulator Kishon Vijay Abraham I 2013-06-20 8:37 ` [PATCH 1/2] regulator: of: Added a property to indicate bypass mode support Kishon Vijay Abraham I @ 2013-06-20 8:37 ` Kishon Vijay Abraham I 2013-06-20 10:52 ` Laxman Dewangan 1 sibling, 1 reply; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-20 8:37 UTC (permalink / raw) To: ldewangan, broonie Cc: grant.likely, rob.herring, rob, lgirdwood, swarren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel, kishon SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using regulator_enable(). Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> --- drivers/regulator/palmas-regulator.c | 39 ++++++++++++++++++++++++++++++---- include/linux/mfd/palmas.h | 9 ++++---- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 3ae44ac..7004bab 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { .ctrl_addr = PALMAS_SMPS9_CTRL, }, { - .name = "SMPS10", + .name = "SMPS10_OUT1", + .sname = "smps10-out2", + .ctrl_addr = PALMAS_SMPS10_CTRL, + }, + { + .name = "SMPS10_OUT2", .sname = "smps10-in", .ctrl_addr = PALMAS_SMPS10_CTRL, }, @@ -487,6 +492,8 @@ static struct regulator_ops palmas_ops_smps10 = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, + .set_bypass = regulator_set_bypass_regmap, + .get_bypass = regulator_get_bypass_regmap, }; static int palmas_is_enabled_ldo(struct regulator_dev *dev) @@ -538,7 +545,8 @@ static int palmas_smps_init(struct palmas *palmas, int id, return ret; switch (id) { - case PALMAS_REG_SMPS10: + case PALMAS_REG_SMPS10_OUT1: + case PALMAS_REG_SMPS10_OUT2: reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK; if (reg_init->mode_sleep) reg |= reg_init->mode_sleep << @@ -681,7 +689,8 @@ static struct of_regulator_match palmas_matches[] = { { .name = "smps7", }, { .name = "smps8", }, { .name = "smps9", }, - { .name = "smps10", }, + { .name = "smps10_out1", }, + { .name = "smps10_out2", }, { .name = "ldo1", }, { .name = "ldo2", }, { .name = "ldo3", }, @@ -869,7 +878,25 @@ static int palmas_regulators_probe(struct platform_device *pdev) pmic->desc[id].id = id; switch (id) { - case PALMAS_REG_SMPS10: + case PALMAS_REG_SMPS10_OUT1: + pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES; + pmic->desc[id].ops = &palmas_ops_smps10; + pmic->desc[id].vsel_reg = + PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, + PALMAS_SMPS10_CTRL); + pmic->desc[id].vsel_mask = SMPS10_VSEL; + pmic->desc[id].enable_reg = + PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, + PALMAS_SMPS10_CTRL); + pmic->desc[id].enable_mask = SMPS10_SWITCH_EN; + pmic->desc[id].bypass_reg = + PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, + PALMAS_SMPS10_CTRL); + pmic->desc[id].bypass_mask = SMPS10_BYPASS_EN; + pmic->desc[id].min_uV = 3750000; + pmic->desc[id].uV_step = 1250000; + break; + case PALMAS_REG_SMPS10_OUT2: pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES; pmic->desc[id].ops = &palmas_ops_smps10; pmic->desc[id].vsel_reg = @@ -880,6 +907,10 @@ static int palmas_regulators_probe(struct platform_device *pdev) PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, PALMAS_SMPS10_CTRL); pmic->desc[id].enable_mask = SMPS10_BOOST_EN; + pmic->desc[id].bypass_reg = + PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, + PALMAS_SMPS10_CTRL); + pmic->desc[id].bypass_mask = SMPS10_BYPASS_EN; pmic->desc[id].min_uV = 3750000; pmic->desc[id].uV_step = 1250000; break; diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 8f21daf..1bbcda9 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -138,7 +138,8 @@ enum palmas_regulators { PALMAS_REG_SMPS7, PALMAS_REG_SMPS8, PALMAS_REG_SMPS9, - PALMAS_REG_SMPS10, + PALMAS_REG_SMPS10_OUT1, + PALMAS_REG_SMPS10_OUT2, /* LDO regulators */ PALMAS_REG_LDO1, PALMAS_REG_LDO2, @@ -336,9 +337,9 @@ struct palmas_pmic { int smps123; int smps457; - int range[PALMAS_REG_SMPS10]; - unsigned int ramp_delay[PALMAS_REG_SMPS10]; - unsigned int current_reg_mode[PALMAS_REG_SMPS10]; + int range[PALMAS_REG_SMPS10_OUT2]; + unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT2]; + unsigned int current_reg_mode[PALMAS_REG_SMPS10_OUT2]; }; struct palmas_resource { -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 8:37 ` [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators Kishon Vijay Abraham I @ 2013-06-20 10:52 ` Laxman Dewangan 2013-06-20 13:50 ` Kishon Vijay Abraham I 0 siblings, 1 reply; 14+ messages in thread From: Laxman Dewangan @ 2013-06-20 10:52 UTC (permalink / raw) To: Kishon Vijay Abraham I Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel On Thursday 20 June 2013 02:07 PM, Kishon Vijay Abraham I wrote: > SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. > SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either > in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures > it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be > used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using > regulator_enable(). > > Cc: Laxman Dewangan <ldewangan@nvidia.com> > Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> > --- > drivers/regulator/palmas-regulator.c | 39 ++++++++++++++++++++++++++++++---- > include/linux/mfd/palmas.h | 9 ++++---- > 2 files changed, 40 insertions(+), 8 deletions(-) > > diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c > index 3ae44ac..7004bab 100644 > --- a/drivers/regulator/palmas-regulator.c > +++ b/drivers/regulator/palmas-regulator.c > @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { > .ctrl_addr = PALMAS_SMPS9_CTRL, > }, > { > - .name = "SMPS10", > + .name = "SMPS10_OUT1", > + .sname = "smps10-out2", > + .ctrl_addr = PALMAS_SMPS10_CTRL, > + }, > + { > + .name = "SMPS10_OUT2", > .sname = "smps10-in", > This sequence can create regulator to be never register. In probe, we register regulator from 0 to max_id. Here smps10-out1 comes first and see the supply as smps10-out2 which is not registered yet and so will fail with PROBE_DEFER When again it tries, the same issue. I think we need to reverse the sequence, SMPS10-OUT2 and then SMPS10-OUT1. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 10:52 ` Laxman Dewangan @ 2013-06-20 13:50 ` Kishon Vijay Abraham I 2013-06-20 14:03 ` Laxman Dewangan 0 siblings, 1 reply; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-20 13:50 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel Hi, On Thursday 20 June 2013 04:22 PM, Laxman Dewangan wrote: > On Thursday 20 June 2013 02:07 PM, Kishon Vijay Abraham I wrote: >> SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. >> SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either >> in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures >> it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be >> used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using >> regulator_enable(). >> >> Cc: Laxman Dewangan <ldewangan@nvidia.com> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> >> --- >> drivers/regulator/palmas-regulator.c | 39 ++++++++++++++++++++++++++++++---- >> include/linux/mfd/palmas.h | 9 ++++---- >> 2 files changed, 40 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/regulator/palmas-regulator.c >> b/drivers/regulator/palmas-regulator.c >> index 3ae44ac..7004bab 100644 >> --- a/drivers/regulator/palmas-regulator.c >> +++ b/drivers/regulator/palmas-regulator.c >> @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { >> .ctrl_addr = PALMAS_SMPS9_CTRL, >> }, >> { >> - .name = "SMPS10", >> + .name = "SMPS10_OUT1", >> + .sname = "smps10-out2", >> + .ctrl_addr = PALMAS_SMPS10_CTRL, >> + }, >> + { >> + .name = "SMPS10_OUT2", >> .sname = "smps10-in", >> > > This sequence can create regulator to be never register. > In probe, we register regulator from 0 to max_id. > Here smps10-out1 comes first and see the supply as smps10-out2 which is not > registered yet and so will fail with PROBE_DEFER > When again it tries, the same issue. hmm.. But I was able to get (regulator_get) *SMPS10_OUT1* without any issue during my testing. From looking at the code, I couldn't see *sname* being used anywhere. Thanks Kishon ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 13:50 ` Kishon Vijay Abraham I @ 2013-06-20 14:03 ` Laxman Dewangan 2013-06-20 14:19 ` Kishon Vijay Abraham I 0 siblings, 1 reply; 14+ messages in thread From: Laxman Dewangan @ 2013-06-20 14:03 UTC (permalink / raw) To: Kishon Vijay Abraham I Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, ian, devicetree-discuss, linux-doc, linux-kernel On Thursday 20 June 2013 07:20 PM, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 20 June 2013 04:22 PM, Laxman Dewangan wrote: >> On Thursday 20 June 2013 02:07 PM, Kishon Vijay Abraham I wrote: >>> SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. >>> SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either >>> in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures >>> it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be >>> used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using >>> regulator_enable(). >>> >>> Cc: Laxman Dewangan <ldewangan@nvidia.com> >>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> >>> --- >>> drivers/regulator/palmas-regulator.c | 39 ++++++++++++++++++++++++++++++---- >>> include/linux/mfd/palmas.h | 9 ++++---- >>> 2 files changed, 40 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/regulator/palmas-regulator.c >>> b/drivers/regulator/palmas-regulator.c >>> index 3ae44ac..7004bab 100644 >>> --- a/drivers/regulator/palmas-regulator.c >>> +++ b/drivers/regulator/palmas-regulator.c >>> @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { >>> .ctrl_addr = PALMAS_SMPS9_CTRL, >>> }, >>> { >>> - .name = "SMPS10", >>> + .name = "SMPS10_OUT1", >>> + .sname = "smps10-out2", >>> + .ctrl_addr = PALMAS_SMPS10_CTRL, >>> + }, >>> + { >>> + .name = "SMPS10_OUT2", >>> .sname = "smps10-in", >>> >> This sequence can create regulator to be never register. >> In probe, we register regulator from 0 to max_id. >> Here smps10-out1 comes first and see the supply as smps10-out2 which is not >> registered yet and so will fail with PROBE_DEFER >> When again it tries, the same issue. > hmm.. But I was able to get (regulator_get) *SMPS10_OUT1* without any issue > during my testing. From looking at the code, I couldn't see *sname* being used > anywhere. We used the sname as pmic->desc[id].supply_name = palmas_regs_info[id].sname; However, how you have populated your dt? Have you added like smps10-out2-supply = <&SMPS10_OUT2> for the palmas regualtor -dt. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 14:03 ` Laxman Dewangan @ 2013-06-20 14:19 ` Kishon Vijay Abraham I 2013-06-20 14:44 ` Laxman Dewangan 0 siblings, 1 reply; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-20 14:19 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel Hi, On Thursday 20 June 2013 07:33 PM, Laxman Dewangan wrote: > On Thursday 20 June 2013 07:20 PM, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Thursday 20 June 2013 04:22 PM, Laxman Dewangan wrote: >>> On Thursday 20 June 2013 02:07 PM, Kishon Vijay Abraham I wrote: >>>> SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. >>>> SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either >>>> in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures >>>> it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be >>>> used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using >>>> regulator_enable(). >>>> >>>> Cc: Laxman Dewangan <ldewangan@nvidia.com> >>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> >>>> --- >>>> drivers/regulator/palmas-regulator.c | 39 >>>> ++++++++++++++++++++++++++++++---- >>>> include/linux/mfd/palmas.h | 9 ++++---- >>>> 2 files changed, 40 insertions(+), 8 deletions(-) >>>> >>>> diff --git a/drivers/regulator/palmas-regulator.c >>>> b/drivers/regulator/palmas-regulator.c >>>> index 3ae44ac..7004bab 100644 >>>> --- a/drivers/regulator/palmas-regulator.c >>>> +++ b/drivers/regulator/palmas-regulator.c >>>> @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { >>>> .ctrl_addr = PALMAS_SMPS9_CTRL, >>>> }, >>>> { >>>> - .name = "SMPS10", >>>> + .name = "SMPS10_OUT1", >>>> + .sname = "smps10-out2", >>>> + .ctrl_addr = PALMAS_SMPS10_CTRL, >>>> + }, >>>> + { >>>> + .name = "SMPS10_OUT2", >>>> .sname = "smps10-in", >>>> >>> This sequence can create regulator to be never register. >>> In probe, we register regulator from 0 to max_id. >>> Here smps10-out1 comes first and see the supply as smps10-out2 which is not >>> registered yet and so will fail with PROBE_DEFER >>> When again it tries, the same issue. >> hmm.. But I was able to get (regulator_get) *SMPS10_OUT1* without any issue >> during my testing. From looking at the code, I couldn't see *sname* being used >> anywhere. > > We used the sname as > pmic->desc[id].supply_name = palmas_regs_info[id].sname; > > However, how you have populated your dt? > Have you added like > smps10-out2-supply = <&SMPS10_OUT2> > > for the palmas regualtor -dt. I added the regulator data like + smps10_out1_reg: smps10_out1 { + regulator-name = "smps10_out1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + regulator-allow-bypass; + ti,warm_sleep = <0>; + ti,roof_floor = <0>; + ti,mode_sleep = <0>; + ti,warm_reset = <0>; + ti,tstep = <0>; + ti,vsel = <0>; + }; and from my controller I reference it using + vbus-supply = <&smps10_out1_reg>; and in the controller driver I use + vbus_reg = devm_regulator_get(dev, "vbus"); Thanks Kishon ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 14:19 ` Kishon Vijay Abraham I @ 2013-06-20 14:44 ` Laxman Dewangan 2013-06-20 15:26 ` Kishon Vijay Abraham I 0 siblings, 1 reply; 14+ messages in thread From: Laxman Dewangan @ 2013-06-20 14:44 UTC (permalink / raw) To: Kishon Vijay Abraham I Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel On Thursday 20 June 2013 07:49 PM, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 20 June 2013 07:33 PM, Laxman Dewangan wrote: >> On Thursday 20 June 2013 07:20 PM, Kishon Vijay Abraham I wrote: >>> Hi, >>> >>> On Thursday 20 June 2013 04:22 PM, Laxman Dewangan wrote: >>>> On Thursday 20 June 2013 02:07 PM, Kishon Vijay Abraham I wrote: >>>>> SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. >>>>> SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either >>>>> in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures >>>>> it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be >>>>> used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using >>>>> regulator_enable(). >>>>> >>>>> Cc: Laxman Dewangan <ldewangan@nvidia.com> >>>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> >>>>> --- >>>>> drivers/regulator/palmas-regulator.c | 39 >>>>> ++++++++++++++++++++++++++++++---- >>>>> include/linux/mfd/palmas.h | 9 ++++---- >>>>> 2 files changed, 40 insertions(+), 8 deletions(-) >>>>> >>>>> diff --git a/drivers/regulator/palmas-regulator.c >>>>> b/drivers/regulator/palmas-regulator.c >>>>> index 3ae44ac..7004bab 100644 >>>>> --- a/drivers/regulator/palmas-regulator.c >>>>> +++ b/drivers/regulator/palmas-regulator.c >>>>> @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { >>>>> .ctrl_addr = PALMAS_SMPS9_CTRL, >>>>> }, >>>>> { >>>>> - .name = "SMPS10", >>>>> + .name = "SMPS10_OUT1", >>>>> + .sname = "smps10-out2", >>>>> + .ctrl_addr = PALMAS_SMPS10_CTRL, >>>>> + }, >>>>> + { >>>>> + .name = "SMPS10_OUT2", >>>>> .sname = "smps10-in", >>>>> >>>> This sequence can create regulator to be never register. >>>> In probe, we register regulator from 0 to max_id. >>>> Here smps10-out1 comes first and see the supply as smps10-out2 which is not >>>> registered yet and so will fail with PROBE_DEFER >>>> When again it tries, the same issue. >>> hmm.. But I was able to get (regulator_get) *SMPS10_OUT1* without any issue >>> during my testing. From looking at the code, I couldn't see *sname* being used >>> anywhere. >> We used the sname as >> pmic->desc[id].supply_name = palmas_regs_info[id].sname; >> >> However, how you have populated your dt? >> Have you added like >> smps10-out2-supply = <&SMPS10_OUT2> >> >> for the palmas regualtor -dt. > I added the regulator data like > > + smps10_out1_reg: smps10_out1 { > + regulator-name = "smps10_out1"; > + regulator-min-microvolt = <5000000>; > + regulator-max-microvolt = <5000000>; > + regulator-always-on; > + regulator-boot-on; > + regulator-allow-bypass; > + ti,warm_sleep = <0>; > + ti,roof_floor = <0>; > + ti,mode_sleep = <0>; > + ti,warm_reset = <0>; > + ti,tstep = <0>; > + ti,vsel = <0>; > + }; > > and from my controller I reference it using > + vbus-supply = <&smps10_out1_reg>; > > and in the controller driver I use > + vbus_reg = devm_regulator_get(dev, "vbus"); Have you added the regulator supply entries? Are you testing on mainline linux-next? I have DT entry as: palmas: tps65913@58 { compatible = "ti,palmas"; reg = <0x58>; interrupts = <0 86 0x4>; :::::::::::::::; palmas_pmic { compatible = "ti,palmas-pmic"; smps1-in-supply = <&tps65090_dcdc3_reg>; smps3-in-supply = <&tps65090_dcdc3_reg>; smps4-in-supply = <&tps65090_dcdc2_reg>; :::::::::; smps10-out2-supply = <&SMPS10_OUT2> :::::::::::::; } And it fails. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 14:44 ` Laxman Dewangan @ 2013-06-20 15:26 ` Kishon Vijay Abraham I 2013-06-21 13:25 ` Laxman Dewangan 0 siblings, 1 reply; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-20 15:26 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel Hi, On Thursday 20 June 2013 08:14 PM, Laxman Dewangan wrote: > On Thursday 20 June 2013 07:49 PM, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Thursday 20 June 2013 07:33 PM, Laxman Dewangan wrote: >>> On Thursday 20 June 2013 07:20 PM, Kishon Vijay Abraham I wrote: >>>> Hi, >>>> >>>> On Thursday 20 June 2013 04:22 PM, Laxman Dewangan wrote: >>>>> On Thursday 20 June 2013 02:07 PM, Kishon Vijay Abraham I wrote: >>>>>> SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. >>>>>> SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either >>>>>> in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures >>>>>> it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be >>>>>> used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using >>>>>> regulator_enable(). >>>>>> >>>>>> Cc: Laxman Dewangan <ldewangan@nvidia.com> >>>>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> >>>>>> --- >>>>>> drivers/regulator/palmas-regulator.c | 39 >>>>>> ++++++++++++++++++++++++++++++---- >>>>>> include/linux/mfd/palmas.h | 9 ++++---- >>>>>> 2 files changed, 40 insertions(+), 8 deletions(-) >>>>>> >>>>>> diff --git a/drivers/regulator/palmas-regulator.c >>>>>> b/drivers/regulator/palmas-regulator.c >>>>>> index 3ae44ac..7004bab 100644 >>>>>> --- a/drivers/regulator/palmas-regulator.c >>>>>> +++ b/drivers/regulator/palmas-regulator.c >>>>>> @@ -97,7 +97,12 @@ static const struct regs_info palmas_regs_info[] = { >>>>>> .ctrl_addr = PALMAS_SMPS9_CTRL, >>>>>> }, >>>>>> { >>>>>> - .name = "SMPS10", >>>>>> + .name = "SMPS10_OUT1", >>>>>> + .sname = "smps10-out2", >>>>>> + .ctrl_addr = PALMAS_SMPS10_CTRL, >>>>>> + }, >>>>>> + { >>>>>> + .name = "SMPS10_OUT2", >>>>>> .sname = "smps10-in", >>>>>> >>>>> This sequence can create regulator to be never register. >>>>> In probe, we register regulator from 0 to max_id. >>>>> Here smps10-out1 comes first and see the supply as smps10-out2 which is not >>>>> registered yet and so will fail with PROBE_DEFER >>>>> When again it tries, the same issue. >>>> hmm.. But I was able to get (regulator_get) *SMPS10_OUT1* without any issue >>>> during my testing. From looking at the code, I couldn't see *sname* being used >>>> anywhere. >>> We used the sname as >>> pmic->desc[id].supply_name = palmas_regs_info[id].sname; >>> >>> However, how you have populated your dt? >>> Have you added like >>> smps10-out2-supply = <&SMPS10_OUT2> >>> >>> for the palmas regualtor -dt. >> I added the regulator data like >> >> + smps10_out1_reg: smps10_out1 { >> + regulator-name = "smps10_out1"; >> + regulator-min-microvolt = <5000000>; >> + regulator-max-microvolt = <5000000>; >> + regulator-always-on; >> + regulator-boot-on; >> + regulator-allow-bypass; >> + ti,warm_sleep = <0>; >> + ti,roof_floor = <0>; >> + ti,mode_sleep = <0>; >> + ti,warm_reset = <0>; >> + ti,tstep = <0>; >> + ti,vsel = <0>; >> + }; >> >> and from my controller I reference it using >> + vbus-supply = <&smps10_out1_reg>; >> >> and in the controller driver I use >> + vbus_reg = devm_regulator_get(dev, "vbus"); > > Have you added the regulator supply entries? > Are you testing on mainline linux-next? Not in linux-next :-( Tested only with mainline. Does inverting the order helps? Thanks Kishon ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-20 15:26 ` Kishon Vijay Abraham I @ 2013-06-21 13:25 ` Laxman Dewangan 2013-06-21 14:00 ` Kishon Vijay Abraham I 0 siblings, 1 reply; 14+ messages in thread From: Laxman Dewangan @ 2013-06-21 13:25 UTC (permalink / raw) To: Kishon Vijay Abraham I Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel On Thursday 20 June 2013 08:56 PM, Kishon Vijay Abraham I wrote: > Hi, > > On Thursday 20 June 2013 08:14 PM, Laxman Dewangan wrote: >> >> Have you added the regulator supply entries? >> Are you testing on mainline linux-next? > Not in linux-next :-( Tested only with mainline. > Does inverting the order helps? > I think because you do not have entry of supply in your dt node, it gets ignored by regulator_dev_lookup() and continue. I made the entry like (added entry form smps10-out2-supply and smps10-in-supply in dt node) and then it failed. /*** + smps10-out2-supply = <&palmas_smps10_out2_reg>; + smps10-in-supply = <&tps65090_dcdc3_reg>; ldo3-in-supply = <&palmas_smps3_reg>; @@ -903,6 +905,20 @@ regulator-always-on; }; + palmas_smps10_out1_reg: smps10_out1 { + regulator-name = "smps10_out1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; + + palmas_smps10_out2_reg: smps10_out2 { + regulator-name = "smps10_out2"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; + **/ After reversing the sequence, it worked fine. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-21 13:25 ` Laxman Dewangan @ 2013-06-21 14:00 ` Kishon Vijay Abraham I 2013-06-22 13:12 ` Laxman Dewangan 0 siblings, 1 reply; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-21 14:00 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel On Friday 21 June 2013 06:55 PM, Laxman Dewangan wrote: > On Thursday 20 June 2013 08:56 PM, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Thursday 20 June 2013 08:14 PM, Laxman Dewangan wrote: >>> >>> Have you added the regulator supply entries? >>> Are you testing on mainline linux-next? >> Not in linux-next :-( Tested only with mainline. >> Does inverting the order helps? >> > > I think because you do not have entry of supply in your dt node, it gets > ignored by regulator_dev_lookup() and continue. > > I made the entry like (added entry form smps10-out2-supply and smps10-in-supply > in dt node) and then it failed. > /*** > > + smps10-out2-supply = <&palmas_smps10_out2_reg>; > + smps10-in-supply = <&tps65090_dcdc3_reg>; > ldo3-in-supply = <&palmas_smps3_reg>; > @@ -903,6 +905,20 @@ > regulator-always-on; > }; > > + palmas_smps10_out1_reg: smps10_out1 { > + regulator-name = "smps10_out1"; > + regulator-min-microvolt = <5000000>; > + regulator-max-microvolt = <5000000>; > + regulator-always-on; > + }; > + > + palmas_smps10_out2_reg: smps10_out2 { > + regulator-name = "smps10_out2"; > + regulator-min-microvolt = <5000000>; > + regulator-max-microvolt = <5000000>; > + regulator-always-on; > + }; > + > **/ > > > After reversing the sequence, it worked fine. You mean, changing the order in dt node helped? Thanks Kishon ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-21 14:00 ` Kishon Vijay Abraham I @ 2013-06-22 13:12 ` Laxman Dewangan 2013-06-24 5:23 ` Kishon Vijay Abraham I 0 siblings, 1 reply; 14+ messages in thread From: Laxman Dewangan @ 2013-06-22 13:12 UTC (permalink / raw) To: Kishon Vijay Abraham I Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel On Friday 21 June 2013 07:30 PM, Kishon Vijay Abraham I wrote: > On Friday 21 June 2013 06:55 PM, Laxman Dewangan wrote: >> On Thursday 20 June 2013 08:56 PM, Kishon Vijay Abraham I wrote: >>> Hi, >>> >>> On Thursday 20 June 2013 08:14 PM, Laxman Dewangan wrote: >>>> Have you added the regulator supply entries? >>>> Are you testing on mainline linux-next? >>> Not in linux-next :-( Tested only with mainline. >>> Does inverting the order helps? >>> >> I think because you do not have entry of supply in your dt node, it gets >> ignored by regulator_dev_lookup() and continue. >> >> I made the entry like (added entry form smps10-out2-supply and smps10-in-supply >> in dt node) and then it failed. >> /*** >> >> + smps10-out2-supply = <&palmas_smps10_out2_reg>; >> + smps10-in-supply = <&tps65090_dcdc3_reg>; >> ldo3-in-supply = <&palmas_smps3_reg>; >> @@ -903,6 +905,20 @@ >> regulator-always-on; >> }; >> >> + palmas_smps10_out1_reg: smps10_out1 { >> + regulator-name = "smps10_out1"; >> + regulator-min-microvolt = <5000000>; >> + regulator-max-microvolt = <5000000>; >> + regulator-always-on; >> + }; >> + >> + palmas_smps10_out2_reg: smps10_out2 { >> + regulator-name = "smps10_out2"; >> + regulator-min-microvolt = <5000000>; >> + regulator-max-microvolt = <5000000>; >> + regulator-always-on; >> + }; >> + >> **/ >> >> >> After reversing the sequence, it worked fine. > You mean, changing the order in dt node helped? The sequence on DT does not matter. We register the regulators in the sequence it is having enums value for regulator-id in loop. So we need to revert there. Yaah, it looks odd that SMPS10-OUT2come before SMPS10-OUT1 in enums definition. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators 2013-06-22 13:12 ` Laxman Dewangan @ 2013-06-24 5:23 ` Kishon Vijay Abraham I 0 siblings, 0 replies; 14+ messages in thread From: Kishon Vijay Abraham I @ 2013-06-24 5:23 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie, grant.likely, rob.herring, rob, lgirdwood, Stephen Warren, gg, sameo, devicetree-discuss, linux-doc, linux-kernel Hi, On Saturday 22 June 2013 06:42 PM, Laxman Dewangan wrote: > On Friday 21 June 2013 07:30 PM, Kishon Vijay Abraham I wrote: >> On Friday 21 June 2013 06:55 PM, Laxman Dewangan wrote: >>> On Thursday 20 June 2013 08:56 PM, Kishon Vijay Abraham I wrote: >>>> Hi, >>>> >>>> On Thursday 20 June 2013 08:14 PM, Laxman Dewangan wrote: >>>>> Have you added the regulator supply entries? >>>>> Are you testing on mainline linux-next? >>>> Not in linux-next :-( Tested only with mainline. >>>> Does inverting the order helps? >>>> >>> I think because you do not have entry of supply in your dt node, it gets >>> ignored by regulator_dev_lookup() and continue. >>> >>> I made the entry like (added entry form smps10-out2-supply and smps10-in-supply >>> in dt node) and then it failed. >>> /*** >>> >>> + smps10-out2-supply = <&palmas_smps10_out2_reg>; >>> + smps10-in-supply = <&tps65090_dcdc3_reg>; >>> ldo3-in-supply = <&palmas_smps3_reg>; >>> @@ -903,6 +905,20 @@ >>> regulator-always-on; >>> }; >>> >>> + palmas_smps10_out1_reg: smps10_out1 { >>> + regulator-name = "smps10_out1"; >>> + regulator-min-microvolt = <5000000>; >>> + regulator-max-microvolt = <5000000>; >>> + regulator-always-on; >>> + }; >>> + >>> + palmas_smps10_out2_reg: smps10_out2 { >>> + regulator-name = "smps10_out2"; >>> + regulator-min-microvolt = <5000000>; >>> + regulator-max-microvolt = <5000000>; >>> + regulator-always-on; >>> + }; >>> + >>> **/ >>> >>> >>> After reversing the sequence, it worked fine. >> You mean, changing the order in dt node helped? > > The sequence on DT does not matter. We register the regulators in the sequence > it is having enums value for regulator-id in loop. So we need to revert there. > > Yaah, it looks odd that SMPS10-OUT2come before SMPS10-OUT1 in enums definition. Will fix that and send a patch. Thanks Kishon ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-06-24 5:24 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-06-20 8:37 [PATCH 0/2] Model SMPS10 regulator Kishon Vijay Abraham I 2013-06-20 8:37 ` [PATCH 1/2] regulator: of: Added a property to indicate bypass mode support Kishon Vijay Abraham I 2013-06-20 11:20 ` Mark Brown 2013-06-20 8:37 ` [PATCH 2/2] regulator: palmas: model SMPS10 as two regulators Kishon Vijay Abraham I 2013-06-20 10:52 ` Laxman Dewangan 2013-06-20 13:50 ` Kishon Vijay Abraham I 2013-06-20 14:03 ` Laxman Dewangan 2013-06-20 14:19 ` Kishon Vijay Abraham I 2013-06-20 14:44 ` Laxman Dewangan 2013-06-20 15:26 ` Kishon Vijay Abraham I 2013-06-21 13:25 ` Laxman Dewangan 2013-06-21 14:00 ` Kishon Vijay Abraham I 2013-06-22 13:12 ` Laxman Dewangan 2013-06-24 5:23 ` Kishon Vijay Abraham I
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).