2 * This file is part of OMAP DSP driver (DSP Gateway version 3.3.1)
4 * Copyright (C) 2002-2006 Nokia Corporation. All rights reserved.
6 * Contact: Toshihiro Kobayashi <toshihiro.kobayashi@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/module.h>
26 #include <linux/device.h>
27 #include <linux/init.h>
28 #include <linux/sched.h>
29 #include <linux/delay.h>
30 #include <linux/platform_device.h>
31 #include <linux/clk.h>
32 #include <linux/mutex.h>
33 #include <asm/uaccess.h>
35 #include <asm/ioctls.h>
36 #include <asm/arch/mailbox.h>
37 #include "hardware_dsp.h"
38 #include "dsp_mbcmd.h"
48 #ifdef CONFIG_OMAP_DSP_FBEXPORT
49 static enum fbstat_e {
53 } fbstat = FBSTAT_ENABLED;
56 static enum cfgstat_e cfgstat;
60 static ssize_t ifver_show(struct device *dev, struct device_attribute *attr,
62 static ssize_t cpustat_show(struct device *dev, struct device_attribute *attr,
64 static ssize_t icrmask_show(struct device *dev, struct device_attribute *attr,
66 static ssize_t icrmask_store(struct device *dev, struct device_attribute *attr,
67 const char *buf, size_t count);
68 static ssize_t loadinfo_show(struct device *dev, struct device_attribute *attr,
71 #define __ATTR_RW(_name, _mode) { \
72 .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \
73 .show = _name##_show, \
74 .store = _name##_store, \
77 static struct device_attribute dev_attr_ifver = __ATTR_RO(ifver);
78 static struct device_attribute dev_attr_cpustat = __ATTR_RO(cpustat);
79 static struct device_attribute dev_attr_icrmask = __ATTR_RW(icrmask, 0644);
80 static struct device_attribute dev_attr_loadinfo = __ATTR_RO(loadinfo);
83 * misc interactive mailbox command operations
85 static struct misc_mb_wait_struct {
87 wait_queue_head_t wait_q;
92 .lock = __MUTEX_INITIALIZER(misc_mb_wait.lock),
93 .wait_q = __WAIT_QUEUE_HEAD_INITIALIZER(misc_mb_wait.wait_q),
96 static int __misc_mbcompose_send_and_wait(u8 cmd_h, u8 cmd_l, u16 data,
99 struct mbcmd mb = MBCMD_INIT(cmd_h, cmd_l, data);
102 if (mutex_lock_interruptible(&misc_mb_wait.lock))
105 misc_mb_wait.cmd_h = mb.cmd_h;
106 misc_mb_wait.cmd_l = mb.cmd_l;
107 misc_mb_wait.retvp = retvp;
108 dsp_mbcmd_send_and_wait(&mb, &misc_mb_wait.wait_q);
110 if (misc_mb_wait.cmd_h != 0)
113 mutex_unlock(&misc_mb_wait.lock);
117 #define misc_mbcompose_send_and_wait(cmd_h, cmd_l, data, retvp) \
118 __misc_mbcompose_send_and_wait(MBOX_CMD_DSP_##cmd_h, (cmd_l), \
121 static int misc_mbcmd_response(struct mbcmd *mb, int argc, int match_cmd_l_flag)
126 /* if match_cmd_l_v flag is set, cmd_l needs to be matched as well. */
127 if (!waitqueue_active(&misc_mb_wait.wait_q) ||
128 (misc_mb_wait.cmd_h != mb->cmd_h) ||
129 (match_cmd_l_flag && (misc_mb_wait.cmd_l != mb->cmd_l))) {
130 const struct cmdinfo *ci = cmdinfo[mb->cmd_h];
133 if (ci->cmd_l_type == CMD_L_TYPE_SUBCMD)
134 sprintf(cmdstr, "%s:%s", ci->name, subcmd_name(mb));
136 strcpy(cmdstr, ci->name);
138 "mbox: unexpected command %s received!\n", cmdstr);
143 * if argc == 1, receive data through mbox:data register.
144 * if argc > 1, receive through ipbuf_sys.
147 misc_mb_wait.retvp[0] = mb->data;
149 if (dsp_mem_enable(ipbuf_sys_da) < 0) {
150 printk(KERN_ERR "mbox: %s - ipbuf_sys_da read failed!\n",
151 cmdinfo[mb->cmd_h]->name);
154 if (sync_with_dsp(&ipbuf_sys_da->s, TID_ANON, 10) < 0) {
155 printk(KERN_ERR "mbox: %s - IPBUF sync failed!\n",
156 cmdinfo[mb->cmd_h]->name);
157 dsp_mem_disable(ipbuf_sys_da);
160 /* need word access. do not use memcpy. */
161 buf = ipbuf_sys_da->d;
162 for (i = 0; i < argc; i++)
163 misc_mb_wait.retvp[i] = buf[i];
164 release_ipbuf_pvt(ipbuf_sys_da);
165 dsp_mem_disable(ipbuf_sys_da);
168 misc_mb_wait.cmd_h = 0;
169 wake_up_interruptible(&misc_mb_wait.wait_q);
173 static int dsp_regread(enum dsp_space_e space, u16 adr, u16 *val)
175 u8 cmd_l = (space == SPACE_MEM) ? REGRW_MEMR : REGRW_IOR;
178 ret = misc_mbcompose_send_and_wait(REGRW, cmd_l, adr, val);
179 if ((ret < 0) && (ret != -EINTR))
180 printk(KERN_ERR "omapdsp: register read error!\n");
185 static int dsp_regwrite(enum dsp_space_e space, u16 adr, u16 val)
187 u8 cmd_l = (space == SPACE_MEM) ? REGRW_MEMW : REGRW_IOW;
188 struct mb_exarg arg = {
194 mbcompose_send_exarg(REGRW, cmd_l, adr, &arg);
198 static int dsp_getvar(u8 varid, u16 *val)
202 ret = misc_mbcompose_send_and_wait(GETVAR, varid, 0, val);
203 if ((ret < 0) && (ret != -EINTR))
204 printk(KERN_ERR "omapdsp: variable read error!\n");
209 static int dsp_setvar(u8 varid, u16 val)
211 mbcompose_send(SETVAR, varid, val);
216 * dsp_cfg() return value
218 * = 1: failed, but state is clear. (DSPCFG command failed)
219 * < 0: failed. need cleanup.
221 static int dsp_cfg(void)
225 #ifdef CONFIG_ARCH_OMAP1
227 dsp_mem_usecount_clear();
231 * DSPCFG command and dsp_mem_start() must be called
232 * while internal mem is on.
234 dsp_mem_enable((void *)dspmem_base);
243 ret = misc_mbcompose_send_and_wait(DSPCFG, DSPCFG_REQ, 0, NULL);
246 printk(KERN_ERR "omapdsp: configuration error!\n");
251 #if defined(CONFIG_ARCH_OMAP1) && defined(OLD_BINARY_SUPPORT)
253 * MBREV 3.2 or earlier doesn't assume DMA domain is on
254 * when DSPCFG command is sent
256 if ((mbox_revision == MBREV_3_0) ||
257 (mbox_revision == MBREV_3_2)) {
258 if ((ret = mbcompose_send(PM, PM_ENABLE, DSPREG_ICR_DMA)) < 0)
263 if ((ret = dsp_task_config_all(n_stask)) < 0)
267 #ifdef CONFIG_OMAP_DSP_FBEXPORT
268 fbstat = FBSTAT_ENABLED;
272 if ((ret = dsp_setvar(VARID_ICRMASK, dsp_cpustat_get_icrmask())) < 0)
275 /* create runtime sysfs entries */
276 device_create_file(dsp_device, &dev_attr_loadinfo);
279 dsp_mem_disable((void *)dspmem_base);
283 static int dsp_uncfg(void)
285 if (dsp_taskmod_busy()) {
286 printk(KERN_WARNING "omapdsp: tasks are busy.\n");
290 /* FIXME: lock task module */
292 /* remove runtime sysfs entries */
293 device_remove_file(dsp_device, &dev_attr_loadinfo);
300 dsp_task_unconfig_all();
306 static int dsp_suspend(void)
310 ret = misc_mbcompose_send_and_wait(SUSPEND, 0, 0, NULL);
313 printk(KERN_ERR "omapdsp: DSP suspend error!\n");
317 udelay(100); /* wait for DSP-side execution */
321 int dsp_cfgstat_request(enum cfgstat_e st_req)
323 static DEFINE_MUTEX(cfgstat_lock);
324 int ret = 0, ret_override = 0;
326 if (mutex_lock_interruptible(&cfgstat_lock))
332 /* cfgstat takes CLEAN, READY or SUSPEND,
333 while st_req can take SUSPEND in addition. */
336 if (cfgstat == CFGSTAT_CLEAN)
338 if ((ret = dsp_uncfg()) < 0)
343 if (cfgstat != CFGSTAT_CLEAN) {
344 printk(KERN_ERR "omapdsp: DSP is ready already!\n");
350 if (ret > 0) { /* failed, but state is clear. */
353 } else if (ret < 0) { /* failed, need cleanup. */
354 st_req = CFGSTAT_CLEAN;
362 * DSP is not reset within this code, but done in omap_pm_suspend.
363 * so if these functions are called from sysfs,
364 * DSP should be reset / unreset out of these functions.
366 case CFGSTAT_SUSPEND:
370 if (dsp_cpustat_get_stat() == CPUSTAT_RUN) {
372 "omapdsp: illegal operation -- trying "
373 "suspend DSP while it is running but "
375 " Resetting DSP.\n");
376 dsp_cpustat_request(CPUSTAT_RESET);
382 if ((ret = dsp_suspend()) < 0)
386 case CFGSTAT_SUSPEND:
397 if (cfgstat != CFGSTAT_SUSPEND) {
399 "omapdsp: DSP resume request, but DSP is not in "
404 st_req = CFGSTAT_READY;
414 mutex_unlock(&cfgstat_lock);
415 return ret_override ? ret_override : ret;
418 enum cfgstat_e dsp_cfgstat_get_stat(void)
426 static int dsp_poll(void)
430 ret = misc_mbcompose_send_and_wait(POLL, 0, 0, NULL);
431 if ((ret < 0) && (ret != -EINTR))
432 printk(KERN_ERR "omapdsp: poll error!\n");
437 int dsp_set_runlevel(u8 level)
439 if (level == RUNLEVEL_RECOVERY) {
440 if (mbcompose_send_recovery(RUNLEVEL, level, 0) < 0)
443 if ((level < RUNLEVEL_USER) ||
444 (level > RUNLEVEL_SUPER))
446 if (mbcompose_send(RUNLEVEL, level, 0) < 0)
453 #ifdef CONFIG_OMAP_DSP_FBEXPORT
454 static void dsp_fbctl_enable(void)
456 mbcompose_send(KFUNC, KFUNC_FBCTL, FBCTL_ENABLE);
459 static int dsp_fbctl_disable(void)
463 ret = misc_mbcompose_send_and_wait(KFUNC, KFUNC_FBCTL, FBCTL_DISABLE,
465 if ((ret < 0) && (ret != -EINTR))
466 printk(KERN_ERR "omapdsp: fb disable error!\n");
471 static int dsp_fbstat_request(enum fbstat_e st)
473 static DEFINE_MUTEX(fbstat_lock);
476 if (mutex_lock_interruptible(&fbstat_lock))
486 case FBSTAT_DISABLED:
487 if ((ret = dsp_fbctl_disable()) < 0)
496 mutex_unlock(&fbstat_lock);
499 #endif /* CONFIG_OMAP_DSP_FBEXPORT */
502 * DSP control device file operations
504 static int dsp_ctl_ioctl(struct inode *inode, struct file *file,
505 unsigned int cmd, unsigned long arg)
511 * command level 1: commands which don't need lock
513 case DSPCTL_IOCTL_RUN:
514 dsp_cpustat_request(CPUSTAT_RUN);
517 case DSPCTL_IOCTL_RESET:
518 dsp_cpustat_request(CPUSTAT_RESET);
521 case DSPCTL_IOCTL_SETRSTVECT:
522 ret = dsp_set_rstvect((dsp_long_t)arg);
525 #ifdef CONFIG_ARCH_OMAP1
526 case DSPCTL_IOCTL_CPU_IDLE:
527 dsp_cpustat_request(CPUSTAT_CPU_IDLE);
530 case DSPCTL_IOCTL_GBL_IDLE:
531 dsp_cpustat_request(CPUSTAT_GBL_IDLE);
534 case DSPCTL_IOCTL_MPUI_WORDSWAP_ON:
538 case DSPCTL_IOCTL_MPUI_WORDSWAP_OFF:
542 case DSPCTL_IOCTL_MPUI_BYTESWAP_ON:
546 case DSPCTL_IOCTL_MPUI_BYTESWAP_OFF:
549 #endif /* CONFIG_ARCH_OMAP1 */
551 case DSPCTL_IOCTL_TASKCNT:
552 ret = dsp_task_count();
555 case DSPCTL_IOCTL_MBSEND:
557 struct omap_dsp_mailbox_cmd u_cmd;
559 if (copy_from_user(&u_cmd, (void *)arg, sizeof(u_cmd)))
561 msg = (u_cmd.cmd << 16) | u_cmd.data;
562 ret = dsp_mbcmd_send((struct mbcmd *)&msg);
566 case DSPCTL_IOCTL_SETVAR:
568 struct omap_dsp_varinfo var;
569 if (copy_from_user(&var, (void *)arg, sizeof(var)))
571 ret = dsp_setvar(var.varid, var.val[0]);
575 case DSPCTL_IOCTL_RUNLEVEL:
576 ret = dsp_set_runlevel(arg);
579 #ifdef CONFIG_OMAP_DSP_FBEXPORT
580 case DSPCTL_IOCTL_FBEN:
581 ret = dsp_fbstat_request(FBSTAT_ENABLED);
586 * command level 2: commands which need lock
588 case DSPCTL_IOCTL_DSPCFG:
589 ret = dsp_cfgstat_request(CFGSTAT_READY);
592 case DSPCTL_IOCTL_DSPUNCFG:
593 ret = dsp_cfgstat_request(CFGSTAT_CLEAN);
596 case DSPCTL_IOCTL_POLL:
600 #ifdef CONFIG_OMAP_DSP_FBEXPORT
601 case DSPCTL_IOCTL_FBDIS:
602 ret = dsp_fbstat_request(FBSTAT_DISABLED);
606 case DSPCTL_IOCTL_SUSPEND:
607 if ((ret = dsp_cfgstat_request(CFGSTAT_SUSPEND)) < 0)
609 dsp_cpustat_request(CPUSTAT_RESET);
612 case DSPCTL_IOCTL_RESUME:
613 if ((ret = dsp_cfgstat_request(CFGSTAT_RESUME)) < 0)
615 dsp_cpustat_request(CPUSTAT_RUN);
618 case DSPCTL_IOCTL_REGMEMR:
620 struct omap_dsp_reginfo *u_reg = (void *)arg;
623 if (copy_from_user(&adr, &u_reg->adr, sizeof(u16)))
625 if ((ret = dsp_regread(SPACE_MEM, adr, &val)) < 0)
627 if (copy_to_user(&u_reg->val, &val, sizeof(u16)))
632 case DSPCTL_IOCTL_REGMEMW:
634 struct omap_dsp_reginfo reg;
636 if (copy_from_user(®, (void *)arg, sizeof(reg)))
638 ret = dsp_regwrite(SPACE_MEM, reg.adr, reg.val);
642 case DSPCTL_IOCTL_REGIOR:
644 struct omap_dsp_reginfo *u_reg = (void *)arg;
647 if (copy_from_user(&adr, &u_reg->adr, sizeof(u16)))
649 if ((ret = dsp_regread(SPACE_IO, adr, &val)) < 0)
651 if (copy_to_user(&u_reg->val, &val, sizeof(u16)))
656 case DSPCTL_IOCTL_REGIOW:
658 struct omap_dsp_reginfo reg;
660 if (copy_from_user(®, (void *)arg, sizeof(reg)))
662 ret = dsp_regwrite(SPACE_IO, reg.adr, reg.val);
666 case DSPCTL_IOCTL_GETVAR:
668 struct omap_dsp_varinfo *u_var = (void *)arg;
670 u16 val[5]; /* maximum */
673 if (copy_from_user(&varid, &u_var->varid, sizeof(u8)))
685 if ((ret = dsp_getvar(varid, val)) < 0)
687 if (copy_to_user(&u_var->val, val, sizeof(u16) * argc))
700 * functions called from mailbox interrupt routine
702 void mbox_suspend(struct mbcmd *mb)
704 misc_mbcmd_response(mb, 0, 0);
707 void mbox_dspcfg(struct mbcmd *mb)
709 u8 last = mb->cmd_l & 0x80;
710 u8 cfgcmd = mb->cmd_l & 0x7f;
711 static dsp_long_t tmp_ipb_adr;
713 if (!waitqueue_active(&misc_mb_wait.wait_q) ||
714 (misc_mb_wait.cmd_h != MBOX_CMD_DSP_DSPCFG)) {
716 "mbox: DSPCFG command received, "
717 "but nobody is waiting for it...\n");
721 /* mailbox protocol check */
722 if (cfgcmd == DSPCFG_PROTREV) {
723 mbox_revision = mb->data;
724 if (mbox_revision == MBPROT_REVISION)
726 #ifdef OLD_BINARY_SUPPORT
727 else if ((mbox_revision == MBREV_3_0) ||
728 (mbox_revision == MBREV_3_2)) {
730 "mbox: ***** old DSP binary *****\n"
731 " Please update your DSP application.\n");
737 "mbox: protocol revision check error!\n"
738 " expected=0x%04x, received=0x%04x\n",
739 MBPROT_REVISION, mb->data);
746 * following commands are accepted only after
747 * revision check has been passed.
749 if (!mbox_revision < 0) {
751 "mbox: DSPCFG command received, "
752 "but revision check has not been passed.\n");
758 tmp_ipb_adr = (u32)mb->data << 16;
762 tmp_ipb_adr |= mb->data;
770 "mbox: Unknown CFG command: cmd_l=0x%02x, data=0x%04x\n",
771 mb->cmd_l, mb->data);
780 void *ipb_sys_da, *ipb_sys_ad;
781 void *mbseq; /* FIXME: 3.4 obsolete */
783 u16 dbg_buf_sz, dbg_line_sz;
784 struct mem_sync_struct mem_sync, *mem_syncp;
786 ipb_sys_da = dspword_to_virt(tmp_ipb_adr);
787 if (ipbuf_sys_config(ipb_sys_da, DIR_D2A) < 0)
790 if (dsp_mem_enable(ipbuf_sys_da) < 0) {
791 printk(KERN_ERR "mbox: DSPCFG - ipbuf_sys_da read failed!\n");
794 if (sync_with_dsp(&ipbuf_sys_da->s, TID_ANON, 10) < 0) {
795 printk(KERN_ERR "mbox: DSPCFG - IPBUF sync failed!\n");
796 dsp_mem_disable(ipbuf_sys_da);
800 * read configuration data on system IPBUF
801 * we must read with 16bit-access
803 #ifdef OLD_BINARY_SUPPORT
804 if (mbox_revision == MBPROT_REVISION) {
806 buf = ipbuf_sys_da->d;
810 badr = MKVIRT(buf[3], buf[4]);
811 /* ipb_sys_da = MKVIRT(buf[5], buf[6]); */
812 ipb_sys_ad = MKVIRT(buf[7], buf[8]);
813 mbseq = MKVIRT(buf[9], buf[10]);
814 dbg_buf = MKVIRT(buf[11], buf[12]);
815 dbg_buf_sz = buf[13];
816 dbg_line_sz = buf[14];
817 mem_sync.DARAM = MKVIRT(buf[15], buf[16]);
818 mem_sync.SARAM = MKVIRT(buf[17], buf[18]);
819 mem_sync.SDRAM = MKVIRT(buf[19], buf[20]);
820 mem_syncp = &mem_sync;
821 #ifdef OLD_BINARY_SUPPORT
822 } else if (mbox_revision == MBREV_3_2) {
823 buf = ipbuf_sys_da->d;
827 badr = MKVIRT(buf[3], buf[4]);
828 /* ipb_sys_da = MKVIRT(buf[5], buf[6]); */
829 ipb_sys_ad = MKVIRT(buf[7], buf[8]);
830 mbseq = MKVIRT(buf[9], buf[10]);
835 } else if (mbox_revision == MBREV_3_0) {
836 buf = ipbuf_sys_da->d;
840 badr = MKVIRT(buf[3], buf[4]);
841 /* bkeep = buf[5]; */
842 /* ipb_sys_da = MKVIRT(buf[6], buf[7]); */
843 ipb_sys_ad = MKVIRT(buf[8], buf[9]);
844 mbseq = MKVIRT(buf[10], buf[11]);
849 } else { /* should not occur */
850 dsp_mem_disable(ipbuf_sys_da);
853 #endif /* OLD_BINARY_SUPPORT */
855 release_ipbuf_pvt(ipbuf_sys_da);
856 dsp_mem_disable(ipbuf_sys_da);
859 * following configurations need to be done before
860 * waking up the dspcfg initiator process.
862 if (ipbuf_sys_config(ipb_sys_ad, DIR_A2D) < 0)
864 if (ipbuf_config(bln, bsz, badr) < 0)
866 if (dsp_mbox_config(mbseq) < 0)
868 if (dsp_dbg_config(dbg_buf, dbg_buf_sz, dbg_line_sz) < 0)
870 if (dsp_mem_sync_config(mem_syncp) < 0)
873 misc_mb_wait.cmd_h = 0;
874 wake_up_interruptible(&misc_mb_wait.wait_q);
881 wake_up_interruptible(&misc_mb_wait.wait_q);
885 void mbox_poll(struct mbcmd *mb)
887 misc_mbcmd_response(mb, 0, 0);
890 void mbox_regrw(struct mbcmd *mb)
894 misc_mbcmd_response(mb, 1, 0);
898 "mbox: Illegal REGRW command: "
899 "cmd_l=0x%02x, data=0x%04x\n", mb->cmd_l, mb->data);
904 void mbox_getvar(struct mbcmd *mb)
908 misc_mbcmd_response(mb, 1, 1);
911 misc_mbcmd_response(mb, 5, 1);
915 "mbox: Illegal GETVAR command: "
916 "cmd_l=0x%02x, data=0x%04x\n", mb->cmd_l, mb->data);
921 void mbox_fbctl_disable(struct mbcmd *mb)
923 misc_mbcmd_response(mb, 0, 0);
926 struct file_operations dsp_ctl_fops = {
927 .owner = THIS_MODULE,
928 .ioctl = dsp_ctl_ioctl,
936 static ssize_t ifver_show(struct device *dev, struct device_attribute *attr,
942 * I/F VERSION descriptions:
944 * 3.2: sysfs / udev support
945 * KMEM_RESERVE / KMEM_RELEASE ioctls for mem device
946 * 3.3: added following ioctls
947 * DSPCTL_IOCTL_GBL_IDLE
948 * DSPCTL_IOCTL_CPU_IDLE (instead of DSPCTL_IOCTL_IDLE)
953 * print all supporting I/F VERSIONs, like followings.
955 * len += sprintf(buf, "3.2\n");
956 * len += sprintf(buf, "3.3\n");
958 len += sprintf(buf + len, "3.2\n");
959 len += sprintf(buf + len, "3.3\n");
965 static char *cpustat_name[CPUSTAT_MAX] = {
966 [CPUSTAT_RESET] = "reset",
967 #ifdef CONFIG_ARCH_OMAP1
968 [CPUSTAT_GBL_IDLE] = "gbl_idle",
969 [CPUSTAT_CPU_IDLE] = "cpu_idle",
971 [CPUSTAT_RUN] = "run",
974 static ssize_t cpustat_show(struct device *dev, struct device_attribute *attr,
977 return sprintf(buf, "%s\n", cpustat_name[dsp_cpustat_get_stat()]);
981 static ssize_t icrmask_show(struct device *dev, struct device_attribute *attr,
984 return sprintf(buf, "0x%04x\n", dsp_cpustat_get_icrmask());
987 static ssize_t icrmask_store(struct device *dev, struct device_attribute *attr,
988 const char *buf, size_t count)
993 mask = simple_strtol(buf, NULL, 16);
994 dsp_cpustat_set_icrmask(mask);
996 if (dsp_cfgstat_get_stat() == CFGSTAT_READY) {
997 ret = dsp_setvar(VARID_ICRMASK, mask);
1006 static ssize_t loadinfo_show(struct device *dev, struct device_attribute *attr,
1013 if ((ret = dsp_getvar(VARID_LOADINFO, val)) < 0)
1017 * load info value range is 0(free) - 10000(busy):
1018 * if CPU load is not measured on DSP, it sets 0xffff at val[0].
1021 if (val[0] == 0xffff) {
1023 "currently DSP load info is not available.\n");
1029 " 10ms average = %3d.%02d%%\n"
1030 " 1sec average = %3d.%02d%% busiest 10ms = %3d.%02d%%\n"
1031 " 1min average = %3d.%02d%% busiest 1s = %3d.%02d%%\n",
1032 val[0]/100, val[0]%100,
1033 val[1]/100, val[1]%100, val[2]/100, val[2]%100,
1034 val[3]/100, val[3]%100, val[4]/100, val[4]%100);
1039 void __init dsp_ctl_init(void)
1041 device_create_file(dsp_device, &dev_attr_ifver);
1042 device_create_file(dsp_device, &dev_attr_cpustat);
1043 device_create_file(dsp_device, &dev_attr_icrmask);
1046 void dsp_ctl_exit(void)
1048 device_remove_file(dsp_device, &dev_attr_ifver);
1049 device_remove_file(dsp_device, &dev_attr_cpustat);
1050 device_remove_file(dsp_device, &dev_attr_icrmask);