diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-sa1100/h3100.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c index b8f2b151539b..5b78c9f9a11d 100644 --- a/arch/arm/mach-sa1100/h3100.c +++ b/arch/arm/mach-sa1100/h3100.c | |||
@@ -28,15 +28,35 @@ | |||
28 | /* | 28 | /* |
29 | * helper for sa1100fb | 29 | * helper for sa1100fb |
30 | */ | 30 | */ |
31 | static struct gpio h3100_lcd_gpio[] = { | ||
32 | { H3100_GPIO_LCD_3V_ON, GPIOF_OUT_INIT_LOW, "LCD 3V" }, | ||
33 | { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD ON" }, | ||
34 | }; | ||
35 | |||
36 | static bool h3100_lcd_request(void) | ||
37 | { | ||
38 | static bool h3100_lcd_ok; | ||
39 | int rc; | ||
40 | |||
41 | if (h3100_lcd_ok) | ||
42 | return true; | ||
43 | |||
44 | rc = gpio_request_array(h3100_lcd_gpio, ARRAY_SIZE(h3100_lcd_gpio)); | ||
45 | if (rc) | ||
46 | pr_err("%s: can't request GPIOs\n", __func__); | ||
47 | else | ||
48 | h3100_lcd_ok = true; | ||
49 | |||
50 | return h3100_lcd_ok; | ||
51 | } | ||
52 | |||
31 | static void h3100_lcd_power(int enable) | 53 | static void h3100_lcd_power(int enable) |
32 | { | 54 | { |
33 | if (!gpio_request(H3XXX_EGPIO_LCD_ON, "LCD ON")) { | 55 | if (!h3100_lcd_request()) |
34 | gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); | 56 | return; |
35 | gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); | 57 | |
36 | gpio_free(H3XXX_EGPIO_LCD_ON); | 58 | gpio_set_value(H3100_GPIO_LCD_3V_ON, enable); |
37 | } else { | 59 | gpio_set_value(H3XXX_EGPIO_LCD_ON, enable); |
38 | pr_err("%s: can't request H3XXX_EGPIO_LCD_ON\n", __func__); | ||
39 | } | ||
40 | } | 60 | } |
41 | 61 | ||
42 | static struct sa1100fb_mach_info h3100_lcd_info = { | 62 | static struct sa1100fb_mach_info h3100_lcd_info = { |
@@ -91,7 +111,6 @@ static struct gpio_default_state h3100_default_gpio[] = { | |||
91 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, | 111 | { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, |
92 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, | 112 | { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, |
93 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, | 113 | { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, |
94 | { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" }, | ||
95 | }; | 114 | }; |
96 | 115 | ||
97 | static void __init h3100_mach_init(void) | 116 | static void __init h3100_mach_init(void) |