2 * linux/arch/arm/mach-omap/dsp/dsp_ctl_core.c
4 * OMAP DSP control devices core driver
6 * Copyright (C) 2004,2005 Nokia Corporation
8 * Written by Toshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * 2005/07/26: DSP Gateway version 3.3
27 #include <linux/module.h>
28 #include <linux/major.h>
30 #include <linux/device.h>
31 #include <linux/init.h>
32 #include <asm/arch/dsp.h>
33 #include "hardware_dsp.h"
40 static struct class *dsp_ctl_class;
41 extern struct file_operations dsp_ctl_fops,
46 static int dsp_ctl_core_open(struct inode *inode, struct file *file)
48 switch (iminor(inode)) {
50 file->f_op = &dsp_ctl_fops;
53 file->f_op = &dsp_mem_fops;
56 file->f_op = &dsp_twch_fops;
59 file->f_op = &dsp_err_fops;
64 if (file->f_op && file->f_op->open)
65 return file->f_op->open(inode, file);
69 static struct file_operations dsp_ctl_core_fops = {
71 .open = dsp_ctl_core_open,
74 static const struct dev_list {
79 {CTL_MINOR, "dspctl", S_IRUSR | S_IWUSR},
80 {MEM_MINOR, "dspmem", S_IRUSR | S_IWUSR | S_IRGRP},
81 {TWCH_MINOR, "dsptwch", S_IRUSR | S_IWUSR | S_IRGRP},
82 {ERR_MINOR, "dsperr", S_IRUSR | S_IRGRP},
85 int __init dsp_ctl_core_init(void)
89 struct class_device *cdev;
91 retval = register_chrdev(OMAP_DSP_CTL_MAJOR, "dspctl",
95 "omapdsp: failed to register dspctl device: %d\n",
100 dsp_ctl_class = class_create(THIS_MODULE, "dspctl");
101 for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
102 cdev = class_device_create(dsp_ctl_class, NULL,
103 MKDEV(OMAP_DSP_CTL_MAJOR,
105 NULL, dev_list[i].devname);
111 void dsp_ctl_core_exit(void)
115 for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
116 class_device_destroy(dsp_ctl_class,
117 MKDEV(OMAP_DSP_CTL_MAJOR,
120 class_destroy(dsp_ctl_class);
122 unregister_chrdev(OMAP_DSP_CTL_MAJOR, "dspctl");