Disable LCD for Gpio IMX7D

Hello,

I want to use these 2 GPIO pin instead of LCD.

Sodimm pin : 60 → lcdif.DATA[2] → gpio3.IO[7]

Sodimm pin : 64 → lcdif.DATA[15] → gpio3.IO[20]

So i decide to modify my “imx7-colibri-eval-v3.dtsi” file and make the dtb. Then with the toradex recommandation change the pin direction and value :

echo 84 > /sys/class/gpio/export
echo low > /sys/class/gpio/gpio84/direction
echo 1 > /sys/class/gpio/gpio84/value

echo 71 > /sys/class/gpio/export
echo low > /sys/class/gpio/gpio71/direction
echo 1 > /sys/class/gpio/gpio71/value

But nothing append. I can export but the pin is still low.
I change in my dtsi the lcdif status like this :

&lcdif {
    status = "disabled";
};

and the iomuxc like this :

&iomuxc {
	imx7d-eval-v3 {
		pinctrl_additionalgpio: additionalgpios {
             fsl,pins = <
                MX7D_PAD_LCD_DATA02__GPIO3_IO7	0x14
                MX7D_PAD_LCD_DATA15__GPIO3_IO20   0x14   
             >;
        };
	};
};

this is my all dtsi file :

/*
 * Copyright 2016 Toradex AG
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

/ {
	chosen {
		bootargs = "console=ttymxc0,115200";
	};

	clocks {
		/* fixed crystal dedicated to mpc258x */
		clk16m: clk@1 {
			compatible = "fixed-clock";
			reg=<1>;
			#clock-cells = <0>;
			clock-frequency = <16000000>;
			clock-output-names = "clk16m";
		};
	};

	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpiokeys>;

		power {
			label = "Wake-Up";
			gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>;
			linux,code = <KEY_WAKEUP>;
			debounce-interval = <10>;
			gpio-key,wakeup;
		};
	};

	extcon_usbc_det: usbc_det {
		compatible = "linux,extcon-usb-gpio";
		debounce = <25>;
		id-gpio = <&gpio7 14 GPIO_ACTIVE_HIGH>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_usbc_det>;
	};

	gpio_additional {
        pinctrl-name = "default";
        pinctrl-0 = <&pinctrl_additionalgpio>;
        status = "okay";
    };
};

&bl {
	brightness-levels = <0 4 8 16 32 64 128 255>;
	default-brightness-level = <6>;
	status = "okay";
};

&adc1 {
	status = "okay";
};

&adc2 {
	status = "okay";
};

&epxp {
	status = "okay";
};

&ecspi3 {
	status = "okay";

	mcp258x0: mcp258x@1 {
		compatible = "microchip,mcp2515";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_can_int>;
		reg = <0>;
		clocks = <&clk16m>;
		interrupt-parent = <&gpio5>;
		interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
		spi-max-frequency = <10000000>;
		status = "okay";
	};

	spidev0: spidev@1 {
		compatible = "toradex,evalspi";
		reg = <0>;
		spi-max-frequency = <23000000>;
		status = "disabled";
	};
};

&fec1 {
	status = "okay";
};


/*&fec2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_enet2>;

	clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
		<&clks IMX7D_ENET_AXI_ROOT_CLK>,
		<&clks IMX7D_ENET2_TIME_ROOT_CLK>,
		<&clks IMX7D_PLL_ENET_MAIN_50M_CLK>,
		<&clks IMX7D_ENET2_REF_ROOT_CLK>;
	clock-names = "ipg", "ahb", "ptp","enet_clk_ref", "enet_out";
    assigned-clocks =     <&clks IMX7D_ENET2_TIME_ROOT_SRC>,
                            <&clks IMX7D_ENET2_TIME_ROOT_CLK>,
                            <&clks IMX7D_ENET_PHY_REF_ROOT_DIV>;
	assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
    assigned-clock-rates = <0>, <100000000>, <50000000>;
	phy-mode = "rmii";
	fsl,mii-exclusive;
	fsl,magic-packet;
	status = "okay";
};*/

&i2c4 {
	status = "okay";

	touch: touchrevf0710a@10 {
		compatible = "touchrevolution,fusion-f0710a";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpiotouch>;
		reg = <0x10>;
			/* SODIMM 28, Pen down interrupt */
		gpios = <&gpio1 9 GPIO_ACTIVE_HIGH
			/* SODIMM 30, Reset interrupt */
			 &gpio1 10 GPIO_ACTIVE_LOW
			>;
		status = "disabled";
	};

	/* M41T0M6 real time clock on carrier board */
	rtc: m41t0m6@68 {
		compatible = "st,m41t00";
		reg = <0x68>;
	};
};


&lcdif {
    status = "disabled";
};


&pwm1 {
	status = "disabled";
};

&pwm2 {
	status = "disabled";
};

&pwm3 {
	status = "disabled";
};

&pwm4 {
	status = "disabled";
};

&uart1 {
	status = "okay";
};

&uart2 {
	status = "okay";
};

&uart3 {
	status = "okay";
};

&usbotg1 {
	extcon = <&extcon_usbc_det>;
	vbus-supply = <&reg_usb_otg2_vbus>;
	status = "okay";
};

