diff options
author | Kishore Y <kishore.y@ti.com> | 2010-11-15 01:09:03 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2011-01-10 03:54:20 -0500 |
commit | a64903357596c64f3848d448033eb5cc7563c00d (patch) | |
tree | 9ca86cb91c541dcf6733115c9360f311fc8bde85 | |
parent | 2d2afa46e320b22d1ddcd430d62d6363b0a7e2b9 (diff) |
OMAP3: ZOOM2/3/3630SDP: Add display board file for OMAP3
Board-zoom-display.c added as a common file for display functionality
on boards zoom2, zoom3 and 3630sdp.
Signed-off-by: Mukund Mittal <mmittal@ti.com>
Signed-off-by: Kishore Y <kishore.y@ti.com>
Signed-off-by: Rajkumar N <rajkumar.nagarajan@ti.com>
Signed-off-by: Samreen <samreen@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-zoom-display.c | 168 | ||||
-rw-r--r-- | arch/arm/mach-omap2/board-zoom-peripherals.c | 49 | ||||
-rw-r--r-- | arch/arm/mach-omap2/include/mach/board-zoom.h | 3 |
4 files changed, 221 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 4ab82f6f15b1..6202f229f70a 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -187,16 +187,19 @@ obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ | |||
187 | hsmmc.o | 187 | hsmmc.o |
188 | obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom.o \ | 188 | obj-$(CONFIG_MACH_OMAP_ZOOM2) += board-zoom.o \ |
189 | board-zoom-peripherals.o \ | 189 | board-zoom-peripherals.o \ |
190 | board-zoom-display.o \ | ||
190 | board-flash.o \ | 191 | board-flash.o \ |
191 | hsmmc.o \ | 192 | hsmmc.o \ |
192 | board-zoom-debugboard.o | 193 | board-zoom-debugboard.o |
193 | obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom.o \ | 194 | obj-$(CONFIG_MACH_OMAP_ZOOM3) += board-zoom.o \ |
194 | board-zoom-peripherals.o \ | 195 | board-zoom-peripherals.o \ |
196 | board-zoom-display.o \ | ||
195 | board-flash.o \ | 197 | board-flash.o \ |
196 | hsmmc.o \ | 198 | hsmmc.o \ |
197 | board-zoom-debugboard.o | 199 | board-zoom-debugboard.o |
198 | obj-$(CONFIG_MACH_OMAP_3630SDP) += board-3630sdp.o \ | 200 | obj-$(CONFIG_MACH_OMAP_3630SDP) += board-3630sdp.o \ |
199 | board-zoom-peripherals.o \ | 201 | board-zoom-peripherals.o \ |
202 | board-zoom-display.o \ | ||
200 | board-flash.o \ | 203 | board-flash.o \ |
201 | hsmmc.o | 204 | hsmmc.o |
202 | obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \ | 205 | obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \ |
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c new file mode 100644 index 000000000000..6bcd43657aed --- /dev/null +++ b/arch/arm/mach-omap2/board-zoom-display.c | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Texas Instruments Inc. | ||
3 | * | ||
4 | * Modified from mach-omap2/board-zoom-peripherals.c | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/gpio.h> | ||
15 | #include <linux/i2c/twl.h> | ||
16 | #include <linux/spi/spi.h> | ||
17 | #include <plat/mcspi.h> | ||
18 | #include <plat/display.h> | ||
19 | |||
20 | #define LCD_PANEL_RESET_GPIO_PROD 96 | ||
21 | #define LCD_PANEL_RESET_GPIO_PILOT 55 | ||
22 | #define LCD_PANEL_QVGA_GPIO 56 | ||
23 | |||
24 | static void zoom_lcd_panel_init(void) | ||
25 | { | ||
26 | int ret; | ||
27 | unsigned char lcd_panel_reset_gpio; | ||
28 | |||
29 | lcd_panel_reset_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? | ||
30 | LCD_PANEL_RESET_GPIO_PROD : | ||
31 | LCD_PANEL_RESET_GPIO_PILOT; | ||
32 | |||
33 | ret = gpio_request(lcd_panel_reset_gpio, "lcd reset"); | ||
34 | if (ret) { | ||
35 | pr_err("Failed to get LCD reset GPIO (gpio%d).\n", | ||
36 | lcd_panel_reset_gpio); | ||
37 | return; | ||
38 | } | ||
39 | gpio_direction_output(lcd_panel_reset_gpio, 1); | ||
40 | |||
41 | ret = gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga"); | ||
42 | if (ret) { | ||
43 | pr_err("Failed to get LCD_PANEL_QVGA_GPIO (gpio%d).\n", | ||
44 | LCD_PANEL_QVGA_GPIO); | ||
45 | goto err0; | ||
46 | } | ||
47 | gpio_direction_output(LCD_PANEL_QVGA_GPIO, 1); | ||
48 | |||
49 | return; | ||
50 | err0: | ||
51 | gpio_free(lcd_panel_reset_gpio); | ||
52 | } | ||
53 | |||
54 | static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
55 | { | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
60 | { | ||
61 | } | ||
62 | |||
63 | /* | ||
64 | * PWMA/B register offsets (TWL4030_MODULE_PWMA) | ||
65 | */ | ||
66 | #define TWL_INTBR_PMBR1 0xD | ||
67 | #define TWL_INTBR_GPBR1 0xC | ||
68 | #define TWL_LED_PWMON 0x0 | ||
69 | #define TWL_LED_PWMOFF 0x1 | ||
70 | |||
71 | static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level) | ||
72 | { | ||
73 | unsigned char c; | ||
74 | u8 mux_pwm, enb_pwm; | ||
75 | |||
76 | if (level > 100) | ||
77 | return -1; | ||
78 | |||
79 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &mux_pwm, TWL_INTBR_PMBR1); | ||
80 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &enb_pwm, TWL_INTBR_GPBR1); | ||
81 | |||
82 | if (level == 0) { | ||
83 | /* disable pwm1 output and clock */ | ||
84 | enb_pwm = enb_pwm & 0xF5; | ||
85 | /* change pwm1 pin to gpio pin */ | ||
86 | mux_pwm = mux_pwm & 0xCF; | ||
87 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
88 | enb_pwm, TWL_INTBR_GPBR1); | ||
89 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
90 | mux_pwm, TWL_INTBR_PMBR1); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | if (!((enb_pwm & 0xA) && (mux_pwm & 0x30))) { | ||
95 | /* change gpio pin to pwm1 pin */ | ||
96 | mux_pwm = mux_pwm | 0x30; | ||
97 | /* enable pwm1 output and clock*/ | ||
98 | enb_pwm = enb_pwm | 0x0A; | ||
99 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
100 | mux_pwm, TWL_INTBR_PMBR1); | ||
101 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
102 | enb_pwm, TWL_INTBR_GPBR1); | ||
103 | } | ||
104 | |||
105 | c = ((50 * (100 - level)) / 100) + 1; | ||
106 | twl_i2c_write_u8(TWL4030_MODULE_PWM1, 0x7F, TWL_LED_PWMOFF); | ||
107 | twl_i2c_write_u8(TWL4030_MODULE_PWM1, c, TWL_LED_PWMON); | ||
108 | |||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static struct omap_dss_device zoom_lcd_device = { | ||
113 | .name = "lcd", | ||
114 | .driver_name = "NEC_8048_panel", | ||
115 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
116 | .phy.dpi.data_lines = 24, | ||
117 | .platform_enable = zoom_panel_enable_lcd, | ||
118 | .platform_disable = zoom_panel_disable_lcd, | ||
119 | .max_backlight_level = 100, | ||
120 | .set_backlight = zoom_set_bl_intensity, | ||
121 | }; | ||
122 | |||
123 | static struct omap_dss_device *zoom_dss_devices[] = { | ||
124 | &zoom_lcd_device, | ||
125 | }; | ||
126 | |||
127 | static struct omap_dss_board_info zoom_dss_data = { | ||
128 | .num_devices = ARRAY_SIZE(zoom_dss_devices), | ||
129 | .devices = zoom_dss_devices, | ||
130 | .default_device = &zoom_lcd_device, | ||
131 | }; | ||
132 | |||
133 | static struct platform_device zoom_dss_device = { | ||
134 | .name = "omapdss", | ||
135 | .id = -1, | ||
136 | .dev = { | ||
137 | .platform_data = &zoom_dss_data, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static struct omap2_mcspi_device_config dss_lcd_mcspi_config = { | ||
142 | .turbo_mode = 1, | ||
143 | .single_channel = 1, /* 0: slave, 1: master */ | ||
144 | }; | ||
145 | |||
146 | static struct spi_board_info nec_8048_spi_board_info[] __initdata = { | ||
147 | [0] = { | ||
148 | .modalias = "nec_8048_spi", | ||
149 | .bus_num = 1, | ||
150 | .chip_select = 2, | ||
151 | .max_speed_hz = 375000, | ||
152 | .controller_data = &dss_lcd_mcspi_config, | ||
153 | }, | ||
154 | }; | ||
155 | |||
156 | static struct platform_device *zoom_display_devices[] __initdata = { | ||
157 | &zoom_dss_device, | ||
158 | }; | ||
159 | |||
160 | void __init zoom_display_init(void) | ||
161 | { | ||
162 | platform_add_devices(zoom_display_devices, | ||
163 | ARRAY_SIZE(zoom_display_devices)); | ||
164 | spi_register_board_info(nec_8048_spi_board_info, | ||
165 | ARRAY_SIZE(nec_8048_spi_board_info)); | ||
166 | zoom_lcd_panel_init(); | ||
167 | } | ||
168 | |||
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index 3fbd0edd712e..14d95afa3f0d 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #define OMAP_ZOOM_WLAN_PMENA_GPIO (101) | 35 | #define OMAP_ZOOM_WLAN_PMENA_GPIO (101) |
36 | #define OMAP_ZOOM_WLAN_IRQ_GPIO (162) | 36 | #define OMAP_ZOOM_WLAN_IRQ_GPIO (162) |
37 | 37 | ||
38 | #define LCD_PANEL_ENABLE_GPIO (7 + OMAP_MAX_GPIO_LINES) | ||
39 | |||
38 | /* Zoom2 has Qwerty keyboard*/ | 40 | /* Zoom2 has Qwerty keyboard*/ |
39 | static uint32_t board_keymap[] = { | 41 | static uint32_t board_keymap[] = { |
40 | KEY(0, 0, KEY_E), | 42 | KEY(0, 0, KEY_E), |
@@ -224,9 +226,43 @@ static struct omap2_hsmmc_info mmc[] = { | |||
224 | {} /* Terminator */ | 226 | {} /* Terminator */ |
225 | }; | 227 | }; |
226 | 228 | ||
229 | static struct regulator_consumer_supply zoom_vpll2_supply = | ||
230 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"); | ||
231 | |||
232 | static struct regulator_consumer_supply zoom_vdda_dac_supply = | ||
233 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); | ||
234 | |||
235 | static struct regulator_init_data zoom_vpll2 = { | ||
236 | .constraints = { | ||
237 | .min_uV = 1800000, | ||
238 | .max_uV = 1800000, | ||
239 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
240 | | REGULATOR_MODE_STANDBY, | ||
241 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
242 | | REGULATOR_CHANGE_STATUS, | ||
243 | }, | ||
244 | .num_consumer_supplies = 1, | ||
245 | .consumer_supplies = &zoom_vpll2_supply, | ||
246 | }; | ||
247 | |||
248 | static struct regulator_init_data zoom_vdac = { | ||
249 | .constraints = { | ||
250 | .min_uV = 1800000, | ||
251 | .max_uV = 1800000, | ||
252 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
253 | | REGULATOR_MODE_STANDBY, | ||
254 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
255 | | REGULATOR_CHANGE_STATUS, | ||
256 | }, | ||
257 | .num_consumer_supplies = 1, | ||
258 | .consumer_supplies = &zoom_vdda_dac_supply, | ||
259 | }; | ||
260 | |||
227 | static int zoom_twl_gpio_setup(struct device *dev, | 261 | static int zoom_twl_gpio_setup(struct device *dev, |
228 | unsigned gpio, unsigned ngpio) | 262 | unsigned gpio, unsigned ngpio) |
229 | { | 263 | { |
264 | int ret; | ||
265 | |||
230 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 266 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
231 | mmc[0].gpio_cd = gpio + 0; | 267 | mmc[0].gpio_cd = gpio + 0; |
232 | omap2_hsmmc_init(mmc); | 268 | omap2_hsmmc_init(mmc); |
@@ -238,7 +274,15 @@ static int zoom_twl_gpio_setup(struct device *dev, | |||
238 | zoom_vsim_supply.dev = mmc[0].dev; | 274 | zoom_vsim_supply.dev = mmc[0].dev; |
239 | zoom_vmmc2_supply.dev = mmc[1].dev; | 275 | zoom_vmmc2_supply.dev = mmc[1].dev; |
240 | 276 | ||
241 | return 0; | 277 | ret = gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd enable"); |
278 | if (ret) { | ||
279 | pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", | ||
280 | LCD_PANEL_ENABLE_GPIO); | ||
281 | return ret; | ||
282 | } | ||
283 | gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0); | ||
284 | |||
285 | return ret; | ||
242 | } | 286 | } |
243 | 287 | ||
244 | /* EXTMUTE callback function */ | 288 | /* EXTMUTE callback function */ |
@@ -301,7 +345,8 @@ static struct twl4030_platform_data zoom_twldata = { | |||
301 | .vmmc1 = &zoom_vmmc1, | 345 | .vmmc1 = &zoom_vmmc1, |
302 | .vmmc2 = &zoom_vmmc2, | 346 | .vmmc2 = &zoom_vmmc2, |
303 | .vsim = &zoom_vsim, | 347 | .vsim = &zoom_vsim, |
304 | 348 | .vpll2 = &zoom_vpll2, | |
349 | .vdac = &zoom_vdac, | ||
305 | }; | 350 | }; |
306 | 351 | ||
307 | static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = { | 352 | static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = { |
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h b/arch/arm/mach-omap2/include/mach/board-zoom.h index f93ca3928c3b..d20bd9c1a106 100644 --- a/arch/arm/mach-omap2/include/mach/board-zoom.h +++ b/arch/arm/mach-omap2/include/mach/board-zoom.h | |||
@@ -1,9 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Defines for zoom boards | 2 | * Defines for zoom boards |
3 | */ | 3 | */ |
4 | #include <plat/display.h> | ||
5 | |||
4 | #define ZOOM_NAND_CS 0 | 6 | #define ZOOM_NAND_CS 0 |
5 | 7 | ||
6 | extern int __init zoom_debugboard_init(void); | 8 | extern int __init zoom_debugboard_init(void); |
7 | extern void __init zoom_peripherals_init(void); | 9 | extern void __init zoom_peripherals_init(void); |
10 | extern void __init zoom_display_init(void); | ||
8 | 11 | ||
9 | #define ZOOM2_HEADSET_EXTMUTE_GPIO 153 | 12 | #define ZOOM2_HEADSET_EXTMUTE_GPIO 153 |