aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/powerdomain.c
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/mach-omap2/powerdomain.c
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/mach-omap2/powerdomain.c')
-rw-r--r--arch/arm/mach-omap2/powerdomain.c149
1 files changed, 77 insertions, 72 deletions
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