/* The define SD_1_8 allows to use the SD interface at a higher speed mode
 * if the card supports it. For this the signaling voltage is switched from
 * 3.3V to 1.8V under the usdhc1's drivers control.
 * All pins supplied with NVCC_SD1 must be able to cope with this
 * and must (MUST!!!) not be driven with a voltage higher than 1.8V or
 * the interface will not work.
 */
/* #define SD_1_8 */
&usdhc1 {
#ifdef SD_1_8
	pinctrl-names = "default", "state_100mhz", "state_200mhz";
	pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_cd_usdhc1>;
	pinctrl-1 = <&pinctrl_usdhc1_100mhz &pinctrl_cd_usdhc1>;
	pinctrl-2 = <&pinctrl_usdhc1_200mhz &pinctrl_cd_usdhc1>;
	vmmc-supply = <&reg_3p3v>;
	vqmmc-supply = <&reg_LDO2>;
#else
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_cd_usdhc1>;
	no-1-8-v;
#endif
	cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
	disable-wp;
	enable-sdio-wakeup;
	keep-power-in-suspend;
	status = "okay";
};



&iomuxc {
	imx7d-eval-v3 {
		pinctrl_gpiotouch: touchgpios {
			fsl,pins = <
				MX7D_PAD_GPIO1_IO09__GPIO1_IO9		0x74
				MX7D_PAD_GPIO1_IO10__GPIO1_IO10		0x14
			>;
		};

		pinctrl_additionalgpio: additionalgpios {
             fsl,pins = <
                MX7D_PAD_LCD_DATA02__GPIO3_IO7		0x14
                MX7D_PAD_LCD_DATA15__GPIO3_IO20   	0x14   
             >;
        };
	};
};

Thanks for help !

Dear @tupperware,

Thank you for contacting Toradex Support!

Your approach looks correct already. In order to examine further, could you please share your dmesg log with us.

Thank and Regards,
Janani.

Dear @tupperware ,

I also happened to notice that you configure the pins “low”/ “high”, as opposed to “ïn”/ “out”

Thanks and Regards,
Janani.

Hello @tupperware ,

Thank you for the file. Yes, you are correct the dmesg file does not give away much.

The SODIMM pin in the discussion is pulled down and you must use software to pull them up. Also, can you share the debug log for GPIO?

Thank you and regards,
Janani.

My first command :
cat /sys/kernel/debug/pinctrl/pinctrl-handles

file link text

So i found my “additionalgpios” and its function of " imx7d-eval-v3"

    type: MUX_GROUP controller 30330000.iomuxc group: additionalgpios (30) function: imx7d-eval-v3 (1)

    type: CONFIGS_PIN controller 30330000.iomuxc pin MX7D_PAD_LCD_DATA02 (52) 00000014

    type: CONFIGS_PIN controller 30330000.iomuxc pin MX7D_PAD_LCD_DATA15 (65) 00000014

Then the second command :

cat /sys/kernel/debug/gpio

if i look the GPIO debug i found this :

GPIOs 0-31, platform/30200000.gpio, 30200000.gpio:                                                                                 
 gpio-0   (cd                  ) in  lo                                                                                            
 gpio-1   (Wake-Up             ) in  lo                                                                                            
                                                                                                                                   
GPIOs 32-63, platform/30210000.gpio, 30210000.gpio:                                                                                
                                                                                                                                   
GPIOs 64-95, platform/30220000.gpio, 30220000.gpio:                                                                                
 gpio-71  (sysfs               ) out lo                                                                                            
 gpio-84  (sysfs               ) out lo                                                                                            
                                                                                                                                   
GPIOs 96-127, platform/30230000.gpio, 30230000.gpio:                                                                               
 gpio-103 (usb_otg2_vbus       ) out lo                                                                                            
 gpio-107 (spi_imx             ) out lo                                                                                            
                                                                                                                                   
GPIOs 128-159, platform/30240000.gpio, 30240000.gpio:                                                                              
                                                                                                                                   
GPIOs 160-191, platform/30250000.gpio, 30250000.gpio:                                                                              
                                                                                                                                   
GPIOs 192-223, platform/30260000.gpio, 30260000.gpio:                                                                              
 gpio-206 (id                  ) in  hi    

I have 71 and 84 so my gpio3.IO[7] and gpio3.IO[20]. I can put them as Input but i can’t put them as output and high.

Dear @tupperware ,

Glad it worked. Good luck with the project!

Best Regards,
Janani

Hi,

It work now, I can see my pin go high.

I change this in my dtsi file :

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_additionalgpio>;
	imx7d-eval-v3 {

But i have something else strange

echo 84 > /sys/class/gpio/export → OK

echo out > /sys/class/gpio/gpio84/direction → OK

echo 1 > /sys/class/gpio/gpio84/value → OK

cat /sys/class/gpio/gpio84/value → 0 !!! but my pin go high

thank you @saijanani.tx

Hello,

Here the dmesg file. I can see nothing about lcdif.
link text

I tried also “in”/“out” instead of “low”/“high” buth nothing happened.

thank you.