diff options
author | Prashant Gaikwad <pgaikwad@nvidia.com> | 2012-09-21 18:09:41 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-09-24 12:44:44 -0700 |
commit | 7854b13be0f153a94d280fe2c2275dde9ebc4024 (patch) | |
tree | f37608e8fb0394305f3492189908b4be106b8d62 /drivers/media | |
parent | 2dd68ce4502d70284b3d2256bb9b278b9eb1bbfb (diff) |
media: video: nvavp: Add option to boost sclk
Audio is glitch is observed if sclk is set to minimun and
display is on. As early suspend functionality is removed,
we need to update the display status using sysfs.
Add sysfs to boost sclk from user space when display is
turned on.
bug 1039961
Change-Id: Ib918b1bae7cdff7d3ea665b4bcf8c5879df50982
Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-on: http://git-master/r/134394
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Wen Yi <wyi@nvidia.com>
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Shridhar Rasal <srasal@nvidia.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/tegra/nvavp/nvavp_dev.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/video/tegra/nvavp/nvavp_dev.c b/drivers/media/video/tegra/nvavp/nvavp_dev.c index 78e7b0a0b2bb..a2db3b27c4cc 100644 --- a/drivers/media/video/tegra/nvavp/nvavp_dev.c +++ b/drivers/media/video/tegra/nvavp/nvavp_dev.c @@ -86,6 +86,9 @@ #define IS_VIDEO_CHANNEL_ID(channel_id) (channel_id == NVAVP_VIDEO_CHANNEL ? 1: 0) +#define SCLK_BOOST_RATE 40000000 + +static bool boost_sclk; struct nvavp_channel { struct mutex pushbuffer_lock; @@ -1473,6 +1476,34 @@ static const struct file_operations tegra_audio_nvavp_fops = { }; #endif +static ssize_t boost_sclk_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", boost_sclk); +} + +static ssize_t boost_sclk_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct nvhost_device *ndev = to_nvhost_device(dev); + struct nvavp_info *nvavp = nvhost_get_drvdata(ndev); + unsigned long val = 0; + + if (kstrtoul(buf, 10, &val) < 0) + return -EINVAL; + + if (val) + clk_set_rate(nvavp->sclk, SCLK_BOOST_RATE); + else if (!val) + clk_set_rate(nvavp->sclk, 0); + + boost_sclk = val; + + return count; +} + +DEVICE_ATTR(boost_sclk, S_IRUGO|S_IWUSR, boost_sclk_show, boost_sclk_store); + static int tegra_nvavp_probe(struct nvhost_device *ndev, struct nvhost_device_id *id_table) { @@ -1682,6 +1713,8 @@ static int tegra_nvavp_probe(struct nvhost_device *ndev, nvhost_set_drvdata(ndev, nvavp); nvavp->nvhost_dev = ndev; + device_create_file(&ndev->dev, &dev_attr_boost_sclk); + return 0; err_req_irq_pend: @@ -1741,6 +1774,8 @@ static int tegra_nvavp_remove(struct nvhost_device *ndev) nvavp_unload_ucode(nvavp); nvavp_unload_os(nvavp); + device_remove_file(&ndev->dev, &dev_attr_boost_sclk); + misc_deregister(&nvavp->video_misc_dev); #if defined(CONFIG_TEGRA_NVAVP_AUDIO) |