aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c134
-rw-r--r--arch/arm/mach-omap1/devices.c37
-rw-r--r--arch/arm/mach-omap1/mcbsp.c3
3 files changed, 0 insertions, 174 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index c9e9e37c5676..5224b67f7f1c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -32,7 +32,6 @@
32#include <plat/board.h> 32#include <plat/board.h>
33#include <plat/keypad.h> 33#include <plat/keypad.h>
34#include <plat/common.h> 34#include <plat/common.h>
35#include <plat/dsp_common.h>
36#include <plat/hwa742.h> 35#include <plat/hwa742.h>
37#include <plat/lcd_mipid.h> 36#include <plat/lcd_mipid.h>
38#include <plat/mmc.h> 37#include <plat/mmc.h>
@@ -242,138 +241,6 @@ static inline void nokia770_mmc_init(void)
242} 241}
243#endif 242#endif
244 243
245#if defined(CONFIG_OMAP_DSP)
246/*
247 * audio power control
248 */
249#define HEADPHONE_GPIO 14
250#define AMPLIFIER_CTRL_GPIO 58
251
252static struct clk *dspxor_ck;
253static DEFINE_MUTEX(audio_pwr_lock);
254/*
255 * audio_pwr_state
256 * +--+-------------------------+---------------------------------------+
257 * |-1|down |power-up request -> 0 |
258 * +--+-------------------------+---------------------------------------+
259 * | 0|up |power-down(1) request -> 1 |
260 * | | |power-down(2) request -> (ignore) |
261 * +--+-------------------------+---------------------------------------+
262 * | 1|up, |power-up request -> 0 |
263 * | |received down(1) request |power-down(2) request -> -1 |
264 * +--+-------------------------+---------------------------------------+
265 */
266static int audio_pwr_state = -1;
267
268static inline void aic23_power_up(void)
269{
270}
271static inline void aic23_power_down(void)
272{
273}
274
275/*
276 * audio_pwr_up / down should be called under audio_pwr_lock
277 */
278static void nokia770_audio_pwr_up(void)
279{
280 clk_enable(dspxor_ck);
281
282 /* Turn on codec */
283 aic23_power_up();
284
285 if (gpio_get_value(HEADPHONE_GPIO))
286 /* HP not connected, turn on amplifier */
287 gpio_set_value(AMPLIFIER_CTRL_GPIO, 1);
288 else
289 /* HP connected, do not turn on amplifier */
290 printk("HP connected\n");
291}
292
293static void codec_delayed_power_down(struct work_struct *work)
294{
295 mutex_lock(&audio_pwr_lock);
296 if (audio_pwr_state == -1)
297 aic23_power_down();
298 clk_disable(dspxor_ck);
299 mutex_unlock(&audio_pwr_lock);
300}
301
302static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
303
304static void nokia770_audio_pwr_down(void)
305{
306 /* Turn off amplifier */
307 gpio_set_value(AMPLIFIER_CTRL_GPIO, 0);
308
309 /* Turn off codec: schedule delayed work */
310 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */
311}
312
313static int
314nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
315{
316 mutex_lock(&audio_pwr_lock);
317 if (audio_pwr_state == -1)
318 nokia770_audio_pwr_up();
319 /* force audio_pwr_state = 0, even if it was 1. */
320 audio_pwr_state = 0;
321 mutex_unlock(&audio_pwr_lock);
322 return 0;
323}
324
325static int
326nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
327{
328 mutex_lock(&audio_pwr_lock);
329 switch (stage) {
330 case 1:
331 if (audio_pwr_state == 0)
332 audio_pwr_state = 1;
333 break;
334 case 2:
335 if (audio_pwr_state == 1) {
336 nokia770_audio_pwr_down();
337 audio_pwr_state = -1;
338 }
339 break;
340 }
341 mutex_unlock(&audio_pwr_lock);
342 return 0;
343}
344
345static struct dsp_kfunc_device nokia770_audio_device = {
346 .name = "audio",
347 .type = DSP_KFUNC_DEV_TYPE_AUDIO,
348 .enable = nokia770_audio_pwr_up_request,
349 .disable = nokia770_audio_pwr_down_request,
350};
351
352static __init int omap_dsp_init(void)
353{
354 int ret;
355
356 dspxor_ck = clk_get(0, "dspxor_ck");
357 if (IS_ERR(dspxor_ck)) {
358 printk(KERN_ERR "couldn't acquire dspxor_ck\n");
359 return PTR_ERR(dspxor_ck);
360 }
361
362 ret = dsp_kfunc_device_register(&nokia770_audio_device);
363 if (ret) {
364 printk(KERN_ERR
365 "KFUNC device registration faild: %s\n",
366 nokia770_audio_device.name);
367 goto out;
368 }
369 return 0;
370 out:
371 return ret;
372}
373#else
374#define omap_dsp_init() do {} while (0)
375#endif /* CONFIG_OMAP_DSP */
376
377static void __init omap_nokia770_init(void) 244static void __init omap_nokia770_init(void)
378{ 245{
379 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); 246 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
@@ -382,7 +249,6 @@ static void __init omap_nokia770_init(void)
382 omap_gpio_init(); 249 omap_gpio_init();
383 omap_serial_init(); 250 omap_serial_init();
384 omap_register_i2c_bus(1, 100, NULL, 0); 251 omap_register_i2c_bus(1, 100, NULL, 0);
385 omap_dsp_init();
386 hwa742_dev_init(); 252 hwa742_dev_init();
387 ads7846_dev_init(); 253 ads7846_dev_init();
388 mipid_dev_init(); 254 mipid_dev_init();
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 379100c17639..c00d602a2599 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -63,44 +63,7 @@ static void omap_init_rtc(void)
63static inline void omap_init_rtc(void) {} 63static inline void omap_init_rtc(void) {}
64#endif 64#endif
65 65
66#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
67
68#if defined(CONFIG_ARCH_OMAP15XX)
69# define OMAP1_MBOX_SIZE 0x23
70# define INT_DSP_MAILBOX1 INT_1510_DSP_MAILBOX1
71#elif defined(CONFIG_ARCH_OMAP16XX)
72# define OMAP1_MBOX_SIZE 0x2f
73# define INT_DSP_MAILBOX1 INT_1610_DSP_MAILBOX1
74#endif
75
76#define OMAP1_MBOX_BASE OMAP16XX_MAILBOX_BASE
77
78static struct resource mbox_resources[] = {
79 {
80 .start = OMAP1_MBOX_BASE,
81 .end = OMAP1_MBOX_BASE + OMAP1_MBOX_SIZE,
82 .flags = IORESOURCE_MEM,
83 },
84 {
85 .start = INT_DSP_MAILBOX1,
86 .flags = IORESOURCE_IRQ,
87 },
88};
89
90static struct platform_device mbox_device = {
91 .name = "omap1-mailbox",
92 .id = -1,
93 .num_resources = ARRAY_SIZE(mbox_resources),
94 .resource = mbox_resources,
95};
96
97static inline void omap_init_mbox(void)
98{
99 platform_device_register(&mbox_device);
100}
101#else
102static inline void omap_init_mbox(void) { } 66static inline void omap_init_mbox(void) { }
103#endif
104 67
105/*-------------------------------------------------------------------------*/ 68/*-------------------------------------------------------------------------*/
106 69
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index e9bdff192f82..b3a796a6da03 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -23,7 +23,6 @@
23#include <plat/mux.h> 23#include <plat/mux.h>
24#include <plat/cpu.h> 24#include <plat/cpu.h>
25#include <plat/mcbsp.h> 25#include <plat/mcbsp.h>
26#include <plat/dsp_common.h>
27 26
28#define DPS_RSTCT2_PER_EN (1 << 0) 27#define DPS_RSTCT2_PER_EN (1 << 0)
29#define DSP_RSTCT2_WD_PER_EN (1 << 1) 28#define DSP_RSTCT2_WD_PER_EN (1 << 1)
@@ -46,7 +45,6 @@ static void omap1_mcbsp_request(unsigned int id)
46 clk_enable(api_clk); 45 clk_enable(api_clk);
47 clk_enable(dsp_clk); 46 clk_enable(dsp_clk);
48 47
49 omap_dsp_request_mem();
50 /* 48 /*
51 * DSP external peripheral reset 49 * DSP external peripheral reset
52 * FIXME: This should be moved to dsp code 50 * FIXME: This should be moved to dsp code
@@ -62,7 +60,6 @@ static void omap1_mcbsp_free(unsigned int id)
62{ 60{
63 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) { 61 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
64 if (--dsp_use == 0) { 62 if (--dsp_use == 0) {
65 omap_dsp_release_mem();
66 if (!IS_ERR(api_clk)) { 63 if (!IS_ERR(api_clk)) {
67 clk_disable(api_clk); 64 clk_disable(api_clk);
68 clk_put(api_clk); 65 clk_put(api_clk);