https://wiki.st.com/stm32mpu-ecosystem-v2/index.php?title=Pinctrl_overview&feed=atom&action=history
Pinctrl overview - Revision history
2024-03-28T23:15:10Z
Revision history for this page on the wiki
MediaWiki 1.31.16
https://wiki.st.com/stm32mpu-ecosystem-v2/index.php?title=Pinctrl_overview&diff=71102&oldid=prev
Alexandre Torgue at 15:17, 10 June 2020
2020-06-10T15:17:30Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 15:17, 10 June 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l276" >Line 276:</td>
<td colspan="2" class="diff-lineno">Line 276:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*'''Pinctrl core part''': generic core<ref>{{CodeSource | Linux kernel | drivers/pinctrl/core.c | Pinctrl framework source - core.c}} Sources of generic pinctrl framework</ref>, generic pinconf<ref>{{CodeSource |Linux kernel | drivers/pinctrl/pinconf.c |Pinctrl framework source - pinconf.c}} Sources of generic pin configuration</ref> and generic pinmux<ref>{{CodeSource |Linux kernel | drivers/pinctrl/pinmux.c | Pinctrl framework source - pinmux.c}} Sources of generic pin muxing</ref></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*'''Pinctrl core part''': generic core<ref>{{CodeSource | Linux kernel | drivers/pinctrl/core.c | Pinctrl framework source - core.c}} Sources of generic pinctrl framework</ref>, generic pinconf<ref>{{CodeSource |Linux kernel | drivers/pinctrl/pinconf.c |Pinctrl framework source - pinconf.c}} Sources of generic pin configuration</ref> and generic pinmux<ref>{{CodeSource |Linux kernel | drivers/pinctrl/pinmux.c | Pinctrl framework source - pinmux.c}} Sources of generic pin muxing</ref></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>*'''STM32 pinctrl vendor part''': folder to STM32 dedicated pinctrl functions<ref>{{CodeSource | Linux kernel | drivers/pinctrl/stm32 | STM32 vendor specific folder}} Provides all vendor specifics functions</ref></div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>*'''STM32 pinctrl vendor part''': folder to STM32 dedicated pinctrl functions<ref>{{CodeSource | Linux kernel | drivers/pinctrl/stm32<ins class="diffchange diffchange-inline">/ </ins>| STM32 vendor specific folder}} Provides all vendor specifics functions</ref></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*'''base driver part'''<ref name="Base_driver"/></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*'''base driver part'''<ref name="Base_driver"/></div></td></tr>
</table>
Alexandre Torgue
https://wiki.st.com/stm32mpu-ecosystem-v2/index.php?title=Pinctrl_overview&diff=71101&oldid=prev
Alexandre Torgue at 15:15, 10 June 2020
2020-06-10T15:15:47Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 15:15, 10 June 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l222" >Line 222:</td>
<td colspan="2" class="diff-lineno">Line 222:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     +---pinctrl-handles      | List of all pin states registered.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     +---pinctrl-handles      | List of all pin states registered.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     +---pinctrl-maps        | List of all pin states registered per pin used.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     +---pinctrl-maps        | List of all pin states registered per pin used.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>     +---soc:<del class="diffchange diffchange-inline">pincontroller </del>  | Folder which contains pins information for a pin controller.</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>     +---soc:<ins class="diffchange diffchange-inline">pin-controller-z@54004000    | Folder which contains pins information for a pin controller.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    +---soc:pin-controller@50002000 </ins>  | Folder which contains pins information for a pin controller.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>:2 Pin controller information:</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>:2 Pin controller information:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>  {{Board$}} ls -l /sys/kernel/debug/pinctrl/soc:<del class="diffchange diffchange-inline">pincontroller</del></div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>  {{Board$}} ls -l /sys/kernel/debug/pinctrl/soc:<ins class="diffchange diffchange-inline">pin-controller@50002000</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     |</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     |</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     +---gpio-ranges          | Provides mapping between logical address space and pins address space for GPIOs.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>     +---gpio-ranges          | Provides mapping between logical address space and pins address space for GPIOs.</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l239" >Line 239:</td>
<td colspan="2" class="diff-lineno">Line 240:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* The following extract of kernel log shows that pin controller is well probed:</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* The following extract of kernel log shows that pin controller is well probed:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div><pre></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.353613] stm32mp157-pinctrl soc:pin-controller: GPIOA bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.353613] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOA bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.360539] stm32mp157-pinctrl soc:pin-controller: GPIOB bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.360539] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOB bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.367344] stm32mp157-pinctrl soc:pin-controller: GPIOC bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.367344] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOC bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.374199] stm32mp157-pinctrl soc:pin-controller: GPIOD bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.374199] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOD bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.381016] stm32mp157-pinctrl soc:pin-controller: GPIOE bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.381016] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOE bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.387850] stm32mp157-pinctrl soc:pin-controller: GPIOF bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.387850] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOF bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.394625] stm32mp157-pinctrl soc:pin-controller: GPIOG bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.394625] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOG bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.401463] stm32mp157-pinctrl soc:pin-controller: GPIOH bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.401463] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOH bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.408257] stm32mp157-pinctrl soc:pin-controller: GPIOI bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.408257] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOI bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.415098] stm32mp157-pinctrl soc:pin-controller: GPIOJ bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.415098] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOJ bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.421889] stm32mp157-pinctrl soc:pin-controller: GPIOK bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.421889] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: GPIOK bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.428444] stm32mp157-pinctrl soc:pin-controller: Pinctrl STM32 initialized</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.428444] stm32mp157-pinctrl soc:pin-controller<ins class="diffchange diffchange-inline">@50002000</ins>: Pinctrl STM32 initialized</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.436604] stm32mp157-pinctrl soc:pin-controller-z: GPIOZ bank added</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.436604] stm32mp157-pinctrl soc:pin-controller-z<ins class="diffchange diffchange-inline">@54004000</ins>: GPIOZ bank added</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[    0.443222] stm32mp157-pinctrl soc:pin-controller-z: Pinctrl STM32 initialized</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[    0.443222] stm32mp157-pinctrl soc:pin-controller-z<ins class="diffchange diffchange-inline">@54004000</ins>: Pinctrl STM32 initialized</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div></pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>By default there is no indication in the log that the pin default state has been correctly applied to the device by the base driver. If an issue occurs (like a conflict) the device probe will fail with an error.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>By default there is no indication in the log that the pin default state has been correctly applied to the device by the base driver. If an issue occurs (like a conflict) the device probe will fail with an error.</div></td></tr>
</table>
Alexandre Torgue
https://wiki.st.com/stm32mpu-ecosystem-v2/index.php?title=Pinctrl_overview&diff=70397&oldid=prev
Jean Christophe Trotin at 08:09, 15 April 2020
2020-04-15T08:09:55Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 08:09, 15 April 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>This article explains how '''pinctrl''' framework manages IOs/pins, how to configure it, and how to use it.  </div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This article explains how <ins class="diffchange diffchange-inline">the Linux<sup>&reg;</sup> </ins>'''pinctrl''' framework manages IOs/pins, how to configure it, and how to use it.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Framework purpose==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Framework purpose==</div></td></tr>
<!-- diff cache key sfr_6065dc8b0294:diff::1.12:old-67081:rev-70397 -->
</table>
Jean Christophe Trotin
https://wiki.st.com/stm32mpu-ecosystem-v2/index.php?title=Pinctrl_overview&diff=67081&oldid=prev
Jean Christophe Trotin at 13:43, 30 January 2020
2020-01-30T13:43:05Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 13:43, 30 January 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"><noinclude></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{ArticleBasedOnModel | [[Framework overview article model]]}}</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{ArticleMainWriter | AlexandreT}}</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">{{ ArticleApprovedVersion|AlexandreT | ErwanLR (Done), GeraldB (Passed 6Aug'18), BernardP (PASS, 11June'18), FabriceG (PASS, 28June'18) | No previous approved version | BrunoB - 26Oct'18 - 9426 | 26Oct'18 }} </del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">[[Category:IOs pin management|1]] </del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></noinclude></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">'''SUMMARY'''<br></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This article explains how '''pinctrl''' framework manages IOs/pins, how to configure it, and how to use it.  </div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This article explains how '''pinctrl''' framework manages IOs/pins, how to configure it, and how to use it.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l304" >Line 304:</td>
<td colspan="2" class="diff-lineno">Line 295:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==References==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==References==</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><references /></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><<del class="diffchange diffchange-inline">references </del>/></div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><<ins class="diffchange diffchange-inline">noinclude></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">[[Category:IOs pin management|1]] </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">{{PublicationRequestId | 9426 | 2018-10-26 | BrunoB}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">{{ArticleBasedOnModel | Framework overview article model}}</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"><</ins>/<ins class="diffchange diffchange-inline">noinclude</ins>></div></td></tr>
</table>
Jean Christophe Trotin
https://wiki.st.com/stm32mpu-ecosystem-v2/index.php?title=Pinctrl_overview&diff=47202&oldid=prev
Frq08988 at 17:48, 9 January 2019
2019-01-09T17:48:28Z
<p></p>
<p><b>New page</b></p><div><noinclude><br />
{{ArticleBasedOnModel | [[Framework overview article model]]}}<br />
{{ArticleMainWriter | AlexandreT}}<br />
{{ ArticleApprovedVersion|AlexandreT | ErwanLR (Done), GeraldB (Passed 6Aug'18), BernardP (PASS, 11June'18), FabriceG (PASS, 28June'18) | No previous approved version | BrunoB - 26Oct'18 - 9426 | 26Oct'18 }} <br />
<br />
[[Category:IOs pin management|1]] <br />
</noinclude><br />
<br />
'''SUMMARY'''<br><br />
This article explains how '''pinctrl''' framework manages IOs/pins, how to configure it, and how to use it. <br />
<br />
==Framework purpose==<br />
Many of the microprocessor pins (with digital I/O or analog pin type) are multiplexed between different functions: GPIO, alternate function(s).<br><br />
Pinctrl framework is used to:<br />
* Configure pin hardware settings: multiplexing, pull-up/pull-down, open-drain ...<br />
* Provide information through debugfs<br />
<br />
Pinctrl framework is the Linux framework to configure and control the microprocessor pins. There are 2 ways to use it:<br />
* A pin (or group of pins) is controlled by a hardware block, then pinctrl will apply the pin configuration given by the device tree (it just applies devicetree configuration)<br />
* A pin needs to be controlled by software (typically a GPIO), then GPIOLib framework will be used to control this pin on top of pinctrl framework. Refer to [[GPIOLib overview]].<br />
<br />
==System overview==<br />
<br />
[[File:Pinctrl_overview.png]]<br />
<br />
===Component description===<br />
<br />
* '''Pinctrl:''' the pinctrl framework '''core''', its role is to:<br />
**provide API to other drivers <br />
**call specific vendor callback for pin configuration (muxing end setting)<br />
**create logical pin mapping and guarantee pin exclusivity for a device.<br />
<br />
* '''Pinctrl-stm32:''' microprocessor '''specific''' pinctrl driver, its role is to:<br />
**register vendor specific functions (callback) to pinctrl framework<br />
**access to hardware registers to configure pins (muxing and all pins capabilities)<br />
**provide other services described in [[GPIOLib overview]].<br />
<br />
*'''Base driver:''' generic kernel driver in charge of getting pin information through the device tree for a device and to register those pins to the pinctrl framework. <br />
<br />
* '''Foo_driver:'''<br />
**Foo_driver could be any driver that needs specific pins configuration. Note that "default" pins configuration is managed by the kernel base before foo_driver probe. No action is needed by the foo driver.<br><br />
**this configuration is described in the device tree file. See [[Pinctrl device tree configuration]].<br />
<br />
* '''debugfs:'''<br />
**provides debug interface available through user terminal, including pin configurations, muxing... See [[Pinctrl_overview#How_to_monitor_with_debugfs|How_to_monitor_with_debugfs]].<br />
<br />
===API description=== <br />
<br />
*'''Kernel space API''': Pinctrl API provides API interface to user driver.<br />
:*Main useful API functions are:<br />
::-''devm_pinctrl_get()'': call to get all pinctrl information.<br />
::-''pinctrl_lookup_state()'': call to obtain a pinctrl state struct from a name.<br />
::-''pinctrl_select_state()'': call to select a pinctrl state struct. After a call to this function, pins are configured.<br />
:*Possible standard state names are: {{Highlight|'''"default"'''}}, {{Highlight|'''"init"'''}}, {{Highlight|'''"sleep"'''}} and {{Highlight|'''"idle"'''}}.<br />
:*Pinctrl API functions to control those standard states are:<br />
::-''pinctrl_pm_select_sleep_state'': call to select {{Highlight|'''"sleep"'''}} state defined in device tree.<br />
::-''pinctrl_pm_select_idle_state'': call to select {{Highlight|'''"idle"'''}} state defined in device tree.<br />
::-''pinctrl_pm_select_default_state'': call to select {{Highlight|'''"default"'''}} state in device tree<br />
:*See pinctrl kernel documentation<ref name="API">{{CodeSource | Linux kernel | Documentation/driver-api/pinctl.rst}} Pinctrl documentation</ref> for more API function descriptions.<br />
<br />
*'''debugfs:'''<br />
:See [[Pinctrl_overview#How_to_monitor_with_debugfs|How_to_monitor_with_debugfs]]<br />
<br />
==Configuration==<br />
===Kernel configuration===<br />
Pinctrl framework and driver are enabled by default.<br />
<br />
===Device tree configuration===<br />
Refer to [[Pinctrl device tree configuration]].<br />
<br />
==How to use the framework==<br />
For a device, there are two ways to use pinctrl framework:<br />
*standard pinctrl utilization<br />
*custom (+standard) pinctrl utilization <br />
<br />
====Standard====<br />
*To simplify kernel development and avoid code duplication, Linux kernel is in charge to call pinctrl framework to apply pin states (pins configuration). It is possible when standard entries are used in device tree for "pinctrl-names". Possible standard names are: {{Highlight|'''"default"'''}}, {{Highlight|'''"init"'''}}, {{Highlight|'''"sleep"'''}} and {{Highlight|'''"idle"'''}}. <br />
<br />
<br />
*'''Device tree part:''' when using this approach, since Kernel base driver calls pinctrl framework, the user has to write device tree configuration. It means:<br />
:- '''Write pin states''': pin states nodes are defined inside the pin controller device node that contains several information about pin configuration. It can be for one pin or a group of pins. This information is not generic and depends on each pin controller driver. See [[Pinctrl device tree configuration]] for details. <br />
<br />
<br />
<pre>pincontroller {<br />
foo_state_pins_a {<br />
"pins configuration: muxing, pull-up/pull-down, ..."<br />
};<br />
<br />
foo_state_pins_b {<br />
"pins configuration: muxing, pull-up/pull-down, ..."<br />
};<br />
<br />
foo_state_pins_sleep_b {<br />
"pins configuration: muxing, pull-up/pull-down, ..."<br />
};<br />
}</pre><br />
<br />
:- '''Invoke pin configuration inside user device node'''.<br />
<br />
foo_device { {{Highlight|'''comments'''}}<br />
...<br />
pinctrl-names = "default"; {{Highlight|-->Standard name known by Linux Kernel. It's mapped on pinctrl-0 state.}}<br />
pinctrl-0 = <&foo_state_pins_a>; {{Highlight|-->Phandle to a pin state node(see above).}}<br />
...<br />
};<br />
<br />
<br />
::If needed two pin nodes ''foo_state_pins_a'' and ''foo_state_pins_b'' can be used for a same state:<br />
<pre><br />
foo_device {<br />
...<br />
pinctrl-names = "default";<br />
pinctrl-0 = <&foo_state_pins_a &foo_state_pins_b>;<br />
...<br />
};<br />
</pre><br />
<br />
<br />
::Two differents states {{Highlight|'''"default"'''}} and {{Highlight|'''"sleep"'''}} can also be defined. First name {{Highlight|'''"default"'''}} is mapped to the first state "pinctrl-0", second name {{Highlight|'''"sleep"'''}} is mapped to the second state "pinctrl-1": <br />
<pre><br />
foo_device {<br />
...<br />
pinctrl-names = "default", "sleep";<br />
pinctrl-0 = <&foo_state_pins_a>;<br />
pinctrl-1 = <&foo_state_pins_sleep_a>;<br />
...<br />
};<br />
</pre><br />
<br />
*'''Base driver part<ref name="Base_driver">{{CodeSource | Linux kernel | drivers/base/pinctrl.c}} Pinctrl base driver source</ref>'''<br />
<br />
The base driver is in charge to '''register''' pin states to devices that use standard names as {{Highlight|'''"default"'''}}, {{Highlight|'''"idle"'''}}, {{Highlight|'''"sleep"'''}}, {{Highlight|'''"init"'''}}. This driver is in charge to '''select''' {{Highlight|'''"default"'''}} and {{Highlight|'''"init"'''}} state:<br />
<br />
:-If {{Highlight|'''"default"'''}} state is defined in device tree, this state is selected before the driver probe.<br />
<br />
:-If {{Highlight|'''"init"'''}} and {{Highlight|'''"default"'''}} state are defined, the {{Highlight|'''"init"'''}} state is selected before the driver probe and the {{Highlight|'''"default"'''}} state is selected after the driver probe. It is mainly used to avoid glitches. <br />
<br />
<br />
*'''Foo driver part'''<br />
As explain above the base driver is in charge to select {{Highlight|'''"default"'''}} and {{Highlight|'''"init"'''}} states at probe time. To select {{Highlight|'''"idle"'''}} and {{Highlight|'''"sleep"'''}} states, the foo driver has to call pinctrl framework API:<br />
<br />
{{Highlight|'''"sleep"'''}} and {{Highlight|'''"idle"'''}} states are mainly used for power management. Indeed to reduce leakage and power consumption, pin settings are changed when the device is not in use. In this case ''pinctrl_pm_select_sleep_state'' and ''pinctrl_pm_select_idle_state'' functions can be used. When the device is used again, {{Highlight|'''"default"'''}} state has to be restored, then ''pinctrl_pm_select_default_state'' is used.<br />
<br />
====Custom====<br />
*Sometimes, using standard pin states (managed by base driver and not by concerned foo_driver) is not enough. Foo_driver may need to control pin states at runtime. In such a case it will be up to foo_driver to call framework API.<br />
<br />
*The custom pinctrl usage may cohabit with the standard usage explained in previous section.<br />
<br />
*Extracted from documentation<ref name="API"/>, here is an example on how to use 2 different configurations inside a device driver:<br />
**'''device tree part'''<br />
::- '''Write pin states''': pin states nodes are defined inside the pin controller device node that contains several information about pin configuration. It can be for one pin or a group of pins. This information is not generic and depends on each pin controller driver. See [[Pinctrl device tree configuration]] for details. <br />
<br />
<pre>pincontroller {<br />
foo_state_pins_a {<br />
"pins configuration: muxing, pull-up/pull-down, ..."<br />
};<br />
<br />
foo_state_pins_b {<br />
"pins configuration: muxing, pull-up/pull-down, ..."<br />
};<br />
}</pre><br />
<br />
::-'''Invoke pin configuration inside user device node'''.<br />
<br />
<pre><br />
foo_device {<br />
pinctrl-names = "state-A", "state-B";<br />
pinctrl-0 = <&state_pins_A>;<br />
pinctrl-1 = <&state_pins_B>;<br />
};<br />
<br />
</pre><br />
:*'''foo driver part'''<br />
<br />
::- Initialization part:<br />
<br />
<pre><br />
#include <linux/pinctrl/consumer.h><br />
<br />
struct pinctrl *p;<br />
struct pinctrl_state *s1, *s2;<br />
<br />
foo_probe()<br />
{<br />
/* Setup */<br />
p = devm_pinctrl_get(&device);<br />
if (IS_ERR(p))<br />
...<br />
<br />
s1 = pinctrl_lookup_state(foo->p, "state-A");<br />
if (IS_ERR(s1))<br />
...<br />
<br />
s2 = pinctrl_lookup_state(foo->p, "state-B");<br />
if (IS_ERR(s2))<br />
...<br />
}<br />
</pre><br />
<br />
::- Runtime usage: each state can be selected at runtime.<br />
<br />
<pre>foo_switch()<br />
{<br />
/* Select pinctrl state A */<br />
ret = pinctrl_select_state(s1);<br />
if (ret < 0)<br />
...<br />
<br />
...<br />
<br />
/* select pinctrl state B */<br />
ret = pinctrl_select_state(s2);<br />
if (ret < 0)<br />
...<br />
<br />
...<br />
}<br />
</pre><br />
*See {{CodeSource | Linux kernel | drivers/mmc/host/mmci.c | mmci driver}} example for a real use case (search for "pinctrl_select_state").<br />
<br />
==How to trace and debug the framework==<br />
<br />
===How to monitor===<br />
====How to monitor with debugfs====<br />
Some information about pin controller / pins states / pins configurations is available in [[Debugfs]] interface. There are two levels of information:<br />
<br />
:1 Generic information:<br />
{{Board$}} ls -l /sys/kernel/debug/pinctrl/<br />
|<br />
+---pinctrl-devices | List of pin ctroller devices.<br />
+---pinctrl-handles | List of all pin states registered.<br />
+---pinctrl-maps | List of all pin states registered per pin used.<br />
+---soc:pincontroller | Folder which contains pins information for a pin controller.<br />
<br />
:2 Pin controller information:<br />
{{Board$}} ls -l /sys/kernel/debug/pinctrl/soc:pincontroller<br />
|<br />
+---gpio-ranges | Provides mapping between logical address space and pins address space for GPIOs.<br />
+---pinconf-config | Provides modified pins at runtime. Not supported.<br />
+---pinconf-groups | Provides pin config settings per pin group.<br />
+---pinconf-pins | Provides all pins settings. It reflects the hardware values.<br />
+---pingroups | Provides registered pin groups.<br />
+---pinmux-functions | Provides all possibles muxing available.<br />
+---pinmux-pins | Provides a list for each pin the muxing selected and the device which use the pin.<br />
+---pins | Provides list of all pins.<br />
<br />
===How to trace===<br />
* The following extract of kernel log shows that pin controller is well probed:<br />
<pre><br />
[ 0.353613] stm32mp157-pinctrl soc:pin-controller: GPIOA bank added<br />
[ 0.360539] stm32mp157-pinctrl soc:pin-controller: GPIOB bank added<br />
[ 0.367344] stm32mp157-pinctrl soc:pin-controller: GPIOC bank added<br />
[ 0.374199] stm32mp157-pinctrl soc:pin-controller: GPIOD bank added<br />
[ 0.381016] stm32mp157-pinctrl soc:pin-controller: GPIOE bank added<br />
[ 0.387850] stm32mp157-pinctrl soc:pin-controller: GPIOF bank added<br />
[ 0.394625] stm32mp157-pinctrl soc:pin-controller: GPIOG bank added<br />
[ 0.401463] stm32mp157-pinctrl soc:pin-controller: GPIOH bank added<br />
[ 0.408257] stm32mp157-pinctrl soc:pin-controller: GPIOI bank added<br />
[ 0.415098] stm32mp157-pinctrl soc:pin-controller: GPIOJ bank added<br />
[ 0.421889] stm32mp157-pinctrl soc:pin-controller: GPIOK bank added<br />
[ 0.428444] stm32mp157-pinctrl soc:pin-controller: Pinctrl STM32 initialized<br />
[ 0.436604] stm32mp157-pinctrl soc:pin-controller-z: GPIOZ bank added<br />
[ 0.443222] stm32mp157-pinctrl soc:pin-controller-z: Pinctrl STM32 initialized<br />
</pre><br />
By default there is no indication in the log that the pin default state has been correctly applied to the device by the base driver. If an issue occurs (like a conflict) the device probe will fail with an error.<br />
<br />
* If more kernel logs are needed, use pinctrl [[How to use the kernel dynamic debug|dynamic debug]]:<br />
{{Board$}} dmesg -n8<br />
{{Board$}} echo "file drivers/pinctrl* +p" > /sys/kernel/debug/dynamic_debug/control<br />
<br />
:- Since main pin states are applied when devices are probed (meaning before userland prompt) the dynamic printk may need to be enabled in command line:<br />
root=/dev/mmcblk0p5 rootwait rw earlyprintk console=ttyS3,115200 loglevel=8 '''dyndbg="{{Green|file}} drivers/pinctrl/* +p"'''<br />
<br />
===How to debug===<br />
Our pin controller is configured in ''strict mode'' (meaning that a pin can be requested by only one device). <br />
So if a device cannot request a pin during kernel boot, the device tree should be controlled to check if the pin is not affected to two different devices.<br />
<br />
Another kind of problem may be that a pin configuration does not fit with the design. In this case, first check the [[Pinctrl overview#How to monitor with debugfs|pinconf-pins]] file in debugfs to verify that the pin hardware settings correspond to the settings defined in the device tree for the same pins. If everything matches, compare the settings with the board schematic in search for missing or unaligned settings, in particular regarding pull-up/pull-down/open-drain ... See [[GPIO internal peripheral]] article.<br />
<br />
==Source code location==<br />
<br />
Source files are located inside kernel Linux.<br />
<br />
*'''Pinctrl core part''': generic core<ref>{{CodeSource | Linux kernel | drivers/pinctrl/core.c | Pinctrl framework source - core.c}} Sources of generic pinctrl framework</ref>, generic pinconf<ref>{{CodeSource |Linux kernel | drivers/pinctrl/pinconf.c |Pinctrl framework source - pinconf.c}} Sources of generic pin configuration</ref> and generic pinmux<ref>{{CodeSource |Linux kernel | drivers/pinctrl/pinmux.c | Pinctrl framework source - pinmux.c}} Sources of generic pin muxing</ref><br />
<br />
*'''STM32 pinctrl vendor part''': folder to STM32 dedicated pinctrl functions<ref>{{CodeSource | Linux kernel | drivers/pinctrl/stm32 | STM32 vendor specific folder}} Provides all vendor specifics functions</ref><br />
<br />
*'''base driver part'''<ref name="Base_driver"/><br />
<br />
==To go further==<br />
===Configure pins for a new board===<br />
To configure a new board, two scenarios are possible:<br />
<br />
*Pins/groups for device/internal peripherals are already defined: in this case, you only have to select the right group for your device according to schematics.<br />
<br />
*Pins/groups for device/internal peripherals are NOT already defined: In this case, you have to define your pins/groups settings inside pincontroller and to select it in your device node according to schematics.<br />
<br />
*Please refer to [[Pinctrl_device_tree_configuration#DT_configuration_examples|Pinctrl device tree configuration example]]<br />
<br />
Or you can use [[STM32CubeMX]] to select your pins and to generate the devicetree accordingly.<br />
<br />
===Trainings===<br />
More details about pinctrl framework <ref>[http://bootlin.com/doc/training/linux-kernel/linux-kernel-slides.pdf character device interface], ''Linux Kernel and Driver Development'' training document, see Introduction to pin muxing''' chapter</ref><br />
<br />
==References==<br />
<br />
<references /></div>
Frq08988