diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-12-17 01:04:14 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-12-17 01:04:14 -0500 |
commit | 022573c275500e1a50889949f679d04b5446edf6 (patch) | |
tree | 766ab0e13fc38275466f8544d1bbf4982833cbff /arch/arm/mach-ux500/board-mop500-stuib.c | |
parent | 516d798f656614f59553b1ff3592c2c36102b684 (diff) | |
parent | a455e2985f57e2a71566bb8850094af38b2c932d (diff) |
Merge branch 'next' into for-linus
Prepare first set of updates for 3.8 merge window.
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500-stuib.c')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-stuib.c | 93 |
1 files changed, 4 insertions, 89 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-stuib.c b/arch/arm/mach-ux500/board-mop500-stuib.c index 8c979770d87..7e1f294f043 100644 --- a/arch/arm/mach-ux500/board-mop500-stuib.c +++ b/arch/arm/mach-ux500/board-mop500-stuib.c | |||
@@ -77,9 +77,6 @@ static struct i2c_board_info __initdata mop500_i2c0_devices_stuib[] = { | |||
77 | * BU21013 ROHM touchscreen interface on the STUIBs | 77 | * BU21013 ROHM touchscreen interface on the STUIBs |
78 | */ | 78 | */ |
79 | 79 | ||
80 | /* tracks number of bu21013 devices being enabled */ | ||
81 | static int bu21013_devices; | ||
82 | |||
83 | #define TOUCH_GPIO_PIN 84 | 80 | #define TOUCH_GPIO_PIN 84 |
84 | 81 | ||
85 | #define TOUCH_XMAX 384 | 82 | #define TOUCH_XMAX 384 |
@@ -88,85 +85,8 @@ static int bu21013_devices; | |||
88 | #define PRCMU_CLOCK_OCR 0x1CC | 85 | #define PRCMU_CLOCK_OCR 0x1CC |
89 | #define TSC_EXT_CLOCK_9_6MHZ 0x840000 | 86 | #define TSC_EXT_CLOCK_9_6MHZ 0x840000 |
90 | 87 | ||
91 | /** | ||
92 | * bu21013_gpio_board_init : configures the touch panel. | ||
93 | * @reset_pin: reset pin number | ||
94 | * This function can be used to configures | ||
95 | * the voltage and reset the touch panel controller. | ||
96 | */ | ||
97 | static int bu21013_gpio_board_init(int reset_pin) | ||
98 | { | ||
99 | int retval = 0; | ||
100 | |||
101 | bu21013_devices++; | ||
102 | if (bu21013_devices == 1) { | ||
103 | retval = gpio_request(reset_pin, "touchp_reset"); | ||
104 | if (retval) { | ||
105 | printk(KERN_ERR "Unable to request gpio reset_pin"); | ||
106 | return retval; | ||
107 | } | ||
108 | retval = gpio_direction_output(reset_pin, 1); | ||
109 | if (retval < 0) { | ||
110 | printk(KERN_ERR "%s: gpio direction failed\n", | ||
111 | __func__); | ||
112 | return retval; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | return retval; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * bu21013_gpio_board_exit : deconfigures the touch panel controller | ||
121 | * @reset_pin: reset pin number | ||
122 | * This function can be used to deconfigures the chip selection | ||
123 | * for touch panel controller. | ||
124 | */ | ||
125 | static int bu21013_gpio_board_exit(int reset_pin) | ||
126 | { | ||
127 | int retval = 0; | ||
128 | |||
129 | if (bu21013_devices == 1) { | ||
130 | retval = gpio_direction_output(reset_pin, 0); | ||
131 | if (retval < 0) { | ||
132 | printk(KERN_ERR "%s: gpio direction failed\n", | ||
133 | __func__); | ||
134 | return retval; | ||
135 | } | ||
136 | gpio_set_value(reset_pin, 0); | ||
137 | } | ||
138 | bu21013_devices--; | ||
139 | |||
140 | return retval; | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * bu21013_read_pin_val : get the interrupt pin value | ||
145 | * This function can be used to get the interrupt pin value for touch panel | ||
146 | * controller. | ||
147 | */ | ||
148 | static int bu21013_read_pin_val(void) | ||
149 | { | ||
150 | return gpio_get_value(TOUCH_GPIO_PIN); | ||
151 | } | ||
152 | |||
153 | static struct bu21013_platform_device tsc_plat_device = { | 88 | static struct bu21013_platform_device tsc_plat_device = { |
154 | .cs_en = bu21013_gpio_board_init, | 89 | .touch_pin = TOUCH_GPIO_PIN, |
155 | .cs_dis = bu21013_gpio_board_exit, | ||
156 | .irq_read_val = bu21013_read_pin_val, | ||
157 | .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN), | ||
158 | .touch_x_max = TOUCH_XMAX, | ||
159 | .touch_y_max = TOUCH_YMAX, | ||
160 | .ext_clk = false, | ||
161 | .x_flip = false, | ||
162 | .y_flip = true, | ||
163 | }; | ||
164 | |||
165 | static struct bu21013_platform_device tsc_plat2_device = { | ||
166 | .cs_en = bu21013_gpio_board_init, | ||
167 | .cs_dis = bu21013_gpio_board_exit, | ||
168 | .irq_read_val = bu21013_read_pin_val, | ||
169 | .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN), | ||
170 | .touch_x_max = TOUCH_XMAX, | 90 | .touch_x_max = TOUCH_XMAX, |
171 | .touch_y_max = TOUCH_YMAX, | 91 | .touch_y_max = TOUCH_YMAX, |
172 | .ext_clk = false, | 92 | .ext_clk = false, |
@@ -181,21 +101,16 @@ static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = { | |||
181 | }, | 101 | }, |
182 | { | 102 | { |
183 | I2C_BOARD_INFO("bu21013_tp", 0x5D), | 103 | I2C_BOARD_INFO("bu21013_tp", 0x5D), |
184 | .platform_data = &tsc_plat2_device, | 104 | .platform_data = &tsc_plat_device, |
185 | }, | 105 | }, |
186 | |||
187 | }; | 106 | }; |
188 | 107 | ||
189 | void __init mop500_stuib_init(void) | 108 | void __init mop500_stuib_init(void) |
190 | { | 109 | { |
191 | if (machine_is_hrefv60()) { | 110 | if (machine_is_hrefv60()) |
192 | tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO; | 111 | tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO; |
193 | tsc_plat2_device.cs_pin = HREFV60_TOUCH_RST_GPIO; | 112 | else |
194 | } else { | ||
195 | tsc_plat_device.cs_pin = GPIO_BU21013_CS; | 113 | tsc_plat_device.cs_pin = GPIO_BU21013_CS; |
196 | tsc_plat2_device.cs_pin = GPIO_BU21013_CS; | ||
197 | |||
198 | } | ||
199 | 114 | ||
200 | mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib, | 115 | mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib, |
201 | ARRAY_SIZE(mop500_i2c0_devices_stuib)); | 116 | ARRAY_SIZE(mop500_i2c0_devices_stuib)); |