Skip to contentSkip to conversation

Query on pin multiplexing with device tree

DISCUSSION Victor Ascroft 2 participants 3 messages Sep 25, 2014 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hello,

pinctrl_touchctrl_idle: touchctrl_idle {
            fsl,pins = <
                MF610_PAD_PTA18__GPIO_8            0x0041
                MF610_PAD_PTA19__GPIO_9            0x0041
                >;
        };

        pinctrl_touchctrl_read: touchctrl_read {
            fsl,pins = <
                MF610_PAD_PTA18__ADC0_SE0        0x0041
                MF610_PAD_PTA19__ADC0_SE1        0x0041
                >;

If i have pin multiplexing in device tree as above, how can i select and change the pin multiplexing at run time?

Regards,
Sanchayan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140925/7ba0ae4f/attachment.html

#2 lore raw

Hi Victor,

Quoted 15 lines · Victor Ascroft

Hello,

pinctrl_touchctrl_idle: touchctrl_idle {
            fsl,pins = <
                MF610_PAD_PTA18__GPIO_8            0x0041
                MF610_PAD_PTA19__GPIO_9            0x0041
                >;
        };

        pinctrl_touchctrl_read: touchctrl_read {
            fsl,pins = <
                MF610_PAD_PTA18__ADC0_SE0        0x0041
                MF610_PAD_PTA19__ADC0_SE1        0x0041
                >;
Quoted 2 lines

If i have pin multiplexing in device tree as above, how can i select and change the pin multiplexing at run time?

This will have to be done by the "consumer" driver, which judging by the node names here will be your touchscreen driver.

You will have to reference in pinctrl-names several different states, instead of just "default" that is commonly used, and then, you can modify the state to use using the pinctrl functions.

That would make something like this in your DT:

    touchscreen at deadbeef {
        pinctrl-names = "default", "idle";
	pinctrl-0 = <&pinctrl_touchctrl_read>;
	pinctrl-1 = <&pinctrl_touchctrl_idle>;
    };

The good thing about this is that the states default, idle and sleep are already grabbed by the device model whenever your driver is probed, and the only thing you have to do from your driver to switch from one state to another is to call pinctrl_pm_select_default_state or pinctrl_pm_select_idle_state.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140925/01050d62/attachment.bin 
#3 lore raw
Quoted 34 lines · Maxime Ripard

Hi Victor,

Quoted 15 lines · Victor Ascroft

Hello,

pinctrl_touchctrl_idle: touchctrl_idle {
            fsl,pins = <
                MF610_PAD_PTA18__GPIO_8            0x0041
                MF610_PAD_PTA19__GPIO_9            0x0041
                >;
        };

        pinctrl_touchctrl_read: touchctrl_read {
            fsl,pins = <
                MF610_PAD_PTA18__ADC0_SE0        0x0041
                MF610_PAD_PTA19__ADC0_SE1        0x0041
                >;
Quoted 2 lines

If i have pin multiplexing in device tree as above, how can i select and change the pin multiplexing at run time?

This will have to be done by the "consumer" driver, which judging by the node names here will be your touchscreen driver.

You will have to reference in pinctrl-names several different states, instead of just "default" that is commonly used, and then, you can modify the state to use using the pinctrl functions.

That would make something like this in your DT:

    touchscreen at deadbeef {
        pinctrl-names = "default", "idle";
	pinctrl-0 = <&pinctrl_touchctrl_read>;
	pinctrl-1 = <&pinctrl_touchctrl_idle>;
    };
Quoted 8 lines

The good thing about this is that the states default, idle and sleep are already grabbed by the device model whenever your driver is probed, and the only thing you have to do from your driver to switch from one state to another is to call pinctrl_pm_select_default_state or pinctrl_pm_select_idle_state.

Maxime

I was not aware of the device model reading the default and idle state on probe. I have the touchscreen binding set up now.

Thank you very much.

Regards,
Victor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140925/08900425/attachment.html