diff options
author | Sumit Bhattacharya <sumitb@nvidia.com> | 2014-02-19 17:00:57 +0530 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2014-03-03 21:07:11 -0800 |
commit | 21b69b9d71409fbe8272e4d94bb1a06ee45776b8 (patch) | |
tree | 24379f0c3782467858a1fda10a308194f952a0c5 /drivers | |
parent | 9ce69254884fb96175b2a2a4fb32880476bfd888 (diff) |
media: tegra: nvavp: Export audio clock apis
Export nvavp_enable_audio_clocks and nvavp_disable_audio_clocks apis
so that kernel side audio driver can call these apis directly. Also
change the protorype of this functions to facilitate calling from
audio kernel driver. This is needed to support kernel based audio
offload support.
Bug 1399922
Change-Id: I92f738f244cd47848e73db63544301b02b52c74a
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/369287
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/platform/tegra/nvavp/nvavp_dev.c | 66 | ||||
-rw-r--r-- | drivers/media/platform/tegra/nvavp/nvavp_os.h | 2 |
2 files changed, 38 insertions, 30 deletions
diff --git a/drivers/media/platform/tegra/nvavp/nvavp_dev.c b/drivers/media/platform/tegra/nvavp/nvavp_dev.c index 1ed07fbc0310..af86c74f124a 100644 --- a/drivers/media/platform/tegra/nvavp/nvavp_dev.c +++ b/drivers/media/platform/tegra/nvavp/nvavp_dev.c @@ -1721,59 +1721,53 @@ static int nvavp_force_clock_stay_on_ioctl(struct file *filp, unsigned int cmd, } #if defined(CONFIG_TEGRA_NVAVP_AUDIO) -static int nvavp_enable_audio_clocks(struct file *filp, unsigned int cmd, - unsigned long arg) +int nvavp_enable_audio_clocks(nvavp_clientctx_t client, u32 clk_id) { - struct nvavp_clientctx *clientctx = filp->private_data; + struct nvavp_clientctx *clientctx = client; struct nvavp_info *nvavp = clientctx->nvavp; - struct nvavp_clock_args config; - - if (copy_from_user(&config, (void __user *)arg, sizeof(struct nvavp_clock_args))) - return -EFAULT; - dev_dbg(&nvavp->nvhost_dev->dev, "%s: clk_id=%d\n", - __func__, config.id); + dev_dbg(&nvavp->nvhost_dev->dev, "%s: clk_id = %d\n", + __func__, clk_id); - if (config.id == NVAVP_MODULE_ID_VCP) + mutex_lock(&nvavp->open_lock); + if (clk_id == NVAVP_MODULE_ID_VCP) clk_prepare_enable(nvavp->vcp_clk); - else if (config.id == NVAVP_MODULE_ID_BSEA) + else if (clk_id == NVAVP_MODULE_ID_BSEA) clk_prepare_enable(nvavp->bsea_clk); - + mutex_unlock(&nvavp->open_lock); return 0; } +EXPORT_SYMBOL_GPL(nvavp_enable_audio_clocks); -static int nvavp_disable_audio_clocks(struct file *filp, unsigned int cmd, - unsigned long arg) +int nvavp_disable_audio_clocks(nvavp_clientctx_t client, u32 clk_id) { - struct nvavp_clientctx *clientctx = filp->private_data; + struct nvavp_clientctx *clientctx = client; struct nvavp_info *nvavp = clientctx->nvavp; - struct nvavp_clock_args config; - if (copy_from_user(&config, (void __user *)arg, sizeof(struct nvavp_clock_args))) - return -EFAULT; + dev_dbg(&nvavp->nvhost_dev->dev, "%s: clk_id = %d\n", + __func__, clk_id); - dev_dbg(&nvavp->nvhost_dev->dev, "%s: clk_id=%d\n", - __func__, config.id); - - if (config.id == NVAVP_MODULE_ID_VCP) + mutex_lock(&nvavp->open_lock); + if (clk_id == NVAVP_MODULE_ID_VCP) clk_disable_unprepare(nvavp->vcp_clk); - else if (config.id == NVAVP_MODULE_ID_BSEA) + else if (clk_id == NVAVP_MODULE_ID_BSEA) clk_disable_unprepare(nvavp->bsea_clk); - + mutex_unlock(&nvavp->open_lock); return 0; } +EXPORT_SYMBOL_GPL(nvavp_disable_audio_clocks); #else -static int nvavp_enable_audio_clocks(struct file *filp, unsigned int cmd, - unsigned long arg) +int nvavp_enable_audio_clocks(nvavp_clientctx_t client, u32 clk_id) { return 0; } +EXPORT_SYMBOL_GPL(nvavp_enable_audio_clocks); -static int nvavp_disable_audio_clocks(struct file *filp, unsigned int cmd, - unsigned long arg) +int nvavp_disable_audio_clocks(nvavp_clientctx_t client, u32_clk_id) { return 0; } +EXPORT_SYMBOL_GPL(nvavp_disable_audio_clocks); #endif static int nvavp_set_min_online_cpus_ioctl(struct file *filp, unsigned int cmd, @@ -2015,6 +2009,8 @@ nvavp_channel_open(struct file *filp, struct nvavp_channel_open_args *arg) static long tegra_nvavp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { + struct nvavp_clientctx *clientctx = filp->private_data; + struct nvavp_clock_args config; int ret = 0; u8 buf[NVAVP_IOCTL_CHANNEL_MAX_ARG_SIZE]; @@ -2045,10 +2041,20 @@ static long tegra_nvavp_ioctl(struct file *filp, unsigned int cmd, ret = nvavp_force_clock_stay_on_ioctl(filp, cmd, arg); break; case NVAVP_IOCTL_ENABLE_AUDIO_CLOCKS: - ret = nvavp_enable_audio_clocks(filp, cmd, arg); + if (copy_from_user(&config, (void __user *)arg, + sizeof(struct nvavp_clock_args))) { + ret = -EFAULT; + break; + } + ret = nvavp_enable_audio_clocks(clientctx, config.id); break; case NVAVP_IOCTL_DISABLE_AUDIO_CLOCKS: - ret = nvavp_disable_audio_clocks(filp, cmd, arg); + if (copy_from_user(&config, (void __user *)arg, + sizeof(struct nvavp_clock_args))) { + ret = -EFAULT; + break; + } + ret = nvavp_disable_audio_clocks(clientctx, config.id); break; case NVAVP_IOCTL_SET_MIN_ONLINE_CPUS: ret = nvavp_set_min_online_cpus_ioctl(filp, cmd, arg); diff --git a/drivers/media/platform/tegra/nvavp/nvavp_os.h b/drivers/media/platform/tegra/nvavp/nvavp_os.h index 0c807a82aac3..1e9c1b2d099b 100644 --- a/drivers/media/platform/tegra/nvavp/nvavp_os.h +++ b/drivers/media/platform/tegra/nvavp/nvavp_os.h @@ -104,5 +104,7 @@ typedef void *nvavp_clientctx_t; int tegra_nvavp_audio_client_open(nvavp_clientctx_t *clientctx); int tegra_nvavp_audio_client_release(nvavp_clientctx_t clientctx); +int nvavp_enable_audio_clocks(nvavp_clientctx_t client, u32 clk_id); +int nvavp_disable_audio_clocks(nvavp_clientctx_t client, u32 clk_id); #endif /* __MEDIA_VIDEO_TEGRA_NVAVP_OS_H */ |