aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:02 -0500
committerPaul Walmsley <paul@pwsan.com>2010-01-26 22:13:02 -0500
commitf0271d65f9ac511d2e3e1fdbcd7418a5a7df0769 (patch)
tree11955198152ab0fcef09adc276dd98e3dc5c898c /arch/arm
parent915aad89fcc57a03511c69915b3876f4e53074ee (diff)
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: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/clockdomain.c65
-rw-r--r--arch/arm/mach-omap2/powerdomain.c149
-rw-r--r--arch/arm/plat-omap/include/plat/clockdomain.h87
-rw-r--r--arch/arm/plat-omap/include/plat/powerdomain.h40
4 files changed, 167 insertions, 174 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 6eaa9314cd64..a38a615b422f 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -351,10 +351,10 @@ static void _init_sleepdep_usecount(struct clockdomain *clkdm)
351 * @init_autodeps: optional pointer to an array of autodeps to register 351 * @init_autodeps: optional pointer to an array of autodeps to register
352 * 352 *
353 * Set up internal state. If a pointer to an array of clockdomains 353 * Set up internal state. If a pointer to an array of clockdomains
354 * was supplied, loop through the list of clockdomains, register all 354 * @clkdms was supplied, loop through the list of clockdomains,
355 * that are available on the current platform. Similarly, if a pointer 355 * register all that are available on the current platform. Similarly,
356 * to an array of clockdomain autodependencies was provided, register 356 * if a pointer to an array of clockdomain autodependencies
357 * those. No return value. 357 * @init_autodeps was provided, register those. No return value.
358 */ 358 */
359void clkdm_init(struct clockdomain **clkdms, 359void clkdm_init(struct clockdomain **clkdms,
360 struct clkdm_autodep *init_autodeps) 360 struct clkdm_autodep *init_autodeps)
@@ -386,8 +386,8 @@ void clkdm_init(struct clockdomain **clkdms,
386 * clkdm_lookup - look up a clockdomain by name, return a pointer 386 * clkdm_lookup - look up a clockdomain by name, return a pointer
387 * @name: name of clockdomain 387 * @name: name of clockdomain
388 * 388 *
389 * Find a registered clockdomain by its name. Returns a pointer to the 389 * Find a registered clockdomain by its name @name. Returns a pointer
390 * struct clockdomain if found, or NULL otherwise. 390 * to the struct clockdomain if found, or NULL otherwise.
391 */ 391 */
392struct clockdomain *clkdm_lookup(const char *name) 392struct clockdomain *clkdm_lookup(const char *name)
393{ 393{
@@ -412,8 +412,8 @@ struct clockdomain *clkdm_lookup(const char *name)
412 * clkdm_for_each - call function on each registered clockdomain 412 * clkdm_for_each - call function on each registered clockdomain
413 * @fn: callback function * 413 * @fn: callback function *
414 * 414 *
415 * Call the supplied function for each registered clockdomain. 415 * Call the supplied function @fn for each registered clockdomain.
416 * The callback function can return anything but 0 to bail 416 * The callback function @fn can return anything but 0 to bail
417 * out early from the iterator. The callback function is called with 417 * out early from the iterator. The callback function is called with
418 * the clkdm_mutex held, so no clockdomain structure manipulation 418 * the clkdm_mutex held, so no clockdomain structure manipulation
419 * functions should be called from the callback, although hardware 419 * 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 * @clkdm: struct clockdomain * 446 * @clkdm: struct clockdomain *
447 * 447 *
448 * Return a pointer to the struct powerdomain that the specified clockdomain 448 * Return a pointer to the struct powerdomain that the specified clockdomain
449 * 'clkdm' exists in, or returns NULL if clkdm argument is NULL. 449 * @clkdm exists in, or returns NULL if @clkdm is NULL.
450 */ 450 */
451struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm) 451struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)
452{ 452{
@@ -759,10 +759,10 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
759 759
760/** 760/**
761 * omap2_clkdm_clktrctrl_read - read the clkdm's current state transition mode 761 * omap2_clkdm_clktrctrl_read - read the clkdm's current state transition mode
762 * @clk: struct clk * of a clockdomain 762 * @clkdm: struct clkdm * of a clockdomain
763 * 763 *
764 * Return the clockdomain's current state transition mode from the 764 * Return the clockdomain @clkdm current state transition mode from the
765 * corresponding domain OMAP2_CM_CLKSTCTRL register. Returns -EINVAL if clk 765 * corresponding domain CM_CLKSTCTRL register. Returns -EINVAL if @clkdm
766 * is NULL or the current mode upon success. 766 * is NULL or the current mode upon success.
767 */ 767 */
768static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm) 768static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
@@ -784,7 +784,7 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
784 * @clkdm: struct clockdomain * 784 * @clkdm: struct clockdomain *
785 * 785 *
786 * Instruct the CM to force a sleep transition on the specified 786 * Instruct the CM to force a sleep transition on the specified
787 * clockdomain 'clkdm'. Returns -EINVAL if clk is NULL or if 787 * clockdomain @clkdm. Returns -EINVAL if @clkdm is NULL or if
788 * clockdomain does not support software-initiated sleep; 0 upon 788 * clockdomain does not support software-initiated sleep; 0 upon
789 * success. 789 * success.
790 */ 790 */
@@ -828,7 +828,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
828 * @clkdm: struct clockdomain * 828 * @clkdm: struct clockdomain *
829 * 829 *
830 * Instruct the CM to force a wakeup transition on the specified 830 * Instruct the CM to force a wakeup transition on the specified
831 * clockdomain 'clkdm'. Returns -EINVAL if clkdm is NULL or if the 831 * clockdomain @clkdm. Returns -EINVAL if @clkdm is NULL or if the
832 * clockdomain does not support software-controlled wakeup; 0 upon 832 * clockdomain does not support software-controlled wakeup; 0 upon
833 * success. 833 * success.
834 */ 834 */
@@ -871,7 +871,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
871 * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm 871 * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm
872 * @clkdm: struct clockdomain * 872 * @clkdm: struct clockdomain *
873 * 873 *
874 * Allow the hardware to automatically switch the clockdomain into 874 * Allow the hardware to automatically switch the clockdomain @clkdm into
875 * active or idle states, as needed by downstream clocks. If the 875 * active or idle states, as needed by downstream clocks. If the
876 * clockdomain has any downstream clocks enabled in the clock 876 * clockdomain has any downstream clocks enabled in the clock
877 * framework, wkdep/sleepdep autodependencies are added; this is so 877 * framework, wkdep/sleepdep autodependencies are added; this is so
@@ -904,8 +904,8 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
904 * @clkdm: struct clockdomain * 904 * @clkdm: struct clockdomain *
905 * 905 *
906 * Prevent the hardware from automatically switching the clockdomain 906 * Prevent the hardware from automatically switching the clockdomain
907 * into inactive or idle states. If the clockdomain has downstream 907 * @clkdm into inactive or idle states. If the clockdomain has
908 * clocks enabled in the clock framework, wkdep/sleepdep 908 * downstream clocks enabled in the clock framework, wkdep/sleepdep
909 * autodependencies are removed. No return value. 909 * autodependencies are removed. No return value.
910 */ 910 */
911void omap2_clkdm_deny_idle(struct clockdomain *clkdm) 911void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
@@ -936,14 +936,14 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
936 * @clkdm: struct clockdomain * 936 * @clkdm: struct clockdomain *
937 * @clk: struct clk * of the enabled downstream clock 937 * @clk: struct clk * of the enabled downstream clock
938 * 938 *
939 * Increment the usecount of this clockdomain 'clkdm' and ensure that 939 * Increment the usecount of the clockdomain @clkdm and ensure that it
940 * it is awake. Intended to be called by clk_enable() code. If the 940 * is awake before @clk is enabled. Intended to be called by
941 * clockdomain is in software-supervised idle mode, force the 941 * clk_enable() code. If the clockdomain is in software-supervised
942 * clockdomain to wake. If the clockdomain is in hardware-supervised 942 * idle mode, force the clockdomain to wake. If the clockdomain is in
943 * idle mode, add clkdm-pwrdm autodependencies, to ensure that devices 943 * hardware-supervised idle mode, add clkdm-pwrdm autodependencies, to
944 * in the clockdomain can be read from/written to by on-chip processors. 944 * ensure that devices in the clockdomain can be read from/written to
945 * Returns -EINVAL if passed null pointers; returns 0 upon success or 945 * by on-chip processors. Returns -EINVAL if passed null pointers;
946 * if the clockdomain is in hwsup idle mode. 946 * returns 0 upon success or if the clockdomain is in hwsup idle mode.
947 */ 947 */
948int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) 948int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
949{ 949{
@@ -988,13 +988,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
988 * @clkdm: struct clockdomain * 988 * @clkdm: struct clockdomain *
989 * @clk: struct clk * of the disabled downstream clock 989 * @clk: struct clk * of the disabled downstream clock
990 * 990 *
991 * Decrement the usecount of this clockdomain 'clkdm'. Intended to be 991 * Decrement the usecount of this clockdomain @clkdm when @clk is
992 * called by clk_disable() code. If the usecount goes to 0, put the 992 * disabled. Intended to be called by clk_disable() code. If the
993 * clockdomain to sleep (software-supervised mode) or remove the 993 * clockdomain usecount goes to 0, put the clockdomain to sleep
994 * clkdm-pwrdm autodependencies (hardware-supervised mode). Returns 994 * (software-supervised mode) or remove the clkdm autodependencies
995 * -EINVAL if passed null pointers; -ERANGE if the clkdm usecount 995 * (hardware-supervised mode). Returns -EINVAL if passed null
996 * underflows and debugging is enabled; or returns 0 upon success or 996 * pointers; -ERANGE if the @clkdm usecount underflows and debugging
997 * if the clockdomain is in hwsup idle mode. 997 * is enabled; or returns 0 upon success or if the clockdomain is in
998 * hwsup idle mode.
998 */ 999 */
999int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 1000int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1000{ 1001{
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 9d4b8f5e09b6..dc03289d5dea 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -185,11 +185,13 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
185 185
186/** 186/**
187 * pwrdm_init - set up the powerdomain layer 187 * pwrdm_init - set up the powerdomain layer
188 * @pwrdm_list: array of struct powerdomain pointers to register
188 * 189 *
189 * Loop through the list of powerdomains, registering all that are 190 * Loop through the array of powerdomains @pwrdm_list, registering all
190 * available on the current CPU. If pwrdm_list is supplied and not 191 * that are available on the current CPU. If pwrdm_list is supplied
191 * null, all of the referenced powerdomains will be registered. No 192 * and not null, all of the referenced powerdomains will be
192 * return value. 193 * registered. No return value. XXX pwrdm_list is not really a
194 * "list"; it is an array. Rename appropriately.
193 */ 195 */
194void pwrdm_init(struct powerdomain **pwrdm_list) 196void pwrdm_init(struct powerdomain **pwrdm_list)
195{ 197{
@@ -217,8 +219,8 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
217 * pwrdm_lookup - look up a powerdomain by name, return a pointer 219 * pwrdm_lookup - look up a powerdomain by name, return a pointer
218 * @name: name of powerdomain 220 * @name: name of powerdomain
219 * 221 *
220 * Find a registered powerdomain by its name. Returns a pointer to the 222 * Find a registered powerdomain by its name @name. Returns a pointer
221 * struct powerdomain if found, or NULL otherwise. 223 * to the struct powerdomain if found, or NULL otherwise.
222 */ 224 */
223struct powerdomain *pwrdm_lookup(const char *name) 225struct powerdomain *pwrdm_lookup(const char *name)
224{ 226{
@@ -236,11 +238,11 @@ struct powerdomain *pwrdm_lookup(const char *name)
236 * pwrdm_for_each - call function on each registered clockdomain 238 * pwrdm_for_each - call function on each registered clockdomain
237 * @fn: callback function * 239 * @fn: callback function *
238 * 240 *
239 * Call the supplied function for each registered powerdomain. The 241 * Call the supplied function @fn for each registered powerdomain.
240 * callback function can return anything but 0 to bail out early from 242 * The callback function @fn can return anything but 0 to bail out
241 * the iterator. Returns the last return value of the callback function, which 243 * early from the iterator. Returns the last return value of the
242 * should be 0 for success or anything else to indicate failure; or -EINVAL if 244 * callback function, which should be 0 for success or anything else
243 * the function pointer is null. 245 * to indicate failure; or -EINVAL if the function pointer is null.
244 */ 246 */
245int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), 247int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
246 void *user) 248 void *user)
@@ -265,7 +267,7 @@ int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
265 * @pwrdm: struct powerdomain * to add the clockdomain to 267 * @pwrdm: struct powerdomain * to add the clockdomain to
266 * @clkdm: struct clockdomain * to associate with a powerdomain 268 * @clkdm: struct clockdomain * to associate with a powerdomain
267 * 269 *
268 * Associate the clockdomain 'clkdm' with a powerdomain 'pwrdm'. This 270 * Associate the clockdomain @clkdm with a powerdomain @pwrdm. This
269 * enables the use of pwrdm_for_each_clkdm(). Returns -EINVAL if 271 * enables the use of pwrdm_for_each_clkdm(). Returns -EINVAL if
270 * presented with invalid pointers; -ENOMEM if memory could not be allocated; 272 * presented with invalid pointers; -ENOMEM if memory could not be allocated;
271 * or 0 upon success. 273 * or 0 upon success.
@@ -313,10 +315,10 @@ pac_exit:
313 * @pwrdm: struct powerdomain * to add the clockdomain to 315 * @pwrdm: struct powerdomain * to add the clockdomain to
314 * @clkdm: struct clockdomain * to associate with a powerdomain 316 * @clkdm: struct clockdomain * to associate with a powerdomain
315 * 317 *
316 * Dissociate the clockdomain 'clkdm' from the powerdomain 318 * Dissociate the clockdomain @clkdm from the powerdomain
317 * 'pwrdm'. Returns -EINVAL if presented with invalid pointers; 319 * @pwrdm. Returns -EINVAL if presented with invalid pointers; -ENOENT
318 * -ENOENT if the clkdm was not associated with the powerdomain, or 0 320 * if @clkdm was not associated with the powerdomain, or 0 upon
319 * upon success. 321 * success.
320 */ 322 */
321int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm) 323int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm)
322{ 324{
@@ -353,8 +355,8 @@ pdc_exit:
353 * @pwrdm: struct powerdomain * to iterate over 355 * @pwrdm: struct powerdomain * to iterate over
354 * @fn: callback function * 356 * @fn: callback function *
355 * 357 *
356 * Call the supplied function for each clockdomain in the powerdomain 358 * Call the supplied function @fn for each clockdomain in the powerdomain
357 * 'pwrdm'. The callback function can return anything but 0 to bail 359 * @pwrdm. The callback function can return anything but 0 to bail
358 * out early from the iterator. Returns -EINVAL if presented with 360 * out early from the iterator. Returns -EINVAL if presented with
359 * invalid pointers; or passes along the last return value of the 361 * invalid pointers; or passes along the last return value of the
360 * callback function, which should be 0 for success or anything else 362 * callback function, which should be 0 for success or anything else
@@ -380,7 +382,7 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
380 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain 382 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
381 * @pwrdm: struct powerdomain * 383 * @pwrdm: struct powerdomain *
382 * 384 *
383 * Return the number of controllable memory banks in powerdomain pwrdm, 385 * Return the number of controllable memory banks in powerdomain @pwrdm,
384 * starting with 1. Returns -EINVAL if the powerdomain pointer is null. 386 * starting with 1. Returns -EINVAL if the powerdomain pointer is null.
385 */ 387 */
386int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm) 388int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm)
@@ -396,7 +398,7 @@ int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm)
396 * @pwrdm: struct powerdomain * to set 398 * @pwrdm: struct powerdomain * to set
397 * @pwrst: one of the PWRDM_POWER_* macros 399 * @pwrst: one of the PWRDM_POWER_* macros
398 * 400 *
399 * Set the powerdomain pwrdm's next power state to pwrst. The powerdomain 401 * Set the powerdomain @pwrdm's next power state to @pwrst. The powerdomain
400 * may not enter this state immediately if the preconditions for this state 402 * may not enter this state immediately if the preconditions for this state
401 * have not been satisfied. Returns -EINVAL if the powerdomain pointer is 403 * have not been satisfied. Returns -EINVAL if the powerdomain pointer is
402 * null or if the power state is invalid for the powerdomin, or returns 0 404 * null or if the power state is invalid for the powerdomin, or returns 0
@@ -424,7 +426,7 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
424 * pwrdm_read_next_pwrst - get next powerdomain power state 426 * pwrdm_read_next_pwrst - get next powerdomain power state
425 * @pwrdm: struct powerdomain * to get power state 427 * @pwrdm: struct powerdomain * to get power state
426 * 428 *
427 * Return the powerdomain pwrdm's next power state. Returns -EINVAL 429 * Return the powerdomain @pwrdm's next power state. Returns -EINVAL
428 * if the powerdomain pointer is null or returns the next power state 430 * if the powerdomain pointer is null or returns the next power state
429 * upon success. 431 * upon success.
430 */ 432 */
@@ -441,7 +443,7 @@ int pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
441 * pwrdm_read_pwrst - get current powerdomain power state 443 * pwrdm_read_pwrst - get current powerdomain power state
442 * @pwrdm: struct powerdomain * to get power state 444 * @pwrdm: struct powerdomain * to get power state
443 * 445 *
444 * Return the powerdomain pwrdm's current power state. Returns -EINVAL 446 * Return the powerdomain @pwrdm's current power state. Returns -EINVAL
445 * if the powerdomain pointer is null or returns the current power state 447 * if the powerdomain pointer is null or returns the current power state
446 * upon success. 448 * upon success.
447 */ 449 */
@@ -458,7 +460,7 @@ int pwrdm_read_pwrst(struct powerdomain *pwrdm)
458 * pwrdm_read_prev_pwrst - get previous powerdomain power state 460 * pwrdm_read_prev_pwrst - get previous powerdomain power state
459 * @pwrdm: struct powerdomain * to get previous power state 461 * @pwrdm: struct powerdomain * to get previous power state
460 * 462 *
461 * Return the powerdomain pwrdm's previous power state. Returns -EINVAL 463 * Return the powerdomain @pwrdm's previous power state. Returns -EINVAL
462 * if the powerdomain pointer is null or returns the previous power state 464 * if the powerdomain pointer is null or returns the previous power state
463 * upon success. 465 * upon success.
464 */ 466 */
@@ -476,11 +478,11 @@ int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
476 * @pwrdm: struct powerdomain * to set 478 * @pwrdm: struct powerdomain * to set
477 * @pwrst: one of the PWRDM_POWER_* macros 479 * @pwrst: one of the PWRDM_POWER_* macros
478 * 480 *
479 * Set the next power state that the logic portion of the powerdomain 481 * Set the next power state @pwrst that the logic portion of the
480 * pwrdm will enter when the powerdomain enters retention. This will 482 * powerdomain @pwrdm will enter when the powerdomain enters retention.
481 * be either RETENTION or OFF, if supported. Returns -EINVAL if the 483 * This will be either RETENTION or OFF, if supported. Returns
482 * powerdomain pointer is null or the target power state is not not 484 * -EINVAL if the powerdomain pointer is null or the target power
483 * supported, or returns 0 upon success. 485 * state is not not supported, or returns 0 upon success.
484 */ 486 */
485int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) 487int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
486{ 488{
@@ -512,13 +514,14 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
512 * @bank: memory bank number to set (0-3) 514 * @bank: memory bank number to set (0-3)
513 * @pwrst: one of the PWRDM_POWER_* macros 515 * @pwrst: one of the PWRDM_POWER_* macros
514 * 516 *
515 * Set the next power state that memory bank x of the powerdomain 517 * Set the next power state @pwrst that memory bank @bank of the
516 * pwrdm will enter when the powerdomain enters the ON state. Bank 518 * powerdomain @pwrdm will enter when the powerdomain enters the ON
517 * will be a number from 0 to 3, and represents different types of 519 * state. @bank will be a number from 0 to 3, and represents different
518 * memory, depending on the powerdomain. Returns -EINVAL if the 520 * types of memory, depending on the powerdomain. Returns -EINVAL if
519 * powerdomain pointer is null or the target power state is not not 521 * the powerdomain pointer is null or the target power state is not
520 * supported for this memory bank, -EEXIST if the target memory bank 522 * not supported for this memory bank, -EEXIST if the target memory
521 * does not exist or is not controllable, or returns 0 upon success. 523 * bank does not exist or is not controllable, or returns 0 upon
524 * success.
522 */ 525 */
523int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) 526int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
524{ 527{
@@ -575,14 +578,15 @@ int pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
575 * @bank: memory bank number to set (0-3) 578 * @bank: memory bank number to set (0-3)
576 * @pwrst: one of the PWRDM_POWER_* macros 579 * @pwrst: one of the PWRDM_POWER_* macros
577 * 580 *
578 * Set the next power state that memory bank x of the powerdomain 581 * Set the next power state @pwrst that memory bank @bank of the
579 * pwrdm will enter when the powerdomain enters the RETENTION state. 582 * powerdomain @pwrdm will enter when the powerdomain enters the
580 * Bank will be a number from 0 to 3, and represents different types 583 * RETENTION state. Bank will be a number from 0 to 3, and represents
581 * of memory, depending on the powerdomain. pwrst will be either 584 * different types of memory, depending on the powerdomain. @pwrst
582 * RETENTION or OFF, if supported. Returns -EINVAL if the powerdomain 585 * will be either RETENTION or OFF, if supported. Returns -EINVAL if
583 * pointer is null or the target power state is not not supported for 586 * the powerdomain pointer is null or the target power state is not
584 * this memory bank, -EEXIST if the target memory bank does not exist 587 * not supported for this memory bank, -EEXIST if the target memory
585 * or is not controllable, or returns 0 upon success. 588 * bank does not exist or is not controllable, or returns 0 upon
589 * success.
586 */ 590 */
587int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) 591int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
588{ 592{
@@ -637,10 +641,10 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst)
637 * pwrdm_read_logic_pwrst - get current powerdomain logic retention power state 641 * pwrdm_read_logic_pwrst - get current powerdomain logic retention power state
638 * @pwrdm: struct powerdomain * to get current logic retention power state 642 * @pwrdm: struct powerdomain * to get current logic retention power state
639 * 643 *
640 * Return the current power state that the logic portion of 644 * Return the power state that the logic portion of powerdomain @pwrdm
641 * powerdomain pwrdm will enter 645 * will enter when the powerdomain enters retention. Returns -EINVAL
642 * Returns -EINVAL if the powerdomain pointer is null or returns the 646 * if the powerdomain pointer is null or returns the logic retention
643 * current logic retention power state upon success. 647 * power state upon success.
644 */ 648 */
645int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) 649int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
646{ 650{
@@ -655,9 +659,9 @@ int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
655 * pwrdm_read_prev_logic_pwrst - get previous powerdomain logic power state 659 * pwrdm_read_prev_logic_pwrst - get previous powerdomain logic power state
656 * @pwrdm: struct powerdomain * to get previous logic power state 660 * @pwrdm: struct powerdomain * to get previous logic power state
657 * 661 *
658 * Return the powerdomain pwrdm's logic power state. Returns -EINVAL 662 * Return the powerdomain @pwrdm's previous logic power state. Returns
659 * if the powerdomain pointer is null or returns the previous logic 663 * -EINVAL if the powerdomain pointer is null or returns the previous
660 * power state upon success. 664 * logic power state upon success.
661 */ 665 */
662int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) 666int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
663{ 667{
@@ -679,8 +683,8 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
679 * @pwrdm: struct powerdomain * to get current memory bank power state 683 * @pwrdm: struct powerdomain * to get current memory bank power state
680 * @bank: memory bank number (0-3) 684 * @bank: memory bank number (0-3)
681 * 685 *
682 * Return the powerdomain pwrdm's current memory power state for bank 686 * Return the powerdomain @pwrdm's current memory power state for bank
683 * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if 687 * @bank. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if
684 * the target memory bank does not exist or is not controllable, or 688 * the target memory bank does not exist or is not controllable, or
685 * returns the current memory power state upon success. 689 * returns the current memory power state upon success.
686 */ 690 */
@@ -733,10 +737,11 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
733 * @pwrdm: struct powerdomain * to get previous memory bank power state 737 * @pwrdm: struct powerdomain * to get previous memory bank power state
734 * @bank: memory bank number (0-3) 738 * @bank: memory bank number (0-3)
735 * 739 *
736 * Return the powerdomain pwrdm's previous memory power state for bank 740 * Return the powerdomain @pwrdm's previous memory power state for
737 * x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if 741 * bank @bank. Returns -EINVAL if the powerdomain pointer is null,
738 * the target memory bank does not exist or is not controllable, or 742 * -EEXIST if the target memory bank does not exist or is not
739 * returns the previous memory power state upon success. 743 * controllable, or returns the previous memory power state upon
744 * success.
740 */ 745 */
741int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) 746int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
742{ 747{
@@ -783,10 +788,10 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
783 * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm 788 * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm
784 * @pwrdm: struct powerdomain * to clear 789 * @pwrdm: struct powerdomain * to clear
785 * 790 *
786 * Clear the powerdomain's previous power state register. Clears the 791 * Clear the powerdomain's previous power state register @pwrdm.
787 * entire register, including logic and memory bank previous power states. 792 * Clears the entire register, including logic and memory bank
788 * Returns -EINVAL if the powerdomain pointer is null, or returns 0 upon 793 * previous power states. Returns -EINVAL if the powerdomain pointer
789 * success. 794 * is null, or returns 0 upon success.
790 */ 795 */
791int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) 796int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
792{ 797{
@@ -811,11 +816,11 @@ int pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
811 * @pwrdm: struct powerdomain * 816 * @pwrdm: struct powerdomain *
812 * 817 *
813 * Enable automatic context save-and-restore upon power state change 818 * Enable automatic context save-and-restore upon power state change
814 * for some devices in a powerdomain. Warning: this only affects a 819 * for some devices in the powerdomain @pwrdm. Warning: this only
815 * subset of devices in a powerdomain; check the TRM closely. Returns 820 * affects a subset of devices in a powerdomain; check the TRM
816 * -EINVAL if the powerdomain pointer is null or if the powerdomain 821 * closely. Returns -EINVAL if the powerdomain pointer is null or if
817 * does not support automatic save-and-restore, or returns 0 upon 822 * the powerdomain does not support automatic save-and-restore, or
818 * success. 823 * returns 0 upon success.
819 */ 824 */
820int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) 825int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
821{ 826{
@@ -839,11 +844,11 @@ int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
839 * @pwrdm: struct powerdomain * 844 * @pwrdm: struct powerdomain *
840 * 845 *
841 * Disable automatic context save-and-restore upon power state change 846 * Disable automatic context save-and-restore upon power state change
842 * for some devices in a powerdomain. Warning: this only affects a 847 * for some devices in the powerdomain @pwrdm. Warning: this only
843 * subset of devices in a powerdomain; check the TRM closely. Returns 848 * affects a subset of devices in a powerdomain; check the TRM
844 * -EINVAL if the powerdomain pointer is null or if the powerdomain 849 * closely. Returns -EINVAL if the powerdomain pointer is null or if
845 * does not support automatic save-and-restore, or returns 0 upon 850 * the powerdomain does not support automatic save-and-restore, or
846 * success. 851 * returns 0 upon success.
847 */ 852 */
848int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) 853int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
849{ 854{
@@ -866,7 +871,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
866 * pwrdm_has_hdwr_sar - test whether powerdomain supports hardware SAR 871 * pwrdm_has_hdwr_sar - test whether powerdomain supports hardware SAR
867 * @pwrdm: struct powerdomain * 872 * @pwrdm: struct powerdomain *
868 * 873 *
869 * Returns 1 if powerdomain 'pwrdm' supports hardware save-and-restore 874 * Returns 1 if powerdomain @pwrdm supports hardware save-and-restore
870 * for some devices, or 0 if it does not. 875 * for some devices, or 0 if it does not.
871 */ 876 */
872bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm) 877bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm)
@@ -878,7 +883,7 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm)
878 * pwrdm_wait_transition - wait for powerdomain power transition to finish 883 * pwrdm_wait_transition - wait for powerdomain power transition to finish
879 * @pwrdm: struct powerdomain * to wait for 884 * @pwrdm: struct powerdomain * to wait for
880 * 885 *
881 * If the powerdomain pwrdm is in the process of a state transition, 886 * If the powerdomain @pwrdm is in the process of a state transition,
882 * spin until it completes the power transition, or until an iteration 887 * spin until it completes the power transition, or until an iteration
883 * bailout value is reached. Returns -EINVAL if the powerdomain 888 * bailout value is reached. Returns -EINVAL if the powerdomain
884 * pointer is null, -EAGAIN if the bailout value was reached, or 889 * pointer is null, -EAGAIN if the bailout value was reached, or
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h b/arch/arm/plat-omap/include/plat/clockdomain.h
index 45b5debc5d3f..ba0a6c07c0fe 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -40,86 +40,77 @@
40#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2 40#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2
41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3 41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3
42 42
43/* 43/**
44 * struct clkdm_autodep - a clockdomain that should have wkdeps 44 * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
45 * and sleepdeps added when a clockdomain should stay active in hwsup mode; 45 * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
46 * and conversely, removed when the clockdomain should be allowed to go 46 * @omap_chip: OMAP chip types that this autodep is valid on
47 * inactive in hwsup mode. 47 *
48 * A clockdomain that should have wkdeps and sleepdeps added when a
49 * clockdomain should stay active in hwsup mode; and conversely,
50 * removed when the clockdomain should be allowed to go inactive in
51 * hwsup mode.
52 *
53 * Autodeps are deprecated and should be removed after
54 * omap_hwmod-based fine-grained module idle control is added.
48 */ 55 */
49struct clkdm_autodep { 56struct clkdm_autodep {
50
51 union { 57 union {
52 /* Name of the clockdomain to add a wkdep/sleepdep on */
53 const char *name; 58 const char *name;
54
55 /* Clockdomain pointer (looked up at clkdm_init() time) */
56 struct clockdomain *ptr; 59 struct clockdomain *ptr;
57 } clkdm; 60 } clkdm;
58
59 /* OMAP chip types that this clockdomain dep is valid on */
60 const struct omap_chip_id omap_chip; 61 const struct omap_chip_id omap_chip;
61
62}; 62};
63 63
64/* Encodes dependencies between clockdomains - statically defined */ 64/**
65 * struct clkdm_dep - encode dependencies between clockdomains
66 * @clkdm_name: clockdomain name
67 * @clkdm: pointer to the struct clockdomain of @clkdm_name
68 * @omap_chip: OMAP chip types that this dependency is valid on
69 * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
70 * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
71 *
72 * Statically defined. @clkdm is resolved from @clkdm_name at runtime and
73 * should not be pre-initialized.
74 *
75 * XXX Should also include hardware (fixed) dependencies.
76 */
65struct clkdm_dep { 77struct clkdm_dep {
66
67 /* Clockdomain name */
68 const char *clkdm_name; 78 const char *clkdm_name;
69
70 /* Clockdomain pointer - resolved by the clockdomain code */
71 struct clockdomain *clkdm; 79 struct clockdomain *clkdm;
72
73 /* Number of wakeup dependencies causing this clkdm to wake */
74 atomic_t wkdep_usecount; 80 atomic_t wkdep_usecount;
75
76 /* Number of sleep dependencies that could prevent clkdm from idle */
77 atomic_t sleepdep_usecount; 81 atomic_t sleepdep_usecount;
78
79 /* Flags to mark OMAP chip restrictions, etc. */
80 const struct omap_chip_id omap_chip; 82 const struct omap_chip_id omap_chip;
81
82}; 83};
83 84
85/**
86 * struct clockdomain - OMAP clockdomain
87 * @name: clockdomain name
88 * @pwrdm: powerdomain containing this clockdomain
89 * @clktrctrl_reg: CLKSTCTRL reg for the given clock domain
90 * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
91 * @flags: Clockdomain capability flags
92 * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
93 * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
94 * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
95 * @omap_chip: OMAP chip types that this clockdomain is valid on
96 * @usecount: Usecount tracking
97 * @node: list_head to link all clockdomains together
98 */
84struct clockdomain { 99struct clockdomain {
85
86 /* Clockdomain name */
87 const char *name; 100 const char *name;
88
89 union { 101 union {
90 /* Powerdomain enclosing this clockdomain */
91 const char *name; 102 const char *name;
92
93 /* Powerdomain pointer assigned at clkdm_register() */
94 struct powerdomain *ptr; 103 struct powerdomain *ptr;
95 } pwrdm; 104 } pwrdm;
96
97 /* CLKSTCTRL reg for the given clock domain*/
98 void __iomem *clkstctrl_reg; 105 void __iomem *clkstctrl_reg;
99
100 /* CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg */
101 const u16 clktrctrl_mask; 106 const u16 clktrctrl_mask;
102
103 /* Clockdomain capability flags */
104 const u8 flags; 107 const u8 flags;
105
106 /* Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit */
107 const u8 dep_bit; 108 const u8 dep_bit;
108
109 /* Clockdomains that can be told to wake this powerdomain up */
110 struct clkdm_dep *wkdep_srcs; 109 struct clkdm_dep *wkdep_srcs;
111
112 /* Clockdomains that can be told to keep this clkdm from inactivity */
113 struct clkdm_dep *sleepdep_srcs; 110 struct clkdm_dep *sleepdep_srcs;
114
115 /* OMAP chip types that this clockdomain is valid on */
116 const struct omap_chip_id omap_chip; 111 const struct omap_chip_id omap_chip;
117
118 /* Usecount tracking */
119 atomic_t usecount; 112 atomic_t usecount;
120
121 struct list_head node; 113 struct list_head node;
122
123}; 114};
124 115
125void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps); 116void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps);
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index 87e13f88994f..e15c7e9da975 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -68,40 +68,36 @@
68struct clockdomain; 68struct clockdomain;
69struct powerdomain; 69struct powerdomain;
70 70
71/**
72 * struct powerdomain - OMAP powerdomain
73 * @name: Powerdomain name
74 * @omap_chip: represents the OMAP chip types containing this pwrdm
75 * @prcm_offs: the address offset from CM_BASE/PRM_BASE
76 * @pwrsts: Possible powerdomain power states
77 * @pwrsts_logic_ret: Possible logic power states when pwrdm in RETENTION
78 * @flags: Powerdomain flags
79 * @banks: Number of software-controllable memory banks in this powerdomain
80 * @pwrsts_mem_ret: Possible memory bank pwrstates when pwrdm in RETENTION
81 * @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
82 * @pwrdm_clkdms: Clockdomains in this powerdomain
83 * @node: list_head linking all powerdomains
84 * @state:
85 * @state_counter:
86 * @timer:
87 * @state_timer:
88 */
71struct powerdomain { 89struct powerdomain {
72
73 /* Powerdomain name */
74 const char *name; 90 const char *name;
75
76 /* Used to represent the OMAP chip types containing this pwrdm */
77 const struct omap_chip_id omap_chip; 91 const struct omap_chip_id omap_chip;
78
79 /* the address offset from CM_BASE/PRM_BASE */
80 const s16 prcm_offs; 92 const s16 prcm_offs;
81
82 /* Possible powerdomain power states */
83 const u8 pwrsts; 93 const u8 pwrsts;
84
85 /* Possible logic power states when pwrdm in RETENTION */
86 const u8 pwrsts_logic_ret; 94 const u8 pwrsts_logic_ret;
87
88 /* Powerdomain flags */
89 const u8 flags; 95 const u8 flags;
90
91 /* Number of software-controllable memory banks in this powerdomain */
92 const u8 banks; 96 const u8 banks;
93
94 /* Possible memory bank pwrstates when pwrdm in RETENTION */
95 const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS]; 97 const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];
96
97 /* Possible memory bank pwrstates when pwrdm is ON */
98 const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS]; 98 const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS];
99
100 /* Clockdomains in this powerdomain */
101 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS]; 99 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
102
103 struct list_head node; 100 struct list_head node;
104
105 int state; 101 int state;
106 unsigned state_counter[PWRDM_MAX_PWRSTS]; 102 unsigned state_counter[PWRDM_MAX_PWRSTS];
107 103