summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/nvhost_syncpt.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-05-30 15:28:19 +0300
committerSimone Willett <swillett@nvidia.com>2012-06-14 16:29:58 -0700
commitf2dd85f69f329f372db29d2e20d71f7e0e0f85bb (patch)
tree5c5d9cc279844dc31a5b4346c4f45b9d9c9ac790 /drivers/video/tegra/host/nvhost_syncpt.c
parent9774bbe31a0741ad71929156f59afdb2aba4eae5 (diff)
video: tegra: host: Parametrize host1x
Add parameters in host1x nvhost_device on * number of sync points * number of wait bases * number of channels * number of mlocks * client managed bitmask * naming of sync points Add automatically generated headers and use symbols from them to access hardware. Move host1x device definition from generic host1x to SoC specific source files t20.c and t30.c. Bug 982965 Change-Id: Ibec84be22d75b363900d10bcbd59d4d8321d54a1 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/104974 Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/nvhost_syncpt.c')
-rw-r--r--drivers/video/tegra/host/nvhost_syncpt.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c
index 34f7a0b08315..06f535207876 100644
--- a/drivers/video/tegra/host/nvhost_syncpt.c
+++ b/drivers/video/tegra/host/nvhost_syncpt.c
@@ -40,9 +40,9 @@ void nvhost_syncpt_reset(struct nvhost_syncpt *sp)
u32 i;
BUG_ON(!(syncpt_op().reset && syncpt_op().reset_wait_base));
- for (i = 0; i < sp->nb_pts; i++)
+ for (i = 0; i < nvhost_syncpt_nb_pts(sp); i++)
syncpt_op().reset(sp, i);
- for (i = 0; i < sp->nb_bases; i++)
+ for (i = 0; i < nvhost_syncpt_nb_bases(sp); i++)
syncpt_op().reset_wait_base(sp, i);
wmb();
}
@@ -55,14 +55,14 @@ void nvhost_syncpt_save(struct nvhost_syncpt *sp)
u32 i;
BUG_ON(!(syncpt_op().update_min && syncpt_op().read_wait_base));
- for (i = 0; i < sp->nb_pts; i++) {
- if (client_managed(i))
+ for (i = 0; i < nvhost_syncpt_nb_pts(sp); i++) {
+ if (nvhost_syncpt_client_managed(sp, i))
syncpt_op().update_min(sp, i);
else
BUG_ON(!nvhost_syncpt_min_eq_max(sp, i));
}
- for (i = 0; i < sp->nb_bases; i++)
+ for (i = 0; i < nvhost_syncpt_nb_bases(sp); i++)
syncpt_op().read_wait_base(sp, i);
}
@@ -123,7 +123,7 @@ void nvhost_syncpt_cpu_incr(struct nvhost_syncpt *sp, u32 id)
*/
void nvhost_syncpt_incr(struct nvhost_syncpt *sp, u32 id)
{
- if (client_managed(id))
+ if (nvhost_syncpt_client_managed(sp, id))
nvhost_syncpt_incr_max(sp, id, 1);
nvhost_module_busy(syncpt_to_dev(sp)->dev);
nvhost_syncpt_cpu_incr(sp, id);
@@ -298,7 +298,7 @@ bool nvhost_syncpt_is_expired(
* If future valueis zero, we have a client managed sync point. In that
* case we do a direct comparison.
*/
- if (!client_managed(id))
+ if (!nvhost_syncpt_client_managed(sp, id))
return future_val - thresh >= current_val - thresh;
else
return (s32)(current_val - thresh) >= 0;
@@ -368,10 +368,15 @@ int nvhost_syncpt_init(struct nvhost_device *dev,
int err = 0;
/* Allocate structs for min, max and base values */
- sp->min_val = kzalloc(sizeof(atomic_t) * sp->nb_pts, GFP_KERNEL);
- sp->max_val = kzalloc(sizeof(atomic_t) * sp->nb_pts, GFP_KERNEL);
- sp->base_val = kzalloc(sizeof(u32) * sp->nb_bases, GFP_KERNEL);
- sp->lock_counts = kzalloc(sizeof(atomic_t) * sp->nb_mlocks, GFP_KERNEL);
+ sp->min_val = kzalloc(sizeof(atomic_t) * nvhost_syncpt_nb_pts(sp),
+ GFP_KERNEL);
+ sp->max_val = kzalloc(sizeof(atomic_t) * nvhost_syncpt_nb_pts(sp),
+ GFP_KERNEL);
+ sp->base_val = kzalloc(sizeof(u32) * nvhost_syncpt_nb_bases(sp),
+ GFP_KERNEL);
+ sp->lock_counts =
+ kzalloc(sizeof(atomic_t) * nvhost_syncpt_nb_mlocks(sp),
+ GFP_KERNEL);
if (!(sp->min_val && sp->max_val && sp->base_val && sp->lock_counts)) {
/* frees happen in the deinit */
@@ -386,15 +391,15 @@ int nvhost_syncpt_init(struct nvhost_device *dev,
}
/* Allocate two attributes for each sync point: min and max */
- sp->syncpt_attrs = kzalloc(sizeof(*sp->syncpt_attrs) * sp->nb_pts * 2,
- GFP_KERNEL);
+ sp->syncpt_attrs = kzalloc(sizeof(*sp->syncpt_attrs)
+ * nvhost_syncpt_nb_pts(sp) * 2, GFP_KERNEL);
if (!sp->syncpt_attrs) {
err = -ENOMEM;
goto fail;
}
/* Fill in the attributes */
- for (i = 0; i < sp->nb_pts; i++) {
+ for (i = 0; i < nvhost_syncpt_nb_pts(sp); i++) {
char name[MAX_SYNCPT_LENGTH];
struct kobject *kobj;
struct nvhost_syncpt_attr *min = &sp->syncpt_attrs[i*2];
@@ -455,3 +460,23 @@ void nvhost_syncpt_deinit(struct nvhost_syncpt *sp)
kfree(sp->syncpt_attrs);
sp->syncpt_attrs = NULL;
}
+
+int nvhost_syncpt_client_managed(struct nvhost_syncpt *sp, u32 id)
+{
+ return BIT(id) & syncpt_to_dev(sp)->info.client_managed;
+}
+
+int nvhost_syncpt_nb_pts(struct nvhost_syncpt *sp)
+{
+ return syncpt_to_dev(sp)->info.nb_pts;
+}
+
+int nvhost_syncpt_nb_bases(struct nvhost_syncpt *sp)
+{
+ return syncpt_to_dev(sp)->info.nb_bases;
+}
+
+int nvhost_syncpt_nb_mlocks(struct nvhost_syncpt *sp)
+{
+ return syncpt_to_dev(sp)->info.nb_mlocks;
+}