diff options
author | Denis Carikli <denis@eukrea.com> | 2012-05-08 03:20:24 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-05-08 11:31:24 -0400 |
commit | 13d1dd83a5aa9eeec07f3c34df249a0faed96931 (patch) | |
tree | aef2018a333a4eee26b9b95f92ec7404683017d7 /arch/arm/mach-imx | |
parent | 7138a7f9ac3640df808c295c411bc4acb3d1965e (diff) |
ARM: imx: eukrea_mbimxsd: add backlight and lcd support
Signed-off-by: Eric BĂ©nard <eric@eukrea.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c index bc89bb6430e8..920e42a9389f 100644 --- a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/input.h> | 29 | #include <linux/input.h> |
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include <video/platform_lcd.h> | ||
32 | #include <linux/backlight.h> | ||
31 | 33 | ||
32 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
33 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
@@ -71,10 +73,57 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { | |||
71 | MX51_PAD_AUD3_BB_RXD__AUD3_RXD, | 73 | MX51_PAD_AUD3_BB_RXD__AUD3_RXD, |
72 | MX51_PAD_AUD3_BB_CK__AUD3_TXC, | 74 | MX51_PAD_AUD3_BB_CK__AUD3_TXC, |
73 | MX51_PAD_AUD3_BB_FS__AUD3_TXFS, | 75 | MX51_PAD_AUD3_BB_FS__AUD3_TXFS, |
76 | /* LCD Backlight */ | ||
77 | MX51_PAD_DI1_D1_CS__GPIO3_4, | ||
78 | /* LCD RST */ | ||
79 | MX51_PAD_CSI1_D9__GPIO3_13, | ||
74 | }; | 80 | }; |
75 | 81 | ||
76 | #define GPIO_LED1 IMX_GPIO_NR(3, 30) | 82 | #define GPIO_LED1 IMX_GPIO_NR(3, 30) |
77 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 31) | 83 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 31) |
84 | #define GPIO_LCDRST IMX_GPIO_NR(3, 13) | ||
85 | #define GPIO_LCDBL IMX_GPIO_NR(3, 4) | ||
86 | |||
87 | static void eukrea_mbimxsd51_lcd_power_set(struct plat_lcd_data *pd, | ||
88 | unsigned int power) | ||
89 | { | ||
90 | if (power) | ||
91 | gpio_direction_output(GPIO_LCDRST, 1); | ||
92 | else | ||
93 | gpio_direction_output(GPIO_LCDRST, 0); | ||
94 | } | ||
95 | |||
96 | static struct plat_lcd_data eukrea_mbimxsd51_lcd_power_data = { | ||
97 | .set_power = eukrea_mbimxsd51_lcd_power_set, | ||
98 | }; | ||
99 | |||
100 | static struct platform_device eukrea_mbimxsd51_lcd_powerdev = { | ||
101 | .name = "platform-lcd", | ||
102 | .dev.platform_data = &eukrea_mbimxsd51_lcd_power_data, | ||
103 | }; | ||
104 | |||
105 | static void eukrea_mbimxsd51_bl_set_intensity(int intensity) | ||
106 | { | ||
107 | if (intensity) | ||
108 | gpio_direction_output(GPIO_LCDBL, 1); | ||
109 | else | ||
110 | gpio_direction_output(GPIO_LCDBL, 0); | ||
111 | } | ||
112 | |||
113 | static struct generic_bl_info eukrea_mbimxsd51_bl_info = { | ||
114 | .name = "eukrea_mbimxsd51-bl", | ||
115 | .max_intensity = 0xff, | ||
116 | .default_intensity = 0xff, | ||
117 | .set_bl_intensity = eukrea_mbimxsd51_bl_set_intensity, | ||
118 | }; | ||
119 | |||
120 | static struct platform_device eukrea_mbimxsd51_bl_dev = { | ||
121 | .name = "generic-bl", | ||
122 | .id = 1, | ||
123 | .dev = { | ||
124 | .platform_data = &eukrea_mbimxsd51_bl_info, | ||
125 | }, | ||
126 | }; | ||
78 | 127 | ||
79 | static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { | 128 | static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { |
80 | { | 129 | { |
@@ -122,6 +171,19 @@ struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = { | |||
122 | .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, | 171 | .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, |
123 | }; | 172 | }; |
124 | 173 | ||
174 | static int screen_type; | ||
175 | |||
176 | static int __init eukrea_mbimxsd51_screen_type(char *options) | ||
177 | { | ||
178 | if (!strcmp(options, "dvi")) | ||
179 | screen_type = 1; | ||
180 | else if (!strcmp(options, "tft")) | ||
181 | screen_type = 0; | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | __setup("screen_type=", eukrea_mbimxsd51_screen_type); | ||
186 | |||
125 | /* | 187 | /* |
126 | * system init for baseboard usage. Will be called by cpuimx51sd init. | 188 | * system init for baseboard usage. Will be called by cpuimx51sd init. |
127 | * | 189 | * |
@@ -149,6 +211,18 @@ void __init eukrea_mbimxsd51_baseboard_init(void) | |||
149 | gpio_direction_input(GPIO_SWITCH1); | 211 | gpio_direction_input(GPIO_SWITCH1); |
150 | gpio_free(GPIO_SWITCH1); | 212 | gpio_free(GPIO_SWITCH1); |
151 | 213 | ||
214 | gpio_request(GPIO_LCDRST, "LCDRST"); | ||
215 | gpio_direction_output(GPIO_LCDRST, 0); | ||
216 | gpio_request(GPIO_LCDBL, "LCDBL"); | ||
217 | gpio_direction_output(GPIO_LCDBL, 0); | ||
218 | if (!screen_type) { | ||
219 | platform_device_register(&eukrea_mbimxsd51_bl_dev); | ||
220 | platform_device_register(&eukrea_mbimxsd51_lcd_powerdev); | ||
221 | } else { | ||
222 | gpio_free(GPIO_LCDRST); | ||
223 | gpio_free(GPIO_LCDBL); | ||
224 | } | ||
225 | |||
152 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | 226 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, |
153 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | 227 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); |
154 | 228 | ||