diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-08-13 15:17:52 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-08-14 11:13:06 -0400 |
commit | 49f91b9ed14f6c2dd90d99c65a2ab47bd93652b1 (patch) | |
tree | 645b41420616623f4113de7a5ad40074d0eccf47 /arch | |
parent | ce611d7b98eec03b2b1036ac55b7604b268154d8 (diff) |
ARM: S3C64XX: Move SmartQ LCD control platform definition to shared file
This shares the common LCD control platform definition used in the SmartQ 5 and
7. This also corrects it as a GPIO bitbanged SPI device instead of an I²C one,
which was wrong.
Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-smartq.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-smartq5.c | 28 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-smartq7.c | 28 |
3 files changed, 30 insertions, 58 deletions
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c index 028d080dcd35..54309dad3e0e 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq.c +++ b/arch/arm/mach-s3c64xx/mach-smartq.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/pwm_backlight.h> | 17 | #include <linux/pwm_backlight.h> |
18 | #include <linux/serial_core.h> | 18 | #include <linux/serial_core.h> |
19 | #include <linux/spi/spi_gpio.h> | ||
19 | #include <linux/usb/gpio_vbus.h> | 20 | #include <linux/usb/gpio_vbus.h> |
20 | 21 | ||
21 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
@@ -184,6 +185,33 @@ static struct s3c_hwmon_pdata smartq_hwmon_pdata __initdata = { | |||
184 | }, | 185 | }, |
185 | }; | 186 | }; |
186 | 187 | ||
188 | static int __init smartq_lcd_setup_gpio(void) | ||
189 | { | ||
190 | int ret; | ||
191 | |||
192 | ret = gpio_request(S3C64XX_GPM(3), "LCD power"); | ||
193 | if (ret < 0) | ||
194 | return ret; | ||
195 | |||
196 | /* turn power off */ | ||
197 | gpio_direction_output(S3C64XX_GPM(3), 0); | ||
198 | |||
199 | return 0; | ||
200 | } | ||
201 | |||
202 | /* GPM0 -> CS */ | ||
203 | static struct spi_gpio_platform_data smartq_lcd_control = { | ||
204 | .sck = S3C64XX_GPM(1), | ||
205 | .mosi = S3C64XX_GPM(2), | ||
206 | .miso = S3C64XX_GPM(2), | ||
207 | }; | ||
208 | |||
209 | static struct platform_device smartq_lcd_control_device = { | ||
210 | .name = "spi-gpio", | ||
211 | .id = 1, | ||
212 | .dev.platform_data = &smartq_lcd_control, | ||
213 | }; | ||
214 | |||
187 | static void smartq_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) | 215 | static void smartq_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) |
188 | { | 216 | { |
189 | gpio_direction_output(S3C64XX_GPM(3), power); | 217 | gpio_direction_output(S3C64XX_GPM(3), power); |
@@ -199,7 +227,6 @@ static struct platform_device smartq_lcd_power_device = { | |||
199 | .dev.platform_data = &smartq_lcd_power_data, | 227 | .dev.platform_data = &smartq_lcd_power_data, |
200 | }; | 228 | }; |
201 | 229 | ||
202 | |||
203 | static struct platform_device *smartq_devices[] __initdata = { | 230 | static struct platform_device *smartq_devices[] __initdata = { |
204 | &s3c_device_hsmmc1, /* Init iNAND first, ... */ | 231 | &s3c_device_hsmmc1, /* Init iNAND first, ... */ |
205 | &s3c_device_hsmmc0, /* ... then the external SD card */ | 232 | &s3c_device_hsmmc0, /* ... then the external SD card */ |
@@ -214,6 +241,7 @@ static struct platform_device *smartq_devices[] __initdata = { | |||
214 | &s3c_device_ts, | 241 | &s3c_device_ts, |
215 | &s3c_device_usb_hsotg, | 242 | &s3c_device_usb_hsotg, |
216 | &smartq_backlight_device, | 243 | &smartq_backlight_device, |
244 | &smartq_lcd_control_device, | ||
217 | &smartq_lcd_power_device, | 245 | &smartq_lcd_power_device, |
218 | &smartq_usb_otg_vbus_dev, | 246 | &smartq_usb_otg_vbus_dev, |
219 | }; | 247 | }; |
@@ -252,7 +280,6 @@ static int __init smartq_power_off_init(void) | |||
252 | /* leave power on */ | 280 | /* leave power on */ |
253 | gpio_direction_output(S3C64XX_GPK(15), 0); | 281 | gpio_direction_output(S3C64XX_GPK(15), 0); |
254 | 282 | ||
255 | |||
256 | pm_power_off = smartq_power_off; | 283 | pm_power_off = smartq_power_off; |
257 | 284 | ||
258 | return ret; | 285 | return ret; |
@@ -354,6 +381,7 @@ void __init smartq_machine_init(void) | |||
354 | s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata); | 381 | s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata); |
355 | s3c24xx_ts_set_platdata(&smartq_touchscreen_pdata); | 382 | s3c24xx_ts_set_platdata(&smartq_touchscreen_pdata); |
356 | 383 | ||
384 | WARN_ON(smartq_lcd_setup_gpio()); | ||
357 | WARN_ON(smartq_power_off_init()); | 385 | WARN_ON(smartq_power_off_init()); |
358 | WARN_ON(smartq_usb_host_init()); | 386 | WARN_ON(smartq_usb_host_init()); |
359 | WARN_ON(smartq_usb_otg_init()); | 387 | WARN_ON(smartq_usb_otg_init()); |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c index 1d0326ead90f..82a9043d1fab 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq5.c +++ b/arch/arm/mach-s3c64xx/mach-smartq5.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/fb.h> | 12 | #include <linux/fb.h> |
13 | #include <linux/gpio.h> | 13 | #include <linux/gpio.h> |
14 | #include <linux/gpio_keys.h> | 14 | #include <linux/gpio_keys.h> |
15 | #include <linux/i2c-gpio.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/input.h> | 16 | #include <linux/input.h> |
18 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
@@ -33,31 +32,6 @@ | |||
33 | 32 | ||
34 | #include "mach-smartq.h" | 33 | #include "mach-smartq.h" |
35 | 34 | ||
36 | static void __init smartq5_lcd_setup_gpio(void) | ||
37 | { | ||
38 | gpio_request(S3C64XX_GPM(0), "LCD SCEN pin"); | ||
39 | gpio_request(S3C64XX_GPM(1), "LCD SCL pin"); | ||
40 | gpio_request(S3C64XX_GPM(2), "LCD SDA pin"); | ||
41 | gpio_request(S3C64XX_GPM(3), "LCD power"); | ||
42 | |||
43 | /* turn power off */ | ||
44 | gpio_direction_output(S3C64XX_GPM(0), 1); | ||
45 | gpio_direction_input(S3C64XX_GPM(1)); | ||
46 | gpio_direction_input(S3C64XX_GPM(2)); | ||
47 | gpio_direction_output(S3C64XX_GPM(3), 0); | ||
48 | } | ||
49 | |||
50 | static struct i2c_gpio_platform_data smartq5_lcd_control = { | ||
51 | .sda_pin = S3C64XX_GPM(2), | ||
52 | .scl_pin = S3C64XX_GPM(1), | ||
53 | }; | ||
54 | |||
55 | static struct platform_device smartq5_lcd_control_device = { | ||
56 | .name = "i2c-gpio", | ||
57 | .id = 1, | ||
58 | .dev.platform_data = &smartq5_lcd_control, | ||
59 | }; | ||
60 | |||
61 | static struct gpio_led smartq5_leds[] __initdata = { | 35 | static struct gpio_led smartq5_leds[] __initdata = { |
62 | { | 36 | { |
63 | .name = "smartq5:green", | 37 | .name = "smartq5:green", |
@@ -160,7 +134,6 @@ static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = { | |||
160 | static struct platform_device *smartq5_devices[] __initdata = { | 134 | static struct platform_device *smartq5_devices[] __initdata = { |
161 | &smartq5_leds_device, | 135 | &smartq5_leds_device, |
162 | &smartq5_buttons_device, | 136 | &smartq5_buttons_device, |
163 | &smartq5_lcd_control_device, | ||
164 | }; | 137 | }; |
165 | 138 | ||
166 | static void __init smartq5_machine_init(void) | 139 | static void __init smartq5_machine_init(void) |
@@ -168,7 +141,6 @@ static void __init smartq5_machine_init(void) | |||
168 | s3c_fb_set_platdata(&smartq5_lcd_pdata); | 141 | s3c_fb_set_platdata(&smartq5_lcd_pdata); |
169 | 142 | ||
170 | smartq_machine_init(); | 143 | smartq_machine_init(); |
171 | smartq5_lcd_setup_gpio(); | ||
172 | 144 | ||
173 | platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices)); | 145 | platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices)); |
174 | } | 146 | } |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c index e0bc78ecb156..c4868dbd2fe2 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq7.c +++ b/arch/arm/mach-s3c64xx/mach-smartq7.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/fb.h> | 12 | #include <linux/fb.h> |
13 | #include <linux/gpio.h> | 13 | #include <linux/gpio.h> |
14 | #include <linux/gpio_keys.h> | 14 | #include <linux/gpio_keys.h> |
15 | #include <linux/i2c-gpio.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/input.h> | 16 | #include <linux/input.h> |
18 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
@@ -33,31 +32,6 @@ | |||
33 | 32 | ||
34 | #include "mach-smartq.h" | 33 | #include "mach-smartq.h" |
35 | 34 | ||
36 | static void __init smartq7_lcd_setup_gpio(void) | ||
37 | { | ||
38 | gpio_request(S3C64XX_GPM(0), "LCD CSB pin"); | ||
39 | gpio_request(S3C64XX_GPM(3), "LCD power"); | ||
40 | gpio_request(S3C64XX_GPM(4), "LCD power status"); | ||
41 | |||
42 | /* turn power off */ | ||
43 | gpio_direction_output(S3C64XX_GPM(0), 1); | ||
44 | gpio_direction_output(S3C64XX_GPM(3), 0); | ||
45 | gpio_direction_input(S3C64XX_GPM(4)); | ||
46 | } | ||
47 | |||
48 | static struct i2c_gpio_platform_data smartq7_lcd_control = { | ||
49 | .sda_pin = S3C64XX_GPM(2), | ||
50 | .scl_pin = S3C64XX_GPM(1), | ||
51 | .sda_is_open_drain = 1, | ||
52 | .scl_is_open_drain = 1, | ||
53 | }; | ||
54 | |||
55 | static struct platform_device smartq7_lcd_control_device = { | ||
56 | .name = "i2c-gpio", | ||
57 | .id = 1, | ||
58 | .dev.platform_data = &smartq7_lcd_control, | ||
59 | }; | ||
60 | |||
61 | static struct gpio_led smartq7_leds[] __initdata = { | 35 | static struct gpio_led smartq7_leds[] __initdata = { |
62 | { | 36 | { |
63 | .name = "smartq7:red", | 37 | .name = "smartq7:red", |
@@ -176,7 +150,6 @@ static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = { | |||
176 | static struct platform_device *smartq7_devices[] __initdata = { | 150 | static struct platform_device *smartq7_devices[] __initdata = { |
177 | &smartq7_leds_device, | 151 | &smartq7_leds_device, |
178 | &smartq7_buttons_device, | 152 | &smartq7_buttons_device, |
179 | &smartq7_lcd_control_device, | ||
180 | }; | 153 | }; |
181 | 154 | ||
182 | static void __init smartq7_machine_init(void) | 155 | static void __init smartq7_machine_init(void) |
@@ -184,7 +157,6 @@ static void __init smartq7_machine_init(void) | |||
184 | s3c_fb_set_platdata(&smartq7_lcd_pdata); | 157 | s3c_fb_set_platdata(&smartq7_lcd_pdata); |
185 | 158 | ||
186 | smartq_machine_init(); | 159 | smartq_machine_init(); |
187 | smartq7_lcd_setup_gpio(); | ||
188 | 160 | ||
189 | platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices)); | 161 | platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices)); |
190 | } | 162 | } |