aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2440/mach-rx1950.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c2440/mach-rx1950.c')
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c95
1 files changed, 67 insertions, 28 deletions
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index eab6ae50683c..27ea95096fe1 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -263,27 +263,78 @@ void rx1950_disable_charger(void)
263 gpio_direction_output(S3C2410_GPJ(3), 0); 263 gpio_direction_output(S3C2410_GPJ(3), 0);
264} 264}
265 265
266DEFINE_SPINLOCK(rx1950_blink_spin);
267
268static int rx1950_led_blink_set(unsigned gpio, int state,
269 unsigned long *delay_on, unsigned long *delay_off)
270{
271 int blink_gpio, check_gpio;
272
273 switch (gpio) {
274 case S3C2410_GPA(6):
275 blink_gpio = S3C2410_GPA(4);
276 check_gpio = S3C2410_GPA(3);
277 break;
278 case S3C2410_GPA(7):
279 blink_gpio = S3C2410_GPA(3);
280 check_gpio = S3C2410_GPA(4);
281 break;
282 default:
283 return -EINVAL;
284 break;
285 }
286
287 if (delay_on && delay_off && !*delay_on && !*delay_off)
288 *delay_on = *delay_off = 500;
289
290 spin_lock(&rx1950_blink_spin);
291
292 switch (state) {
293 case GPIO_LED_NO_BLINK_LOW:
294 case GPIO_LED_NO_BLINK_HIGH:
295 if (!gpio_get_value(check_gpio))
296 gpio_set_value(S3C2410_GPJ(6), 0);
297 gpio_set_value(blink_gpio, 0);
298 gpio_set_value(gpio, state);
299 break;
300 case GPIO_LED_BLINK:
301 gpio_set_value(gpio, 0);
302 gpio_set_value(S3C2410_GPJ(6), 1);
303 gpio_set_value(blink_gpio, 1);
304 break;
305 }
306
307 spin_unlock(&rx1950_blink_spin);
308
309 return 0;
310}
311
266static struct gpio_led rx1950_leds_desc[] = { 312static struct gpio_led rx1950_leds_desc[] = {
267 { 313 {
268 .name = "Green", 314 .name = "Green",
269 .default_trigger = "main-battery-charging-or-full", 315 .default_trigger = "main-battery-full",
270 .gpio = S3C2410_GPA(6), 316 .gpio = S3C2410_GPA(6),
317 .retain_state_suspended = 1,
271 }, 318 },
272 { 319 {
273 .name = "Red", 320 .name = "Red",
274 .default_trigger = "main-battery-full", 321 .default_trigger
275 .gpio = S3C2410_GPA(7), 322 = "main-battery-charging-blink-full-solid",
323 .gpio = S3C2410_GPA(7),
324 .retain_state_suspended = 1,
276 }, 325 },
277 { 326 {
278 .name = "Blue", 327 .name = "Blue",
279 .default_trigger = "rx1950-acx-mem", 328 .default_trigger = "rx1950-acx-mem",
280 .gpio = S3C2410_GPA(11), 329 .gpio = S3C2410_GPA(11),
330 .retain_state_suspended = 1,
281 }, 331 },
282}; 332};
283 333
284static struct gpio_led_platform_data rx1950_leds_pdata = { 334static struct gpio_led_platform_data rx1950_leds_pdata = {
285 .num_leds = ARRAY_SIZE(rx1950_leds_desc), 335 .num_leds = ARRAY_SIZE(rx1950_leds_desc),
286 .leds = rx1950_leds_desc, 336 .leds = rx1950_leds_desc,
337 .gpio_blink_set = rx1950_led_blink_set,
287}; 338};
288 339
289static struct platform_device rx1950_leds = { 340static struct platform_device rx1950_leds = {
@@ -566,26 +617,10 @@ static struct s3c2410_platform_nand rx1950_nand_info = {
566 .sets = rx1950_nand_sets, 617 .sets = rx1950_nand_sets,
567}; 618};
568 619
569static void rx1950_udc_pullup(enum s3c2410_udc_cmd_e cmd)
570{
571 switch (cmd) {
572 case S3C2410_UDC_P_ENABLE:
573 gpio_direction_output(S3C2410_GPJ(5), 1);
574 break;
575 case S3C2410_UDC_P_DISABLE:
576 gpio_direction_output(S3C2410_GPJ(5), 0);
577 break;
578 case S3C2410_UDC_P_RESET:
579 break;
580 default:
581 break;
582 }
583}
584
585static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = { 620static struct s3c2410_udc_mach_info rx1950_udc_cfg __initdata = {
586 .udc_command = rx1950_udc_pullup,
587 .vbus_pin = S3C2410_GPG(5), 621 .vbus_pin = S3C2410_GPG(5),
588 .vbus_pin_inverted = 1, 622 .vbus_pin_inverted = 1,
623 .pullup_pin = S3C2410_GPJ(5),
589}; 624};
590 625
591static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = { 626static struct s3c2410_ts_mach_info rx1950_ts_cfg __initdata = {
@@ -750,9 +785,6 @@ static void __init rx1950_init_machine(void)
750 S3C2410_MISCCR_USBSUSPND0 | 785 S3C2410_MISCCR_USBSUSPND0 |
751 S3C2410_MISCCR_USBSUSPND1, 0x0); 786 S3C2410_MISCCR_USBSUSPND1, 0x0);
752 787
753 WARN_ON(gpio_request(S3C2410_GPJ(5), "UDC pullup"));
754 gpio_direction_output(S3C2410_GPJ(5), 0);
755
756 /* mmc power is disabled by default */ 788 /* mmc power is disabled by default */
757 WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power")); 789 WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
758 gpio_direction_output(S3C2410_GPJ(1), 0); 790 gpio_direction_output(S3C2410_GPJ(1), 0);
@@ -771,6 +803,13 @@ static void __init rx1950_init_machine(void)
771 803
772 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); 804 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
773 805
806 WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
807 WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
808 WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
809 gpio_direction_output(S3C2410_GPA(3), 0);
810 gpio_direction_output(S3C2410_GPA(4), 0);
811 gpio_direction_output(S3C2410_GPJ(6), 0);
812
774 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); 813 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
775 814
776 i2c_register_board_info(0, rx1950_i2c_devices, 815 i2c_register_board_info(0, rx1950_i2c_devices,