diff options
author | Mayuresh Kulkarni <mkulkarni@nvidia.com> | 2012-06-18 12:35:40 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-06-26 07:14:03 -0700 |
commit | 7bef3f71fa38cc3c39953ec479dcfdcfa725be4d (patch) | |
tree | db00c32ad7633f8ded1896d15eec8a6878b472fb /drivers/video/tegra/dc | |
parent | 81a8d469a7e9d70d0a2cc0345ddf509038bb620a (diff) |
video: tegra: use public APIs exposed by host1x driver
Bug 961009
Change-Id: Ifdcc7bc8a40d270e70a63329f46caff541bf01e2
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/109461
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/dc')
-rw-r--r-- | drivers/video/tegra/dc/bandwidth.c | 1 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dc.c | 19 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dc_priv.h | 13 | ||||
-rw-r--r-- | drivers/video/tegra/dc/dsi.c | 25 |
4 files changed, 23 insertions, 35 deletions
diff --git a/drivers/video/tegra/dc/bandwidth.c b/drivers/video/tegra/dc/bandwidth.c index 5d0e5ee68bd6..785ec7cedfbd 100644 --- a/drivers/video/tegra/dc/bandwidth.c +++ b/drivers/video/tegra/dc/bandwidth.c @@ -16,6 +16,7 @@ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/clk.h> #include <mach/clk.h> #include <mach/dc.h> diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c index 834637db0f3a..39470e18215e 100644 --- a/drivers/video/tegra/dc/dc.c +++ b/drivers/video/tegra/dc/dc.c @@ -34,13 +34,13 @@ #include <linux/seq_file.h> #include <linux/backlight.h> #include <linux/gpio.h> +#include <linux/nvhost.h> #include <video/tegrafb.h> #include <drm/drm_fixed.h> #ifdef CONFIG_SWITCH #include <linux/switch.h> #endif - #include <mach/clk.h> #include <mach/dc.h> #include <mach/fb.h> @@ -51,8 +51,6 @@ #include "dc_reg.h" #include "dc_config.h" #include "dc_priv.h" -#include "host1x/host1x.h" -#include "host1x/host1x_syncpt.h" #include "nvsd.h" #define TEGRA_CRC_LATCHED_DELAY 34 @@ -1109,7 +1107,7 @@ u32 tegra_dc_incr_syncpt_max(struct tegra_dc *dc, int i) u32 max; mutex_lock(&dc->lock); - max = nvhost_syncpt_incr_max(&nvhost_get_host(dc->ndev)->syncpt, + max = nvhost_syncpt_incr_max_ext(dc->ndev, dc->syncpt[i].id, ((dc->enabled) ? 1 : 0)); dc->syncpt[i].max = max; mutex_unlock(&dc->lock); @@ -1123,9 +1121,7 @@ void tegra_dc_incr_syncpt_min(struct tegra_dc *dc, int i, u32 val) if ( dc->enabled ) while (dc->syncpt[i].min < val) { dc->syncpt[i].min++; - nvhost_syncpt_cpu_incr( - &nvhost_get_host(dc->ndev)->syncpt, - dc->syncpt[i].id); + nvhost_syncpt_cpu_incr_ext(dc->ndev, dc->syncpt[i].id); } mutex_unlock(&dc->lock); } @@ -2076,7 +2072,7 @@ static irqreturn_t tegra_dc_irq(int irq, void *ptr) unsigned long underflow_mask; u32 val; - if (!nvhost_module_powered(nvhost_get_host(dc->ndev)->dev)) { + if (!nvhost_module_powered_ext(nvhost_get_parent(dc->ndev))) { WARN(1, "IRQ when DC not powered!\n"); tegra_dc_io_start(dc); status = tegra_dc_readl(dc, DC_CMD_INT_STATUS); @@ -2286,8 +2282,7 @@ static int tegra_dc_init(struct tegra_dc *dc) dc->syncpt[i].id = syncpt; dc->syncpt[i].min = dc->syncpt[i].max = - nvhost_syncpt_read(&nvhost_get_host(dc->ndev)->syncpt, - syncpt); + nvhost_syncpt_read_ext(dc->ndev, syncpt); } print_mode(dc, &dc->mode, __func__); @@ -2487,9 +2482,7 @@ static void _tegra_dc_controller_disable(struct tegra_dc *dc) trace_printk("%s:syncpt flush id=%d\n", dc->ndev->name, dc->syncpt[i].id); dc->syncpt[i].min++; - nvhost_syncpt_cpu_incr( - &nvhost_get_host(dc->ndev)->syncpt, - dc->syncpt[i].id); + nvhost_syncpt_cpu_incr_ext(dc->ndev, dc->syncpt[i].id); } } trace_printk("%s:disabled\n", dc->ndev->name); diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h index ac3a5d341e18..19c8656689d1 100644 --- a/drivers/video/tegra/dc/dc_priv.h +++ b/drivers/video/tegra/dc/dc_priv.h @@ -24,11 +24,10 @@ #include <linux/fb.h> #include <linux/completion.h> #include <linux/switch.h> +#include <linux/nvhost.h> #include <mach/dc.h> -#include "../host/nvhost_acm.h" - #include <mach/tegra_dc_ext.h> #include <mach/clk.h> @@ -150,12 +149,12 @@ struct tegra_dc { static inline void tegra_dc_io_start(struct tegra_dc *dc) { - nvhost_module_busy(to_nvhost_device(dc->ndev->dev.parent)); + nvhost_module_busy_ext(nvhost_get_parent(dc->ndev)); } static inline void tegra_dc_io_end(struct tegra_dc *dc) { - nvhost_module_idle(to_nvhost_device(dc->ndev->dev.parent)); + nvhost_module_idle_ext(nvhost_get_parent(dc->ndev)); } static inline unsigned long tegra_dc_readl(struct tegra_dc *dc, @@ -163,7 +162,7 @@ static inline unsigned long tegra_dc_readl(struct tegra_dc *dc, { unsigned long ret; - BUG_ON(!nvhost_module_powered(to_nvhost_device(dc->ndev->dev.parent))); + BUG_ON(!nvhost_module_powered_ext(nvhost_get_parent(dc->ndev))); if (!tegra_is_clk_enabled(dc->clk)) WARN(1, "DC is clock-gated.\n"); @@ -175,7 +174,7 @@ static inline unsigned long tegra_dc_readl(struct tegra_dc *dc, static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long val, unsigned long reg) { - BUG_ON(!nvhost_module_powered(to_nvhost_device(dc->ndev->dev.parent))); + BUG_ON(!nvhost_module_powered_ext(nvhost_get_parent(dc->ndev))); if (!tegra_is_clk_enabled(dc->clk)) WARN(1, "DC is clock-gated.\n"); @@ -206,7 +205,7 @@ static inline void *tegra_dc_get_outdata(struct tegra_dc *dc) } static inline unsigned long tegra_dc_get_default_emc_clk_rate( - struct tegra_dc *dc) + struct tegra_dc *dc) { return dc->pdata->emc_clk_rate ? dc->pdata->emc_clk_rate : ULONG_MAX; } diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c index 26301abe4222..ff80aac7149d 100644 --- a/drivers/video/tegra/dc/dsi.c +++ b/drivers/video/tegra/dc/dsi.c @@ -14,18 +14,19 @@ * */ +#include <linux/kernel.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/err.h> #include <linux/fb.h> #include <linux/gpio.h> #include <linux/interrupt.h> -#include <linux/kernel.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/workqueue.h> #include <linux/debugfs.h> #include <linux/seq_file.h> +#include <linux/nvhost.h> #include <mach/clk.h> #include <mach/dc.h> @@ -36,8 +37,6 @@ #include "dc_reg.h" #include "dc_priv.h" -#include "host1x/host1x.h" -#include "host1x/host1x_syncpt.h" #include "dsi_regs.h" #include "dsi.h" @@ -298,7 +297,7 @@ inline unsigned long tegra_dsi_readl(struct tegra_dc_dsi_data *dsi, u32 reg) { unsigned long ret; - BUG_ON(!nvhost_module_powered(nvhost_get_host(dsi->dc->ndev)->dev)); + BUG_ON(!nvhost_module_powered_ext(nvhost_get_parent(dsi->dc->ndev))); ret = readl(dsi->base + reg * 4); trace_printk("readl %p=%#08lx\n", dsi->base + reg * 4, ret); return ret; @@ -307,7 +306,7 @@ EXPORT_SYMBOL(tegra_dsi_readl); inline void tegra_dsi_writel(struct tegra_dc_dsi_data *dsi, u32 val, u32 reg) { - BUG_ON(!nvhost_module_powered(nvhost_get_host(dsi->dc->ndev)->dev)); + BUG_ON(!nvhost_module_powered_ext(nvhost_get_parent(dsi->dc->ndev))); trace_printk("writel %p=%#08x\n", dsi->base + reg * 4, val); writel(val, dsi->base + reg * 4); } @@ -441,17 +440,15 @@ static int tegra_dsi_syncpt(struct tegra_dc_dsi_data *dsi) ret = 0; - dsi->syncpt_val = nvhost_syncpt_read( - &nvhost_get_host(dsi->dc->ndev)->syncpt, - dsi->syncpt_id); + dsi->syncpt_val = nvhost_syncpt_read_ext(dsi->dc->ndev, dsi->syncpt_id); val = DSI_INCR_SYNCPT_COND(OP_DONE) | DSI_INCR_SYNCPT_INDX(dsi->syncpt_id); tegra_dsi_writel(dsi, val, DSI_INCR_SYNCPT); /* TODO: Use interrupt rather than polling */ - ret = nvhost_syncpt_wait(&nvhost_get_host(dsi->dc->ndev)->syncpt, - dsi->syncpt_id, dsi->syncpt_val + 1); + ret = nvhost_syncpt_wait_timeout_ext(dsi->dc->ndev, dsi->syncpt_id, + dsi->syncpt_val + 1, MAX_SCHEDULE_TIMEOUT, NULL); if (ret < 0) { dev_err(&dsi->dc->ndev->dev, "DSI sync point failure\n"); goto fail; @@ -2277,9 +2274,7 @@ static int tegra_dsi_bta(struct tegra_dc_dsi_data *dsi) tegra_dsi_writel(dsi, val, DSI_HOST_DSI_CONTROL); #if DSI_USE_SYNC_POINTS - /* FIXME: Workaround for nvhost_syncpt_read */ - dsi->syncpt_val = nvhost_syncpt_update_min( - &nvhost_get_host(dsi->dc->ndev)->syncpt, + dsi->syncpt_val = nvhost_syncpt_read_ext(dsi->dc->ndev, dsi->syncpt_id); val = DSI_INCR_SYNCPT_COND(OP_DONE) | @@ -2287,8 +2282,8 @@ static int tegra_dsi_bta(struct tegra_dc_dsi_data *dsi) tegra_dsi_writel(dsi, val, DSI_INCR_SYNCPT); /* TODO: Use interrupt rather than polling */ - err = nvhost_syncpt_wait(&nvhost_get_host(dsi->dc->ndev)->syncpt, - dsi->syncpt_id, dsi->syncpt_val + 1); + err = nvhost_syncpt_wait_timeout_ext(dsi->dc->ndev, dsi->syncpt_id, + dsi->syncpt_val + 1, MAX_SCHEDULE_TIMEOUT, NULL); if (err < 0) dev_err(&dsi->dc->ndev->dev, "DSI sync point failure\n"); |