summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Pedash <vyacheslav.pedash@globallogic.com>2022-07-11 15:47:03 +0300
committerJohn Klug <john.klug@multitech.com>2022-09-23 12:36:04 -0500
commit65b417af62c7f686bbc07c91f40fc037f47377d3 (patch)
treec8a371750ba871161da5c7c953a8ede9ec6b276f
parent30a330a75813bd7efb69de48e4149691565ce41f (diff)
downloadmts-io-65b417af62c7f686bbc07c91f40fc037f47377d3.tar.gz
mts-io-65b417af62c7f686bbc07c91f40fc037f47377d3.tar.bz2
mts-io-65b417af62c7f686bbc07c91f40fc037f47377d3.zip
Genrate trigger events for LEDs instead of direct GPIO control.
-rw-r--r--io-module/machine/mtcpm.c65
1 files 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",