video: tegra: use public APIs exposed by host1x driver
Mayuresh Kulkarni [Mon, 18 Jun 2012 07:05:40 +0000 (12:05 +0530)]
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>

Rebase-Id: R3a993982921a5585701117175d2c2e620ace2462

drivers/video/tegra/dc/bandwidth.c
drivers/video/tegra/dc/dc.c
drivers/video/tegra/dc/dc_priv.h
drivers/video/tegra/dc/dsi.c

index 5d0e5ee..785ec7c 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/clk.h>
 
 #include <mach/clk.h>
 #include <mach/dc.h>
index c52dba7..293ac95 100644 (file)
 #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>
@@ -52,7 +52,6 @@
 #include "dc_config.h"
 #include "dc_priv.h"
 #include "dev.h"
-#include "host1x/host1x_syncpt.h"
 #include "nvsd.h"
 
 #define TEGRA_CRC_LATCHED_DELAY                34
@@ -1468,7 +1467,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);
@@ -1482,9 +1481,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);
 }
@@ -2409,7 +2406,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);
@@ -2626,8 +2623,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__);
@@ -2827,9 +2823,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);
index ccf3a15..5a6089e 100644 (file)
 #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>
 
@@ -153,12 +152,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,
@@ -166,8 +165,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(to_nvhost_device(dc->ndev->dev.parent)));
        if (!tegra_is_clk_enabled(dc->clk))
                WARN(1, "DC is clock-gated.\n");
 
@@ -179,8 +177,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(to_nvhost_device(dc->ndev->dev.parent)));
        if (!tegra_is_clk_enabled(dc->clk))
                WARN(1, "DC is clock-gated.\n");
 
@@ -211,7 +208,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;
 }
index fd0243a..5bb7d1c 100644 (file)
  *
  */
 
+#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>
@@ -28,6 +28,7 @@
 #include <linux/export.h>
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
+#include <linux/nvhost.h>
 
 #include <mach/clk.h>
 #include <mach/dc.h>
@@ -39,7 +40,6 @@
 #include "dc_reg.h"
 #include "dc_priv.h"
 #include "dev.h"
-#include "host1x/host1x_syncpt.h"
 #include "dsi_regs.h"
 #include "dsi.h"
 
@@ -270,7 +270,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;
@@ -279,7 +279,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);
 }
@@ -413,17 +413,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;
@@ -2574,9 +2572,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) |
@@ -2584,8 +2580,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");