Search code examples
embedded-linuxyoctogpiodevice-tree

Where can I find the mapping of SAMA5D27-SOM1-EK1 devices and it's GPIOS?


I am using SAMA5D27-SOM-EK1 embedded board. I build for it Linux image OS using YOCTO project version SUMO.

I need to know device's GPIOS ( gpios-leds and gpios keys specialy) and the mapping of the board.

When I enter in /sys/firmware/devicetree/base/leds/red for example in the board terminal I can find gpio file but when i open it there are symbols which i can't read. I think that I can find such things in the generated Device Tree but i can't find its path!

Please help me out


Solution

  • Here is the original dts: https://elixir.bootlin.com/linux/v5.2/source/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts#L510

    The relevant part is:

        leds {
        compatible = "gpio-leds";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_led_gpio_default>;
        status = "okay"; /* Conflict with pwm0. */
    
        red {
            label = "red";
            gpios = <&pioA PIN_PA10 GPIO_ACTIVE_HIGH>;
        };
    
        green {
            label = "green";
            gpios = <&pioA PIN_PB1 GPIO_ACTIVE_HIGH>;
        };
    
        blue {
            label = "blue";
            gpios = <&pioA PIN_PA31 GPIO_ACTIVE_HIGH>;
            linux,default-trigger = "heartbeat";
        };
    };
    

    This shows that the red LED is connected to the PA10 gpio, green is on PB1 and blue on PA31.

    The other way to find the info is to look at the schematics here: http://ww1.microchip.com/downloads/en/DeviceDoc/SAMA5D27-SOM1-EK1_Board%20Files_1.B.B.zip

    Page 3 of SAMA5D27-SOM1-EK1_REVB.pdf sums the pinmuxing and page 8 shows the actual connection.

    Regarding what you want to do (toggling the led if I remember correctly), you can simply have a look at /sys/class/leds/red/brightness writing 0 in that file will turn it off while writing 1, will turn it on.