Hi,
I want to export GPIO leds (52,55) to the user space where it can be controlled from an userspace program.
When I try to see the exported GPIO’s from the terminal I get the following output.
sh-4.3# cat /sys/kernel/debug/gpio
GPIOs 0-31, platform/209c000.gpio, 209c000.gpio:
GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:
gpio-37 (cd ) in hi
gpio-52 (? ) out lo
gpio-54 (Wake-Up ) in lo
gpio-55 (? ) out lo
GPIOs 64-95, platform/20a4000.gpio, 20a4000.gpio:
gpio-84 (spi_imx ) out lo
gpio-88 (spi_imx ) out lo
gpio-89 (spi_imx ) out lo
gpio-95 (usb_host_vbus ) out lo
GPIOs 96-127, platform/20a8000.gpio, 20a8000.gpio:
gpio-108 (scl ) in hi
gpio-109 (sda ) in hi
GPIOs 128-159, platform/20ac000.gpio, 20ac000.gpio:
gpio-130 (spi_imx ) out lo
gpio-145 (spi_imx ) out lo
GPIOs 160-191, platform/20b0000.gpio, 20b0000.gpio:
GPIOs 192-223, platform/20b4000.gpio, 20b4000.gpio:
gpio-204 (id ) in lo
I can control the LEDs from the GPIO-Tool which shows that we have the lines correct.
Here is my device tree (copied from Apalis IMX6): imx6dl-colibri-eval-v3.dts
&iomuxc {
/*
* Mux all pins which are unused to be GPIOs
* so they are ready for export to user space
*/
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_weim_gpio_1 &pinctrl_weim_gpio_2
&pinctrl_weim_gpio_3 &pinctrl_weim_gpio_4
&pinctrl_weim_gpio_5 &pinctrl_weim_gpio_6
&pinctrl_csi_gpio_1
&pinctrl_gpio_1
&pinctrl_gpio_2
&pinctrl_usbh_oc_1 &pinctrl_usbc_id_1>;
gpio {
pinctrl_pcap_1: pcap-1 {
fsl,pins = <
MX6QDL_PAD_GPIO_9__GPIO1_IO09 PAD_CTRL_HYS_PD /* SODIMM 28 */
MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 PAD_CTRL_HYS_PD /* SODIMM 30 */
>;
};
};
leds_colibri {
pinctrl_leds_colibri: leds-colibri {
fsl,pins = <
MX6QDL_PAD_EIM_CS0__GPIO2_IO23 PAD_CTRL_HYS_PU
MX6QDL_PAD_EIM_A18__GPIO2_IO20 PAD_CTRL_HYS_PU
>;
};
};
}
{
leds { compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_leds_colibri>;
led1-red {
label = "LED_1_RED";
gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
};
led2-green {
label = "LED_2_GREEN";
gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
};
};
Can someone let me know what am I doing wrong here?
If I have a export extra GPIOs, Do i just include them in this node ?
Also, would it be possible to work up a little code snippet that shows me what I need to include to actually read the state of the input pins and control the state of the output pins?
Thanks