aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-31 20:11:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 20:30:54 -0400
commit0556dc340e5159cdff925a5ab7f3a72f49745661 (patch)
treecad2c9b013734b7968ce1a82667e34c294013495
parent2967b0ad3302d8627c0d99bfed4b8f167e21fdee (diff)
backlight: fix broken regulator API usage in l4f00242t03
The regulator support in the l4f00242t03 is very non-idiomatic. Rather than requesting the regulators based on the device name and the supply names used by the device the driver requires boards to pass system specific supply names around through platform data. The driver also conditionally requests the regulators based on this platform data, adding unneeded conditional code to the driver. Fix this by removing the platform data and converting to the standard idiom, also updating all in tree users of the driver. As no datasheet appears to be available for the LCD I'm guessing the names for the supplies based on the existing users and I've no ability to do anything more than compile test. The use of regulator_set_voltage() in the driver is also problematic, since fixed voltages are required the expectation would be that the voltages would be fixed in the constraints set by the machines rather than manually configured by the driver, but is less problematic. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c6
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c6
-rw-r--r--drivers/video/backlight/l4f00242t03.c57
-rw-r--r--include/linux/spi/l4f00242t03.h2
4 files changed, 24 insertions, 47 deletions
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 2eafbac2c763..377230497dcc 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -241,7 +241,7 @@ static struct regulator_init_data gpo_init = {
241}; 241};
242 242
243static struct regulator_consumer_supply vmmc1_consumers[] = { 243static struct regulator_consumer_supply vmmc1_consumers[] = {
244 REGULATOR_SUPPLY("lcd_2v8", NULL), 244 REGULATOR_SUPPLY("vcore", "spi0.0"),
245}; 245};
246 246
247static struct regulator_init_data vmmc1_init = { 247static struct regulator_init_data vmmc1_init = {
@@ -257,7 +257,7 @@ static struct regulator_init_data vmmc1_init = {
257}; 257};
258 258
259static struct regulator_consumer_supply vgen_consumers[] = { 259static struct regulator_consumer_supply vgen_consumers[] = {
260 REGULATOR_SUPPLY("vdd_lcdio", NULL), 260 REGULATOR_SUPPLY("vdd", "spi0.0"),
261}; 261};
262 262
263static struct regulator_init_data vgen_init = { 263static struct regulator_init_data vgen_init = {
@@ -348,8 +348,6 @@ static const struct imx_fb_platform_data mx27_3ds_fb_data __initconst = {
348static struct l4f00242t03_pdata mx27_3ds_lcd_pdata = { 348static struct l4f00242t03_pdata mx27_3ds_lcd_pdata = {
349 .reset_gpio = LCD_RESET, 349 .reset_gpio = LCD_RESET,
350 .data_enable_gpio = LCD_ENABLE, 350 .data_enable_gpio = LCD_ENABLE,
351 .core_supply = "lcd_2v8",
352 .io_supply = "vdd_lcdio",
353}; 351};
354 352
355static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { 353static struct spi_board_info mx27_3ds_spi_devs[] __initdata = {
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 589066fb3316..6484db525bd7 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -285,8 +285,6 @@ static struct mx3fb_platform_data mx3fb_pdata __initdata = {
285static struct l4f00242t03_pdata mx31_3ds_l4f00242t03_pdata = { 285static struct l4f00242t03_pdata mx31_3ds_l4f00242t03_pdata = {
286 .reset_gpio = IOMUX_TO_GPIO(MX31_PIN_LCS1), 286 .reset_gpio = IOMUX_TO_GPIO(MX31_PIN_LCS1),
287 .data_enable_gpio = IOMUX_TO_GPIO(MX31_PIN_SER_RS), 287 .data_enable_gpio = IOMUX_TO_GPIO(MX31_PIN_SER_RS),
288 .core_supply = "lcd_2v8",
289 .io_supply = "vdd_lcdio",
290}; 288};
291 289
292/* 290/*
@@ -411,7 +409,7 @@ static struct regulator_init_data vmmc2_init = {
411}; 409};
412 410
413static struct regulator_consumer_supply vmmc1_consumers[] = { 411static struct regulator_consumer_supply vmmc1_consumers[] = {
414 REGULATOR_SUPPLY("lcd_2v8", NULL), 412 REGULATOR_SUPPLY("vcore", "spi0.0"),
415 REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), 413 REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"),
416}; 414};
417 415
@@ -428,7 +426,7 @@ static struct regulator_init_data vmmc1_init = {
428}; 426};
429 427
430static struct regulator_consumer_supply vgen_consumers[] = { 428static struct regulator_consumer_supply vgen_consumers[] = {
431 REGULATOR_SUPPLY("vdd_lcdio", NULL), 429 REGULATOR_SUPPLY("vdd", "spi0.0"),
432}; 430};
433 431
434static struct regulator_init_data vgen_init = { 432static struct regulator_init_data vgen_init = {
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index 98ad3e5f7c85..77ec70bcb303 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -52,15 +52,11 @@ static void l4f00242t03_lcd_init(struct spi_device *spi)
52 52
53 dev_dbg(&spi->dev, "initializing LCD\n"); 53 dev_dbg(&spi->dev, "initializing LCD\n");
54 54
55 if (priv->io_reg) { 55 regulator_set_voltage(priv->io_reg, 1800000, 1800000);
56 regulator_set_voltage(priv->io_reg, 1800000, 1800000); 56 regulator_enable(priv->io_reg);
57 regulator_enable(priv->io_reg);
58 }
59 57
60 if (priv->core_reg) { 58 regulator_set_voltage(priv->core_reg, 2800000, 2800000);
61 regulator_set_voltage(priv->core_reg, 2800000, 2800000); 59 regulator_enable(priv->core_reg);
62 regulator_enable(priv->core_reg);
63 }
64 60
65 l4f00242t03_reset(pdata->reset_gpio); 61 l4f00242t03_reset(pdata->reset_gpio);
66 62
@@ -78,11 +74,8 @@ static void l4f00242t03_lcd_powerdown(struct spi_device *spi)
78 74
79 gpio_set_value(pdata->data_enable_gpio, 0); 75 gpio_set_value(pdata->data_enable_gpio, 0);
80 76
81 if (priv->io_reg) 77 regulator_disable(priv->io_reg);
82 regulator_disable(priv->io_reg); 78 regulator_disable(priv->core_reg);
83
84 if (priv->core_reg)
85 regulator_disable(priv->core_reg);
86} 79}
87 80
88static int l4f00242t03_lcd_power_get(struct lcd_device *ld) 81static int l4f00242t03_lcd_power_get(struct lcd_device *ld)
@@ -201,24 +194,18 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
201 if (ret) 194 if (ret)
202 goto err3; 195 goto err3;
203 196
204 if (pdata->io_supply) { 197 priv->io_reg = regulator_get(&spi->dev, "vdd");
205 priv->io_reg = regulator_get(NULL, pdata->io_supply); 198 if (IS_ERR(priv->io_reg)) {
206 199 dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
207 if (IS_ERR(priv->io_reg)) { 200 __func__);
208 pr_err("%s: Unable to get the IO regulator\n", 201 goto err3;
209 __func__);
210 goto err3;
211 }
212 } 202 }
213 203
214 if (pdata->core_supply) { 204 priv->core_reg = regulator_get(&spi->dev, "vcore");
215 priv->core_reg = regulator_get(NULL, pdata->core_supply); 205 if (IS_ERR(priv->core_reg)) {
216 206 dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
217 if (IS_ERR(priv->core_reg)) { 207 __func__);
218 pr_err("%s: Unable to get the core regulator\n", 208 goto err4;
219 __func__);
220 goto err4;
221 }
222 } 209 }
223 210
224 priv->ld = lcd_device_register("l4f00242t03", 211 priv->ld = lcd_device_register("l4f00242t03",
@@ -238,11 +225,9 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi)
238 return 0; 225 return 0;
239 226
240err5: 227err5:
241 if (priv->core_reg) 228 regulator_put(priv->core_reg);
242 regulator_put(priv->core_reg);
243err4: 229err4:
244 if (priv->io_reg) 230 regulator_put(priv->io_reg);
245 regulator_put(priv->io_reg);
246err3: 231err3:
247 gpio_free(pdata->data_enable_gpio); 232 gpio_free(pdata->data_enable_gpio);
248err2: 233err2:
@@ -266,10 +251,8 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi)
266 gpio_free(pdata->data_enable_gpio); 251 gpio_free(pdata->data_enable_gpio);
267 gpio_free(pdata->reset_gpio); 252 gpio_free(pdata->reset_gpio);
268 253
269 if (priv->io_reg) 254 regulator_put(priv->io_reg);
270 regulator_put(priv->io_reg); 255 regulator_put(priv->core_reg);
271 if (priv->core_reg)
272 regulator_put(priv->core_reg);
273 256
274 kfree(priv); 257 kfree(priv);
275 258
diff --git a/include/linux/spi/l4f00242t03.h b/include/linux/spi/l4f00242t03.h
index aee1dbda4edc..bc8677c8eba9 100644
--- a/include/linux/spi/l4f00242t03.h
+++ b/include/linux/spi/l4f00242t03.h
@@ -24,8 +24,6 @@
24struct l4f00242t03_pdata { 24struct l4f00242t03_pdata {
25 unsigned int reset_gpio; 25 unsigned int reset_gpio;
26 unsigned int data_enable_gpio; 26 unsigned int data_enable_gpio;
27 const char *io_supply; /* will be set to 1.8 V */
28 const char *core_supply; /* will be set to 2.8 V */
29}; 27};
30 28
31#endif /* _INCLUDE_LINUX_SPI_L4F00242T03_H_ */ 29#endif /* _INCLUDE_LINUX_SPI_L4F00242T03_H_ */