]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-n800-audio.c
ARM: OMAP: N8x0: Add retu-headset platform data
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-n800-audio.c
1 /*
2  * linux/arch/arm/mach-omap2/board-n800-audio.c
3  *
4  * Copyright (C) 2006 Nokia Corporation
5  * Contact: Juha Yrjola
6  *          Jarkko Nikula <jarkko.nikula@nokia.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23
24 #include <linux/err.h>
25 #include <linux/clk.h>
26 #include <linux/platform_device.h>
27 #include <linux/spi/tsc2301.h>
28
29 #include <asm/io.h>
30 #include <mach/eac.h>
31
32 #include <mach/dsp_common.h>
33
34 void __init n800_audio_init(struct tsc2301_platform_data *tc)
35 {
36 }
37
38 #ifdef CONFIG_OMAP_DSP
39
40 int n800_audio_enable(struct dsp_kfunc_device *kdev, int stage)
41 {
42 #ifdef AUDIO_ENABLED
43         unsigned long flags;
44         int do_enable = 0;
45
46         spin_lock_irqsave(&audio_lock, flags);
47
48         pr_debug("DSP power up request (audio codec %sinitialized)\n",
49                  audio_ok ? "" : "not ");
50
51         if (enable_audio)
52                 goto out;
53         enable_audio = 1;
54         if (audio_ok)
55                 do_enable = 1;
56 out:
57         spin_unlock_irqrestore(&audio_lock, flags);
58         if (do_enable)
59                 eac_set_mode(eac_device, 1, 1);
60 #endif
61         return 0;
62 }
63
64 int n800_audio_disable(struct dsp_kfunc_device *kdev, int stage)
65 {
66 #ifdef AUDIO_ENABLED
67         unsigned long flags;
68         int do_disable = 0;
69
70         spin_lock_irqsave(&audio_lock, flags);
71
72         pr_debug("DSP power down request (audio codec %sinitialized)\n",
73                 audio_ok ? "" : "not ");
74
75         if (!enable_audio)
76                 goto out;
77         enable_audio = 0;
78         if (audio_ok)
79                 do_disable = 1;
80 out:
81         spin_unlock_irqrestore(&audio_lock, flags);
82         if (do_disable)
83                 eac_set_mode(eac_device, 0, 0);
84 #endif
85         return 0;
86 }
87
88 #endif /* CONFIG_OMAP_DSP */