Skip to contentSkip to conversation

ARM: OMAP3+: VCVP mapping fixes to get DVFS working

PATCH New Tero Kristo 4 participants 8 messages Oct 10, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ARM: OMAP3+: VCVP mapping fixes to get DVFS working

Hi,

Seems like MPU DVFS does not scale the voltages currently with DT boot, due to missing mapping between regulator -> VCVP. Fixed this by adding support for platform data in the TWL regulator DT case + adding platform data quirk for the same.

Tested on omap3-beagle by measuring the MPU voltage rail.

OMAP4+ platforms do not currently register DVFS regulator, so this set by itself does not fix OMAP4 (needs the TPS MPU regulator added to DT etc. for OMAP4460.)

-Tero

#1 lore raw

PATCH 1/2 ARM: OMAP3+: TWL: add support for mapping platform data via pdata-quirks

Device tree based boot does not currently support DVFS voltage scaling, as the VC/VP mapping is broken. This patch adds support to provide platform data in the device tree boot case also, basically to pass the function pointers to the vc/vp core for voltage changes.

---
 arch/arm/mach-omap2/pdata-quirks.c |    8 ++--
 arch/arm/mach-omap2/twl-common.c   |   88 ++++++++++++++++++++++++++++++++----
 arch/arm/mach-omap2/twl-common.h   |    2 +
 3 files changed, 84 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +4 -4
index 90c88d4..03e4a86 100644
@@ -311,10 +311,10 @@ void omap_auxdata_legacy_init(struct device *dev)
 	if (dev->platform_data)
 		return;
 
