Group and resource assignments for TWL4030
[linux-ginger.git] / arch / arm / mach-omap2 / board-n800-audio.c
blobfd83313aa359c36b0f8f82cfec10354bf75da1e5
1 /*
2 * linux/arch/arm/mach-omap2/board-n800-audio.c
4 * Copyright (C) 2006 Nokia Corporation
5 * Contact: Juha Yrjola
6 * Jarkko Nikula <jarkko.nikula@nokia.com>
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.
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.
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
24 #include <linux/err.h>
25 #include <linux/clk.h>
26 #include <linux/platform_device.h>
27 #include <linux/spi/tsc2301.h>
29 #include <asm/io.h>
30 #include <mach/eac.h>
32 #include <mach/dsp_common.h>
34 void __init n800_audio_init(struct tsc2301_platform_data *tc)
38 #ifdef CONFIG_OMAP_DSP
40 int n800_audio_enable(struct dsp_kfunc_device *kdev, int stage)
42 #ifdef AUDIO_ENABLED
43 unsigned long flags;
44 int do_enable = 0;
46 spin_lock_irqsave(&audio_lock, flags);
48 pr_debug("DSP power up request (audio codec %sinitialized)\n",
49 audio_ok ? "" : "not ");
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;
64 int n800_audio_disable(struct dsp_kfunc_device *kdev, int stage)
66 #ifdef AUDIO_ENABLED
67 unsigned long flags;
68 int do_disable = 0;
70 spin_lock_irqsave(&audio_lock, flags);
72 pr_debug("DSP power down request (audio codec %sinitialized)\n",
73 audio_ok ? "" : "not ");
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;
88 #endif /* CONFIG_OMAP_DSP */