aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-03-06 11:23:32 -0500
committerShawn Guo <shawn.guo@freescale.com>2014-04-30 01:40:27 -0400
commit6b961bad80c6d41f177df9256ff1d2794d3849de (patch)
tree19c47d0ee4201f959f586f4ffc5caaa44bf113dd
parentcfdb7d564c03a06e00f76a5e9b3929f802c1040b (diff)
ARM: i.MX: mx21ads: Use fixed voltage regulator for LCD power
Instead of using init() and exit() hooks from framebuffer driver to control power of LCD, introduce fixed voltage regulator for this purpose. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index 87425949244a..0b8e63fdbca0 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -19,6 +19,8 @@
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/basic_mmio_gpio.h> 20#include <linux/basic_mmio_gpio.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h>
22#include <asm/mach-types.h> 24#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
24#include <asm/mach/time.h> 26#include <asm/mach/time.h>
@@ -191,22 +193,32 @@ static struct platform_device mx21ads_mmgpio = {
191 }, 193 },
192}; 194};
193 195
194static int mx21ads_fb_init(struct platform_device *pdev) 196static struct regulator_consumer_supply mx21ads_lcd_regulator_consumer =
195{ 197 REGULATOR_SUPPLY("lcd", "imx-fb.0");
196 int ret;
197 198
198 ret = gpio_request(MX21ADS_IO_LCDON, "fb-lcdon"); 199static struct regulator_init_data mx21ads_lcd_regulator_init_data = {
199 if (ret) 200 .constraints = {
200 return ret; 201 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
202 },
203 .consumer_supplies = &mx21ads_lcd_regulator_consumer,
204 .num_consumer_supplies = 1,
205};
201 206
202 return gpio_direction_output(MX21ADS_IO_LCDON, 1); 207static struct fixed_voltage_config mx21ads_lcd_regulator_pdata = {
203} 208 .supply_name = "LCD",
209 .microvolts = 3300000,
210 .gpio = MX21ADS_IO_LCDON,
211 .enable_high = 1,
212 .init_data = &mx21ads_lcd_regulator_init_data,
213};
204 214
205static void mx21ads_fb_exit(struct platform_device *pdev) 215static struct platform_device mx21ads_lcd_regulator = {
206{ 216 .name = "reg-fixed-voltage",
207 gpio_set_value(MX21ADS_IO_LCDON, 0); 217 .id = PLATFORM_DEVID_AUTO,
208 gpio_free(MX21ADS_IO_LCDON); 218 .dev = {
209} 219 .platform_data = &mx21ads_lcd_regulator_pdata,
220 },
221};
210 222
211/* 223/*
212 * Connected is a portrait Sharp-QVGA display 224 * Connected is a portrait Sharp-QVGA display
@@ -239,9 +251,6 @@ static const struct imx_fb_platform_data mx21ads_fb_data __initconst = {
239 .pwmr = 0x00a903ff, 251 .pwmr = 0x00a903ff,
240 .lscr1 = 0x00120300, 252 .lscr1 = 0x00120300,
241 .dmacr = 0x00020008, 253 .dmacr = 0x00020008,
242
243 .init = mx21ads_fb_init,
244 .exit = mx21ads_fb_exit,
245}; 254};
246 255
247static int mx21ads_sdhc_get_ro(struct device *dev) 256static int mx21ads_sdhc_get_ro(struct device *dev)
@@ -283,6 +292,7 @@ mx21ads_nand_board_info __initconst = {
283 292
284static struct platform_device *platform_devices[] __initdata = { 293static struct platform_device *platform_devices[] __initdata = {
285 &mx21ads_mmgpio, 294 &mx21ads_mmgpio,
295 &mx21ads_lcd_regulator,
286 &mx21ads_nor_mtd_device, 296 &mx21ads_nor_mtd_device,
287}; 297};
288 298
@@ -296,12 +306,13 @@ static void __init mx21ads_board_init(void)
296 imx21_add_imx_uart0(&uart_pdata_rts); 306 imx21_add_imx_uart0(&uart_pdata_rts);
297 imx21_add_imx_uart2(&uart_pdata_norts); 307 imx21_add_imx_uart2(&uart_pdata_norts);
298 imx21_add_imx_uart3(&uart_pdata_rts); 308 imx21_add_imx_uart3(&uart_pdata_rts);
299 imx21_add_imx_fb(&mx21ads_fb_data);
300 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata); 309 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata);
301 imx21_add_mxc_nand(&mx21ads_nand_board_info); 310 imx21_add_mxc_nand(&mx21ads_nand_board_info);
302 311
303 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 312 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
304 313
314 imx21_add_imx_fb(&mx21ads_fb_data);
315
305 mx21ads_cs8900_resources[1].start = 316 mx21ads_cs8900_resources[1].start =
306 gpio_to_irq(MX21ADS_CS8900A_IRQ_GPIO); 317 gpio_to_irq(MX21ADS_CS8900A_IRQ_GPIO);
307 mx21ads_cs8900_resources[1].end = 318 mx21ads_cs8900_resources[1].end =