Skip to contentSkip to conversation

Fix/Clean regulator consumer mapping for 3430sdp

PATCH Superseded Rajendra Nayak 2 participants 6 messages Feb 3, 2011

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix/Clean regulator consumer mapping for 3430sdp

This is a short series to fix some, and clean the
existing regulator consumer supply mappings for
the OMAP3430sdp board.

The series is boot tested on the 3430sdp board
and applies on 2.6.38-rc3.

Rajendra Nayak (2):
omap3sdp: Fix regulator mapping for ads7846 TS controller
omap3sdp: clean regulator supply mapping in board file

 arch/arm/mach-omap2/board-3430sdp.c |   60 +++++++++++++++--------------------
 1 files changed, 26 insertions(+), 34 deletions(-)
#1 lore raw

PATCH 1/2 omap3sdp: Fix regulator mapping for ads7846 TS controller

On the OMAP3430SDP board, the ads7846 touchscreen controller is powered by VAUX3 regulator (supplying 2.8v). Fix this mapping in the board file, and hence prevent the ads7846 driver init to fail with the below error..

ads7846 spi1.0: unable to get regulator: -19

---
 arch/arm/mach-omap2/board-3430sdp.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +6 -0
index d4e41ef..dcdc718 100644
@@ -427,6 +427,10 @@ static struct twl4030_madc_platform_data sdp3430_madc_data = {
 	.irq_line	= 1,
 };
 
+/* ads7846 on SPI */
+static struct regulator_consumer_supply sdp3430_vaux3_supply =
+	REGULATOR_SUPPLY("vcc", "spi1.0");
+
 /*
  * Apply all the fixed voltages since most versions of U-Boot
  * don't bother with that initialization.
@@ -469,6 +473,8 @@ static struct regulator_init_data sdp3430_vaux3 = {
 		.valid_ops_mask		= REGULATOR_CHANGE_MODE
 					| REGULATOR_CHANGE_STATUS,
 	},
+	.num_consumer_supplies		= 1,
+	.consumer_supplies		= &sdp3430_vaux3_supply,
 };
 
 /* VAUX4 for OMAP VDD_CSI2 (camera) */
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/2 omap3sdp: clean regulator supply mapping in board file

clean the regulator supply mapping data in the 3430sdp board file (which is spread all over) by moving all of them together.
Also use the REGULATOR_SUPPLY macro and remove instances of mapping dev pointers at run time.

---
 arch/arm/mach-omap2/board-3430sdp.c |   54 +++++++++++++----------------------
 1 files changed, 20 insertions(+), 34 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +20 -34
index dcdc718..6afee65 100644
@@ -315,11 +315,6 @@ static struct platform_device sdp3430_dss_device = {
 	},
 };
 
-static struct regulator_consumer_supply sdp3430_vdda_dac_supply = {
-	.supply		= "vdda_dac",
-	.dev		= &sdp3430_dss_device.dev,
-};
-
 static struct platform_device *sdp3430_devices[] __initdata = {
 	&sdp3430_dss_device,
 };
@@ -370,18 +365,6 @@ static struct omap2_hsmmc_info mmc[] = {
 	{}	/* Terminator */
 };
 
