diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2011-09-01 08:05:10 +0300 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:49:11 -0800 |
commit | 17bbd9c676aa818a9b28b77b84c1e28cd080b08e (patch) | |
tree | 98db15a91924ee0670afba961658a7a7a79d8ae5 /drivers/video/tegra/host/nvhost_acm.h | |
parent | 4faee0163e39b1bb91b7e987732ae63884c11f88 (diff) |
nvhost: Modularize ACM code
Refactor nvhost_acm.c so that module specific code can be separated from
generic code:
* Module clock and power op descriptions added to channelmap table
* New module busy/idle interface added
* 3D clock scaling for Tegra3 moved behind the module busy/idle API
* 3D power off code moved to 3dctx where it belongs
* Module power on API removed as there were no users
* Get/Set rate moved to Tegra3 specific file
Bug 870791
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/51275
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
(cherry-picked from ebea06768d9c9d351a7d1c8dc6499c97f2f5002d)
Change-Id: I5857c7db4bbf936a694239a4a3493f2cb95426a1
Reviewed-on: http://git-master/r/56268
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Rebase-Id: Reaccd277c8f4fe12a4f7453cc4e787334122a3b8
Diffstat (limited to 'drivers/video/tegra/host/nvhost_acm.h')
-rw-r--r-- | drivers/video/tegra/host/nvhost_acm.h | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/drivers/video/tegra/host/nvhost_acm.h b/drivers/video/tegra/host/nvhost_acm.h index c726277ca00d..a31219eef97e 100644 --- a/drivers/video/tegra/host/nvhost_acm.h +++ b/drivers/video/tegra/host/nvhost_acm.h @@ -29,60 +29,72 @@ #include <linux/clk.h> #define NVHOST_MODULE_MAX_CLOCKS 3 - +#define NVHOST_MODULE_MAX_POWERGATE_IDS 2 struct nvhost_module; +struct nvhost_master; -enum nvhost_power_action { - NVHOST_POWER_ACTION_OFF, - NVHOST_POWER_ACTION_ON, +struct nvhost_moduledesc_clock { + char *name; + long default_rate; }; -typedef void (*nvhost_modulef)(struct nvhost_module *mod, enum nvhost_power_action action); +#define NVHOST_MODULE_NO_POWERGATING .powergate_ids = {-1, -1} +#define NVHOST_DEFAULT_POWERDOWN_DELAY .powerdown_delay = 25 -struct nvhost_module_client { - struct list_head node; - unsigned long rate[NVHOST_MODULE_MAX_CLOCKS]; - void *priv; -}; +struct nvhost_moduledesc { + void (*prepare_poweroff)(struct nvhost_module *mod); + void (*finalize_poweron)(struct nvhost_module *mod); + void (*busy)(struct nvhost_module *); + void (*idle)(struct nvhost_module *); + void (*suspend)(struct nvhost_module *); + void (*init)(struct device *dev, struct nvhost_module *); + void (*deinit)(struct device *dev, struct nvhost_module *); -struct nvhost_module_clock_info { - struct clk *clk; - unsigned long default_rate; + int powergate_ids[NVHOST_MODULE_MAX_POWERGATE_IDS]; + bool can_powergate; + int powerdown_delay; + struct nvhost_moduledesc_clock clocks[NVHOST_MODULE_MAX_CLOCKS]; }; struct nvhost_module { const char *name; - nvhost_modulef func; struct delayed_work powerdown; - struct nvhost_module_clock_info clk[NVHOST_MODULE_MAX_CLOCKS]; int num_clks; + struct clk *clk[NVHOST_MODULE_MAX_CLOCKS]; struct mutex lock; bool powered; atomic_t refcount; wait_queue_head_t idle; struct nvhost_module *parent; - bool can_powergate; - int powergate_id; - int powergate_id2; - int powerdown_delay; + const struct nvhost_moduledesc *desc; struct list_head client_list; }; int nvhost_module_init(struct nvhost_module *mod, const char *name, - nvhost_modulef func, struct nvhost_module *parent, + const struct nvhost_moduledesc *desc, + struct nvhost_module *parent, struct device *dev); -void nvhost_module_deinit(struct nvhost_module *mod); +void nvhost_module_deinit(struct device *dev, struct nvhost_module *mod); void nvhost_module_suspend(struct nvhost_module *mod, bool system_suspend); -void nvhost_module_reset(struct nvhost_module *mod); +void nvhost_module_reset(struct device *dev, struct nvhost_module *mod); void nvhost_module_busy(struct nvhost_module *mod); void nvhost_module_idle_mult(struct nvhost_module *mod, int refs); -int nvhost_module_add_client(struct nvhost_module *mod, void *priv); -void nvhost_module_remove_client(struct nvhost_module *mod, void *priv); -int nvhost_module_get_rate(struct nvhost_module *mod, unsigned long *rate, - int index); -int nvhost_module_set_rate(struct nvhost_module *mod, void *priv, - unsigned long rate, int index); +int nvhost_module_add_client(struct nvhost_master *host, + struct nvhost_module *mod, + void *priv); +void nvhost_module_remove_client(struct nvhost_master *host, + struct nvhost_module *mod, + void *priv); +int nvhost_module_get_rate(struct nvhost_master *host, + struct nvhost_module *mod, + unsigned long *rate, + int index); +int nvhost_module_set_rate(struct nvhost_master *host, + struct nvhost_module *mod, void *priv, + unsigned long rate, int index); + +#define host_acm_op(host) (host->op.acm) static inline bool nvhost_module_powered(struct nvhost_module *mod) { @@ -94,10 +106,5 @@ static inline void nvhost_module_idle(struct nvhost_module *mod) nvhost_module_idle_mult(mod, 1); } -/* - * call when performing submit to notify scaling mechanism that 3d module is - * in use - */ -void module3d_notify_busy(void); #endif |