struct sync_fence *tegra_dc_create_fence(struct tegra_dc *dc, int i, u32 val)
{
struct nvhost_ctrl_sync_fence_info syncpt;
- struct nvhost_master *host = nvhost_get_host(dc->ndev);
u32 id = tegra_dc_get_syncpt_id(dc, i);
syncpt.id = id;
syncpt.thresh = val;
- return nvhost_sync_create_fence(&host->syncpt, &syncpt, 1,
- dev_name(&dc->ndev->dev));
+ return nvhost_sync_create_fence(
+ to_platform_device(dc->ndev->dev.parent),
+ &syncpt, 1, dev_name(&dc->ndev->dev));
}
void
pts[i].thresh = job->sp[i].fence;
}
- err = nvhost_sync_create_fence_fd(
- &nvhost_get_host(ctx->ch->dev)->syncpt,
+ err = nvhost_sync_create_fence_fd(ctx->ch->dev,
pts, num_syncpt_incrs, "fence", &args->fence);
if (err)
goto fail;
&pt.id, &pt.thresh);
if (err)
return err;
- return nvhost_sync_create_fence_fd(sp->sp, &pt, 1, "fence", fd);
+ return nvhost_sync_create_fence_fd(sp->c->g->dev, &pt, 1, "fence", fd);
#else
return -ENODEV;
#endif
}
}
- err = nvhost_sync_create_fence_fd(&ctx->dev->syncpt, pts, args->num_pts,
- name, &args->fence_fd);
+ err = nvhost_sync_create_fence_fd(ctx->dev->dev, pts, args->num_pts,
+ name, &args->fence_fd);
out:
kfree(pts);
return err;
return fence;
}
+EXPORT_SYMBOL(nvhost_sync_fdget);
int nvhost_sync_num_pts(struct sync_fence *fence)
{
return num;
}
+EXPORT_SYMBOL(nvhost_sync_num_pts);
u32 nvhost_sync_pt_id(struct sync_pt *__pt)
{
struct nvhost_sync_pt *pt = to_nvhost_sync_pt(__pt);
return pt->obj->id;
}
+EXPORT_SYMBOL(nvhost_sync_pt_id);
u32 nvhost_sync_pt_thresh(struct sync_pt *__pt)
{
struct nvhost_sync_pt *pt = to_nvhost_sync_pt(__pt);
return pt->thresh;
}
+EXPORT_SYMBOL(nvhost_sync_pt_thresh);
/* Public API */
sync_timeline_signal(&obj->obj);
}
-int nvhost_sync_create_fence_fd(struct nvhost_syncpt *sp,
+int nvhost_sync_create_fence_fd(struct platform_device *pdev,
struct nvhost_ctrl_sync_fence_info *pts,
u32 num_pts, const char *name, int *fence_fd)
{
int err;
struct sync_fence *fence = NULL;
- fence = nvhost_sync_create_fence(sp, pts, num_pts, name);
+ fence = nvhost_sync_create_fence(pdev, pts, num_pts, name);
if (fence == NULL) {
err = -EINVAL;
return err;
}
+EXPORT_SYMBOL(nvhost_sync_create_fence_fd);
-struct sync_fence *nvhost_sync_create_fence(struct nvhost_syncpt *sp,
+struct sync_fence *nvhost_sync_create_fence(struct platform_device *pdev,
struct nvhost_ctrl_sync_fence_info *pts,
u32 num_pts, const char *name)
{
+ struct nvhost_master *master = nvhost_get_host(pdev);
+ struct nvhost_syncpt *sp = &master->syncpt;
int err;
u32 i;
struct sync_fence *fence = NULL;
return ERR_PTR(err);
}
+EXPORT_SYMBOL(nvhost_sync_create_fence);
+
void nvhost_sync_pt_signal(struct nvhost_sync_pt *pt);
-int nvhost_sync_create_fence_fd(
- struct nvhost_syncpt *sp,
- struct nvhost_ctrl_sync_fence_info *pts,
- u32 num_pts,
- const char *name,
- s32 *fence_fd);
-struct sync_fence *nvhost_sync_create_fence(
- struct nvhost_syncpt *sp,
- struct nvhost_ctrl_sync_fence_info *pts,
- u32 num_pts,
- const char *name);
-struct sync_fence *nvhost_sync_fdget(int fd);
-int nvhost_sync_num_pts(struct sync_fence *fence);
-u32 nvhost_sync_pt_id(struct sync_pt *pt);
-u32 nvhost_sync_pt_thresh(struct sync_pt *pt);
-
#else
static inline struct nvhost_sync_timeline *nvhost_sync_timeline_create(
struct nvhost_syncpt *sp,
return;
}
-static inline int nvhost_sync_create_fence_fd(
- struct nvhost_syncpt *sp,
- struct nvhost_ctrl_sync_fence_info *pts,
- u32 num_pts,
- const char *name,
- s32 *fence_fd)
-{
- return -EINVAL;
-}
-
-static inline struct sync_fence *nvhost_sync_create_fence(
- struct nvhost_syncpt *sp,
- struct nvhost_ctrl_sync_fence_info *pts,
- u32 num_pts,
- const char *name)
-{
- return ERR_PTR(-EINVAL);
-}
-
-static inline struct sync_fence *nvhost_sync_fdget(int fd)
-{
- return NULL;
-}
-
-static inline int nvhost_sync_num_pts(struct sync_fence *fence)
-{
- return 0;
-}
-
-static inline u32 nvhost_sync_pt_id(struct sync_pt *pt)
-{
- return NVSYNCPT_INVALID;
-}
-
-static inline u32 nvhost_sync_pt_thresh(struct sync_pt *pt)
-{
- return 0;
-}
-
#endif
#endif /* __KERNEL __ */
{
#ifdef CONFIG_TEGRA_GRHOST_SYNC
struct nvhost_ctrl_sync_fence_info pts = {id, thresh};
- struct nvhost_master *master = nvhost_get_host(dev);
- struct nvhost_syncpt *sp = &master->syncpt;
if (id == NVSYNCPT_INVALID) {
dev_err(&dev->dev, "Create Fence called with invalid id\n");
return -EINVAL;
}
- return nvhost_sync_create_fence_fd(sp, &pts, 1, name, fence_fd);
+ return nvhost_sync_create_fence_fd(dev, &pts, 1, name, fence_fd);
#else
return -EINVAL;
#endif
struct nvhost_device_profile;
struct mem_mgr;
struct nvhost_as_moduleops;
+struct nvhost_ctrl_sync_fence_info;
+struct nvhost_sync_timeline;
+struct nvhost_sync_pt;
+struct sync_pt;
#define NVHOST_MODULE_MAX_CLOCKS 7
#define NVHOST_MODULE_MAX_POWERGATE_IDS 2
static inline void nvhost_debug_dump_device(struct platform_device *pdev) {}
#endif
+#ifdef CONFIG_TEGRA_GRHOST_SYNC
+struct sync_fence *nvhost_sync_create_fence(
+ struct platform_device *pdev,
+ struct nvhost_ctrl_sync_fence_info *pts,
+ u32 num_pts,
+ const char *name);
+int nvhost_sync_create_fence_fd(
+ struct platform_device *pdev,
+ struct nvhost_ctrl_sync_fence_info *pts,
+ u32 num_pts,
+ const char *name,
+ s32 *fence_fd);
+struct sync_fence *nvhost_sync_fdget(int fd);
+int nvhost_sync_num_pts(struct sync_fence *fence);
+u32 nvhost_sync_pt_id(struct sync_pt *pt);
+u32 nvhost_sync_pt_thresh(struct sync_pt *pt);
+
+#else
+static inline struct sync_fence *nvhost_sync_create_fence(
+ struct platform_device *pdev,
+ struct nvhost_ctrl_sync_fence_info *pts,
+ u32 num_pts,
+ const char *name)
+{
+ return ERR_PTR(-EINVAL);
+}
+
+static inline int nvhost_sync_create_fence_fd(
+ struct platform_device *pdev,
+ struct nvhost_ctrl_sync_fence_info *pts,
+ u32 num_pts,
+ const char *name,
+ s32 *fence_fd)
+{
+ return -EINVAL;
+}
+
+static inline struct sync_fence *nvhost_sync_fdget(int fd)
+{
+ return NULL;
+}
+
+static inline int nvhost_sync_num_pts(struct sync_fence *fence)
+{
+ return 0;
+}
+
+static inline u32 nvhost_sync_pt_id(struct sync_pt *pt)
+{
+ return NVSYNCPT_INVALID;
+}
+
+static inline u32 nvhost_sync_pt_thresh(struct sync_pt *pt)
+{
+ return 0;
+}
+
+#endif
+
/* Hacky way to get access to struct nvhost_device_data for VI device. */
extern struct nvhost_device_data t20_vi_info;
extern struct nvhost_device_data t30_vi_info;