-static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
-	.supply			= "vmmc",
-};
-
-static struct regulator_consumer_supply sdp3430_vsim_supply = {
-	.supply			= "vmmc_aux",
-};
-
-static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
-	.supply			= "vmmc",
-};
-
 static int sdp3430_twl_gpio_setup(struct device *dev,
 		unsigned gpio, unsigned ngpio)
 {
@@ -392,13 +375,6 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
 	mmc[1].gpio_cd = gpio + 1;
 	omap2_hsmmc_init(mmc);
 
-	/* link regulators to MMC adapters ... we "know" the
-	 * regulators will be set up only *after* we return.
-	 */
-	sdp3430_vmmc1_supply.dev = mmc[0].dev;
-	sdp3430_vsim_supply.dev = mmc[0].dev;
-	sdp3430_vmmc2_supply.dev = mmc[1].dev;
-
 	/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
 	gpio_request(gpio + 7, "sub_lcd_en_bkl");
 	gpio_direction_output(gpio + 7, 0);
@@ -427,10 +403,28 @@ static struct twl4030_madc_platform_data sdp3430_madc_data = {
 	.irq_line	= 1,
 };
 
+/* regulator consumer mappings */
+
 /* ads7846 on SPI */
 static struct regulator_consumer_supply sdp3430_vaux3_supply =
 	REGULATOR_SUPPLY("vcc", "spi1.0");
 
+static struct regulator_consumer_supply sdp3430_vdda_dac_supply =
+	REGULATOR_SUPPLY("vdda_dac", "omapdss");
+
+/* VPLL2 for digital video outputs */
+static struct regulator_consumer_supply sdp3430_vpll2_supplies =
+	REGULATOR_SUPPLY("vdds_dsi", "omapdss");
+
+static struct regulator_consumer_supply sdp3430_vmmc1_supply =
+	REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
+
+static struct regulator_consumer_supply sdp3430_vsim_supply =
+	REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.0");
+
+static struct regulator_consumer_supply sdp3430_vmmc2_supply =
+	REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
+
 /*
  * Apply all the fixed voltages since most versions of U-Boot
  * don't bother with that initialization.
@@ -550,14 +544,6 @@ static struct regulator_init_data sdp3430_vdac = {
 	.consumer_supplies	= &sdp3430_vdda_dac_supply,
 };
 
-/* VPLL2 for digital video outputs */
-static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
-	{
-		.supply		= "vdds_dsi",
-		.dev		= &sdp3430_dss_device.dev,
-	}
-};
-
 static struct regulator_init_data sdp3430_vpll2 = {
 	.constraints = {
 		.name			= "VDVI",
@@ -569,8 +555,8 @@ static struct regulator_init_data sdp3430_vpll2 = {
 		.valid_ops_mask		= REGULATOR_CHANGE_MODE
 					| REGULATOR_CHANGE_STATUS,
 	},
-	.num_consumer_supplies	= ARRAY_SIZE(sdp3430_vpll2_supplies),
-	.consumer_supplies	= sdp3430_vpll2_supplies,
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &sdp3430_vpll2_supplies,
 };
 
 static struct twl4030_codec_audio_data sdp3430_audio = {
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 1/2 omap3sdp: Fix regulator mapping for ads7846 TS controller

In reply to Rajendra Nayak

Hi,

Quoted 16 lines · Rajendra Nayak
arch/arm/mach-omap2/board-3430sdp.c +4 -0
index d4e41ef..dcdc718 100644
@@ -427,6 +427,10 @@ static struct twl4030_madc_platform_data sdp3430_madc_data = {
 	.irq_line	= 1,
 };
 
+/* ads7846 on SPI */
+static struct regulator_consumer_supply sdp3430_vaux3_supply =
+	REGULATOR_SUPPLY("vcc", "spi1.0");
+
 /*
  * Apply all the fixed voltages since most versions of U-Boot
  * don't bother with that initialization.

arch/arm/mach-omap2/board-3430sdp.c static struct regulator_init_data sdp3430_vaux3 = { · line 478

Quoted 6 lines
arch/arm/mach-omap2/board-3430sdp.c +2 -0
@@ -469,6 +473,8 @@ static struct regulator_init_data sdp3430_vaux3 = {
 		.valid_ops_mask		= REGULATOR_CHANGE_MODE
 					| REGULATOR_CHANGE_STATUS,
 	},
+	.num_consumer_supplies		= 1,
+	.consumer_supplies		= &sdp3430_vaux3_supply,
 };

this is not the expected way of using the regulator framework, you should have:

static struct regulator_consumer_supply sdp3430_vaux3_supplies[] =

	{ REGULATOR_SUPPLY("vcc", "spi1.0"), },
};

...

.num_consume_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
.consumer_supplies = sdp3430_vaux3_supplies,

or something similar. (completely untested though).

Signature · 1 line
balbi
#3 lore raw

PATCH 2/2 omap3sdp: clean regulator supply mapping in board file

In reply to Rajendra Nayak
Quoted 7 lines · Rajendra Nayak

clean the regulator supply mapping data in the 3430sdp board file (which is spread all over) by moving all of them together.
Also use the REGULATOR_SUPPLY macro and remove instances of mapping dev pointers at run time.

same comment is valid for this patch.

Signature · 1 line
balbi
#5 lore raw

PATCH 1/2 omap3sdp: Fix regulator mapping for ads7846 TS controller

In reply to Felipe Balbi
Quoted 5 lines

-----Original Message-----
From: Felipe Balbi [mailto:balbi at ti.com]
Sent: Thursday, February 03, 2011 5:26 PM
To: Rajendra Nayak
Cc: linux-omap at vger.kernel.org; tony at atomide.com;

linux-arm-kernel at lists.infradead.org

Quoted 1 line

Subject: Re: [PATCH 1/2] omap3sdp: Fix regulator mapping for ads7846 TS

controller

Quoted 5 lines

Hi,

Review

Quoted 1 line · Rajendra Nayak
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-3430sdp.c

Quoted 4 lines

arch/arm/mach-omap2/board-3430sdp.c static struct twl4030_madc_platform_data

Quoted 4 lines

index d4e41ef..dcdc718 100644

arch/arm/mach-omap2/board-3430sdp.c +0 -0
@@ -427,6 +427,10 @@ static struct twl4030_madc_platform_data

sdp3430_madc_data = {

Quoted 11 lines

arch/arm/mach-omap2/board-3430sdp.c static struct regulator_init_data sdp3430_vaux3 =

Quoted 11 lines
arch/arm/mach-omap2/board-3430sdp.c +4 -0
 	.irq_line	= 1,
 };
 
+/* ads7846 on SPI */
+static struct regulator_consumer_supply sdp3430_vaux3_supply =
+	REGULATOR_SUPPLY("vcc", "spi1.0");
+
 /*
  * Apply all the fixed voltages since most versions of U-Boot
  * don't bother with that initialization.
@@ -469,6 +473,8 @@ static struct regulator_init_data sdp3430_vaux3 =

{

Quoted 10 lines

arch/arm/mach-omap2/board-3430sdp.c static struct regulator_init_data sdp3430_vaux3 = { · line 478

Quoted 6 lines
arch/arm/mach-omap2/board-3430sdp.c +2 -0
 		.valid_ops_mask		= REGULATOR_CHANGE_MODE
 					| REGULATOR_CHANGE_STATUS,
 	},
+	.num_consumer_supplies		= 1,
+	.consumer_supplies		= &sdp3430_vaux3_supply,
 };

this is not the expected way of using the regulator framework, you should have:

Quoted 8 lines

static struct regulator_consumer_supply sdp3430_vaux3_supplies[] =

	{ REGULATOR_SUPPLY("vcc", "spi1.0"), },
};

...

.num_consume_supplies = ARRAY_SIZE(sdp3430_vaux3_supplies),
.consumer_supplies = sdp3430_vaux3_supplies,

Yup, makes sense. Will fix that and repost.

Quoted 5 lines

or something similar. (completely untested though).

--
balbi