diff options
author | Mayuresh Kulkarni <mkulkarni@nvidia.com> | 2012-06-18 12:35:01 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-06-25 16:23:31 -0700 |
commit | b8c4bf16077a04daf2c895be7cf8da030e45b60e (patch) | |
tree | 74f3cd4af3a41dca67411f1b33d148e293a2d0b2 /drivers/video/tegra | |
parent | 5a85dacd8707c7764785b6f38172c67a8c7ef4b0 (diff) |
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 <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/109219
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/video/tegra')
-rw-r--r-- | drivers/video/tegra/host/host1x/host1x.h | 12 | ||||
-rw-r--r-- | drivers/video/tegra/host/host1x/host1x_syncpt.h | 16 | ||||
-rw-r--r-- | drivers/video/tegra/host/nvhost_acm.c | 21 | ||||
-rw-r--r-- | drivers/video/tegra/host/nvhost_acm.h | 2 | ||||
-rw-r--r-- | drivers/video/tegra/host/nvhost_syncpt.c | 26 | ||||
-rw-r--r-- | drivers/video/tegra/host/nvhost_syncpt.h | 1 |
6 files changed, 60 insertions, 18 deletions
diff --git a/drivers/video/tegra/host/host1x/host1x.h b/drivers/video/tegra/host/host1x/host1x.h index c602a347f7f9..49916b0757d4 100644 --- a/drivers/video/tegra/host/host1x/host1x.h +++ b/drivers/video/tegra/host/host1x/host1x.h @@ -22,6 +22,8 @@ #define __NVHOST_HOST1X_H #include <linux/cdev.h> +#include <linux/nvhost.h> + #include "nvhost_syncpt.h" #include "nvhost_intr.h" @@ -30,11 +32,10 @@ struct nvhost_channel; struct mem_mgr; -struct nvhost_device; struct host1x_device_info { int nb_channels; /* host1x: num channels supported */ - int nb_pts; /* host1x: num syncpoints supported */ + int nb_pts; /* host1x: num syncpoints supported */ int nb_bases; /* host1x: num syncpoints supported */ u32 client_managed; /* host1x: client managed syncpts */ int nb_mlocks; /* host1x: number of mlocks */ @@ -67,4 +68,11 @@ void nvhost_free_channel(struct nvhost_channel *ch); extern pid_t nvhost_debug_null_kickoff_pid; +static inline struct nvhost_master *nvhost_get_host(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))); +} + #endif diff --git a/drivers/video/tegra/host/host1x/host1x_syncpt.h b/drivers/video/tegra/host/host1x/host1x_syncpt.h index 8440ef1047ed..a971db8b1d94 100644 --- a/drivers/video/tegra/host/host1x/host1x_syncpt.h +++ b/drivers/video/tegra/host/host1x/host1x_syncpt.h @@ -21,9 +21,12 @@ #ifndef __NVHOST_HOST1X_HOST1X_SYNCPT_H #define __NVHOST_HOST1X_HOST1X_SYNCPT_H -#define NVSYNCPT_DISP0_A (8) -#define NVSYNCPT_DISP1_A (9) -#define NVSYNCPT_AVP_0 (10) +/* FIXME: + * Sync point ids are now split into 2 files. + * 1 if this one and other is in include/linux/nvhost.h + * So if someone decides to add new sync point in future + * please check both the header files + */ #define NVSYNCPT_CSI_VI_0 (11) #define NVSYNCPT_CSI_VI_1 (12) #define NVSYNCPT_VI_ISP_0 (13) @@ -33,17 +36,10 @@ #define NVSYNCPT_VI_ISP_4 (17) #define NVSYNCPT_2D_0 (18) #define NVSYNCPT_2D_1 (19) -#define NVSYNCPT_DISP0_B (20) -#define NVSYNCPT_DISP1_B (21) #define NVSYNCPT_3D (22) #define NVSYNCPT_MPE (23) -#define NVSYNCPT_DISP0_C (24) -#define NVSYNCPT_DISP1_C (25) -#define NVSYNCPT_VBLANK0 (26) -#define NVSYNCPT_VBLANK1 (27) #define NVSYNCPT_MPE_EBM_EOF (28) #define NVSYNCPT_MPE_WR_SAFE (29) -#define NVSYNCPT_DSI (31) /* sync points that are wholly managed by the client */ #define NVSYNCPTS_CLIENT_MANAGED ( \ diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c index 37b81d707639..06005c423a21 100644 --- a/drivers/video/tegra/host/nvhost_acm.c +++ b/drivers/video/tegra/host/nvhost_acm.c @@ -31,9 +31,9 @@ #include <mach/clk.h> #include <mach/hardware.h> -#define ACM_SUSPEND_WAIT_FOR_IDLE_TIMEOUT (2 * HZ) -#define POWERGATE_DELAY 10 -#define MAX_DEVID_LENGTH 16 +#define ACM_SUSPEND_WAIT_FOR_IDLE_TIMEOUT (2 * HZ) +#define POWERGATE_DELAY 10 +#define MAX_DEVID_LENGTH 16 DEFINE_MUTEX(client_list_lock); @@ -610,3 +610,18 @@ void nvhost_module_deinit(struct nvhost_device *dev) dev->powerstate = NVHOST_POWER_STATE_DEINIT; } +/* public host1x power management APIs */ +bool nvhost_module_powered_ext(struct nvhost_device *dev) +{ + return nvhost_module_powered(dev); +} + +void nvhost_module_busy_ext(struct nvhost_device *dev) +{ + nvhost_module_busy(dev); +} + +void nvhost_module_idle_ext(struct nvhost_device *dev) +{ + nvhost_module_idle(dev); +} diff --git a/drivers/video/tegra/host/nvhost_acm.h b/drivers/video/tegra/host/nvhost_acm.h index d2562e9a369f..a5894dcfc0b2 100644 --- a/drivers/video/tegra/host/nvhost_acm.h +++ b/drivers/video/tegra/host/nvhost_acm.h @@ -45,7 +45,6 @@ int nvhost_module_get_rate(struct nvhost_device *dev, int nvhost_module_set_rate(struct nvhost_device *dev, void *priv, unsigned long rate, int index); - static inline bool nvhost_module_powered(struct nvhost_device *dev) { return dev->powerstate == NVHOST_POWER_STATE_RUNNING; @@ -56,5 +55,4 @@ static inline void nvhost_module_idle(struct nvhost_device *dev) nvhost_module_idle_mult(dev, 1); } - #endif diff --git a/drivers/video/tegra/host/nvhost_syncpt.c b/drivers/video/tegra/host/nvhost_syncpt.c index 06f535207876..9fa7d0652c1f 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.c +++ b/drivers/video/tegra/host/nvhost_syncpt.c @@ -480,3 +480,29 @@ int nvhost_syncpt_nb_mlocks(struct nvhost_syncpt *sp) { return syncpt_to_dev(sp)->info.nb_mlocks; } + +/* public sync point API */ +u32 nvhost_syncpt_incr_max_ext(struct nvhost_device *dev, u32 id, u32 incrs) +{ + struct nvhost_syncpt *sp = &(nvhost_get_host(dev)->syncpt); + return nvhost_syncpt_incr_max(sp, id, incrs); +} + +void nvhost_syncpt_cpu_incr_ext(struct nvhost_device *dev, u32 id) +{ + struct nvhost_syncpt *sp = &(nvhost_get_host(dev)->syncpt); + nvhost_syncpt_cpu_incr(sp, id); +} + +u32 nvhost_syncpt_read_ext(struct nvhost_device *dev, u32 id) +{ + struct nvhost_syncpt *sp = &(nvhost_get_host(dev)->syncpt); + return nvhost_syncpt_read(sp, id); +} + +int nvhost_syncpt_wait_timeout_ext(struct nvhost_device *dev, u32 id, u32 thresh, + u32 timeout, u32 *value) +{ + struct nvhost_syncpt *sp = &(nvhost_get_host(dev)->syncpt); + return nvhost_syncpt_wait_timeout(sp, id, thresh, timeout, value); +} diff --git a/drivers/video/tegra/host/nvhost_syncpt.h b/drivers/video/tegra/host/nvhost_syncpt.h index 04402fb6ac51..9ee4f3a8d49d 100644 --- a/drivers/video/tegra/host/nvhost_syncpt.h +++ b/drivers/video/tegra/host/nvhost_syncpt.h @@ -28,7 +28,6 @@ /* host managed and invalid syncpt id */ #define NVSYNCPT_GRAPHICS_HOST (0) -#define NVSYNCPT_INVALID (-1) /* Attribute struct for sysfs min and max attributes */ struct nvhost_syncpt_attr { |