aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100/h3100.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-sa1100/h3100.c')
-rw-r--r--arch/arm/mach-sa1100/h3100.c54
1 files changed, 44 insertions, 10 deletions
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index b8f2b151539b..daa27c474c13 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 */
31static 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
36static 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
31static void h3100_lcd_power(int enable) 53static 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
42static struct sa1100fb_mach_info h3100_lcd_info = { 62static struct sa1100fb_mach_info h3100_lcd_info = {
@@ -69,6 +89,11 @@ static void __init h3100_map_io(void)
69/* 89/*
70 * This turns the IRDA power on or off on the Compaq H3100 90 * This turns the IRDA power on or off on the Compaq H3100
71 */ 91 */
92static struct gpio h3100_irda_gpio[] = {
93 { H3100_GPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" },
94 { H3100_GPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" },
95};
96
72static int h3100_irda_set_power(struct device *dev, unsigned int state) 97static int h3100_irda_set_power(struct device *dev, unsigned int state)
73{ 98{
74 gpio_set_value(H3100_GPIO_IR_ON, state); 99 gpio_set_value(H3100_GPIO_IR_ON, state);
@@ -80,18 +105,27 @@ static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
80 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000)); 105 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
81} 106}
82 107
108static int h3100_irda_startup(struct device *dev)
109{
110 return gpio_request_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
111}
112
113static void h3100_irda_shutdown(struct device *dev)
114{
115 return gpio_free_array(h3100_irda_gpio, sizeof(h3100_irda_gpio));
116}
117
83static struct irda_platform_data h3100_irda_data = { 118static struct irda_platform_data h3100_irda_data = {
84 .set_power = h3100_irda_set_power, 119 .set_power = h3100_irda_set_power,
85 .set_speed = h3100_irda_set_speed, 120 .set_speed = h3100_irda_set_speed,
121 .startup = h3100_irda_startup,
122 .shutdown = h3100_irda_shutdown,
86}; 123};
87 124
88static struct gpio_default_state h3100_default_gpio[] = { 125static struct gpio_default_state h3100_default_gpio[] = {
89 { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
90 { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
91 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, 126 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
92 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, 127 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
93 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, 128 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
94 { H3100_GPIO_LCD_3V_ON, GPIO_MODE_OUT0, "LCD 3v" },
95}; 129};
96 130
97static void __init h3100_mach_init(void) 131static void __init h3100_mach_init(void)