summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayuresh Kulkarni <mkulkarni@nvidia.com>2012-03-19 18:08:53 +0530
committerSimone Willett <swillett@nvidia.com>2012-03-23 17:29:28 -0700
commit31f8d442a4fe1aa69261e6452b8b652aa637385c (patch)
treed52ef461bb302294088f1931300936df711a9db8
parentd4c9c46147102dfc403691ed52609ae36ba5df08 (diff)
video: tegra: host: use bus_for_each_dev for channel debug output
- this patch uses the iterrator bus API to print the channel status on debug-fs output - it is the first step for removal nvhost_master holding pointers to all the channels Bug 871237 Change-Id: I2eaf8f0124512f1bc1ea9bbbe71d2c112b1947d2 Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-on: http://git-master/r/91676 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/video/tegra/host/chip_support.h2
-rw-r--r--drivers/video/tegra/host/debug.c29
-rw-r--r--drivers/video/tegra/host/host1x/host1x_debug.c8
3 files changed, 24 insertions, 15 deletions
diff --git a/drivers/video/tegra/host/chip_support.h b/drivers/video/tegra/host/chip_support.h
index 17e7f4b165a0..6727e7a69fb4 100644
--- a/drivers/video/tegra/host/chip_support.h
+++ b/drivers/video/tegra/host/chip_support.h
@@ -88,9 +88,11 @@ struct nvhost_chip_support {
struct {
void (*debug_init)(struct dentry *de);
void (*show_channel_cdma)(struct nvhost_master *,
+ struct nvhost_channel *,
struct output *,
int chid);
void (*show_channel_fifo)(struct nvhost_master *,
+ struct nvhost_channel *,
struct output *,
int chid);
void (*show_mlocks)(struct nvhost_master *m,
diff --git a/drivers/video/tegra/host/debug.c b/drivers/video/tegra/host/debug.c
index f3059d599438..91436c903fc6 100644
--- a/drivers/video/tegra/host/debug.c
+++ b/drivers/video/tegra/host/debug.c
@@ -43,24 +43,31 @@ void nvhost_debug_output(struct output *o, const char* fmt, ...)
o->fn(o->ctx, o->buf, len);
}
-
-static void show_channels(struct nvhost_master *m, struct output *o)
+static int show_channels(struct device *dev, void *data)
{
- int i;
- nvhost_debug_output(o, "---- channels ----\n");
- for (i = 0; i < m->nb_channels; i++) {
- struct nvhost_channel *ch = &m->channels[i];
+ struct nvhost_channel *ch;
+ struct nvhost_device *nvdev = to_nvhost_device(dev);
+ struct output *o = data;
+ struct nvhost_master *m;
+
+ if (nvdev == NULL)
+ return 0;
+
+ m = nvhost_get_host(nvdev);
+ ch = nvdev->channel;
+ if (ch) {
mutex_lock(&ch->reflock);
if (ch->refcount) {
mutex_lock(&ch->cdma.lock);
- m->op.debug.show_channel_fifo(m, o, i);
- m->op.debug.show_channel_cdma(m, o, i);
+ m->op.debug.show_channel_fifo(m, ch, o, nvdev->index);
+ m->op.debug.show_channel_cdma(m, ch, o, nvdev->index);
mutex_unlock(&ch->cdma.lock);
}
mutex_unlock(&ch->reflock);
}
-}
+ return 0;
+}
static void show_syncpts(struct nvhost_master *m, struct output *o)
{
@@ -94,12 +101,12 @@ static void show_all(struct nvhost_master *m, struct output *o)
m->op.debug.show_mlocks(m, o);
show_syncpts(m, o);
- show_channels(m, o);
+ nvhost_debug_output(o, "---- channels ----\n");
+ bus_for_each_dev(&nvhost_bus_type, NULL, o, show_channels);
nvhost_module_idle(m->dev);
}
-
#ifdef CONFIG_DEBUG_FS
static int nvhost_debug_show(struct seq_file *s, void *unused)
{
diff --git a/drivers/video/tegra/host/host1x/host1x_debug.c b/drivers/video/tegra/host/host1x/host1x_debug.c
index 06b09d20c55b..1a1d764bbd63 100644
--- a/drivers/video/tegra/host/host1x/host1x_debug.c
+++ b/drivers/video/tegra/host/host1x/host1x_debug.c
@@ -259,9 +259,9 @@ u32 previous_oppair(struct nvhost_cdma *cdma, u32 cur)
}
static void t20_debug_show_channel_cdma(struct nvhost_master *m,
- struct output *o, int chid)
+ struct nvhost_channel *ch, struct output *o, int chid)
{
- struct nvhost_channel *channel = m->channels + chid;
+ struct nvhost_channel *channel = ch;
struct nvhost_cdma *cdma = &channel->cdma;
u32 dmaput, dmaget, dmactrl;
u32 cbstat, cbread;
@@ -322,10 +322,10 @@ static void t20_debug_show_channel_cdma(struct nvhost_master *m,
}
void t20_debug_show_channel_fifo(struct nvhost_master *m,
- struct output *o, int chid)
+ struct nvhost_channel *ch, struct output *o, int chid)
{
u32 val, rd_ptr, wr_ptr, start, end;
- struct nvhost_channel *channel = m->channels + chid;
+ struct nvhost_channel *channel = ch;
int state, count;
nvhost_debug_output(o, "%d: fifo:\n", chid);