Hi Mark,

Waking up this old thread again.

On Wed, 2011-05-11 at 14:12 +0200, Mark Brown wrote:
> On Wed, May 11, 2011 at 12:23:45PM +0300, Tomi Valkeinen wrote:
> 
> > So how should the regulator be set up?
> 
> You need to create a new regulator of some kind and then provide a way
> for machines to set the supply_regulator in the init_data.

What should this "new regulator of some kind" be? I was trying out with
fixed regulator, but I'm not quite sure if that's good here.

I don't want a full controllable regulator, but just a virtual "route"
regulator, which mirrors the state of the parent regulator.

(Well, I don't actually want that, I want to dynamically add some
REGULATOR_SUPPLYs to an existing regulator, but afaik that's not
possible.)

Can the fixed regulator be used like that?

Using a new regulator like this also means that there is a dependency
between the new regulator and the used source supply. I haven't solved
this yet, as the twl driver seems to add the regulators at some later
stage.

Below is my test patch for reference. It doesn't do the work in a common
file, so it's just for testing.

 Tomi

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 2647a95..fb477f1 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -22,6 +22,7 @@
 #include <linux/i2c/twl.h>
 #include <linux/gpio_keys.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/leds.h>
 #include <linux/leds_pwm.h>
 
@@ -277,10 +278,47 @@ static int omap_ethernet_init(void)
        return status;
 }
 
+static struct regulator_consumer_supply fixed_supply[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"),
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
+};
+
+static struct regulator_init_data fixed_reg_init_data = {
+       .supply_regulator = "VCXIO",
+       .constraints = {
+               .min_uV                 = 1800000,
+               .max_uV                 = 1800000,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask  = REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+               .always_on      = true,
+       },
+       .num_consumer_supplies  = ARRAY_SIZE(fixed_supply),
+       .consumer_supplies      = fixed_supply,
+};
+
+static struct fixed_voltage_config omap_dss_fixed_reg_data = {
+       .gpio = -EINVAL,
+       .supply_name = "dss-regulator",
+       .init_data = &fixed_reg_init_data,
+       .enabled_at_boot = 1,
+       .microvolts = 1800000,
+};
+
+static struct platform_device omap_dss_fixed_reg_device = {
+       .name   = "reg-fixed-voltage",
+       .id     = 3,
+       .dev    = {
+               .platform_data  = &omap_dss_fixed_reg_data,
+       },
+};
+
 static struct platform_device *sdp4430_devices[] __initdata = {
        &sdp4430_gpio_keys_device,
        &sdp4430_leds_gpio,
        &sdp4430_leds_pwm,
+       &omap_dss_fixed_reg_device,
 };
 
 static struct omap_board_config_kernel sdp4430_config[] __initdata = {
@@ -339,8 +377,6 @@ static struct regulator_consumer_supply 
sdp4430_vmmc_supply[] = {
        },
 };
 static struct regulator_consumer_supply sdp4430_vcxio_supply[] = {
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"),
-       REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
 };
 
 static int omap4_twl6030_hsmmc_late_init(struct device *dev)


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to