-	if (strcmp("twl4030-gpio", dev_name(dev)))
-		return;
-
-	dev->platform_data = &twl_gpio_auxdata;
+	if (!strcmp("twl4030-gpio", dev_name(dev)))
+		dev->platform_data = &twl_gpio_auxdata;
+	else
+		dev->platform_data = omap_twl_match_regulator(dev);
 }
 
 /*
arch/arm/mach-omap2/twl-common.c +78 -10

125 lines not on this page · raw message

arch/arm/mach-omap2/twl-common.h +2 -0
index 24b65d0..b392ade 100644
@@ -55,6 +55,8 @@ void omap4_pmic_init(const char *pmic_type,
 		    struct twl4030_platform_data *pmic_data,
 		    struct i2c_board_info *devices, int nr_devices);
 
+void *omap_twl_match_regulator(struct device *dev);
+
 void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
 			   u32 pdata_flags, u32 regulators_flags);
 
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

PATCH 1/2 ARM: OMAP3+: TWL: add support for mapping platform data via pdata-quirks

Quoted 19 lines · Tero Kristo

Device tree based boot does not currently support DVFS voltage scaling, as the VC/VP mapping is broken. This patch adds support to provide platform data in the device tree boot case also, basically to pass the function pointers to the vc/vp core for voltage changes.

---
 arch/arm/mach-omap2/pdata-quirks.c |    8 ++--
 arch/arm/mach-omap2/twl-common.c   |   88 ++++++++++++++++++++++++++++++++----
 arch/arm/mach-omap2/twl-common.h   |    2 +
 3 files changed, 84 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +0 -0
index 90c88d4..03e4a86 100644
@@ -311,10 +311,10 @@ void omap_auxdata_legacy_init(struct device *dev)
 	if (dev->platform_data)
 		return;

arch/arm/mach-omap2/pdata-quirks.c void omap_auxdata_legacy_init(struct device *dev) · line 318

Quoted 10 lines
arch/arm/mach-omap2/pdata-quirks.c +4 -4
 
-	if (strcmp("twl4030-gpio", dev_name(dev)))
-		return;
-
-	dev->platform_data = &twl_gpio_auxdata;
+	if (!strcmp("twl4030-gpio", dev_name(dev)))
+		dev->platform_data = &twl_gpio_auxdata;
+	else
+		dev->platform_data = omap_twl_match_regulator(dev);
 }

I think now you're passing also dev->platform_data for all the other devices as this gets called for any devices added.

So you probale should use something like this instead:

	if (!strcmp("twl4030-gpio", dev_name(dev)))
		dev->platform_data = &twl_gpio_auxdata;

	if (!strcmp("twl4030-whatever-you-need", dev_name(dev)))
		dev->platform_data = &twl_gpio_auxdata;

Regards,

Tony

#3 lore raw

PATCH 1/2 ARM: OMAP3+: TWL: add support for mapping platform data via pdata-quirks

Quoted 21 lines · Tony Lindgren
Quoted 20 lines · Tero Kristo

Device tree based boot does not currently support DVFS voltage scaling, as the VC/VP mapping is broken. This patch adds support to provide platform data in the device tree boot case also, basically to pass the function pointers to the vc/vp core for voltage changes.

---
  arch/arm/mach-omap2/pdata-quirks.c |    8 ++--
  arch/arm/mach-omap2/twl-common.c   |   88 ++++++++++++++++++++++++++++++++----
  arch/arm/mach-omap2/twl-common.h   |    2 +
  3 files changed, 84 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/pdata-quirks.c +0 -0
index 90c88d4..03e4a86 100644
@@ -311,10 +311,10 @@ void omap_auxdata_legacy_init(struct device *dev)
  	if (dev->platform_data)
  		return;
 
Quoted 12 lines

arch/arm/mach-omap2/pdata-quirks.c void omap_auxdata_legacy_init(struct device *dev) · line 318

Quoted 9 lines
arch/arm/mach-omap2/pdata-quirks.c +4 -4
-	if (strcmp("twl4030-gpio", dev_name(dev)))
-		return;
-
-	dev->platform_data = &twl_gpio_auxdata;
+	if (!strcmp("twl4030-gpio", dev_name(dev)))
+		dev->platform_data = &twl_gpio_auxdata;
+	else
+		dev->platform_data = omap_twl_match_regulator(dev);
  }

I think now you're passing also dev->platform_data for all the other devices as this gets called for any devices added.

This is true, however omap_twl_match_regulator will return NULL if no match against a DT compatible string is found.

Quoted 8 lines

So you probale should use something like this instead:

	if (!strcmp("twl4030-gpio", dev_name(dev)))
		dev->platform_data = &twl_gpio_auxdata;

	if (!strcmp("twl4030-whatever-you-need", dev_name(dev)))
		dev->platform_data = &twl_gpio_auxdata;

This is what I did first, however the dev_name strings for the regulators are pretty complex: i2c at xyz:twl at 48:twl4030-vdd1-regulator or something like that, and I need to do string comparisons against 5 different devices. The current approach does a DT compatible match, which at least looks neater if it isn't more efficient also.

-Tero

#4 lore raw

PATCH 2/2 regulator: twl: use platform data in the DT based boot also

In reply to Tero Kristo

This allows to pass platform information during a DT boot also, currently this is completely ignored. Needed for supporting the platform specific regulator set_voltage / get_voltage ops for the SMPS regulators.

To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>

---
 drivers/regulator/twl-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/twl-regulator.c +1 -1
index 0b4f866..2c4fa06 100644
@@ -1103,9 +1103,9 @@ static int twlreg_probe(struct platform_device *pdev)
 	if (match) {
 		template = match->data;
 		id = template->desc.id;
+		drvdata = dev_get_platdata(&pdev->dev);
 		initdata = of_get_regulator_init_data(&pdev->dev,
 						      pdev->dev.of_node);
-		drvdata = NULL;
 	} else {
 		id = pdev->id;
 		initdata = dev_get_platdata(&pdev->dev);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 2/2 regulator: twl: use platform data in the DT based boot also

Quoted 29 lines · Tero Kristo

This allows to pass platform information during a DT boot also, currently this is completely ignored. Needed for supporting the platform specific regulator set_voltage / get_voltage ops for the SMPS regulators.

To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>

---
 drivers/regulator/twl-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/twl-regulator.c +1 -1
index 0b4f866..2c4fa06 100644
@@ -1103,9 +1103,9 @@ static int twlreg_probe(struct platform_device *pdev)
 	if (match) {
 		template = match->data;
 		id = template->desc.id;
+		drvdata = dev_get_platdata(&pdev->dev);
 		initdata = of_get_regulator_init_data(&pdev->dev,
 						      pdev->dev.of_node);
-		drvdata = NULL;
 	} else {
 		id = pdev->id;
 		initdata = dev_get_platdata(&pdev->dev);
Signature · 1 line
1.7.9.5

please post this separately and liam, mark need to be in cc. Unfortunately, I think we might be pushed back with pdata should'nt be in of boot.

So a slightly longer commit message might be necessary.

Signature · 2 lines
Regards,
Nishanth Menon
#6 lore raw

PATCH 2/2 regulator: twl: use platform data in the DT based boot also

In reply to Tero Kristo
Quoted 7 lines · Tero Kristo

This allows to pass platform information during a DT boot also, currently this is completely ignored. Needed for supporting the platform specific regulator set_voltage / get_voltage ops for the SMPS regulators.

To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>

Ok that "To:" didn't really work too well, added manually. Can repost if needed.

-Tero

Quoted 20 lines
---
  drivers/regulator/twl-regulator.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/twl-regulator.c +1 -1
index 0b4f866..2c4fa06 100644
@@ -1103,9 +1103,9 @@ static int twlreg_probe(struct platform_device *pdev)
  	if (match) {
  		template = match->data;
  		id = template->desc.id;
+		drvdata = dev_get_platdata(&pdev->dev);
  		initdata = of_get_regulator_init_data(&pdev->dev,
  						      pdev->dev.of_node);
-		drvdata = NULL;
  	} else {
  		id = pdev->id;
  		initdata = dev_get_platdata(&pdev->dev);
maintainer
#7 lore raw

PATCH 2/2 regulator: twl: use platform data in the DT based boot also

Quoted 11 lines · Tero Kristo
Quoted 7 lines · Tero Kristo

This allows to pass platform information during a DT boot also, currently this is completely ignored. Needed for supporting the platform specific regulator set_voltage / get_voltage ops for the SMPS regulators.

To: Liam Girdwood <[email protected]>
To: Mark Brown <[email protected]>

Ok that "To:" didn't really work too well, added manually. Can repost if needed.

I can't apply a quoted reply so yes please. I'm also not seeing patch
1.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141010/b7592177/attachment.sig>