Skip to content

Commit c48ddf6

Browse files
committed
pm_runtime.c: explain the opposition between "enable" and "active"
Pure comments, no code change. Follow-up to commit 8633d5f ("cavs: pm: improve PM_RUNTIME_HOST_DMA_L1 documentation") Signed-off-by: Marc Herbert <marc.herbert@intel.com>
1 parent 2412748 commit c48ddf6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/lib/pm_runtime.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ void pm_runtime_init(struct sof *sof)
3535

3636
}
3737

38+
/* Warning: the terms in this API (enable, active,... ) apply sometimes
39+
* to power _management_ and other times to _power_ which can be
40+
* confusing. They are however consistent with
41+
* https://www.kernel.org/doc/Documentation/power/runtime_pm.txt and the
42+
* long tradition of double and triple negations in power management.
43+
*/
44+
45+
/** Increase the usage counter of some PM context. In general this
46+
* blocks low power state but there are exception(s), for instance the
47+
* context for the PM_RUNTIME_HOST_DMA_L1 is reversed: usage blocks high
48+
* power state.
49+
*
50+
* Warning: some (all?) platforms don't really implement any counter, in
51+
* other words the "counter" is silently maxed at 1.
52+
*/
3853
void pm_runtime_get(enum pm_runtime_context context, uint32_t index)
3954
{
4055
tr_dbg(&pm_tr, "pm_runtime_get() context %d index %d", context, index);
@@ -58,6 +73,8 @@ void pm_runtime_get_sync(enum pm_runtime_context context, uint32_t index)
5873
}
5974
}
6075

76+
/** Decreases the usage counter of some PM context, see pm_runtime_get()
77+
*/
6178
void pm_runtime_put(enum pm_runtime_context context, uint32_t index)
6279
{
6380
tr_dbg(&pm_tr, "pm_runtime_put() context %d index %d", context, index);
@@ -81,6 +98,7 @@ void pm_runtime_put_sync(enum pm_runtime_context context, uint32_t index)
8198
}
8299
}
83100

101+
/** Enables power _management_. The management, not the power. */
84102
void pm_runtime_enable(enum pm_runtime_context context, uint32_t index)
85103
{
86104
tr_dbg(&pm_tr, "pm_runtime_enable() context %d index %d", context,
@@ -93,6 +111,7 @@ void pm_runtime_enable(enum pm_runtime_context context, uint32_t index)
93111
}
94112
}
95113

114+
/** Disables power _management_. The management, not the power. */
96115
void pm_runtime_disable(enum pm_runtime_context context, uint32_t index)
97116
{
98117
tr_dbg(&pm_tr, "pm_runtime_disable() context %d index %d", context,
@@ -105,6 +124,7 @@ void pm_runtime_disable(enum pm_runtime_context context, uint32_t index)
105124
}
106125
}
107126

127+
/** Is the _power_ active. The power, not its management. */
108128
bool pm_runtime_is_active(enum pm_runtime_context context, uint32_t index)
109129
{
110130
tr_dbg(&pm_tr, "pm_runtime_is_active() context %d index %d", context,

0 commit comments

Comments
 (0)