From 65b417af62c7f686bbc07c91f40fc037f47377d3 Mon Sep 17 00:00:00 2001 From: Vyacheslav Pedash Date: Mon, 11 Jul 2022 15:47:03 +0300 Subject: Genrate trigger events for LEDs instead of direct GPIO control. --- io-module/machine/mtcpm.c | 65 ++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 46 deletions(-) diff --git a/io-module/machine/mtcpm.c b/io-module/machine/mtcpm.c index 66c8328..a3cbe87 100644 --- a/io-module/machine/mtcpm.c +++ b/io-module/machine/mtcpm.c @@ -1,4 +1,3 @@ -#define OMAP_GPIO(BANK, GPIO) ((BANK*32)+GPIO) /* * Within a struct gpio_pin, there is only one * occurrence of each pin, so there is only one @@ -120,54 +119,18 @@ static struct gpio_pin gpio_pins_mtcpm[] = { .active_low = 1, }, #endif - { - .name = "STATUS_LED", - .pin = { - .gpio = ~0U, - .flags = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE, - .label = "led-status", - }, - .do_gpio_desc = 1, - }, - { - .name = "CD", - .pin = { - .gpio = ~0U, - .flags = GPIOD_OUT_HIGH, - .label = "led-cd", - }, - .do_gpio_desc = 1, - }, - { - .name = "LED1", - .pin = { - .gpio = ~0U, - .flags = GPIOD_OUT_LOW, - .label = "led-sig1", - }, - .do_gpio_desc = 1, - }, - { - .name = "LED2", - .pin = { - .gpio = ~0U, - .flags = GPIOD_OUT_LOW, - .label = "led-sig2", - }, - .do_gpio_desc = 1, - }, - { - .name = "LED3", - .pin = { - .gpio = ~0U, - .flags = GPIOD_OUT_LOW, - .label = "led-sig3", - }, - .do_gpio_desc = 1, - }, { }, }; +static struct mts_led mtcpmhs_leds[] = { + {.label = "led-cd",}, /* (cellular) Link Status */ + {.label = "led-sig1",}, /* (cellular) Link Quality */ + {.label = "led-sig2",}, /* (cellular) Link Quality */ + {.label = "led-sig3",}, /* (cellular) Link Quality */ + {.label = "led-status",}, /* (cellular) Device Status */ + {} +}; + static DEVICE_ATTR_MTS(dev_attr_wifi_reset_mtcpm, "wlan-enabled", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_bt_reset_mtcpm, "bt-enabled", @@ -184,6 +147,16 @@ static DEVICE_ATTR_MTS(dev_attr_gnss_int_mtcpm, "gnss-int", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_lora_reset_mtcpm, "reset", mts_attr_show_lora_gpio_pin, mts_attr_store_lora_gpio_pin); +static DEVICE_ATTR_MTS(dev_attr_led_cd_mtcpm, "led-cd", + mts_attr_show_led, mts_attr_store_led); +static DEVICE_ATTR_MTS(dev_attr_led_sig1_mtcpm, "led-sig1", + mts_attr_show_led, mts_attr_store_led); +static DEVICE_ATTR_MTS(dev_attr_led_sig2_mtcpm, "led-sig2", + mts_attr_show_led, mts_attr_store_led); +static DEVICE_ATTR_MTS(dev_attr_led_sig3_mtcpm, "led-sig3", + mts_attr_show_led, mts_attr_store_led); +static DEVICE_ATTR_MTS(dev_attr_led_status_mtcpm, "led-status", + mts_attr_show_led, mts_attr_store_led); static DEVICE_ATTR_RO_MTS(dev_attr_lora_cdone_mtcpm, "cdone", mts_attr_show_lora_gpio_pin); static DEVICE_ATTR_MTS(dev_attr_lora_creset_mtcpm, "creset", -- cgit v1.2.3