Re: [systemd-devel] GPIO Reset Button
Op 10 nov. 2012, om 01:17 heeft Lennart Poettering het volgende geschreven: > On Fri, 02.11.12 09:56, Pawel Pastuszak (pawelpastus...@gmail.com) wrote: > >> Hi all, >> >> I was wondering if there is an way to attach an GPIO line to reboot the >> system. I am currently working on an Embedded device that has an GPIO line >> which needs to act as an reboot button this GPIO comes up as an >> /sys/class/gpio/gpio103/ which i want to have it trigger when it switches >> state to low and do an system soft reboot. Does systemd allow any >> functionally like this? > > No. We only look for input devices marked with the "power-switch" > tag. > > The kernel can create input devices for GPIO lines > (CONFIG_KEYBOARD_GPIO), IIRC? Maybe that's useful to achieve this? It should be a matter of: static struct gpio_keys_button my_awesome_gpio_keys[] = { { .code = KEY_POWER, .gpio = GPIO_TO_PIN(1, 16), .active_low = true, .desc = "left", .type = EV_KEY, .wakeup = 1, }, }; static struct gpio_keys_platform_data my_awesome_gpio_key_info = { .buttons= my_awesome_gpio_keys, .nbuttons = ARRAY_SIZE(my_awesome_gpio_keys), }; static struct platform_device my_awesome_keys = { .name = "gpio-keys", .id = -1, .dev= { .platform_data = &my_awesome_gpio_key_info, }, }; Or with devicetree: gpio_keys { compatible = "gpio-keys"; pinctrl-names = "default"; pinctrl-0 = <&bone_lcd3_cape_keys_00A0_pins>; // add a pinctrl section about if needed, otherwise delete these 2 lines #address-cells = <1>; #size-cells = <0>; button@1 { debounce_interval = <50>; linux,code = <105>; // replace with proper KEY_POWER code label = "left"; gpios = <&gpio2 16 0x0>; gpio-key,wakeup; autorepeat; }; }; That will give you a native evdev device that emits KEY_POWER when you toggle the GPIO. regards, Koen ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] GPIO Reset Button
On Fri, 02.11.12 09:56, Pawel Pastuszak (pawelpastus...@gmail.com) wrote: > Hi all, > > I was wondering if there is an way to attach an GPIO line to reboot the > system. I am currently working on an Embedded device that has an GPIO line > which needs to act as an reboot button this GPIO comes up as an > /sys/class/gpio/gpio103/ which i want to have it trigger when it switches > state to low and do an system soft reboot. Does systemd allow any > functionally like this? No. We only look for input devices marked with the "power-switch" tag. The kernel can create input devices for GPIO lines (CONFIG_KEYBOARD_GPIO), IIRC? Maybe that's useful to achieve this? If CONFIG_KEYBOARD_GPIO is not useful for this, I'd be willing to merge a patch for logind that makes it watch gpio lines marked with a specific udev tag the same way it already watches input devices. The code for that should be quite simple and minimal given that we already have the input-based code in place. That way adding device-specific udev rules adding the tag to your gpio device is all that is necessary to make logind pick it up. This should be useful frequently enough to make a logind core feature that we can support upstream. Lennart -- Lennart Poettering - Red Hat, Inc. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] GPIO Reset Button
On Friday 02 November 2012 09:56:53 Pawel Pastuszak wrote: > Hi all, > > I was wondering if there is an way to attach an GPIO line to reboot the > system. I am currently working on an Embedded device that has an GPIO line > which needs to act as an reboot button this GPIO comes up as an > /sys/class/gpio/gpio103/ which i want to have it trigger when it switches > state to low and do an system soft reboot. Does systemd allow any > functionally like this? why not write a evdev driver that report that button as poweroff button ? > > Thanks, > Pawel -- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] GPIO Reset Button
Hi all, I was wondering if there is an way to attach an GPIO line to reboot the system. I am currently working on an Embedded device that has an GPIO line which needs to act as an reboot button this GPIO comes up as an /sys/class/gpio/gpio103/ which i want to have it trigger when it switches state to low and do an system soft reboot. Does systemd allow any functionally like this? Thanks, Pawel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel