summaryrefslogtreecommitdiff
path: root/drivers/video/tegra
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-01-02 11:14:26 +0200
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-01-24 10:50:35 -0800
commit3a74a9a1c0f6337f5c970de4d890f8f6841dc12f (patch)
treeaea0ca0cac1ec2760ec289fd6b85643db453b3ee /drivers/video/tegra
parent5665ef5e26fa8e3fd802153af908a39ea64c55c7 (diff)
video: tegra: host: Access nvhost_master via drvdata
Use standard drvdata interface for storing and accessing nvhost_master. Reviewed-on: http://git-master/r/72846 Change-Id: I191987c8f6d313a6ede9b59f723269cb6a197e8a Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/76815 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/video/tegra')
-rw-r--r--drivers/video/tegra/dc/dc.c13
-rw-r--r--drivers/video/tegra/dc/dc_priv.h8
-rw-r--r--drivers/video/tegra/dc/dsi.c10
-rw-r--r--drivers/video/tegra/dc/ext/dev.c9
-rw-r--r--drivers/video/tegra/host/bus.c5
-rw-r--r--drivers/video/tegra/host/dev.c10
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d.c4
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d_t20.c5
-rw-r--r--drivers/video/tegra/host/gr3d/gr3d_t30.c2
-rw-r--r--drivers/video/tegra/host/host1x/host1x_channel.c46
-rw-r--r--drivers/video/tegra/host/mpe/mpe.c9
-rw-r--r--drivers/video/tegra/host/nvhost_acm.c11
-rw-r--r--drivers/video/tegra/host/nvhost_cdma.h2
-rw-r--r--drivers/video/tegra/host/nvhost_channel.h4
14 files changed, 72 insertions, 66 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 7bbf1035a5c7..951e8caaff2e 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -1283,7 +1283,7 @@ u32 tegra_dc_incr_syncpt_max(struct tegra_dc *dc, int i)
u32 max;
mutex_lock(&dc->lock);
- max = nvhost_syncpt_incr_max(&dc->ndev->host->syncpt,
+ max = nvhost_syncpt_incr_max(&nvhost_get_host(dc->ndev)->syncpt,
dc->syncpt[i].id, ((dc->enabled) ? 1 : 0));
dc->syncpt[i].max = max;
mutex_unlock(&dc->lock);
@@ -1297,7 +1297,8 @@ 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(&dc->ndev->host->syncpt,
+ nvhost_syncpt_cpu_incr(
+ &nvhost_get_host(dc->ndev)->syncpt,
dc->syncpt[i].id);
}
mutex_unlock(&dc->lock);
@@ -2125,7 +2126,7 @@ static irqreturn_t tegra_dc_irq(int irq, void *ptr)
unsigned long underflow_mask;
u32 val;
- if (!nvhost_module_powered(dc->ndev->host->dev)) {
+ if (!nvhost_module_powered(nvhost_get_host(dc->ndev)->dev)) {
WARN(1, "IRQ when DC not powered!\n");
tegra_dc_io_start(dc);
status = tegra_dc_readl(dc, DC_CMD_INT_STATUS);
@@ -2333,7 +2334,8 @@ static void tegra_dc_init(struct tegra_dc *dc)
dc->syncpt[i].id = syncpt;
dc->syncpt[i].min = dc->syncpt[i].max =
- nvhost_syncpt_read(&dc->ndev->host->syncpt, syncpt);
+ nvhost_syncpt_read(&nvhost_get_host(dc->ndev)->syncpt,
+ syncpt);
}
print_mode(dc, &dc->mode, __func__);
@@ -2480,7 +2482,8 @@ static void _tegra_dc_controller_disable(struct tegra_dc *dc)
/* flush any pending syncpt waits */
while (dc->syncpt[i].min < dc->syncpt[i].max) {
dc->syncpt[i].min++;
- nvhost_syncpt_cpu_incr(&dc->ndev->host->syncpt,
+ nvhost_syncpt_cpu_incr(
+ &nvhost_get_host(dc->ndev)->syncpt,
dc->syncpt[i].id);
}
}
diff --git a/drivers/video/tegra/dc/dc_priv.h b/drivers/video/tegra/dc/dc_priv.h
index e516bfd72c85..2a01a8387c16 100644
--- a/drivers/video/tegra/dc/dc_priv.h
+++ b/drivers/video/tegra/dc/dc_priv.h
@@ -143,25 +143,25 @@ struct tegra_dc {
static inline void tegra_dc_io_start(struct tegra_dc *dc)
{
- nvhost_module_busy(dc->ndev->host->dev);
+ nvhost_module_busy(nvhost_get_host(dc->ndev)->dev);
}
static inline void tegra_dc_io_end(struct tegra_dc *dc)
{
- nvhost_module_idle(dc->ndev->host->dev);
+ nvhost_module_idle(nvhost_get_host(dc->ndev)->dev);
}
static inline unsigned long tegra_dc_readl(struct tegra_dc *dc,
unsigned long reg)
{
- BUG_ON(!nvhost_module_powered(dc->ndev->host->dev));
+ BUG_ON(!nvhost_module_powered(nvhost_get_host(dc->ndev)->dev));
return readl(dc->base + reg * 4);
}
static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long val,
unsigned long reg)
{
- BUG_ON(!nvhost_module_powered(dc->ndev->host->dev));
+ BUG_ON(!nvhost_module_powered(nvhost_get_host(dc->ndev)->dev));
writel(val, dc->base + reg * 4);
}
diff --git a/drivers/video/tegra/dc/dsi.c b/drivers/video/tegra/dc/dsi.c
index 5c120342f52a..82902756cc23 100644
--- a/drivers/video/tegra/dc/dsi.c
+++ b/drivers/video/tegra/dc/dsi.c
@@ -303,14 +303,15 @@ static int tegra_dsi_syncpt(struct tegra_dc_dsi_data *dsi)
ret = 0;
dsi->syncpt_val = nvhost_syncpt_read(
- &dsi->dc->ndev->host->syncpt, dsi->syncpt_id);
+ &nvhost_get_host(dsi->dc->ndev)->syncpt,
+ 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(&dsi->dc->ndev->host->syncpt,
+ ret = nvhost_syncpt_wait(&nvhost_get_host(dsi->dc->ndev)->syncpt,
dsi->syncpt_id, dsi->syncpt_val + 1);
if (ret < 0) {
dev_err(&dsi->dc->ndev->dev, "DSI sync point failure\n");
@@ -1742,14 +1743,15 @@ static int tegra_dsi_bta(struct tegra_dc_dsi_data *dsi)
#if DSI_USE_SYNC_POINTS
/* FIXME: Workaround for nvhost_syncpt_read */
dsi->syncpt_val = nvhost_syncpt_update_min(
- &dsi->dc->ndev->host->syncpt, dsi->syncpt_id);
+ &nvhost_get_host(dsi->dc->ndev)->syncpt,
+ 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 */
- err = nvhost_syncpt_wait(&dsi->dc->ndev->host->syncpt,
+ err = nvhost_syncpt_wait(&nvhost_get_host(dsi->dc->ndev)->syncpt,
dsi->syncpt_id, dsi->syncpt_val + 1);
if (err < 0)
dev_err(&dsi->dc->ndev->dev,
diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c
index 2148c0b18c71..ca4ca5370633 100644
--- a/drivers/video/tegra/dc/ext/dev.c
+++ b/drivers/video/tegra/dc/ext/dev.c
@@ -224,10 +224,11 @@ static int tegra_dc_ext_set_windowattr(struct tegra_dc_ext *ext,
win->stride_uv = flip_win->attr.stride_uv;
if ((s32)flip_win->attr.pre_syncpt_id >= 0) {
- nvhost_syncpt_wait_timeout(&ext->dc->ndev->host->syncpt,
- flip_win->attr.pre_syncpt_id,
- flip_win->attr.pre_syncpt_val,
- msecs_to_jiffies(500), NULL);
+ nvhost_syncpt_wait_timeout(
+ &nvhost_get_host(ext->dc->ndev)->syncpt,
+ flip_win->attr.pre_syncpt_id,
+ flip_win->attr.pre_syncpt_val,
+ msecs_to_jiffies(500), NULL);
}
diff --git a/drivers/video/tegra/host/bus.c b/drivers/video/tegra/host/bus.c
index d93e44691847..8234d0fa64c3 100644
--- a/drivers/video/tegra/host/bus.c
+++ b/drivers/video/tegra/host/bus.c
@@ -77,8 +77,6 @@ static int nvhost_drv_probe(struct device *_dev)
struct nvhost_driver *drv = to_nvhost_driver(_dev->driver);
struct nvhost_device *dev = to_nvhost_device(_dev);
- dev->host = nvhost;
-
return drv->probe(dev);
}
@@ -131,8 +129,6 @@ int nvhost_device_register(struct nvhost_device *dev)
if (!dev->dev.parent && nvhost && nvhost->dev != dev)
dev->dev.parent = &nvhost->dev->dev;
- /* Give pointer to host1x */
- dev->host = nvhost;
dev->dev.bus = &nvhost_bus_type;
if (dev->id != -1)
@@ -545,7 +541,6 @@ static int set_parent(struct device *dev, void *data)
struct nvhost_master *host = data;
if (!dev->parent && ndev != host->dev)
dev->parent = &host->dev->dev;
- ndev->host = host;
return 0;
}
diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c
index c7b1ebfd60b0..ea502442aeef 100644
--- a/drivers/video/tegra/host/dev.c
+++ b/drivers/video/tegra/host/dev.c
@@ -162,7 +162,8 @@ static int nvhost_channelopen(struct inode *inode, struct file *filp)
goto fail;
}
priv->priority = NVHOST_PRIORITY_MEDIUM;
- priv->clientid = atomic_add_return(1, &ch->dev->host->clientid);
+ priv->clientid = atomic_add_return(1,
+ &nvhost_get_host(ch->dev)->clientid);
priv->job = nvhost_job_alloc(ch, priv->hwctx, &priv->hdr,
NULL, priv->priority, priv->clientid);
@@ -738,14 +739,14 @@ static const struct file_operations nvhost_ctrlops = {
static void power_on_host(struct nvhost_device *dev)
{
- struct nvhost_master *host = dev->host;
+ struct nvhost_master *host = nvhost_get_drvdata(dev);
nvhost_intr_start(&host->intr, clk_get_rate(dev->clk[0]));
nvhost_syncpt_reset(&host->syncpt);
}
static int power_off_host(struct nvhost_device *dev)
{
- struct nvhost_master *host = dev->host;
+ struct nvhost_master *host = nvhost_get_drvdata(dev);
nvhost_syncpt_save(&host->syncpt);
nvhost_intr_stop(&host->intr);
return 0;
@@ -953,6 +954,9 @@ static int __devinit nvhost_probe(struct platform_device *pdev)
host->dev = &hostdev;
nvhost_bus_add_host(host);
+ /* Give pointer to host1x via driver */
+ nvhost_set_drvdata(&hostdev, host);
+
for (i = 0; i < host->nb_channels; i++) {
struct nvhost_channel *ch = &host->channels[i];
BUG_ON(!host_channel_op(host).init);
diff --git a/drivers/video/tegra/host/gr3d/gr3d.c b/drivers/video/tegra/host/gr3d/gr3d.c
index 709d4ece9394..9e02ace2c721 100644
--- a/drivers/video/tegra/host/gr3d/gr3d.c
+++ b/drivers/video/tegra/host/gr3d/gr3d.c
@@ -77,7 +77,7 @@ void nvhost_3dctx_restore_end(u32 *ptr)
struct nvhost_hwctx *nvhost_3dctx_alloc_common(struct nvhost_channel *ch,
bool map_restore)
{
- struct nvmap_client *nvmap = ch->dev->host->nvmap;
+ struct nvmap_client *nvmap = nvhost_get_host(ch->dev)->nvmap;
struct nvhost_hwctx *ctx;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -130,7 +130,7 @@ void nvhost_3dctx_get(struct nvhost_hwctx *ctx)
void nvhost_3dctx_free(struct kref *ref)
{
struct nvhost_hwctx *ctx = container_of(ref, struct nvhost_hwctx, ref);
- struct nvmap_client *nvmap = ctx->channel->dev->host->nvmap;
+ struct nvmap_client *nvmap = nvhost_get_host(ctx->channel->dev)->nvmap;
if (ctx->restore_virt) {
nvmap_munmap(ctx->restore, ctx->restore_virt);
diff --git a/drivers/video/tegra/host/gr3d/gr3d_t20.c b/drivers/video/tegra/host/gr3d/gr3d_t20.c
index 24d7e6d75503..c576cf7ff5a5 100644
--- a/drivers/video/tegra/host/gr3d/gr3d_t20.c
+++ b/drivers/video/tegra/host/gr3d/gr3d_t20.c
@@ -340,7 +340,8 @@ static void ctx3d_save_service(struct nvhost_hwctx *ctx)
ARRAY_SIZE(ctxsave_regs_3d_global));
wmb();
- nvhost_syncpt_cpu_incr(&ctx->channel->dev->host->syncpt, NVSYNCPT_3D);
+ nvhost_syncpt_cpu_incr(&nvhost_get_host(ctx->channel->dev)->syncpt,
+ NVSYNCPT_3D);
}
int __init nvhost_gr3d_t20_ctxhandler_init(struct nvhost_hwctx_handler *h)
@@ -350,7 +351,7 @@ int __init nvhost_gr3d_t20_ctxhandler_init(struct nvhost_hwctx_handler *h)
u32 *save_ptr;
ch = container_of(h, struct nvhost_channel, ctxhandler);
- nvmap = ch->dev->host->nvmap;
+ nvmap = nvhost_get_host(ch->dev)->nvmap;
setup_save(NULL);
diff --git a/drivers/video/tegra/host/gr3d/gr3d_t30.c b/drivers/video/tegra/host/gr3d/gr3d_t30.c
index 1fde326fc101..3f6a4d31081c 100644
--- a/drivers/video/tegra/host/gr3d/gr3d_t30.c
+++ b/drivers/video/tegra/host/gr3d/gr3d_t30.c
@@ -385,7 +385,7 @@ int __init nvhost_gr3d_t30_ctxhandler_init(struct nvhost_hwctx_handler *h)
u32 *save_ptr;
ch = container_of(h, struct nvhost_channel, ctxhandler);
- nvmap = ch->dev->host->nvmap;
+ nvmap = nvhost_get_host(ch->dev)->nvmap;
register_sets = tegra_gpu_register_sets();
BUG_ON(register_sets == 0 || register_sets > 2);
diff --git a/drivers/video/tegra/host/host1x/host1x_channel.c b/drivers/video/tegra/host/host1x/host1x_channel.c
index 18aa2da5151f..7d34f5da263e 100644
--- a/drivers/video/tegra/host/host1x/host1x_channel.c
+++ b/drivers/video/tegra/host/host1x/host1x_channel.c
@@ -52,7 +52,7 @@ int host1x_channel_submit(struct nvhost_job *job)
{
struct nvhost_hwctx *hwctx_to_save = NULL;
struct nvhost_channel *channel = job->ch;
- struct nvhost_syncpt *sp = &job->ch->dev->host->syncpt;
+ struct nvhost_syncpt *sp = &nvhost_get_host(job->ch->dev)->syncpt;
u32 user_syncpt_incrs = job->syncpt_incrs;
bool need_restore = false;
u32 syncval;
@@ -162,7 +162,7 @@ int host1x_channel_submit(struct nvhost_job *job)
/* gather restore buffer */
if (need_restore) {
nvhost_cdma_push_gather(&channel->cdma,
- channel->dev->host->nvmap,
+ nvhost_get_host(channel->dev)->nvmap,
nvmap_ref_to_handle(channel->cur_ctx->restore),
nvhost_opcode_gather(channel->cur_ctx->restore_size),
channel->cur_ctx->restore_phys);
@@ -222,7 +222,8 @@ int host1x_channel_submit(struct nvhost_job *job)
* if necessary, and to release the restore buffer)
*/
if (hwctx_to_save) {
- err = nvhost_intr_add_action(&channel->dev->host->intr,
+ err = nvhost_intr_add_action(
+ &nvhost_get_host(channel->dev)->intr,
job->syncpt_id,
syncval - job->syncpt_incrs
+ hwctx_to_save->save_thresh,
@@ -235,7 +236,8 @@ int host1x_channel_submit(struct nvhost_job *job)
if (need_restore) {
BUG_ON(!ctxrestore_waiter);
- err = nvhost_intr_add_action(&channel->dev->host->intr,
+ err = nvhost_intr_add_action(
+ &nvhost_get_host(channel->dev)->intr,
job->syncpt_id,
syncval - user_syncpt_incrs,
NVHOST_INTR_ACTION_CTXRESTORE, channel->cur_ctx,
@@ -246,8 +248,8 @@ int host1x_channel_submit(struct nvhost_job *job)
}
/* schedule a submit complete interrupt */
- err = nvhost_intr_add_action(&channel->dev->host->intr, job->syncpt_id,
- syncval,
+ err = nvhost_intr_add_action(&nvhost_get_host(channel->dev)->intr,
+ job->syncpt_id, syncval,
NVHOST_INTR_ACTION_SUBMIT_COMPLETE, channel,
completed_waiter,
NULL);
@@ -293,7 +295,7 @@ int host1x_channel_read_3d_reg(
job = nvhost_job_alloc(channel, hwctx,
NULL,
- channel->dev->host->nvmap, 0, 0);
+ nvhost_get_host(channel->dev)->nvmap, 0, 0);
if (!job) {
err = -ENOMEM;
goto done;
@@ -324,7 +326,7 @@ int host1x_channel_read_3d_reg(
}
}
- syncval = nvhost_syncpt_incr_max(&channel->dev->host->syncpt,
+ syncval = nvhost_syncpt_incr_max(&nvhost_get_host(channel->dev)->syncpt,
NVSYNCPT_3D, syncpt_incrs);
job->syncpt_id = NVSYNCPT_3D;
@@ -390,7 +392,8 @@ int host1x_channel_read_3d_reg(
* if necessary, and to release the restore buffer)
*/
if (hwctx_to_save) {
- err = nvhost_intr_add_action(&channel->dev->host->intr,
+ err = nvhost_intr_add_action(
+ &nvhost_get_host(channel->dev)->intr,
NVSYNCPT_3D,
syncval - syncpt_incrs + hwctx_to_save->save_incrs - 1,
NVHOST_INTR_ACTION_CTXSAVE, hwctx_to_save,
@@ -401,27 +404,28 @@ int host1x_channel_read_3d_reg(
}
/* Wait for FIFO to be ready */
- err = nvhost_intr_add_action(&channel->dev->host->intr, NVSYNCPT_3D,
- syncval - 2,
+ err = nvhost_intr_add_action(&nvhost_get_host(channel->dev)->intr,
+ NVSYNCPT_3D, syncval - 2,
NVHOST_INTR_ACTION_WAKEUP, &wq,
read_waiter,
&ref);
read_waiter = NULL;
WARN(err, "Failed to set wakeup interrupt");
wait_event(wq,
- nvhost_syncpt_min_cmp(&channel->dev->host->syncpt,
+ nvhost_syncpt_min_cmp(&nvhost_get_host(channel->dev)->syncpt,
NVSYNCPT_3D, syncval - 2));
- nvhost_intr_put_ref(&channel->dev->host->intr, ref);
+ nvhost_intr_put_ref(&nvhost_get_host(channel->dev)->intr, ref);
/* Read the register value from FIFO */
err = host1x_drain_read_fifo(channel->aperture,
value, 1, &pending);
/* Indicate we've read the value */
- nvhost_syncpt_cpu_incr(&channel->dev->host->syncpt, NVSYNCPT_3D);
+ nvhost_syncpt_cpu_incr(&nvhost_get_host(channel->dev)->syncpt,
+ NVSYNCPT_3D);
/* Schedule a submit complete interrupt */
- err = nvhost_intr_add_action(&channel->dev->host->intr,
+ err = nvhost_intr_add_action(&nvhost_get_host(channel->dev)->intr,
NVSYNCPT_3D, syncval,
NVHOST_INTR_ACTION_SUBMIT_COMPLETE, channel,
completed_waiter, NULL);
@@ -510,7 +514,7 @@ int host1x_save_context(struct nvhost_device *dev, u32 syncpt_id)
job = nvhost_job_alloc(ch, hwctx_to_save,
NULL,
- ch->dev->host->nvmap, 0, 0);
+ nvhost_get_host(ch->dev)->nvmap, 0, 0);
if (IS_ERR_OR_NULL(job)) {
err = PTR_ERR(job);
mutex_unlock(&ch->submitlock);
@@ -522,7 +526,7 @@ int host1x_save_context(struct nvhost_device *dev, u32 syncpt_id)
ch->cur_ctx = NULL;
syncpt_incrs = hwctx_to_save->save_incrs;
- syncpt_val = nvhost_syncpt_incr_max(&ch->dev->host->syncpt,
+ syncpt_val = nvhost_syncpt_incr_max(&nvhost_get_host(ch->dev)->syncpt,
syncpt_id, syncpt_incrs);
job->syncpt_id = syncpt_id;
@@ -540,7 +544,7 @@ int host1x_save_context(struct nvhost_device *dev, u32 syncpt_id)
nvhost_job_put(job);
job = NULL;
- err = nvhost_intr_add_action(&ch->dev->host->intr, syncpt_id,
+ err = nvhost_intr_add_action(&nvhost_get_host(ch->dev)->intr, syncpt_id,
syncpt_val - syncpt_incrs + hwctx_to_save->save_thresh,
NVHOST_INTR_ACTION_CTXSAVE, hwctx_to_save,
ctx_waiter,
@@ -548,7 +552,7 @@ int host1x_save_context(struct nvhost_device *dev, u32 syncpt_id)
ctx_waiter = NULL;
WARN(err, "Failed to set context save interrupt");
- err = nvhost_intr_add_action(&ch->dev->host->intr,
+ err = nvhost_intr_add_action(&nvhost_get_host(ch->dev)->intr,
syncpt_id, syncpt_val,
NVHOST_INTR_ACTION_WAKEUP, &wq,
wakeup_waiter,
@@ -556,10 +560,10 @@ int host1x_save_context(struct nvhost_device *dev, u32 syncpt_id)
wakeup_waiter = NULL;
WARN(err, "Failed to set wakeup interrupt");
wait_event(wq,
- nvhost_syncpt_min_cmp(&ch->dev->host->syncpt,
+ nvhost_syncpt_min_cmp(&nvhost_get_host(ch->dev)->syncpt,
syncpt_id, syncpt_val));
- nvhost_intr_put_ref(&ch->dev->host->intr, ref);
+ nvhost_intr_put_ref(&nvhost_get_host(ch->dev)->intr, ref);
nvhost_cdma_update(&ch->cdma);
diff --git a/drivers/video/tegra/host/mpe/mpe.c b/drivers/video/tegra/host/mpe/mpe.c
index 5d497221a671..471702ea48fb 100644
--- a/drivers/video/tegra/host/mpe/mpe.c
+++ b/drivers/video/tegra/host/mpe/mpe.c
@@ -439,7 +439,7 @@ static u32 *save_ram(u32 *ptr, unsigned int *pending,
static struct nvhost_hwctx *ctxmpe_alloc(struct nvhost_channel *ch)
{
- struct nvmap_client *nvmap = ch->dev->host->nvmap;
+ struct nvmap_client *nvmap = nvhost_get_host(ch->dev)->nvmap;
struct nvhost_hwctx *ctx;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -482,7 +482,7 @@ static void ctxmpe_get(struct nvhost_hwctx *ctx)
static void ctxmpe_free(struct kref *ref)
{
struct nvhost_hwctx *ctx = container_of(ref, struct nvhost_hwctx, ref);
- struct nvmap_client *nvmap = ctx->channel->dev->host->nvmap;
+ struct nvmap_client *nvmap = nvhost_get_host(ctx->channel->dev)->nvmap;
if (ctx->restore_virt)
nvmap_munmap(ctx->restore, ctx->restore_virt);
@@ -522,7 +522,8 @@ static void ctxmpe_save_service(struct nvhost_hwctx *ctx)
IRFR_RAM_SIZE, IRFR_RAM_READ_CMD, IRFR_RAM_READ_DATA);
wmb();
- nvhost_syncpt_cpu_incr(&ctx->channel->dev->host->syncpt, NVSYNCPT_MPE);
+ nvhost_syncpt_cpu_incr(&nvhost_get_host(ctx->channel->dev)->syncpt,
+ NVSYNCPT_MPE);
}
int __init nvhost_mpe_ctxhandler_init(struct nvhost_hwctx_handler *h)
@@ -532,7 +533,7 @@ int __init nvhost_mpe_ctxhandler_init(struct nvhost_hwctx_handler *h)
u32 *save_ptr;
ch = container_of(h, struct nvhost_channel, ctxhandler);
- nvmap = ch->dev->host->nvmap;
+ nvmap = nvhost_get_host(ch->dev)->nvmap;
setup_save(NULL);
diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c
index 7a0108ab5f2f..8d44d87769d1 100644
--- a/drivers/video/tegra/host/nvhost_acm.c
+++ b/drivers/video/tegra/host/nvhost_acm.c
@@ -441,15 +441,10 @@ static void debug_not_idle(struct nvhost_master *host)
int nvhost_module_suspend(struct nvhost_device *dev, bool system_suspend)
{
int ret;
- struct nvhost_master *host;
+ struct nvhost_master *host = nvhost_get_host(dev);
- if (system_suspend) {
- host = dev->host;
- if (!is_module_idle(dev))
- debug_not_idle(host);
- } else {
- host = dev->host;
- }
+ if (system_suspend && !is_module_idle(dev))
+ debug_not_idle(host);
ret = wait_event_timeout(dev->idle_wq, is_module_idle(dev),
ACM_SUSPEND_WAIT_FOR_IDLE_TIMEOUT);
diff --git a/drivers/video/tegra/host/nvhost_cdma.h b/drivers/video/tegra/host/nvhost_cdma.h
index 39142ca5cd83..a5ef8da29e78 100644
--- a/drivers/video/tegra/host/nvhost_cdma.h
+++ b/drivers/video/tegra/host/nvhost_cdma.h
@@ -108,7 +108,7 @@ struct nvhost_cdma {
};
#define cdma_to_channel(cdma) container_of(cdma, struct nvhost_channel, cdma)
-#define cdma_to_dev(cdma) ((cdma_to_channel(cdma))->dev->host)
+#define cdma_to_dev(cdma) nvhost_get_host(cdma_to_channel(cdma)->dev)
#define cdma_op(cdma) (cdma_to_dev(cdma)->op.cdma)
#define cdma_to_nvmap(cdma) ((cdma_to_dev(cdma))->nvmap)
#define pb_to_cdma(pb) container_of(pb, struct nvhost_cdma, push_buffer)
diff --git a/drivers/video/tegra/host/nvhost_channel.h b/drivers/video/tegra/host/nvhost_channel.h
index f6c22cac963d..251fa94ee18f 100644
--- a/drivers/video/tegra/host/nvhost_channel.h
+++ b/drivers/video/tegra/host/nvhost_channel.h
@@ -72,8 +72,8 @@ struct nvhost_channel *nvhost_getchannel(struct nvhost_channel *ch);
void nvhost_putchannel(struct nvhost_channel *ch, struct nvhost_hwctx *ctx);
int nvhost_channel_suspend(struct nvhost_channel *ch);
-#define channel_cdma_op(ch) (ch->dev->host->op.cdma)
-#define channel_op(ch) (ch->dev->host->op.channel)
+#define channel_cdma_op(ch) (nvhost_get_host(ch->dev)->op.cdma)
+#define channel_op(ch) (nvhost_get_host(ch->dev)->op.channel)
#define host_channel_op(host) (host->op.channel)
int nvhost_channel_drain_read_fifo(void __iomem *chan_regs,