From 40477b44d12e3bc6c2af13b24dfeaf2ea43762ac Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 29 May 2012 18:30:16 +0300 Subject: video: tegra: host: Fix error case memory leaks When a submit fails, the related nvhost_job is not freed. Add an explicit free. Also, 3D is mapping the save buffer, but it is not unmapped. Bug 991972 Change-Id: Ie335adb5e64f54557e76d12dfb6a9a1557781e8d Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/105152 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen --- drivers/video/tegra/host/bus_client.c | 5 +++++ drivers/video/tegra/host/gr3d/gr3d_t30.c | 2 ++ 2 files changed, 7 insertions(+) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c index 87aa9c64d363..12e0a043aec8 100644 --- a/drivers/video/tegra/host/bus_client.c +++ b/drivers/video/tegra/host/bus_client.c @@ -182,6 +182,11 @@ static void reset_submit(struct nvhost_channel_userctx *ctx) ctx->hdr.num_relocs = 0; ctx->num_relocshifts = 0; ctx->hdr.num_waitchks = 0; + + if (ctx->job) { + nvhost_job_put(ctx->job); + ctx->job = NULL; + } } static ssize_t nvhost_channelwrite(struct file *filp, const char __user *buf, diff --git a/drivers/video/tegra/host/gr3d/gr3d_t30.c b/drivers/video/tegra/host/gr3d/gr3d_t30.c index 57f4c779eff8..4bc7c9f92bb5 100644 --- a/drivers/video/tegra/host/gr3d/gr3d_t30.c +++ b/drivers/video/tegra/host/gr3d/gr3d_t30.c @@ -427,6 +427,8 @@ struct nvhost_hwctx_handler *nvhost_gr3d_t30_ctxhandler_init( setup_save(p, save_ptr); + nvmap_munmap(p->save_buf, save_ptr); + p->h.alloc = ctx3d_alloc_v1; p->h.save_push = save_push_v1; p->h.save_service = NULL; -- cgit v1.2.3 From 7051a98f335b7326cab052eed93c11bfcacf5d24 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 29 May 2012 07:51:49 +0300 Subject: video: tegra: host: Use correct units in default timeout Convert the jiffies to msecs when assigning a channel the default timeout. Change-Id: If9b6fb7c695e9621a0c50d99d4d1362b6dd214b6 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/105022 Reviewed-by: Rohan Somvanshi Tested-by: Rohan Somvanshi --- drivers/video/tegra/host/bus_client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c index 12e0a043aec8..962de32f359f 100644 --- a/drivers/video/tegra/host/bus_client.c +++ b/drivers/video/tegra/host/bus_client.c @@ -140,7 +140,9 @@ static int nvhost_channelopen(struct inode *inode, struct file *filp) priv->priority = NVHOST_PRIORITY_MEDIUM; priv->clientid = atomic_add_return(1, &nvhost_get_host(ch->dev)->clientid); - priv->timeout = MAX_STUCK_CHECK_COUNT * SYNCPT_CHECK_PERIOD; + priv->timeout = + jiffies_to_msecs(MAX_STUCK_CHECK_COUNT * SYNCPT_CHECK_PERIOD); + return 0; fail: nvhost_channelrelease(inode, filp); -- cgit v1.2.3 From 0c7e4570597660ebd56ef97d06a2c1c8b9caaf79 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 28 May 2012 15:49:54 +0300 Subject: video: tegra: host: Remove nvhost dsi driver Remove nvhost dsi driver. Real dsi driver is in tegradc. Bug 982965 Change-Id: I86044ba586d796ae8d049471a154dcf37bd0e6ed Reviewed-on: http://git-master/r/104975 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen --- drivers/video/tegra/host/Makefile | 1 - drivers/video/tegra/host/dsi/Makefile | 7 --- drivers/video/tegra/host/dsi/dsi.c | 83 ----------------------------------- 3 files changed, 91 deletions(-) delete mode 100644 drivers/video/tegra/host/dsi/Makefile delete mode 100644 drivers/video/tegra/host/dsi/dsi.c (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/host/Makefile b/drivers/video/tegra/host/Makefile index d47c97571286..f228a3ad0396 100644 --- a/drivers/video/tegra/host/Makefile +++ b/drivers/video/tegra/host/Makefile @@ -17,7 +17,6 @@ obj-$(CONFIG_TEGRA_GRHOST) += gr3d/ obj-$(CONFIG_TEGRA_GRHOST) += host1x/ obj-$(CONFIG_TEGRA_GRHOST) += t20/ obj-$(CONFIG_TEGRA_GRHOST) += t30/ -obj-$(CONFIG_TEGRA_GRHOST) += dsi/ obj-$(CONFIG_TEGRA_GRHOST) += gr2d/ obj-$(CONFIG_TEGRA_GRHOST) += isp/ obj-$(CONFIG_TEGRA_GRHOST) += vi/ diff --git a/drivers/video/tegra/host/dsi/Makefile b/drivers/video/tegra/host/dsi/Makefile deleted file mode 100644 index eb94d3ec4928..000000000000 --- a/drivers/video/tegra/host/dsi/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -GCOV_PROFILE := y -EXTRA_CFLAGS += -Idrivers/video/tegra/host - -nvhost-dsi-objs = \ - dsi.o - -obj-$(CONFIG_TEGRA_GRHOST) += nvhost-dsi.o diff --git a/drivers/video/tegra/host/dsi/dsi.c b/drivers/video/tegra/host/dsi/dsi.c deleted file mode 100644 index 87da8a6f1b8a..000000000000 --- a/drivers/video/tegra/host/dsi/dsi.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * drivers/video/tegra/host/dsi/dsi.c - * - * Tegra Graphics DSI - * - * Copyright (c) 2012, NVIDIA Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "dev.h" -#include "bus_client.h" - -static int dsi_probe(struct nvhost_device *dev, - struct nvhost_device_id *id_table) -{ - return nvhost_client_device_init(dev); -} - -static int __exit dsi_remove(struct nvhost_device *dev) -{ - /* Add clean-up */ - return 0; -} - -static int dsi_suspend(struct nvhost_device *dev, pm_message_t state) -{ - return nvhost_client_device_suspend(dev); -} - -static int dsi_resume(struct nvhost_device *dev) -{ - dev_info(&dev->dev, "resuming\n"); - return 0; -} - -struct nvhost_device *dsi_device; - -static struct nvhost_driver dsi_driver = { - .probe = dsi_probe, - .remove = __exit_p(dsi_remove), -#ifdef CONFIG_PM - .suspend = dsi_suspend, - .resume = dsi_resume, -#endif - .driver = { - .owner = THIS_MODULE, - .name = "dsi", - } -}; - -static int __init dsi_init(void) -{ - int err; - - dsi_device = nvhost_get_device("dsi"); - if (!dsi_device) - return -ENXIO; - - err = nvhost_device_register(dsi_device); - if (err) - return err; - - return nvhost_driver_register(&dsi_driver); -} - -static void __exit dsi_exit(void) -{ - nvhost_driver_unregister(&dsi_driver); -} - -module_init(dsi_init); -module_exit(dsi_exit); -- cgit v1.2.3 From eeb69dd3be1f25f0b51f72bf83564b5016ae3114 Mon Sep 17 00:00:00 2001 From: Krishna Reddy Date: Wed, 23 May 2012 16:00:07 -0700 Subject: video: tegra: Config option for cache maint by set/ways. Add config option to enable/disable cache maintenance by set/ways. Change-Id: Ie795e19650b2c05cd4789dbc1e8f04f9edc70bf1 Signed-off-by: Krishna Reddy Reviewed-on: http://git-master/r/104290 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Kaz Fukuoka Reviewed-by: Bo Yan --- drivers/video/tegra/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/Kconfig b/drivers/video/tegra/Kconfig index 59e27788680d..15c2acfa8cc7 100644 --- a/drivers/video/tegra/Kconfig +++ b/drivers/video/tegra/Kconfig @@ -102,6 +102,15 @@ config NVMAP_PAGE_POOL_SIZE hex default 0x0 +config NVMAP_CACHE_MAINT_BY_SET_WAYS + bool "Enalbe cache maintenance by set/ways" + depends on TEGRA_NVMAP + help + Say Y here to reduce cache maintenance overhead by MVA. + This helps in reducing cache maintenance overhead in the systems, + where inner cache includes only L1. For the systems, where inner cache + includes L1 and L2, keep this option disabled. + config NVMAP_VPR bool "Enable VPR Heap." depends on TEGRA_NVMAP -- cgit v1.2.3 From fdf40891983fc3fe1942877dcb07a4eab25f1796 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 31 May 2012 08:15:28 +0300 Subject: video: tegra: host: Restrict register access Register access (read/write) to modules MPE, ISP and VI lack sanity check for the register number. Add checks to ensure only aperture is accessed. Also make sure that the check accounts for wrapping of values of offset and count. Also fixes the register offset for reads which are done in multiple blocks. Bug 992938 Change-Id: I35f30cbd1dda31956286e48c5995b24fd262d1ae Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/105585 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/host/bus_client.c | 32 ++++++++++++++++++++++++++++++-- drivers/video/tegra/host/bus_client.h | 4 ++-- drivers/video/tegra/host/dev.c | 11 ++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c index 962de32f359f..651a8dec738c 100644 --- a/drivers/video/tegra/host/bus_client.c +++ b/drivers/video/tegra/host/bus_client.c @@ -50,10 +50,28 @@ #include "nvhost_job.h" #include "nvhost_hwctx.h" -void nvhost_read_module_regs(struct nvhost_device *ndev, +static int validate_reg(struct nvhost_device *ndev, u32 offset, int count) +{ + struct resource *r = nvhost_get_resource(ndev, IORESOURCE_MEM, 0); + int err = 0; + + if (offset + 4 * count > resource_size(r) + || (offset + 4 * count < offset)) + err = -EPERM; + + return err; +} + +int nvhost_read_module_regs(struct nvhost_device *ndev, u32 offset, int count, u32 *values) { void __iomem *p = ndev->aperture + offset; + int err; + + /* verify offset */ + err = validate_reg(ndev, offset, count); + if (err) + return err; nvhost_module_busy(ndev); while (count--) { @@ -62,12 +80,20 @@ void nvhost_read_module_regs(struct nvhost_device *ndev, } rmb(); nvhost_module_idle(ndev); + + return 0; } -void nvhost_write_module_regs(struct nvhost_device *ndev, +int nvhost_write_module_regs(struct nvhost_device *ndev, u32 offset, int count, const u32 *values) { void __iomem *p = ndev->aperture + offset; + int err; + + /* verify offset */ + err = validate_reg(ndev, offset, count); + if (err) + return err; nvhost_module_busy(ndev); while (count--) { @@ -76,6 +102,8 @@ void nvhost_write_module_regs(struct nvhost_device *ndev, } wmb(); nvhost_module_idle(ndev); + + return 0; } struct nvhost_channel_userctx { diff --git a/drivers/video/tegra/host/bus_client.h b/drivers/video/tegra/host/bus_client.h index adc3a704ea5d..e95ea0bc3401 100644 --- a/drivers/video/tegra/host/bus_client.h +++ b/drivers/video/tegra/host/bus_client.h @@ -24,10 +24,10 @@ #include struct nvhost_device; -void nvhost_read_module_regs(struct nvhost_device *ndev, +int nvhost_read_module_regs(struct nvhost_device *ndev, u32 offset, int count, u32 *values); -void nvhost_write_module_regs(struct nvhost_device *ndev, +int nvhost_write_module_regs(struct nvhost_device *ndev, u32 offset, int count, const u32 *values); int nvhost_client_user_init(struct nvhost_device *dev); diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c index ca73528fbeeb..67520a884d3e 100644 --- a/drivers/video/tegra/host/dev.c +++ b/drivers/video/tegra/host/dev.c @@ -205,6 +205,7 @@ static int nvhost_ioctl_ctrl_module_regrdwr(struct nvhost_ctrl_userctx *ctx, return -EINVAL; while (num_offsets--) { + int err; int remaining = args->block_size >> 2; u32 offs; if (get_user(offs, offsets)) @@ -216,17 +217,21 @@ static int nvhost_ioctl_ctrl_module_regrdwr(struct nvhost_ctrl_userctx *ctx, if (copy_from_user(vals, values, batch*sizeof(u32))) return -EFAULT; - nvhost_write_module_regs(ndev, + err = nvhost_write_module_regs(ndev, offs, batch, vals); + if (err) + return err; } else { - nvhost_read_module_regs(ndev, + err = nvhost_read_module_regs(ndev, offs, batch, vals); + if (err) + return err; if (copy_to_user(values, vals, batch*sizeof(u32))) return -EFAULT; } remaining -= batch; - offs += batch; + offs += batch*sizeof(u32); values += batch; } } -- cgit v1.2.3 From aa52019b1b10988afaf210abbf321d41b7803804 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 1 Jun 2012 11:09:36 +0300 Subject: video: tegra: host: Remove error case panics Remove BUG_ON()s in error cases: * If IOCTL size is too large, return error instead * If sync point id is out of range, return error. Prevents panics in sanity checks nvhost_cdma. Bug 993642 Change-Id: I3cfa7a23dc557c811e20b726885f82666437de7f Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/105866 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Juha Tukkinen --- drivers/video/tegra/host/bus_client.c | 14 ++++++++------ drivers/video/tegra/host/dev.c | 5 ++--- drivers/video/tegra/host/nvhost_acm.c | 12 ++++++++++-- drivers/video/tegra/host/nvhost_syncpt.h | 5 +++++ 4 files changed, 25 insertions(+), 11 deletions(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c index 651a8dec738c..6bfce9a3cb2a 100644 --- a/drivers/video/tegra/host/bus_client.c +++ b/drivers/video/tegra/host/bus_client.c @@ -179,14 +179,17 @@ fail: static int set_submit(struct nvhost_channel_userctx *ctx) { - struct device *device = &ctx->ch->dev->dev; + struct nvhost_device *ndev = ctx->ch->dev; + struct nvhost_master *host = nvhost_get_host(ndev); /* submit should have at least 1 cmdbuf */ - if (!ctx->hdr.num_cmdbufs) + if (!ctx->hdr.num_cmdbufs || + !nvhost_syncpt_is_valid(&host->syncpt, + ctx->hdr.syncpt_id)) return -EIO; if (!ctx->nvmap) { - dev_err(device, "no nvmap context set\n"); + dev_err(&ndev->dev, "no nvmap context set\n"); return -EFAULT; } @@ -402,11 +405,10 @@ static long nvhost_channelctl(struct file *filp, if ((_IOC_TYPE(cmd) != NVHOST_IOCTL_MAGIC) || (_IOC_NR(cmd) == 0) || - (_IOC_NR(cmd) > NVHOST_IOCTL_CHANNEL_LAST)) + (_IOC_NR(cmd) > NVHOST_IOCTL_CHANNEL_LAST) || + (_IOC_SIZE(cmd) > NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE)) return -EFAULT; - BUG_ON(_IOC_SIZE(cmd) > NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE); - if (_IOC_DIR(cmd) & _IOC_WRITE) { if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) return -EFAULT; diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c index 67520a884d3e..2c05fbfb7477 100644 --- a/drivers/video/tegra/host/dev.c +++ b/drivers/video/tegra/host/dev.c @@ -255,11 +255,10 @@ static long nvhost_ctrlctl(struct file *filp, if ((_IOC_TYPE(cmd) != NVHOST_IOCTL_MAGIC) || (_IOC_NR(cmd) == 0) || - (_IOC_NR(cmd) > NVHOST_IOCTL_CTRL_LAST)) + (_IOC_NR(cmd) > NVHOST_IOCTL_CTRL_LAST) || + (_IOC_SIZE(cmd) > NVHOST_IOCTL_CTRL_MAX_ARG_SIZE)) return -EFAULT; - BUG_ON(_IOC_SIZE(cmd) > NVHOST_IOCTL_CTRL_MAX_ARG_SIZE); - if (_IOC_DIR(cmd) & _IOC_WRITE) { if (copy_from_user(buf, (void __user *)arg, _IOC_SIZE(cmd))) return -EFAULT; diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c index 6d96bd023d81..dfd84328307b 100644 --- a/drivers/video/tegra/host/nvhost_acm.c +++ b/drivers/video/tegra/host/nvhost_acm.c @@ -134,7 +134,11 @@ static void to_state_running_locked(struct nvhost_device *dev) for (i = 0; i < dev->num_clks; i++) { int err = clk_enable(dev->clk[i]); - BUG_ON(err); + if (err) { + dev_err(&dev->dev, "Cannot turn on clock %s", + dev->clocks[i].name); + return; + } } if (prev_state == NVHOST_POWER_STATE_POWERGATED @@ -369,7 +373,11 @@ int nvhost_module_init(struct nvhost_device *dev) snprintf(devname, MAX_DEVID_LENGTH, "tegra_%s", dev->name); c = clk_get_sys(devname, dev->clocks[i].name); - BUG_ON(IS_ERR_OR_NULL(c)); + if (IS_ERR_OR_NULL(c)) { + dev_err(&dev->dev, "Cannot get clock %s\n", + dev->clocks[i].name); + continue; + } rate = clk_round_rate(c, rate); clk_enable(c); diff --git a/drivers/video/tegra/host/nvhost_syncpt.h b/drivers/video/tegra/host/nvhost_syncpt.h index b58921bffa9c..fcc9fce72071 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.h +++ b/drivers/video/tegra/host/nvhost_syncpt.h @@ -140,6 +140,11 @@ int nvhost_syncpt_patch_wait(struct nvhost_syncpt *sp, void *patch_addr); void nvhost_syncpt_debug(struct nvhost_syncpt *sp); +static inline int nvhost_syncpt_is_valid(struct nvhost_syncpt *sp, u32 id) +{ + return id != NVSYNCPT_INVALID && id < sp->nb_pts; +} + int nvhost_mutex_try_lock(struct nvhost_syncpt *sp, int idx); void nvhost_mutex_unlock(struct nvhost_syncpt *sp, int idx); -- cgit v1.2.3 From ceb59f7bb086357c057771331b8f6f60fa498b0c Mon Sep 17 00:00:00 2001 From: Krishna Reddy Date: Wed, 23 May 2012 16:10:32 -0700 Subject: video: tegra: nvmap: Use config option NVMAP_CACHE_MAINT_BY_SET_WAYS Change-Id: I762929a0d72a0b26aa1451a946993f4a57806fd4 Signed-off-by: Krishna Reddy Reviewed-on: http://git-master/r/104292 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Kaz Fukuoka Reviewed-by: Bo Yan Reviewed-by: Hiro Sugawara GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/nvmap/nvmap_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c index 14787154523f..7a10231982c1 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.c +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c @@ -540,6 +540,7 @@ static bool fast_cache_maint(struct nvmap_client *client, struct nvmap_handle *h { int ret = false; +#if defined(CONFIG_NVMAP_CACHE_MAINT_BY_SET_WAYS) if ((op == NVMAP_CACHE_OP_INV) || ((end - start) < FLUSH_CLEAN_BY_SET_WAY_THRESHOLD)) goto out; @@ -559,6 +560,7 @@ static bool fast_cache_maint(struct nvmap_client *client, struct nvmap_handle *h } ret = true; out: +#endif return ret; } -- cgit v1.2.3 From 6265d503687da50baefd1b8364abd7194a5826e8 Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Wed, 30 May 2012 18:03:39 -0700 Subject: video: tegra: nvsd: Fix Phase In Issue with Aggressiveness Change to correct behavior for changing settings while phase_in_adjustments is set. Manual K values should not be overridden in the case where DIDIM was on and aggressiveness was changed. They should maintain state to avoid flickering. Bug 992995 Change-Id: Ic35c32a0fd5c6caaeee147dff114649ea25770c5 Signed-off-by: Matt Wagner Reviewed-on: http://git-master/r/105523 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Jon Mayo --- drivers/video/tegra/dc/nvsd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/dc/nvsd.c b/drivers/video/tegra/dc/nvsd.c index 65d518759243..860dd8dab1fd 100644 --- a/drivers/video/tegra/dc/nvsd.c +++ b/drivers/video/tegra/dc/nvsd.c @@ -378,7 +378,10 @@ void nvsd_init(struct tegra_dc *dc, struct tegra_dc_sd_settings *settings) val = tegra_dc_readl(dc, DC_DISP_SD_CONTROL); if (val & SD_ENABLE_NORMAL) - i = tegra_dc_readl(dc, DC_DISP_SD_HW_K_VALUES); + if (settings->phase_in_adjustments) + i = tegra_dc_readl(dc, DC_DISP_SD_MAN_K_VALUES); + else + i = tegra_dc_readl(dc, DC_DISP_SD_HW_K_VALUES); else i = 0; /* 0 values for RGB = 1.0, i.e. non-affected */ -- cgit v1.2.3 From de263f6e253976d8371da7e7b7089f1d9b79e92b Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Thu, 31 May 2012 16:55:15 -0700 Subject: video: tegra: dc: Export dispay feature table. Bug 992947 Change-Id: I0d1ecc9f8f042956cbe631779260a38573936616 Signed-off-by: Kevin Huang Reviewed-on: http://git-master/r/105776 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Jon Mayo --- drivers/video/tegra/dc/dc_config.h | 6 +++--- drivers/video/tegra/dc/ext/dev.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/dc/dc_config.h b/drivers/video/tegra/dc/dc_config.h index f513cd06dc45..314cd11e77f9 100644 --- a/drivers/video/tegra/dc/dc_config.h +++ b/drivers/video/tegra/dc/dc_config.h @@ -129,13 +129,13 @@ enum tegra_dc_feature_option { }; struct tegra_dc_feature_entry { - int window_index; - enum tegra_dc_feature_option option; + u32 window_index; + u32 option; long arg[ENTRY_SIZE]; }; struct tegra_dc_feature { - unsigned num_entries; + u32 num_entries; struct tegra_dc_feature_entry *entries; }; diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c index c349a4720d2e..a8de7a7a26e0 100644 --- a/drivers/video/tegra/dc/ext/dev.c +++ b/drivers/video/tegra/dc/ext/dev.c @@ -708,6 +708,21 @@ static int tegra_dc_ext_get_status(struct tegra_dc_ext_user *user, return 0; } +static int tegra_dc_ext_get_feature(struct tegra_dc_ext_user *user, + struct tegra_dc_ext_feature *feature) +{ + struct tegra_dc *dc = user->ext->dc; + struct tegra_dc_feature *table = dc->feature; + + if (dc->enabled && feature->entries) { + feature->length = table->num_entries; + memcpy(feature->entries, table->entries, table->num_entries * + sizeof(struct tegra_dc_feature_entry)); + } + + return 0; +} + static long tegra_dc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { @@ -805,6 +820,22 @@ static long tegra_dc_ioctl(struct file *filp, unsigned int cmd, return tegra_dc_ext_set_lut(user, &args); } + case TEGRA_DC_EXT_GET_FEATURES: + { + struct tegra_dc_ext_feature args; + int ret; + + if (copy_from_user(&args, user_arg, sizeof(args))) + return -EFAULT; + + ret = tegra_dc_ext_get_feature(user, &args); + + if (copy_to_user(user_arg, &args, sizeof(args))) + return -EFAULT; + + return ret; + } + default: return -EINVAL; } -- cgit v1.2.3 From 1d7ae6b9c9c408639c4ca50b79525a826de126dc Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Fri, 1 Jun 2012 19:59:57 -0700 Subject: video: tegra: dsi: remove build warnings Added void to function prototypes and initialized some variables. Change-Id: I69250f5e17560f900fffddec9697e496af6ad4d2 Signed-off-by: Jon Mayo Reviewed-on: http://git-master/r/106073 Reviewed-by: Automatic_Commit_Validation_User --- drivers/video/tegra/dc/dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index e402c416b779..6624a8e8f52c 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c @@ -1625,7 +1625,7 @@ static void tegra_dsi_pad_calibration(struct tegra_dc_dsi_data *dsi) tegra_vi_csi_writel(val, CSI_CIL_PAD_CONFIG); } -static void tegra_dsi_panelB_enable() +static void tegra_dsi_panelB_enable(void) { unsigned int val; @@ -2751,8 +2751,8 @@ static int tegra_dc_dsi_cp_info(struct tegra_dc_dsi_data *dsi, struct tegra_dsi_out *p_dsi) { struct tegra_dsi_cmd *p_init_cmd; - struct tegra_dsi_cmd *p_early_suspend_cmd; - struct tegra_dsi_cmd *p_late_resume_cmd; + struct tegra_dsi_cmd *p_early_suspend_cmd = NULL; + struct tegra_dsi_cmd *p_late_resume_cmd = NULL; struct tegra_dsi_cmd *p_suspend_cmd; int err; -- cgit v1.2.3 From f61bdbde09605793cfa05f7c59545c62b5e08aa6 Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Fri, 1 Jun 2012 13:24:24 -0700 Subject: video: tegra: dc: remove tegra_dc_host_trigger The function tegra_dc_host_trigger() is no longer used, removing it. Change-Id: I929450bdf0224779910e8569bc8d1b3edb93f12d Signed-off-by: Jon Mayo Reviewed-on: http://git-master/r/106075 Reviewed-by: Simone Willett Tested-by: Simone Willett --- drivers/video/tegra/dc/dc.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'drivers/video/tegra') diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 935f18bc8cfd..d5d0602838e7 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -2146,23 +2146,6 @@ static void tegra_dc_vblank(struct work_struct *work) } } -/* Must acquire dc lock and dc one-shot lock before invoking this function. - * Acquire dc one-shot lock first and then dc lock. */ -void tegra_dc_host_trigger(struct tegra_dc *dc) -{ - /* We release the lock here to prevent deadlock between - * cancel_delayed_work_sync and one-shot work. */ - mutex_unlock(&dc->lock); - - cancel_delayed_work_sync(&dc->one_shot_work); - mutex_lock(&dc->lock); - - schedule_delayed_work(&dc->one_shot_work, - msecs_to_jiffies(dc->one_shot_delay_ms)); - tegra_dc_program_bandwidth(dc); - tegra_dc_writel(dc, NC_HOST_TRIG, DC_CMD_STATE_CONTROL); -} - static void tegra_dc_one_shot_worker(struct work_struct *work) { struct tegra_dc *dc = container_of( -- cgit v1.2.3