diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2013-11-26 05:09:01 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-12-12 18:00:53 -0500 |
commit | 5f72d85e282e83db8eedb291aa89db9198470b38 (patch) | |
tree | f7597601e73a5038b2d03264a54864dd7889654d /arch/arm/mach-sa1100 | |
parent | 22564bde0bc4a0ec04d084d3a6c8c75eb2102d57 (diff) |
ARM: 7898/1: sa1100: h3100: refactor LCD GPIO handling
As GPIOs are going to move to platform device, there is no guarantee
that they will be available at init_machine time.
Request all GPIOs directly in lcd_power callback and not at init_machine
time.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-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) |