From b8c4bf16077a04daf2c895be7cf8da030e45b60e Mon Sep 17 00:00:00 2001 From: Mayuresh Kulkarni Date: Mon, 18 Jun 2012 12:35:01 +0530 Subject: video: tegra: host: add public APIs for power & syncpoint management - add public APIs for power & sync-point management - all these APIs end with string _ext - all these APIs can be found in linux/nvhost.h - all these APIs take nvhost_device as first argument - all these APIs are based on the fact that host1x hardware driver is parent of all the host1x client driver - this allows clients of host1x which are outside host1x driver code to just include nvhost.h & use host1x driver interfaces - this also hides the implementation details of power & sync-point inside host1x driver code - move sync point ids for dc and nvavp to nvhost.h Bug 961009 Change-Id: I1a9ca074df87656c4d4bd246853e039a7850d56a Signed-off-by: Mayuresh Kulkarni Reviewed-on: http://git-master/r/109219 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit --- include/linux/nvhost.h | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h index 2f2d615febae..f84749a75df9 100644 --- a/include/linux/nvhost.h +++ b/include/linux/nvhost.h @@ -27,6 +27,7 @@ #include struct nvhost_master; + struct nvhost_device_power_attr; #define NVHOST_MODULE_MAX_CLOCKS 3 @@ -34,6 +35,25 @@ struct nvhost_device_power_attr; #define NVHOST_MODULE_NO_POWERGATE_IDS .powergate_ids = {-1, -1} #define NVHOST_DEFAULT_CLOCKGATE_DELAY .clockgate_delay = 25 #define NVHOST_NAME_SIZE 24 +#define NVSYNCPT_INVALID (-1) + +/* FIXME: + * Sync point ids are now split into 2 files. + * 1 if this one and other is in + * drivers/video/tegra/host/host1x/host1x_syncpt.h + * So if someone decides to add new sync point in future + * please check both the header files + */ +#define NVSYNCPT_DISP0_A (8) +#define NVSYNCPT_DISP1_A (9) +#define NVSYNCPT_AVP_0 (10) +#define NVSYNCPT_DISP0_B (20) +#define NVSYNCPT_DISP1_B (21) +#define NVSYNCPT_DISP0_C (24) +#define NVSYNCPT_DISP1_C (25) +#define NVSYNCPT_VBLANK0 (26) +#define NVSYNCPT_VBLANK1 (27) +#define NVSYNCPT_DSI (31) enum nvhost_power_sysfs_attributes { NVHOST_POWER_SYSFS_ATTRIB_CLOCKGATE_DELAY = 0, @@ -168,13 +188,24 @@ extern int nvhost_get_irq_byname(struct nvhost_device *, const char *); #define nvhost_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) #define nvhost_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data)) -static inline struct nvhost_master *nvhost_get_host(struct nvhost_device *_dev) + +int nvhost_bus_add_host(struct nvhost_master *host); + +static inline struct nvhost_device *nvhost_get_parent(struct nvhost_device *_dev) { - return (_dev->dev.parent) ? \ - ((struct nvhost_master *) dev_get_drvdata(_dev->dev.parent)) : \ - ((struct nvhost_master *) dev_get_drvdata(&(_dev->dev))); + return _dev->dev.parent ? to_nvhost_device(_dev->dev.parent) : NULL; } -int nvhost_bus_add_host(struct nvhost_master *host); +/* public host1x power management APIs */ +bool nvhost_module_powered_ext(struct nvhost_device *dev); +void nvhost_module_busy_ext(struct nvhost_device *dev); +void nvhost_module_idle_ext(struct nvhost_device *dev); + +/* public host1x sync-point management APIs */ +u32 nvhost_syncpt_incr_max_ext(struct nvhost_device *dev, u32 id, u32 incrs); +void nvhost_syncpt_cpu_incr_ext(struct nvhost_device *dev, u32 id); +u32 nvhost_syncpt_read_ext(struct nvhost_device *dev, u32 id); +int nvhost_syncpt_wait_timeout_ext(struct nvhost_device *dev, u32 id, u32 thresh, + u32 timeout, u32 *value); #endif -- cgit v1.2.3