diff options
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r-- | io-module/mts-io.c | 72 |
1 files changed, 44 insertions, 28 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c index e4290a6..ed0cb49 100644 --- a/io-module/mts-io.c +++ b/io-module/mts-io.c @@ -49,6 +49,7 @@ #include "mts_io.h" #include "buttons.h" #include "mts_supercap.h" +#include "radio_udev_discovery.h" #define PLATFORM_NAME "mts-io" @@ -257,6 +258,7 @@ static ssize_t mts_attr_store_radio_reset(struct device *dev, radio_reset_timer_is_start = 1; } + reset_radio_udev_discovery(); log_info("radio is reset\n"); pin = gpio_pin_by_attr_name("radio-reset"); @@ -509,6 +511,13 @@ static DEVICE_ATTR_MTS(dev_attr_radio_reset_backoff_index, "radio-reset-backoff- static DEVICE_ATTR_RO_MTS(dev_attr_radio_reset_backoff_seconds, "radio-reset-backoff-seconds", mts_attr_show_radio_reset_backoff_seconds); +static DEVICE_ATTR_MTS(dev_attr_radio_udev_discovery, "radio-udev-discovery", + mts_attr_show_radio_udev_discovery, mts_attr_store_radio_udev_discovery); + +static DEVICE_ATTR_MTS(dev_attr_radio_reset_monitor, "radio-reset-monitor", + mts_attr_show_radio_reset_monitor, mts_attr_store_radio_reset_monitor); + + /* shared gpio-based LEDs */ static DEVICE_ATTR_MTS(dev_attr_led_status, "led-status", mts_attr_show_gpio_pin, mts_attr_store_gpio_pin); @@ -878,6 +887,13 @@ mts_id_eeprom_load(void) set_buttons(default_buttons); mts_hw_version = MTRV1_0_3; log_info("detected board %s", HW_VERSION_MTRV1_0_3); + } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTRV1_0_4, strlen(HW_VERSION_MTRV1_0_4)) == 0) { + attr_group = &mtrv1_0_4_platform_attribute_group; + gpio_pins = gpio_pins_mtrv1_0_4; + set_buttons(default_buttons); + mts_hw_version = MTRV1_0_4; + mtr_setup_radio_status(id_eeprom.product_id); + log_info("detected board %s", HW_VERSION_MTRV1_0_4); } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTHS_0_0, strlen(HW_VERSION_MTHS_0_0)) == 0) { attr_group = &mths_0_0_platform_attribute_group; gpio_pins = gpio_pins_mths_0_0; @@ -1307,41 +1323,41 @@ static int __init mts_io_init(void) static void __exit mts_io_exit(void) { - if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) { - spi_unregister_driver(&mts_spi_dout_driver); - } - if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) { - spi_unregister_driver(&mts_spi_din_driver); - } - spi_unregister_driver(&mts_spi_board_temp_driver); + struct gpio_pin *pin; + if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) { + spi_unregister_driver(&mts_spi_dout_driver); + } + if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) { + spi_unregister_driver(&mts_spi_din_driver); + } + spi_unregister_driver(&mts_spi_board_temp_driver); - struct gpio_pin *pin; - /* delete radio_reset_timer */ - del_timer(&radio_reset_timer); - /* delete radio_reset_available_timer */ - del_timer(&radio_reset_available_timer); + /* delete radio_reset_timer */ + del_timer(&radio_reset_timer); + /* delete radio_reset_available_timer */ + del_timer(&radio_reset_available_timer); - for (pin = gpio_pins; *pin->name; pin++) - if (pin->capability == 0 || DEVICE_CAPA(id_eeprom.capa,pin->capability)) - gpio_free(pin->pin.gpio); + for (pin = gpio_pins; *pin->name; pin++) + if (pin->capability == 0 || DEVICE_CAPA(id_eeprom.capa,pin->capability)) + gpio_free(pin->pin.gpio); - cleanup_buttons(); + cleanup_buttons(); - //cleanup supercap monitor worker if SUPERCAP CAPA is true - if(DEVICE_CAPA(id_eeprom.capa, CAPA_SUPERCAP)) { - cleanup_supercap_worker(); - } + //cleanup supercap monitor worker if SUPERCAP CAPA is true + if(DEVICE_CAPA(id_eeprom.capa, CAPA_SUPERCAP)) { + cleanup_supercap_worker(); + } - cleanup(); + cleanup(); - if (mts_leds) { - mts_leds_unregister(); - } + if (mts_leds) { + mts_leds_unregister(); + } - if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) { - mts_teardown_lora_port(); - } - log_info("exiting"); + if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) { + mts_teardown_lora_port(); + } + log_info("exiting"); } module_init(mts_io_init); |