aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-nokia770.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/board-nokia770.c')
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c98
1 files changed, 89 insertions, 9 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 70014f751bc4..22db19a53647 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -33,6 +33,12 @@
33#include <asm/arch/dsp_common.h> 33#include <asm/arch/dsp_common.h>
34#include <asm/arch/aic23.h> 34#include <asm/arch/aic23.h>
35#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
36#include <asm/arch/omapfb.h>
37#include <asm/arch/lcd_mipid.h>
38
39#include "../plat-omap/dsp/dsp_common.h"
40
41#define ADS7846_PENDOWN_GPIO 15
36 42
37static void __init omap_nokia770_init_irq(void) 43static void __init omap_nokia770_init_irq(void)
38{ 44{
@@ -91,9 +97,44 @@ static struct platform_device nokia770_kp_device = {
91}; 97};
92 98
93static struct platform_device *nokia770_devices[] __initdata = { 99static struct platform_device *nokia770_devices[] __initdata = {
94 &nokia770_kp_device, 100 &nokia770_kp_device,
101};
102
103static void mipid_shutdown(struct mipid_platform_data *pdata)
104{
105 if (pdata->nreset_gpio != -1) {
106 printk(KERN_INFO "shutdown LCD\n");
107 omap_set_gpio_dataout(pdata->nreset_gpio, 0);
108 msleep(120);
109 }
110}
111
112static struct mipid_platform_data nokia770_mipid_platform_data = {
113 .shutdown = mipid_shutdown,
95}; 114};
96 115
116static void mipid_dev_init(void)
117{
118 const struct omap_lcd_config *conf;
119
120 conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
121 if (conf != NULL) {
122 nokia770_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
123 nokia770_mipid_platform_data.data_lines = conf->data_lines;
124 }
125}
126
127static void ads7846_dev_init(void)
128{
129 if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0)
130 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
131}
132
133static int ads7846_get_pendown_state(void)
134{
135 return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO);
136}
137
97static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { 138static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
98 .x_max = 0x0fff, 139 .x_max = 0x0fff,
99 .y_max = 0x0fff, 140 .y_max = 0x0fff,
@@ -101,14 +142,17 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata =
101 .pressure_max = 255, 142 .pressure_max = 255,
102 .debounce_max = 10, 143 .debounce_max = 10,
103 .debounce_tol = 3, 144 .debounce_tol = 3,
145 .debounce_rep = 1,
146 .get_pendown_state = ads7846_get_pendown_state,
104}; 147};
105 148
106static struct spi_board_info nokia770_spi_board_info[] __initdata = { 149static struct spi_board_info nokia770_spi_board_info[] __initdata = {
107 [0] = { 150 [0] = {
108 .modalias = "lcd_mipid", 151 .modalias = "lcd_mipid",
109 .bus_num = 2, 152 .bus_num = 2,
110 .chip_select = 3, 153 .chip_select = 3,
111 .max_speed_hz = 12000000, 154 .max_speed_hz = 12000000,
155 .platform_data = &nokia770_mipid_platform_data,
112 }, 156 },
113 [1] = { 157 [1] = {
114 .modalias = "ads7846", 158 .modalias = "ads7846",
@@ -153,6 +197,7 @@ static struct omap_board_config_kernel nokia770_config[] = {
153 { OMAP_TAG_MMC, &nokia770_mmc_config }, 197 { OMAP_TAG_MMC, &nokia770_mmc_config },
154}; 198};
155 199
200#if defined(CONFIG_OMAP_DSP)
156/* 201/*
157 * audio power control 202 * audio power control
158 */ 203 */
@@ -183,7 +228,7 @@ static void nokia770_audio_pwr_up(void)
183 clk_enable(dspxor_ck); 228 clk_enable(dspxor_ck);
184 229
185 /* Turn on codec */ 230 /* Turn on codec */
186 tlv320aic23_power_up(); 231 aic23_power_up();
187 232
188 if (omap_get_gpio_datain(HEADPHONE_GPIO)) 233 if (omap_get_gpio_datain(HEADPHONE_GPIO))
189 /* HP not connected, turn on amplifier */ 234 /* HP not connected, turn on amplifier */
@@ -197,7 +242,7 @@ static void codec_delayed_power_down(struct work_struct *work)
197{ 242{
198 down(&audio_pwr_sem); 243 down(&audio_pwr_sem);
199 if (audio_pwr_state == -1) 244 if (audio_pwr_state == -1)
200 tlv320aic23_power_down(); 245 aic23_power_down();
201 clk_disable(dspxor_ck); 246 clk_disable(dspxor_ck);
202 up(&audio_pwr_sem); 247 up(&audio_pwr_sem);
203} 248}
@@ -213,7 +258,8 @@ static void nokia770_audio_pwr_down(void)
213 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */ 258 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */
214} 259}
215 260
216void nokia770_audio_pwr_up_request(int stage) 261static int
262nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
217{ 263{
218 down(&audio_pwr_sem); 264 down(&audio_pwr_sem);
219 if (audio_pwr_state == -1) 265 if (audio_pwr_state == -1)
@@ -221,9 +267,11 @@ void nokia770_audio_pwr_up_request(int stage)
221 /* force audio_pwr_state = 0, even if it was 1. */ 267 /* force audio_pwr_state = 0, even if it was 1. */
222 audio_pwr_state = 0; 268 audio_pwr_state = 0;
223 up(&audio_pwr_sem); 269 up(&audio_pwr_sem);
270 return 0;
224} 271}
225 272
226void nokia770_audio_pwr_down_request(int stage) 273static int
274nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
227{ 275{
228 down(&audio_pwr_sem); 276 down(&audio_pwr_sem);
229 switch (stage) { 277 switch (stage) {
@@ -239,8 +287,39 @@ void nokia770_audio_pwr_down_request(int stage)
239 break; 287 break;
240 } 288 }
241 up(&audio_pwr_sem); 289 up(&audio_pwr_sem);
290 return 0;
242} 291}
243 292
293static struct dsp_kfunc_device nokia770_audio_device = {
294 .name = "audio",
295 .type = DSP_KFUNC_DEV_TYPE_AUDIO,
296 .enable = nokia770_audio_pwr_up_request,
297 .disable = nokia770_audio_pwr_down_request,
298};
299
300static __init int omap_dsp_init(void)
301{
302 int ret;
303
304 dspxor_ck = clk_get(0, "dspxor_ck");
305 if (IS_ERR(dspxor_ck)) {
306 printk(KERN_ERR "couldn't acquire dspxor_ck\n");
307 return PTR_ERR(dspxor_ck);
308 }
309
310 ret = dsp_kfunc_device_register(&nokia770_audio_device);
311 if (ret) {
312 printk(KERN_ERR
313 "KFUNC device registration faild: %s\n",
314 nokia770_audio_device.name);
315 goto out;
316 }
317 return 0;
318 out:
319 return ret;
320}
321#endif /* CONFIG_OMAP_DSP */
322
244static void __init omap_nokia770_init(void) 323static void __init omap_nokia770_init(void)
245{ 324{
246 nokia770_config[0].data = &nokia770_usb_config; 325 nokia770_config[0].data = &nokia770_usb_config;
@@ -250,10 +329,11 @@ static void __init omap_nokia770_init(void)
250 ARRAY_SIZE(nokia770_spi_board_info)); 329 ARRAY_SIZE(nokia770_spi_board_info));
251 omap_board_config = nokia770_config; 330 omap_board_config = nokia770_config;
252 omap_board_config_size = ARRAY_SIZE(nokia770_config); 331 omap_board_config_size = ARRAY_SIZE(nokia770_config);
332 omap_gpio_init();
253 omap_serial_init(); 333 omap_serial_init();
254 omap_dsp_audio_pwr_up_request = nokia770_audio_pwr_up_request; 334 omap_dsp_init();
255 omap_dsp_audio_pwr_down_request = nokia770_audio_pwr_down_request; 335 ads7846_dev_init();
256 dspxor_ck = clk_get(0, "dspxor_ck"); 336 mipid_dev_init();
257} 337}
258 338
259static void __init omap_nokia770_map_io(void) 339static void __init omap_nokia770_map_io(void)