OpenWrt Forum Archive

Topic: How it's possible to unlock GPIO pins

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

How it's possible to unlock GPIO pins allocated by /sys/class/leds/? How can I get name of module that is using device?

recently, i had the inverse question: how to add gpios as leds

and i guess the answer i got is your answer too:
by compiling your own fw after removing the gpios from

target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c

my question was specific for the gl-inet, so you have to find the corresponding Source-file for your hardware

Thank you verry much, it was easy. For WR2543ND it's necessary to comment lines (/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.10.49/arch/mips/ath79/mach-tl-wr2543n.c) 24-59, for LEDs USB and WPS, next 69-85, for Reset and WPS buttons, and 121-125.

/*static struct gpio_led tl_wr2543n_leds_gpio[] __initdata = {
    {
        .name        = "tp-link:green:usb",
        .gpio        = TL_WR2543N_GPIO_LED_USB,
        .active_low    = 1,
    }, {
        .name        = "tp-link:green:wps",
        .gpio        = TL_WR2543N_GPIO_LED_WPS,
        .active_low    = 1,
    }
};*/

...

/*static struct gpio_keys_button tl_wr2543n_gpio_keys[] __initdata = {
    {
        .desc        = "reset",
        .type        = EV_KEY,
        .code        = KEY_RESTART,
        .debounce_interval = TL_WR2543N_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = TL_WR2543N_GPIO_BTN_RESET,
        .active_low    = 1,
    }, {
        .desc        = "wps",
        .type        = EV_KEY,
        .code        = KEY_WPS_BUTTON,
        .debounce_interval = TL_WR2543N_KEYS_DEBOUNCE_INTERVAL,
        .gpio        = TL_WR2543N_GPIO_BTN_WPS,
        .active_low    = 1,
    }
};*/

...

static void __init tl_wr2543n_setup(void)
{
    u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
    u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);

    ath79_register_m25p80(&tl_wr2543n_flash_data);
    /*ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr2543n_leds_gpio),
                 tl_wr2543n_leds_gpio);
    ath79_register_gpio_keys_polled(-1, TL_WR2543N_KEYS_POLL_INTERVAL,
                    ARRAY_SIZE(tl_wr2543n_gpio_keys),
                    tl_wr2543n_gpio_keys);*/
    ath79_register_usb();

(Last edited by jfila on 13 Nov 2014, 18:33)

The discussion might have continued from here.