Commit f0271d65 authored by Paul Walmsley's avatar Paul Walmsley

OMAP clockdomain/powerdomain: improve documentation

This patch only affects documentation; no functional changes are
included.

Clean up comments in the current clockdomain, powerdomain code and
header files.  This mostly involves conversion to kerneldoc format,
although some clarifications are also included.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
parent 915aad89
...@@ -351,10 +351,10 @@ static void _init_sleepdep_usecount(struct clockdomain *clkdm) ...@@ -351,10 +351,10 @@ static void _init_sleepdep_usecount(struct clockdomain *clkdm)
* @init_autodeps: optional pointer to an array of autodeps to register * @init_autodeps: optional pointer to an array of autodeps to register
* *
* Set up internal state. If a pointer to an array of clockdomains * Set up internal state. If a pointer to an array of clockdomains
* was supplied, loop through the list of clockdomains, register all * @clkdms was supplied, loop through the list of clockdomains,
* that are available on the current platform. Similarly, if a pointer * register all that are available on the current platform. Similarly,
* to an array of clockdomain autodependencies was provided, register * if a pointer to an array of clockdomain autodependencies
* those. No return value. * @init_autodeps was provided, register those. No return value.
*/ */
void clkdm_init(struct clockdomain **clkdms, void clkdm_init(struct clockdomain **clkdms,
struct clkdm_autodep *init_autodeps) struct clkdm_autodep *init_autodeps)
...@@ -386,8 +386,8 @@ void clkdm_init(struct clockdomain **clkdms, ...@@ -386,8 +386,8 @@ void clkdm_init(struct clockdomain **clkdms,
* clkdm_lookup - look up a clockdomain by name, return a pointer * clkdm_lookup - look up a clockdomain by name, return a pointer
* @name: name of clockdomain * @name: name of clockdomain
* *
* Find a registered clockdomain by its name. Returns a pointer to the * Find a registered clockdomain by its name @name. Returns a pointer
* struct clockdomain if found, or NULL otherwise. * to the struct clockdomain if found, or NULL otherwise.
*/ */
struct clockdomain *clkdm_lookup(const char *name) struct clockdomain *clkdm_lookup(const char *name)
{ {
...@@ -412,8 +412,8 @@ struct clockdomain *clkdm_lookup(const char *name) ...@@ -412,8 +412,8 @@ struct clockdomain *clkdm_lookup(const char *name)
* clkdm_for_each - call function on each registered clockdomain * clkdm_for_each - call function on each registered clockdomain
* @fn: callback function * * @fn: callback function *
* *
* Call the supplied function for each registered clockdomain. * Call the supplied function @fn for each registered clockdomain.
* The callback function can return anything but 0 to bail * The callback function @fn can return anything but 0 to bail
* out early from the iterator. The callback function is called with * out early from the iterator. The callback function is called with
* the clkdm_mutex held, so no clockdomain structure manipulation * the clkdm_mutex held, so no clockdomain structure manipulation
* functions should be called from the callback, although hardware * functions should be called from the callback, although hardware
...@@ -446,7 +446,7 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user), ...@@ -446,7 +446,7 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* *
* Return a pointer to the struct powerdomain that the specified clockdomain * Return a pointer to the struct powerdomain that the specified clockdomain
* 'clkdm' exists in, or returns NULL if clkdm argument is NULL. * @clkdm exists in, or returns NULL if @clkdm is NULL.
*/ */
struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm) struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)
{ {
...@@ -759,10 +759,10 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm) ...@@ -759,10 +759,10 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
/** /**
* omap2_clkdm_clktrctrl_read - read the clkdm's current state transition mode * omap2_clkdm_clktrctrl_read - read the clkdm's current state transition mode
* @clk: struct clk * of a clockdomain * @clkdm: struct clkdm * of a clockdomain
* *
* Return the clockdomain's current state transition mode from the * Return the clockdomain @clkdm current state transition mode from the
* corresponding domain OMAP2_CM_CLKSTCTRL register. Returns -EINVAL if clk * corresponding domain CM_CLKSTCTRL register. Returns -EINVAL if @clkdm
* is NULL or the current mode upon success. * is NULL or the current mode upon success.
*/ */
static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm) static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
...@@ -784,7 +784,7 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm) ...@@ -784,7 +784,7 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* *
* Instruct the CM to force a sleep transition on the specified * Instruct the CM to force a sleep transition on the specified
* clockdomain 'clkdm'. Returns -EINVAL if clk is NULL or if * clockdomain @clkdm. Returns -EINVAL if @clkdm is NULL or if
* clockdomain does not support software-initiated sleep; 0 upon * clockdomain does not support software-initiated sleep; 0 upon
* success. * success.
*/ */
...@@ -828,7 +828,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm) ...@@ -828,7 +828,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* *
* Instruct the CM to force a wakeup transition on the specified * Instruct the CM to force a wakeup transition on the specified
* clockdomain 'clkdm'. Returns -EINVAL if clkdm is NULL or if the * clockdomain @clkdm. Returns -EINVAL if @clkdm is NULL or if the
* clockdomain does not support software-controlled wakeup; 0 upon * clockdomain does not support software-controlled wakeup; 0 upon
* success. * success.
*/ */
...@@ -871,7 +871,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm) ...@@ -871,7 +871,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
* omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* *
* Allow the hardware to automatically switch the clockdomain into * Allow the hardware to automatically switch the clockdomain @clkdm into
* active or idle states, as needed by downstream clocks. If the * active or idle states, as needed by downstream clocks. If the
* clockdomain has any downstream clocks enabled in the clock * clockdomain has any downstream clocks enabled in the clock
* framework, wkdep/sleepdep autodependencies are added; this is so * framework, wkdep/sleepdep autodependencies are added; this is so
...@@ -904,8 +904,8 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm) ...@@ -904,8 +904,8 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* *
* Prevent the hardware from automatically switching the clockdomain * Prevent the hardware from automatically switching the clockdomain
* into inactive or idle states. If the clockdomain has downstream * @clkdm into inactive or idle states. If the clockdomain has
* clocks enabled in the clock framework, wkdep/sleepdep * downstream clocks enabled in the clock framework, wkdep/sleepdep
* autodependencies are removed. No return value. * autodependencies are removed. No return value.
*/ */
void omap2_clkdm_deny_idle(struct clockdomain *clkdm) void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
...@@ -936,14 +936,14 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm) ...@@ -936,14 +936,14 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* @clk: struct clk * of the enabled downstream clock * @clk: struct clk * of the enabled downstream clock
* *
* Increment the usecount of this clockdomain 'clkdm' and ensure that * Increment the usecount of the clockdomain @clkdm and ensure that it
* it is awake. Intended to be called by clk_enable() code. If the * is awake before @clk is enabled. Intended to be called by
* clockdomain is in software-supervised idle mode, force the * clk_enable() code. If the clockdomain is in software-supervised
* clockdomain to wake. If the clockdomain is in hardware-supervised * idle mode, force the clockdomain to wake. If the clockdomain is in
* idle mode, add clkdm-pwrdm autodependencies, to ensure that devices * hardware-supervised idle mode, add clkdm-pwrdm autodependencies, to
* in the clockdomain can be read from/written to by on-chip processors. * ensure that devices in the clockdomain can be read from/written to
* Returns -EINVAL if passed null pointers; returns 0 upon success or * by on-chip processors. Returns -EINVAL if passed null pointers;
* if the clockdomain is in hwsup idle mode. * returns 0 upon success or if the clockdomain is in hwsup idle mode.
*/ */
int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
{ {
...@@ -988,13 +988,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) ...@@ -988,13 +988,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
* @clk: struct clk * of the disabled downstream clock * @clk: struct clk * of the disabled downstream clock
* *
* Decrement the usecount of this clockdomain 'clkdm'. Intended to be * Decrement the usecount of this clockdomain @clkdm when @clk is
* called by clk_disable() code. If the usecount goes to 0, put the * disabled. Intended to be called by clk_disable() code. If the
* clockdomain to sleep (software-supervised mode) or remove the * clockdomain usecount goes to 0, put the clockdomain to sleep
* clkdm-pwrdm autodependencies (hardware-supervised mode). Returns * (software-supervised mode) or remove the clkdm autodependencies
* -EINVAL if passed null pointers; -ERANGE if the clkdm usecount * (hardware-supervised mode). Returns -EINVAL if passed null
* underflows and debugging is enabled; or returns 0 upon success or * pointers; -ERANGE if the @clkdm usecount underflows and debugging
* if the clockdomain is in hwsup idle mode. * is enabled; or returns 0 upon success or if the clockdomain is in
* hwsup idle mode.
*/ */
int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
{ {
......
This diff is collapsed.
...@@ -40,86 +40,77 @@ ...@@ -40,86 +40,77 @@
#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2 #define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2
#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3 #define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3
/* /**
* struct clkdm_autodep - a clockdomain that should have wkdeps * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
* and sleepdeps added when a clockdomain should stay active in hwsup mode; * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
* and conversely, removed when the clockdomain should be allowed to go * @omap_chip: OMAP chip types that this autodep is valid on
* inactive in hwsup mode. *
* A clockdomain that should have wkdeps and sleepdeps added when a
* clockdomain should stay active in hwsup mode; and conversely,
* removed when the clockdomain should be allowed to go inactive in
* hwsup mode.
*
* Autodeps are deprecated and should be removed after
* omap_hwmod-based fine-grained module idle control is added.
*/ */
struct clkdm_autodep { struct clkdm_autodep {
union { union {
/* Name of the clockdomain to add a wkdep/sleepdep on */
const char *name; const char *name;
/* Clockdomain pointer (looked up at clkdm_init() time) */
struct clockdomain *ptr; struct clockdomain *ptr;
} clkdm; } clkdm;
/* OMAP chip types that this clockdomain dep is valid on */
const struct omap_chip_id omap_chip; const struct omap_chip_id omap_chip;
}; };
/* Encodes dependencies between clockdomains - statically defined */ /**
* struct clkdm_dep - encode dependencies between clockdomains
* @clkdm_name: clockdomain name
* @clkdm: pointer to the struct clockdomain of @clkdm_name
* @omap_chip: OMAP chip types that this dependency is valid on
* @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
* @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
*
* Statically defined. @clkdm is resolved from @clkdm_name at runtime and
* should not be pre-initialized.
*
* XXX Should also include hardware (fixed) dependencies.
*/
struct clkdm_dep { struct clkdm_dep {
/* Clockdomain name */
const char *clkdm_name; const char *clkdm_name;
/* Clockdomain pointer - resolved by the clockdomain code */
struct clockdomain *clkdm; struct clockdomain *clkdm;
/* Number of wakeup dependencies causing this clkdm to wake */
atomic_t wkdep_usecount; atomic_t wkdep_usecount;
/* Number of sleep dependencies that could prevent clkdm from idle */
atomic_t sleepdep_usecount; atomic_t sleepdep_usecount;
/* Flags to mark OMAP chip restrictions, etc. */
const struct omap_chip_id omap_chip; const struct omap_chip_id omap_chip;
}; };
/**
* struct clockdomain - OMAP clockdomain
* @name: clockdomain name
* @pwrdm: powerdomain containing this clockdomain
* @clktrctrl_reg: CLKSTCTRL reg for the given clock domain
* @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
* @flags: Clockdomain capability flags
* @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
* @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
* @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
* @omap_chip: OMAP chip types that this clockdomain is valid on
* @usecount: Usecount tracking
* @node: list_head to link all clockdomains together
*/
struct clockdomain { struct clockdomain {
/* Clockdomain name */
const char *name; const char *name;
union { union {
/* Powerdomain enclosing this clockdomain */
const char *name; const char *name;
/* Powerdomain pointer assigned at clkdm_register() */
struct powerdomain *ptr; struct powerdomain *ptr;
} pwrdm; } pwrdm;
/* CLKSTCTRL reg for the given clock domain*/
void __iomem *clkstctrl_reg; void __iomem *clkstctrl_reg;
/* CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg */
const u16 clktrctrl_mask; const u16 clktrctrl_mask;
/* Clockdomain capability flags */
const u8 flags; const u8 flags;
/* Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit */
const u8 dep_bit; const u8 dep_bit;
/* Clockdomains that can be told to wake this powerdomain up */
struct clkdm_dep *wkdep_srcs; struct clkdm_dep *wkdep_srcs;
/* Clockdomains that can be told to keep this clkdm from inactivity */
struct clkdm_dep *sleepdep_srcs; struct clkdm_dep *sleepdep_srcs;
/* OMAP chip types that this clockdomain is valid on */
const struct omap_chip_id omap_chip; const struct omap_chip_id omap_chip;
/* Usecount tracking */
atomic_t usecount; atomic_t usecount;
struct list_head node; struct list_head node;
}; };
void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps); void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps);
......
...@@ -68,40 +68,36 @@ ...@@ -68,40 +68,36 @@
struct clockdomain; struct clockdomain;
struct powerdomain; struct powerdomain;
/**
* struct powerdomain - OMAP powerdomain
* @name: Powerdomain name
* @omap_chip: represents the OMAP chip types containing this pwrdm
* @prcm_offs: the address offset from CM_BASE/PRM_BASE
* @pwrsts: Possible powerdomain power states
* @pwrsts_logic_ret: Possible logic power states when pwrdm in RETENTION
* @flags: Powerdomain flags
* @banks: Number of software-controllable memory banks in this powerdomain
* @pwrsts_mem_ret: Possible memory bank pwrstates when pwrdm in RETENTION
* @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
* @pwrdm_clkdms: Clockdomains in this powerdomain
* @node: list_head linking all powerdomains
* @state:
* @state_counter:
* @timer:
* @state_timer:
*/
struct powerdomain { struct powerdomain {
/* Powerdomain name */
const char *name; const char *name;
/* Used to represent the OMAP chip types containing this pwrdm */
const struct omap_chip_id omap_chip; const struct omap_chip_id omap_chip;
/* the address offset from CM_BASE/PRM_BASE */
const s16 prcm_offs; const s16 prcm_offs;
/* Possible powerdomain power states */
const u8 pwrsts; const u8 pwrsts;
/* Possible logic power states when pwrdm in RETENTION */
const u8 pwrsts_logic_ret; const u8 pwrsts_logic_ret;
/* Powerdomain flags */
const u8 flags; const u8 flags;
/* Number of software-controllable memory banks in this powerdomain */
const u8 banks; const u8 banks;
/* Possible memory bank pwrstates when pwrdm in RETENTION */
const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS]; const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];
/* Possible memory bank pwrstates when pwrdm is ON */
const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS]; const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS];
/* Clockdomains in this powerdomain */
struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS]; struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
struct list_head node; struct list_head node;
int state; int state;
unsigned state_counter[PWRDM_MAX_PWRSTS]; unsigned state_counter[PWRDM_MAX_PWRSTS];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment