I tried to define GPIO0 as a led in dts file. here is my definition:
act_led{
label = "act_led";
gpios = <&gpio0 0 0>;
linux,default-trigger = "default-on";
};
there is "act_led" is in /sys/class/leds/. it works when writing this command:
echo heartbeat > /sys/class/leds/act_led/trigger
however when the "act_led" is turned off, other gpios (GPIO1, GPIO2, GPIO4, GPIO5) goes to low level. why this is happening?
Hi,
I too had some strange behaviour of GPIOs. Perhaps you can
provide some additional infos? How are GPIO{1,2,4,5}
configured? Do you have any pinctrl setup for your GPIOs?
here is configuration of GPIOs
pinctrl@80018000 {
pinctrl-names = "default";
pinctrl-0 = <&hog_pins_a>;
hog_pins_a: hog@0 {
reg = <0>;
fsl,pinmux-ids = <
0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */
0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
my_gpio0_1: led_gpio0_1@0 {
reg = <0>;
fsl,pinmux-ids = <
0x0013 // MX23_PAD_GPMI_D01__GPIO_0_1
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
my_gpio0_2: led_gpio0_2@0 {
reg = <0>;
fsl,pinmux-ids = <
0x0023 // MX23_PAD_GPMI_D02__GPIO_0_2
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
my_gpio1_6: led_gpio1_6@0 {
reg = <0>;
fsl,pinmux-ids = <
0x1063 // MX23_PAD_LCD_D06__GPIO_1_6
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
my_gpio1_7: led_gpio1_7@0 {
reg = <0>;
fsl,pinmux-ids = <
0x1073 // MX23_PAD_LCD_D07__GPIO_1_7
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
auxi2c_sda: aux_i2c_sda@0 {
reg = <0>;
fsl,pinmux-ids = <
0x0053 // MX23_PAD_GPMI_D05__GPIO_0_5
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
auxi2c_scl: aux_i2c_scl@0 {
reg = <0>;
fsl,pinmux-ids = <
0x0043 // MX23_PAD_GPMI_D04__GPIO_0_4
>;
fsl,drive-strength = <0>;
fsl,voltage = <1>;
fsl,pull-up = <0>;
};
};
Are you referencing these definitions later in your dts,
or are you just controling the GPIOs via sysfs. If the
latter, what's the configuration you impose via sysfs
and what do you actually observe? - Ie which kind of
measurement do you take?
no I am not referencing these definitions later in dts.
for the act_led I use shell script command
echo heartbeat > /sys/class/leds/act_led/trigger
for other pins I use gpio-mmap.h (https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/iMX233/gpio-mmap.h) file in my C program.
Quote from: azuolas on December 16, 2013, 02:51:54 PM
no I am not referencing these definitions later in dts.
Then these definitions probably won't have any effect. (Shouldn't matter
as these are the defaults anyway.)
Quote
for the act_led I use shell script command
echo heartbeat > /sys/class/leds/act_led/trigger
OK
Quote
for other pins I use gpio-mmap.h (https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/iMX233/gpio-mmap.h) file in my C program.
Well, this totally circumvents the kernel GPIO driver. Since the kernel
doesn't know about the new values it will write back the old values
whenever you change the LED or any other kernel driven GPIO. Use
/sys/class/gpio instead fo gpio-mmap.h. If this is to slow for your
application, then write some custom kernel module.
HTH,
Harald