summaryrefslogtreecommitdiff
path: root/drivers/video/tegra
diff options
context:
space:
mode:
authorTom Cherry <tcherry@nvidia.com>2012-06-05 11:41:56 -0700
committerTom Cherry <tcherry@nvidia.com>2012-06-05 11:41:56 -0700
commitb46bcc0a3da47431f2711c3d63e9507cfab18ecd (patch)
tree6b9355395470108f5161840638bf48af0e10f3c1 /drivers/video/tegra
parent63fb092060747250a0dd305bd11018caebe23d65 (diff)
parentf61bdbde09605793cfa05f7c59545c62b5e08aa6 (diff)
Merge commit 'main-ics-2012.06.04-A5' into HEAD
Conflicts: drivers/media/video/tegra/nvavp/nvavp_dev.c Change-Id: I7779b0ce58004f80cccf6193148ac49551ce5da5
Diffstat (limited to 'drivers/video/tegra')
-rw-r--r--drivers/video/tegra/Kconfig9
-rw-r--r--drivers/video/tegra/dc/dc.c17
-rw-r--r--drivers/video/tegra/dc/dc_config.h6
-rw-r--r--drivers/video/tegra/dc/dsi.c6
-rw-r--r--drivers/video/tegra/dc/ext/dev.c31
-rw-r--r--drivers/video/tegra/dc/nvsd.c5
-rw-r--r--drivers/video/tegra/host/Makefile1
-rw-r--r--drivers/video/tegra/host/bus_client.c55
-rw-r--r--drivers/video/tegra/host/bus_client.h4
-rw-r--r--drivers/video/tegra/host/dev.c16
-rw-r--r--drivers/video/tegra/host/dsi/Makefile7
-rw-r--r--drivers/video/tegra/host/dsi/dsi.c83
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d_t30.c2
-rw-r--r--drivers/video/tegra/host/nvhost_acm.c12
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.h5
-rw-r--r--drivers/video/tegra/nvmap/nvmap_ioctl.c2
16 files changed, 127 insertions, 134 deletions
diff --git a/drivers/video/tegra/Kconfig b/drivers/video/tegra/Kconfig
index 59e2778..15c2acf 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
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index df54578..5c960f9 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(
diff --git a/drivers/video/tegra/dc/dc_config.h b/drivers/video/tegra/dc/dc_config.h
index f513cd0..314cd11 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/dsi.c b/drivers/video/tegra/dc/dsi.c
index e402c41..6624a8e 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;
diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c
index c349a47..a8de7a7 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;
}
diff --git a/drivers/video/tegra/dc/nvsd.c b/drivers/video/tegra/dc/nvsd.c
index 65d5187..860dd8d 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 */
diff --git a/drivers/video/tegra/host/Makefile b/drivers/video/tegra/host/Makefile
index d47c975..f228a3a 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/bus_client.c b/drivers/video/tegra/host/bus_client.c
index 87aa9c6..6bfce9a 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 {
@@ -140,7 +168,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);
@@ -149,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;
}
@@ -182,6 +215,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,
@@ -367,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/bus_client.h b/drivers/video/tegra/host/bus_client.h
index adc3a704..e95ea0b 100644
--- a/drivers/video/tegra/host/bus_client.h
+++ b/drivers/video/tegra/host/bus_client.h
@@ -24,10 +24,10 @@
#include <linux/types.h>
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 ca73528..2c05fbf 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;
}
}
@@ -250,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/dsi/Makefile b/drivers/video/tegra/host/dsi/Makefile
deleted file mode 100644
index eb94d3e..00000000
--- 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 87da8a6..00000000
--- 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 <http://www.gnu.org/licenses/>.
- */
-
-#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);
diff --git a/drivers/video/tegra/host/gr3d/gr3d_t30.c b/drivers/video/tegra/host/gr3d/gr3d_t30.c
index 57f4c779..4bc7c9f 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;
diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c
index 6d96bd0..dfd8432 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 b58921b..fcc9fce 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);
diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c
index 1478715..7a10231 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;
}