2 * linux/arch/arm/mach-omap2/board-n800-dsp.c
4 * Copyright (C) 2006 Nokia Corporation.
6 * Contact: Hiroshi DOYU <Hiroshi.DOYU@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
24 #include <linux/kernel.h>
25 #include <linux/device.h>
26 #include <linux/list.h>
27 #include <linux/err.h>
28 #include <linux/clk.h>
31 #include <asm/arch/clock.h>
32 #include <asm/arch/board.h>
34 #include "../plat-omap/dsp/dsp_common.h"
36 #if defined(CONFIG_OMAP_DSP)
39 * dsp peripheral device: AUDIO
41 static struct dsp_kfunc_device n800_audio_device = {
43 .type = DSP_KFUNC_DEV_TYPE_AUDIO,
44 .enable = n800_audio_enable,
45 .disable = n800_audio_disable,
49 * dsp peripheral device: TIMER
51 static int dsp_timer_probe(struct dsp_kfunc_device *kdev)
55 strcpy(clockname, kdev->name);
56 strcat(clockname, "_fck");
58 kdev->fck = clk_get(NULL, clockname);
59 if (IS_ERR(kdev->fck)) {
60 printk(KERN_ERR "couldn't acquire %s\n", clockname);
61 return PTR_ERR(kdev->fck);
63 pr_debug("%s probed successfully\n", clockname);
65 strcpy(clockname, kdev->name);
66 strcat(clockname, "_ick");
67 kdev->ick = clk_get(NULL, clockname);
68 if (IS_ERR(kdev->ick)) {
69 printk(KERN_ERR "couldn't acquire %s\n", clockname);
72 pr_debug("%s probed successfully\n", clockname);
78 return PTR_ERR(kdev->ick);
81 static int dsp_timer_remove(struct dsp_kfunc_device *kdev)
85 pr_debug("%s removed successfully\n", kdev->name);
89 static int dsp_timer_enable(struct dsp_kfunc_device *kdev, int stage)
91 pr_debug("%s enabled(%d)\n", kdev->name, stage);
93 mutex_lock(&kdev->lock);
99 clk_enable(kdev->fck);
100 clk_enable(kdev->ick);
102 mutex_unlock(&kdev->lock);
107 static int dsp_timer_disable(struct dsp_kfunc_device *kdev, int stage)
109 pr_debug("%s disabled(%d)\n", kdev->name, stage);
111 mutex_lock(&kdev->lock);
113 if (kdev->enabled == 0)
117 clk_disable(kdev->ick);
118 clk_disable(kdev->fck);
120 mutex_unlock(&kdev->lock);
125 static struct dsp_kfunc_device n800_timer_device = {
127 .type = DSP_KFUNC_DEV_TYPE_COMMON,
128 .probe = dsp_timer_probe,
129 .remove = dsp_timer_remove,
130 .enable = dsp_timer_enable,
131 .disable = dsp_timer_disable,
134 static struct dsp_kfunc_device *n800_kfunc_dev[] = {
139 void __init n800_dsp_init(void)
142 struct dsp_kfunc_device **p = n800_kfunc_dev;
144 for (i = 0; i < ARRAY_SIZE(n800_kfunc_dev); i++) {
145 ret = dsp_kfunc_device_register(p[i]);
148 "KFUNC device registration failed: %s\n",
155 void __init n800_dsp_init(void) { }
156 #endif /* CONFIG_OMAP_DSP */