From 0a1de60c0d0f0c9f634a8673a1918f716c2cdcad Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU Date: Thu, 21 Sep 2006 17:41:46 +0300 Subject: [PATCH] ARM: OMAP: DSPGW: Peripheral (kfunc) control DSP needs to control some board-specific peripheral devices (GPT, audio, mbox, etc.) through dspgw kfunc commands. Signed-off-by: Hiroshi DOYU Signed-off-by: Juha Yrjola --- arch/arm/plat-omap/devices.c | 26 ++- arch/arm/plat-omap/dsp/dsp.h | 3 - arch/arm/plat-omap/dsp/dsp_common.c | 24 +-- arch/arm/plat-omap/dsp/dsp_common.h | 45 ++++- arch/arm/plat-omap/dsp/dsp_core.c | 226 +++++++++++++++++++++---- arch/arm/plat-omap/dsp/dsp_ctl.c | 16 +- arch/arm/plat-omap/dsp/dsp_mbcmd.h | 12 +- arch/arm/plat-omap/dsp/dsp_mem.c | 26 +-- arch/arm/plat-omap/dsp/error.c | 4 +- arch/arm/plat-omap/dsp/ipbuf.c | 4 +- arch/arm/plat-omap/dsp/ipbuf.h | 22 +-- arch/arm/plat-omap/dsp/mblog.c | 5 +- arch/arm/plat-omap/dsp/task.c | 2 +- include/asm-arm/arch-omap/dsp_common.h | 3 - 14 files changed, 308 insertions(+), 110 deletions(-) diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index e3e2bd50aa4..070c627bcb0 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c @@ -29,6 +29,10 @@ #include "../plat-omap/dsp/dsp_common.h" +static struct dsp_platform_data dsp_pdata = { + .kdev_list = LIST_HEAD_INIT(dsp_pdata.kdev_list), +}; + static struct resource omap_dsp_resources[] = { { .name = "dsp_mmu", @@ -42,9 +46,11 @@ static struct platform_device omap_dsp_device = { .id = -1, .num_resources = ARRAY_SIZE(omap_dsp_resources), .resource = omap_dsp_resources, + .dev = { + .platform_data = &dsp_pdata, + }, }; - static inline void omap_init_dsp(void) { struct resource *res; @@ -63,12 +69,26 @@ static inline void omap_init_dsp(void) platform_device_register(&omap_dsp_device); } + +int dsp_kfunc_device_register(struct dsp_kfunc_device *kdev) +{ + static DEFINE_MUTEX(dsp_pdata_lock); + + mutex_init(&kdev->lock); + + mutex_lock(&dsp_pdata_lock); + list_add_tail(&kdev->entry, &dsp_pdata.kdev_list); + mutex_unlock(&dsp_pdata_lock); + + return 0; +} +EXPORT_SYMBOL(dsp_kfunc_device_register); + #else static inline void omap_init_dsp(void) { } -#endif +#endif /* CONFIG_OMAP_DSP */ /*-------------------------------------------------------------------------*/ - #if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) #define OMAP1_I2C_BASE 0xfffb3800 diff --git a/arch/arm/plat-omap/dsp/dsp.h b/arch/arm/plat-omap/dsp/dsp.h index ec24be72adf..64d22c665cd 100644 --- a/arch/arm/plat-omap/dsp/dsp.h +++ b/arch/arm/plat-omap/dsp/dsp.h @@ -116,7 +116,6 @@ struct mb_exarg { u16 *argv; }; -extern struct mbox *mbox_dsp; extern void dsp_mbox_start(void); extern void dsp_mbox_stop(void); extern int dsp_mbox_config(void *p); @@ -240,5 +239,3 @@ extern const struct cmdinfo *cmdinfo[]; extern char *subcmd_name(struct mbcmd *mb); extern void mblog_add(struct mbcmd *mb, arm_dsp_dir_t dir); - -extern struct device *dsp_device; diff --git a/arch/arm/plat-omap/dsp/dsp_common.c b/arch/arm/plat-omap/dsp/dsp_common.c index e48a47dfd11..70e58122fa9 100644 --- a/arch/arm/plat-omap/dsp/dsp_common.c +++ b/arch/arm/plat-omap/dsp/dsp_common.c @@ -373,7 +373,7 @@ static void dsp_cpustat_update(void) __dsp_core_enable(); #endif cpustat.stat = CPUSTAT_RUN; - enable_irq(dsp_mmu_irq); + enable_irq(omap_dsp->mmu_irq); } return; } @@ -381,7 +381,7 @@ static void dsp_cpustat_update(void) /* cpustat.req < CPUSTAT_RUN */ if (cpustat.stat == CPUSTAT_RUN) { - disable_irq(dsp_mmu_irq); + disable_irq(omap_dsp->mmu_irq); #ifdef CONFIG_ARCH_OMAP1 clk_disable(api_ck_handle); #endif @@ -568,26 +568,6 @@ void dsp_unregister_mem_cb(void) } #endif /* CONFIG_ARCH_OMAP1 */ -/* - * Audio power control function prototypes and defaults - * (To be overridden with board specific functions) - */ -static void generic_audio_pwr_up_request(int stage) -{ - printk(KERN_ERR "audio power-up request function is not defined.\n"); -} - -void (*omap_dsp_audio_pwr_up_request)(int stage) = generic_audio_pwr_up_request; -EXPORT_SYMBOL(omap_dsp_audio_pwr_up_request); - -static void generic_audio_pwr_down_request(int stage) -{ - printk(KERN_ERR "audio power-down request function is not defined.\n"); -} - -void (*omap_dsp_audio_pwr_down_request)(int stage) = generic_audio_pwr_down_request; -EXPORT_SYMBOL(omap_dsp_audio_pwr_down_request); - arch_initcall(omap_dsp_init); #ifdef CONFIG_ARCH_OMAP1 diff --git a/arch/arm/plat-omap/dsp/dsp_common.h b/arch/arm/plat-omap/dsp/dsp_common.h index a1765042bdb..dc846628f7d 100644 --- a/arch/arm/plat-omap/dsp/dsp_common.h +++ b/arch/arm/plat-omap/dsp/dsp_common.h @@ -158,6 +158,49 @@ static inline void dsp_clk_autoidle(void) } #endif -extern int dsp_mmu_irq; +struct dsp_kfunc_device { + char *name; + struct clk *fck; + struct clk *ick;; + struct mutex lock; + int enabled; + int type; +#define DSP_KFUNC_DEV_TYPE_COMMON 1 +#define DSP_KFUNC_DEV_TYPE_AUDIO 2 + + struct list_head entry; + + int (*probe)(struct dsp_kfunc_device *); + int (*remove)(struct dsp_kfunc_device *); + int (*enable)(struct dsp_kfunc_device *, int); + int (*disable)(struct dsp_kfunc_device *, int); +}; + +extern int dsp_kfunc_device_register(struct dsp_kfunc_device *); + +struct dsp_platform_data { + struct list_head kdev_list; +}; + +struct omap_dsp { + struct mutex lock; + int enabled; /* stored peripheral status */ + int mmu_irq; + struct omap_mbox *mbox; + struct device *dev; + struct list_head *kdev_list; +}; + +#if defined(CONFIG_ARCH_OMAP1) +#define command_dvfs_stop(m) (0) +#define command_dvfs_start(m) (0) +#elif defined(CONFIG_ARCH_OMAP2) +#define command_dvfs_stop(m) \ + (((m)->cmd_l == KFUNC_POWER) && ((m)->data == DVFS_STOP)) +#define command_dvfs_start(m) \ + (((m)->cmd_l == KFUNC_POWER) && ((m)->data == DVFS_START)) +#endif + +extern struct omap_dsp *omap_dsp; #endif /* DRIVER_DSP_COMMON_H */ diff --git a/arch/arm/plat-omap/dsp/dsp_core.c b/arch/arm/plat-omap/dsp/dsp_core.c index 09c0388bdce..66b28529f4d 100644 --- a/arch/arm/plat-omap/dsp/dsp_core.c +++ b/arch/arm/plat-omap/dsp/dsp_core.c @@ -40,10 +40,7 @@ MODULE_AUTHOR("Toshihiro Kobayashi "); MODULE_DESCRIPTION("OMAP DSP driver module"); MODULE_LICENSE("GPL"); -struct device *dsp_device; -int dsp_mmu_irq; - -struct omap_mbox *mbox_dsp; +struct omap_dsp *omap_dsp; static struct sync_seq *mbseq; static u16 mbseq_expect_tmp; static u16 *mbseq_expect = &mbseq_expect_tmp; @@ -134,6 +131,98 @@ const struct cmdinfo *cmdinfo[MBOX_CMD_MAX] = { [MBOX_CMD_DSP_DBG] = &cif_dbg, }; +static int dsp_kfunc_probe_devices(struct omap_dsp *dsp) +{ + struct dsp_kfunc_device *p; + int ret, fail = 0; + + mutex_lock(&dsp->lock); + list_for_each_entry(p, dsp->kdev_list, entry) { + if (p->probe == NULL) + continue; + ret = p->probe(p); + if (ret) { + printk(KERN_ERR + "probing %s failed\n", p->name); + fail++; + } + } + mutex_unlock(&dsp->lock); + + pr_debug("%s() fail:%d\n", __FUNCTION__, fail); + + return fail; +} + +static int dsp_kfunc_remove_devices(struct omap_dsp *dsp) +{ + struct dsp_kfunc_device *p; + int ret, fail = 0; + + mutex_lock(&dsp->lock); + list_for_each_entry_reverse(p, dsp->kdev_list, entry) { + if (p->remove == NULL) + continue; + ret = p->remove(p); + if (ret) { + printk(KERN_ERR + "removing %s failed\n", p->name); + fail++; + } + } + mutex_unlock(&dsp->lock); + + pr_debug("%s() fail:%d\n", __FUNCTION__, fail); + + return fail; +} + +static int dsp_kfunc_enable_devices(struct omap_dsp *dsp, int type, int stage) +{ + struct dsp_kfunc_device *p; + int ret, fail = 0; + + mutex_lock(&dsp->lock); + list_for_each_entry(p, dsp->kdev_list, entry) { + if ((p->type != type) || (p->enable == NULL)) + continue; + ret = p->enable(p, stage); + if (ret) { + printk(KERN_ERR + "enabling %s failed\n", p->name); + fail++; + } + } + mutex_unlock(&dsp->lock); + + pr_debug("%s(%d) fail:%d\n", __FUNCTION__, type, fail); + + return fail; +} + +static int dsp_kfunc_disable_devices(struct omap_dsp *dsp, int type, int stage) +{ + struct dsp_kfunc_device *p; + int ret, fail = 0; + + mutex_lock(&dsp->lock); + list_for_each_entry_reverse(p, omap_dsp->kdev_list, entry) { + if ((p->type != type) || (p->disable == NULL)) + continue; + ret = p->disable(p, stage); + if (ret) { + printk(KERN_ERR + "disabling %s failed\n", p->name); + fail++; + } + } + mutex_unlock(&dsp->lock); + + pr_debug("%s(%d) fail:%d\n", __FUNCTION__, type, fail); + + return fail; +} + int sync_with_dsp(u16 *adr, u16 val, int try_cnt) { int try; @@ -145,8 +234,7 @@ int sync_with_dsp(u16 *adr, u16 val, int try_cnt) udelay(1); if (*(volatile u16 *)adr == val) { /* success! */ - printk(KERN_INFO - "omapdsp: sync_with_dsp(): try = %d\n", try); + pr_info("omapdsp: sync_with_dsp(): try = %d\n", try); return 0; } } @@ -189,6 +277,13 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg, { int ret = 0; + if (unlikely(omap_dsp->enabled == 0)) { + ret = dsp_kfunc_enable_devices(omap_dsp, + DSP_KFUNC_DEV_TYPE_COMMON, 0); + if (ret == 0) + omap_dsp->enabled = 1; + } + /* * while MMU fault is set, * only recovery command can be executed @@ -203,7 +298,8 @@ int __dsp_mbcmd_send_exarg(struct mbcmd *mb, struct mb_exarg *arg, if (arg) dsp_mem_enable(ipbuf_sys_ad); - ret = omap_mbox_msg_send(mbox_dsp, *(mbox_msg_t *)mb, (void*)arg); + ret = omap_mbox_msg_send(omap_dsp->mbox, + *(mbox_msg_t *)mb, (void*)arg); if (ret) goto out; @@ -268,7 +364,7 @@ static int mbsync_hold_mem_active; void dsp_mbox_start(void) { - omap_mbox_init_seq(mbox_dsp); + omap_mbox_init_seq(omap_dsp->mbox); mbseq_expect_tmp = 0; } @@ -308,22 +404,22 @@ int dsp_mbox_config(void *p) static int __init dsp_mbox_init(void) { - mbox_dsp->mbox = omap_mbox_get("dsp"); - if (IS_ERR(mbox_dsp)) { + omap_dsp->mbox = omap_mbox_get("dsp"); + if (IS_ERR(omap_dsp->mbox)) { printk(KERN_ERR "failed to get mailbox handler for DSP.\n"); return -ENODEV; } - mbox_dsp->msg_receive_cb = mbcmd_receiver; - mbox_dsp->msg_sender_cb = mbcmd_sender_prepare; + omap_dsp->mbox->msg_receive_cb = mbcmd_receiver; + omap_dsp->mbox->msg_sender_cb = mbcmd_sender_prepare; return 0; } static void dsp_mbox_exit(void) { - mbox_dsp->msg_sender_cb = NULL; - mbox_dsp->msg_receive_cb = NULL; + omap_dsp->mbox->msg_sender_cb = NULL; + omap_dsp->mbox->msg_receive_cb = NULL; if (mbsync_hold_mem_active) { dsp_mem_disable((void *)daram_base); @@ -352,24 +448,52 @@ static void mbox_kfunc_fbctl(struct mbcmd *mb) } } -static void mbox_kfunc_audio_pwr(unsigned short data) +/* + * dspgw: KFUNC message handler + */ +static void mbox_kfunc_power(unsigned short data) { + int ret = -1; + switch (data) { + case DVFS_START: /* ACK from DSP */ + /* TBD */ + break; case AUDIO_PWR_UP: - omap_dsp_audio_pwr_up_request(0); - /* send back ack */ - mbcompose_send(KFUNC, KFUNC_AUDIO_PWR, AUDIO_PWR_UP); + ret = dsp_kfunc_enable_devices(omap_dsp, + DSP_KFUNC_DEV_TYPE_AUDIO, 0); + if (ret == 0) + ret++; break; - case AUDIO_PWR_DOWN1: - omap_dsp_audio_pwr_down_request(1); + case AUDIO_PWR_DOWN: /* == AUDIO_PWR_DOWN1 */ + ret = dsp_kfunc_disable_devices(omap_dsp, + DSP_KFUNC_DEV_TYPE_AUDIO, 1); break; case AUDIO_PWR_DOWN2: - omap_dsp_audio_pwr_down_request(2); + ret = dsp_kfunc_disable_devices(omap_dsp, + DSP_KFUNC_DEV_TYPE_AUDIO, 2); + break; + case DSP_PWR_DOWN: + ret = dsp_kfunc_disable_devices(omap_dsp, + DSP_KFUNC_DEV_TYPE_COMMON, 0); + if (ret == 0) + omap_dsp->enabled = 0; break; default: printk(KERN_ERR - "mailbox: Unknown AUDIO_PWR from DSP: 0x%04x\n", data); + "mailbox: Unknown PWR from DSP: 0x%04x\n", data); + break; } + + if (unlikely(ret < 0)) { + printk(KERN_ERR "mailbox: PWR(0x%04x) failed\n", data); + return; + } + + if (likely(ret == 0)) + return; + + mbcompose_send(KFUNC, KFUNC_POWER, data); } static void mbox_kfunc(struct mbcmd *mb) @@ -378,8 +502,8 @@ static void mbox_kfunc(struct mbcmd *mb) case KFUNC_FBCTL: mbox_kfunc_fbctl(mb); break; - case KFUNC_AUDIO_PWR: - mbox_kfunc_audio_pwr(mb->data); + case KFUNC_POWER: + mbox_kfunc_power(mb->data); break; default: printk(KERN_ERR @@ -404,14 +528,34 @@ extern void dsp_taskmod_exit(void); static int __init dsp_drv_probe(struct platform_device *pdev) { int ret; + struct omap_dsp *info; + struct dsp_platform_data *pdata = pdev->dev.platform_data; dev_info(&pdev->dev, "OMAP DSP driver initialization\n"); - dsp_device = &pdev->dev; + info = kzalloc(sizeof(struct omap_dsp), GFP_KERNEL); + if (unlikely(info == NULL)) { + dev_dbg(&pdev->dev, "no memory for info\n"); + return -ENOMEM; + } + platform_set_drvdata(pdev, info); + omap_dsp = info; - dsp_mmu_irq = platform_get_irq_byname(pdev, "dsp_mmu"); - if (dsp_mmu_irq < 0) - return -ENXIO; + mutex_init(&info->lock); + info->dev = &pdev->dev; + info->kdev_list = &pdata->kdev_list; + + ret = dsp_kfunc_probe_devices(info); + if (ret) { + ret = -ENXIO; + goto fail0; + } + + info->mmu_irq = platform_get_irq_byname(pdev, "dsp_mmu"); + if (unlikely(info->mmu_irq) < 0) { + ret = -ENXIO; + goto fail1; + } #ifdef CONFIG_ARCH_OMAP2 clk_enable(dsp_fck_handle); @@ -420,37 +564,44 @@ static int __init dsp_drv_probe(struct platform_device *pdev) #endif if ((ret = dsp_ctl_core_init()) < 0) - goto fail1; - if ((ret = dsp_mem_init()) < 0) goto fail2; + if ((ret = dsp_mem_init()) < 0) + goto fail3; dsp_ctl_init(); mblog_init(); if ((ret = dsp_taskmod_init()) < 0) - goto fail3; - if ((ret = dsp_mbox_init()) < 0) goto fail4; + if ((ret = dsp_mbox_init()) < 0) + goto fail5; return 0; -fail4: + fail5: dsp_taskmod_exit(); -fail3: + fail4: mblog_exit(); dsp_ctl_exit(); dsp_mem_exit(); -fail2: + fail3: dsp_ctl_core_exit(); -fail1: + fail2: #ifdef CONFIG_ARCH_OMAP2 __dsp_per_disable(); clk_disable(dsp_ick_handle); clk_disable(dsp_fck_handle); #endif + fail1: + dsp_kfunc_remove_devices(info); + fail0: + kfree(info); + return ret; } static int dsp_drv_remove(struct platform_device *pdev) { + struct omap_dsp *info = platform_get_drvdata(pdev); + dsp_cpustat_request(CPUSTAT_RESET); dsp_cfgstat_request(CFGSTAT_CLEAN); @@ -467,6 +618,9 @@ static int dsp_drv_remove(struct platform_device *pdev) clk_disable(dsp_ick_handle); clk_disable(dsp_fck_handle); #endif + dsp_kfunc_remove_devices(info); + kfree(info); + return 0; } diff --git a/arch/arm/plat-omap/dsp/dsp_ctl.c b/arch/arm/plat-omap/dsp/dsp_ctl.c index ba7cc2b8b89..f0258a38a83 100644 --- a/arch/arm/plat-omap/dsp/dsp_ctl.c +++ b/arch/arm/plat-omap/dsp/dsp_ctl.c @@ -273,7 +273,7 @@ static int dsp_cfg(void) goto out; /* create runtime sysfs entries */ - device_create_file(dsp_device, &dev_attr_loadinfo); + device_create_file(omap_dsp->dev, &dev_attr_loadinfo); out: dsp_mem_disable((void *)dspmem_base); @@ -290,7 +290,7 @@ static int dsp_uncfg(void) /* FIXME: lock task module */ /* remove runtime sysfs entries */ - device_remove_file(dsp_device, &dev_attr_loadinfo); + device_remove_file(omap_dsp->dev, &dev_attr_loadinfo); dsp_mbox_stop(); dsp_twch_stop(); @@ -1038,14 +1038,14 @@ out: void __init dsp_ctl_init(void) { - device_create_file(dsp_device, &dev_attr_ifver); - device_create_file(dsp_device, &dev_attr_cpustat); - device_create_file(dsp_device, &dev_attr_icrmask); + device_create_file(omap_dsp->dev, &dev_attr_ifver); + device_create_file(omap_dsp->dev, &dev_attr_cpustat); + device_create_file(omap_dsp->dev, &dev_attr_icrmask); } void dsp_ctl_exit(void) { - device_remove_file(dsp_device, &dev_attr_ifver); - device_remove_file(dsp_device, &dev_attr_cpustat); - device_remove_file(dsp_device, &dev_attr_icrmask); + device_remove_file(omap_dsp->dev, &dev_attr_ifver); + device_remove_file(omap_dsp->dev, &dev_attr_cpustat); + device_remove_file(omap_dsp->dev, &dev_attr_icrmask); } diff --git a/arch/arm/plat-omap/dsp/dsp_mbcmd.h b/arch/arm/plat-omap/dsp/dsp_mbcmd.h index 8d4ff05cd81..d30c3bc8064 100644 --- a/arch/arm/plat-omap/dsp/dsp_mbcmd.h +++ b/arch/arm/plat-omap/dsp/dsp_mbcmd.h @@ -70,15 +70,21 @@ #define PM_ENABLE 0x01 #define KFUNC_FBCTL 0x00 -#define KFUNC_AUDIO_PWR 0x01 +#define KFUNC_POWER 0x01 #define FBCTL_UPD 0x0000 #define FBCTL_ENABLE 0x0002 #define FBCTL_DISABLE 0x0003 -#define AUDIO_PWR_UP 0x0000 -#define AUDIO_PWR_DOWN1 0x0001 +/* KFUNC_POWER */ +#define AUDIO_PWR_UP 0x0000 /* ARM(exe/ack) <-> DSP(req) */ +#define AUDIO_PWR_DOWN 0x0001 /* ARM(exe) <- DSP(req) */ +#define AUDIO_PWR_DOWN1 AUDIO_PWR_DOWN #define AUDIO_PWR_DOWN2 0x0002 +#define DSP_PWR_UP 0x0003 /* ARM(exe/snd) -> DSP(exe) */ +#define DSP_PWR_DOWN 0x0004 /* ARM(exe) <- DSP(req) */ +#define DVFS_START 0x0006 /* ARM(req) <-> DSP(exe/ack)*/ +#define DVFS_STOP 0x0007 /* ARM(req) -> DSP(exe) */ #define TDEL_SAFE 0x0000 #define TDEL_KILL 0x0001 diff --git a/arch/arm/plat-omap/dsp/dsp_mem.c b/arch/arm/plat-omap/dsp/dsp_mem.c index 88aebdb635e..48b7a7935d2 100644 --- a/arch/arm/plat-omap/dsp/dsp_mem.c +++ b/arch/arm/plat-omap/dsp/dsp_mem.c @@ -2313,7 +2313,7 @@ static void do_mmu_int(void) printk(KERN_DEBUG "fault address = %#08x\n", dsp_fault_adr); } - enable_irq(dsp_mmu_irq); + enable_irq(omap_dsp->mmu_irq); return; } @@ -2408,7 +2408,7 @@ static void do_mmu_int(void) dsp_mmu_enable(); #endif - enable_irq(dsp_mmu_irq); + enable_irq(omap_dsp->mmu_irq); } static DECLARE_WORK(mmu_int_work, (void (*)(void *))do_mmu_int, NULL); @@ -2420,7 +2420,7 @@ static DECLARE_WORK(mmu_int_work, (void (*)(void *))do_mmu_int, NULL); static irqreturn_t dsp_mmu_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - disable_irq(dsp_mmu_irq); + disable_irq(omap_dsp->mmu_irq); schedule_work(&mmu_int_work); return IRQ_HANDLED; } @@ -2490,7 +2490,7 @@ int __init dsp_mem_init(void) /* * DSP MMU interrupt setup */ - ret = request_irq(dsp_mmu_irq, dsp_mmu_interrupt, SA_INTERRUPT, + ret = request_irq(omap_dsp->mmu_irq, dsp_mmu_interrupt, SA_INTERRUPT, "dsp_mmu", &devid_mmu); if (ret) { printk(KERN_ERR @@ -2499,11 +2499,11 @@ int __init dsp_mem_init(void) } /* MMU interrupt is not enabled until DSP runs */ - disable_irq(dsp_mmu_irq); + disable_irq(omap_dsp->mmu_irq); - device_create_file(dsp_device, &dev_attr_mmu); - device_create_file(dsp_device, &dev_attr_exmap); - device_create_file(dsp_device, &dev_attr_mempool); + device_create_file(omap_dsp->dev, &dev_attr_mmu); + device_create_file(omap_dsp->dev, &dev_attr_exmap); + device_create_file(omap_dsp->dev, &dev_attr_mempool); return 0; @@ -2519,10 +2519,10 @@ fail: void dsp_mem_exit(void) { - free_irq(dsp_mmu_irq, &devid_mmu); + free_irq(omap_dsp->mmu_irq, &devid_mmu); /* recover disable_depth */ - enable_irq(dsp_mmu_irq); + enable_irq(omap_dsp->mmu_irq); #ifdef CONFIG_ARCH_OMAP1 dsp_reset_idle_boot_base(); @@ -2535,7 +2535,7 @@ void dsp_mem_exit(void) dspvect_page = NULL; } - device_remove_file(dsp_device, &dev_attr_mmu); - device_remove_file(dsp_device, &dev_attr_exmap); - device_remove_file(dsp_device, &dev_attr_mempool); + device_remove_file(omap_dsp->dev, &dev_attr_mmu); + device_remove_file(omap_dsp->dev, &dev_attr_exmap); + device_remove_file(omap_dsp->dev, &dev_attr_mempool); } diff --git a/arch/arm/plat-omap/dsp/error.c b/arch/arm/plat-omap/dsp/error.c index 4720e93ce16..dc831ce342c 100644 --- a/arch/arm/plat-omap/dsp/error.c +++ b/arch/arm/plat-omap/dsp/error.c @@ -105,13 +105,13 @@ struct file_operations dsp_err_fops = { /* DSP MMU */ static void dsp_err_mmu_set(unsigned long arg) { - disable_irq(dsp_mmu_irq); + disable_irq(omap_dsp->mmu_irq); mmu_fadr = (u32)arg; } static void dsp_err_mmu_clr(void) { - enable_irq(dsp_mmu_irq); + enable_irq(omap_dsp->mmu_irq); } /* WDT */ diff --git a/arch/arm/plat-omap/dsp/ipbuf.c b/arch/arm/plat-omap/dsp/ipbuf.c index cdffc2f4bb4..547d085721e 100644 --- a/arch/arm/plat-omap/dsp/ipbuf.c +++ b/arch/arm/plat-omap/dsp/ipbuf.c @@ -42,7 +42,7 @@ void ipbuf_stop(void) { int i; - device_remove_file(dsp_device, &dev_attr_ipbuf); + device_remove_file(omap_dsp->dev, &dev_attr_ipbuf); spin_lock(&ipb_free.lock); RESET_IPBLINK(&ipb_free); @@ -116,7 +116,7 @@ int ipbuf_config(u16 ln, u16 lsz, void *base) " %d words * %d lines at 0x%p.\n", ipbcfg.lsz, ipbcfg.ln, ipbcfg.base); - device_create_file(dsp_device, &dev_attr_ipbuf); + device_create_file(omap_dsp->dev, &dev_attr_ipbuf); return ret; diff --git a/arch/arm/plat-omap/dsp/ipbuf.h b/arch/arm/plat-omap/dsp/ipbuf.h index 3ceaa3c4d19..efaa2b74bbd 100644 --- a/arch/arm/plat-omap/dsp/ipbuf.h +++ b/arch/arm/plat-omap/dsp/ipbuf.h @@ -61,18 +61,18 @@ struct ipbuf_head { extern struct ipbcfg ipbcfg; extern struct ipbuf_sys *ipbuf_sys_da, *ipbuf_sys_ad; -#define ipb_bsycnt_inc(ipbcfg) \ - do { \ - disable_mbox_irq(mbox_dsp); \ - (ipbcfg)->bsycnt++; \ - enable_mbox_irq(mbox_dsp); \ +#define ipb_bsycnt_inc(ipbcfg) \ + do { \ + disable_irq(omap_dsp->mbox->irq); \ + (ipbcfg)->bsycnt++; \ + enable_irq(omap_dsp->mbox->irq); \ } while(0) -#define ipb_bsycnt_dec(ipbcfg) \ - do { \ - disable_mbox_irq(mbox_dsp); \ - (ipbcfg)->bsycnt--; \ - enable_mbox_irq(mbox_dsp); \ +#define ipb_bsycnt_dec(ipbcfg) \ + do { \ + disable_irq(omap_dsp->mbox->irq); \ + (ipbcfg)->bsycnt--; \ + enable_irq(omap_dsp->mbox->irq); \ } while(0) #define dsp_mem_enable_ipbuf() dsp_mem_enable(ipbcfg.base) @@ -84,7 +84,7 @@ struct ipblink { u16 tail; }; -#define IPBLINK_INIT { \ +#define IPBLINK_INIT { \ .lock = SPIN_LOCK_UNLOCKED, \ .top = BID_NULL, \ .tail = BID_NULL, \ diff --git a/arch/arm/plat-omap/dsp/mblog.c b/arch/arm/plat-omap/dsp/mblog.c index aa68d6b0230..e2fb9c3afbf 100644 --- a/arch/arm/plat-omap/dsp/mblog.c +++ b/arch/arm/plat-omap/dsp/mblog.c @@ -47,6 +47,7 @@ char *subcmd_name(struct mbcmd *mb) break; case MBOX_CMD_DSP_KFUNC: s = (cmd_l == KFUNC_FBCTL) ? "FBCTL": + (cmd_l == KFUNC_POWER) ? "POWER": NULL; break; case MBOX_CMD_DSP_DSPCFG: @@ -259,10 +260,10 @@ static struct device_attribute dev_attr_mblog = __ATTR_RO(mblog); void __init mblog_init(void) { - device_create_file(dsp_device, &dev_attr_mblog); + device_create_file(omap_dsp->dev, &dev_attr_mblog); } void mblog_exit(void) { - device_remove_file(dsp_device, &dev_attr_mblog); + device_remove_file(omap_dsp->dev, &dev_attr_mblog); } diff --git a/arch/arm/plat-omap/dsp/task.c b/arch/arm/plat-omap/dsp/task.c index 78b8064950d..18d0e417535 100644 --- a/arch/arm/plat-omap/dsp/task.c +++ b/arch/arm/plat-omap/dsp/task.c @@ -1811,7 +1811,7 @@ static int taskdev_init(struct taskdev *dev, char *name, unsigned char minor) mutex_init(&dev->usecount_lock); memcpy(&dev->fops, &dsp_task_fops, sizeof(struct file_operations)); - dev->dev.parent = dsp_device; + dev->dev.parent = omap_dsp->dev; dev->dev.bus = &dsptask_bus; sprintf(dev->dev.bus_id, "dsptask%d", minor); dev->dev.release = dsptask_dev_release; diff --git a/include/asm-arm/arch-omap/dsp_common.h b/include/asm-arm/arch-omap/dsp_common.h index c244d0a0411..c61f868f24e 100644 --- a/include/asm-arm/arch-omap/dsp_common.h +++ b/include/asm-arm/arch-omap/dsp_common.h @@ -31,7 +31,4 @@ extern int omap_dsp_request_mem(void); extern int omap_dsp_release_mem(void); #endif -extern void (*omap_dsp_audio_pwr_up_request)(int stage); -extern void (*omap_dsp_audio_pwr_down_request)(int stage); - #endif /* ASM_ARCH_DSP_COMMON_H */ -- 2.41.0