Mainline:Broadcom Kona/BCM590xx/Regulators: Difference between revisions
Created page with "== Revisions == BCMPMU_59054_ID is ID for 59054 BCMPMU_59054A1_ANA_REV refers to A1 which has ACLD, A0 does not == Downstream driver notes == * The downstream driver used is BCM59xxx, which despite the name is only for the BCM59054 ** In the tree there are also drivers for BCM59056, a handful of other PMUs including BCM59055, and BCM590xx (which confusingly is '''not''' the same as BCM59xxx). * The whole driver is fragmented as it's an MFD device, but the most import..." |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
(note: this article has not been cleaned up ''at all'', it is imported from my local notes as-is.) | |||
== Revisions == | == Revisions == | ||
Line 39: | Line 41: | ||
''(see <code>drivers/regulator/bcmpmu-regulator-56.c</code>)'' | ''(see <code>drivers/regulator/bcmpmu-regulator-56.c</code>)'' | ||
Unlike BCM59054, there's only one PMMODE register, and it has values PM0 to PM3. DSM (deep sleep) is pins PM0 and PM2. Regular value is written to PM1 and PM3. | <strike>Unlike BCM59054, there's only one PMMODE register</strike> (this is completely wrong! BCM59056 also has multiple PMMODE regs), and it has values PM0 to PM3. DSM (deep sleep) is pins PM0 and PM2. Regular value is written to PM1 and PM3. | ||
I have a sneaking suspicion, based on the mainline driver, and the fact that the function described in the "Enabling the regulator" part will gleefuly ignore PM0 mostly, that PM0 may be some sort of "perma-override" | I have a sneaking suspicion, based on the mainline driver, and the fact that the function described in the "Enabling the regulator" part will gleefuly ignore PM0 mostly, that PM0 may be some sort of "perma-override" | ||
Line 53: | Line 55: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
...a PC reference? You'll see these in the next section. | ...a PC reference? You'll see these in the next section. | ||
Line 70: | Line 73: | ||
The functions <code>__is_2bit_pmmode_regl_enabled</code> and <code>__is_3bit_pmmode_regl_enabled</code> check if a regulator is enabled based on those pin maps, and the <code>pmmode</code> value as read out from the PMMODE registers. | The functions <code>__is_2bit_pmmode_regl_enabled</code> and <code>__is_3bit_pmmode_regl_enabled</code> check if a regulator is enabled based on those pin maps, and the <code>pmmode</code> value as read out from the PMMODE registers. | ||
For every <code>i</code> from 0 to 7 (<code>REGL_PMMODE_VAL_MAX</code>): * get the PM reg shift by <code>PMMODE_2BIT_PMx_MASK & i</code> (PMMODE_2BIT_PMx_MASK == 3) * if this <code>i</code> gives a value through <code>setval & i</code> in set0 or set1, then the value of whether the regulator is enabled is calculated using <code>PMMODE_2BIT_PMx_MASK & (pmmode[inx] >> shift)</code>, where <code>inx</code> is increased for every value where <code>PMMODE_2BIT_PMx_MASK & i</code> == 3. | For every <code>i</code> from 0 to 7 (<code>REGL_PMMODE_VAL_MAX</code>): | ||
* get the PM reg shift by <code>PMMODE_2BIT_PMx_MASK & i</code> (PMMODE_2BIT_PMx_MASK == 3) | |||
* if this <code>i</code> gives a value through <code>setval & i</code> in set0 or set1, then the value of whether the regulator is enabled is calculated using <code>PMMODE_2BIT_PMx_MASK & (pmmode[inx] >> shift)</code>, where <code>inx</code> is increased for every value where <code>PMMODE_2BIT_PMx_MASK & i</code> == 3. | |||
In normal words: if the mode corresponding to the pin in ''any'' of the PMMODE registers is ON, then the regulator is on. | In normal words: if the mode corresponding to the pin in ''any'' of the PMMODE registers is ON, then the regulator is on. | ||
Line 107: | Line 113: | ||
This one's similar to the previous function: | This one's similar to the previous function: | ||
For every <code>i</code> from 0 to 7 (<code>REGL_PMMODE_VAL_MAX</code>): * If the value is in set0 or set1, set the value to <code>PMMODE_ON</code>; otherwise, use '''<code>dsm_pmmode</code>''' (a variable passed at init time). Oooh, DSM again! * Figure out the shift and register like before. * Add the value to a temp variable by ORing <code>val << shift</code> to it. | For every <code>i</code> from 0 to 7 (<code>REGL_PMMODE_VAL_MAX</code>): | ||
* If the value is in set0 or set1, set the value to <code>PMMODE_ON</code>; otherwise, use '''<code>dsm_pmmode</code>''' (a variable passed at init time). Oooh, DSM again! | |||
* Figure out the shift and register like before. | |||
* Add the value to a temp variable by ORing <code>val << shift</code> to it. | |||
Here's the thing: <code>dsm_pmmode</code>... is the mode value provided in <code>__bcmpmuldo_set_mode</code>. | Here's the thing: <code>dsm_pmmode</code>... is the mode value provided in <code>__bcmpmuldo_set_mode</code>. |