0

I have an Intel Galileo board with LED connected to one of GPIO pin. When I am connecting power to Galileo, LED lights up for a second and then turns off again.

Once my application start I am able to manipulate LED. But now I want my LED to turned ON during whole boot process and once my application starts it should manipulate LED after then. I guess to achieve this I have to change kernel code and build it again completely.

halfer
  • 19,824
  • 17
  • 99
  • 186
cgoma
  • 47
  • 2
  • 13
  • There is a project *meta-acpi* on Github where you may find examples how to manipulate GPIO lines via ACPI. Note, any of mentioned way won’t fix your issue fully, otherwise you basically need to either write and run UEFI application, or hack a boot loader (in UEFI btw Linux may be loaded as UEFI application too) – 0andriy Oct 18 '17 at 21:53

1 Answers1

1

If possible, you can make the default state of the GPIO high/low in Boot loader. Or, Refer the following Changes in linux kernel and device tree.

:arch/xxx/boot/dts/xxxx.dts

led@4 {
label = "evmsk:green:heartbeat";
gpios = <&gpio1 7 0>;
linux,default-trigger = "heartbeat";
default-state = "off";
};

:drivers/leds/leds-gpio.c

state = of_get_property(child, "default-state", NULL);
if (state) {
if (!strcmp(state, "keep"))
led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
else if (!strcmp(state, "on"))
led.default_state = LEDS_GPIO_DEFSTATE_ON;
else
led.default_state = LEDS_GPIO_DEFSTATE_OFF;
}

ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state);
Rajeshkumar
  • 739
  • 5
  • 16
  • Thanks for your reply. I guess intel galileo uses x86 arch. But when I went to path :arch/xxx/boot/dts/ for x86 arch, there is no file with extension .dts. So do I need to change only leds-gpio.c. – cgoma Sep 25 '17 at 12:46
  • I didn't see it in the 5.4.y branch either, the yocto BSP seems to be available from here: https://downloadcenter.intel.com/download/26418?v=t you could dig through the recipes. – lnksz Jan 18 '21 at 14:07