diff options
author | Jeff Hatch <jhatch@multitech.com> | 2017-05-24 16:25:53 -0500 |
---|---|---|
committer | Jeff Hatch <jhatch@multitech.com> | 2017-05-24 16:25:53 -0500 |
commit | c113a1d5d7ab480039d52a7de6c98f22928ce4c4 (patch) | |
tree | 8c353433fd2c2d4d53130c9d2c7589b99ed61948 | |
parent | 066312ffe878c4bee809684eb1fd59366ed73730 (diff) | |
parent | 29d8bf9b50bfc3c43efe89961eed6bf61d62eba7 (diff) | |
download | mts-io-1.5.12.tar.gz mts-io-1.5.12.tar.bz2 mts-io-1.5.12.zip |
Merge branch 'mtcap_lna3' into 'master'
1.5.12
mtcap: fix radio power sequence for LNA3 radios
See merge request !12
-rw-r--r-- | io-module/mtcap.c | 50 | ||||
-rw-r--r-- | io-module/mts_io.c | 13 | ||||
-rw-r--r-- | io-module/mts_io.h | 6 |
3 files changed, 57 insertions, 12 deletions
diff --git a/io-module/mtcap.c b/io-module/mtcap.c index c97822a..048a59e 100644 --- a/io-module/mtcap.c +++ b/io-module/mtcap.c @@ -160,12 +160,13 @@ static int radio_unconditional_shutdown_mtcap(void) /* radio control (power/reset) for mtcap */ -static int radio_off_mtcap(void) +static int radio_off_mtcap(int radio_model) { // ref: Telit_LE910_Hardware_User_Guide_r6.pdf (4.3.2 Hardware Shutdown) struct gpio_pin *pwrmon_pin = gpio_pin_by_attr_name("radio-power-monitor"); struct gpio_pin *onoff_pin = gpio_pin_by_attr_name("radio-power"); struct gpio_pin *rst_pin = gpio_pin_by_attr_name("radio-reset"); + unsigned int hold_time; int value; int i; @@ -188,8 +189,15 @@ static int radio_off_mtcap(void) // finalization state can differ according to the situation in which the LE910 is so it // cannot be fixed definitely. Normally it will be above 15 seconds later from releasing // ON/OFF# and DTE should monitor the status of PWRMON to see the actual power off. + hold_time = 2500; + if (radio_model == RADIO_LNA3) { + + // To turn OFF the LE910 V2 the pad ON_OFF* must be tied low for at least 3 seconds and then released. + // ref: Telit_LE910_V2_Hardware_User_Guide_r7.pdf + hold_time = 3500; + } - reset_gpio_pin(onoff_pin, 2500, 0); + reset_gpio_pin(onoff_pin, hold_time, 0); value = 0; for (i = 0; i < 15; i++) { @@ -214,12 +222,13 @@ static int radio_off_mtcap(void) return 0; } -static int radio_on_mtcap(void) +static int radio_on_mtcap(int radio_model) { // ref: Telit_LE910_Hardware_User_Guide_r6.pdf struct gpio_pin *pwrmon_pin = gpio_pin_by_attr_name("radio-power-monitor"); struct gpio_pin *onoff_pin = gpio_pin_by_attr_name("radio-power"); struct gpio_pin *rst_pin = gpio_pin_by_attr_name("radio-reset"); + unsigned int hold_time; int value; if (!onoff_pin || !pwrmon_pin || !rst_pin) { @@ -234,13 +243,21 @@ static int radio_on_mtcap(void) log_info("turning on cell radio"); + // for LEU1 (ref: Telit_LE910_Hardware_User_Guide_r6.pdf) + hold_time = 1500; + if (radio_model == RADIO_LNA3) { + + // To turn on the LE910 V2 the pad ON_OFF* must be tied low for at least 5 seconds and then released. + // ref: Telit_LE910_V2_Hardware_User_Guide_r7.pdf + hold_time = 5500; + } + // drive on/off pin high for at least 1 seconoff_pin gpio_set_value(onoff_pin->pin.gpio, 1); msleep(1000); - // 1) drive on/off pin low for < 2 sec - // 2) drive on/off pin high - reset_gpio_pin(onoff_pin, 1500, 0); + // ON_OFF must be tied low and then released + reset_gpio_pin(onoff_pin, hold_time, 0); // check that power is high value = gpio_get_value(pwrmon_pin->pin.gpio); @@ -253,11 +270,12 @@ static int radio_on_mtcap(void) return 0; } -static int radio_reset_mtcap(void) +static int radio_reset_mtcap(int radio_model) { // ref: Telit_LE910_Hardware_User_Guide_r6.pdf struct gpio_pin *rst_pin = gpio_pin_by_attr_name("radio-reset"); struct gpio_pin *onoff_pin = gpio_pin_by_attr_name("radio-power"); + unsigned int hold_time; if (!rst_pin || !onoff_pin) { return -ENODEV; @@ -276,6 +294,14 @@ static int radio_reset_mtcap(void) // log_info("turning on cell radio"); + // for LEU1 (ref: Telit_LE910_Hardware_User_Guide_r6.pdf) + hold_time = 1500; + if (radio_model == RADIO_LNA3) { + // To turn on the LE910 V2 the pad ON_OFF* must be tied low for at least 5 seconds and then released. + // ref: Telit_LE910_V2_Hardware_User_Guide_r7.pdf + hold_time = 5500; + } + // drive on/off pin high for at least 1 sec gpio_set_value(onoff_pin->pin.gpio, 1); msleep(1000); @@ -283,7 +309,7 @@ static int radio_reset_mtcap(void) // drive on/off pin low for < 2 sec // drive on/off pin high - reset_gpio_pin(onoff_pin, 1500, 0); + reset_gpio_pin(onoff_pin, hold_time, 0); return 0; } @@ -293,6 +319,7 @@ static ssize_t mts_attr_store_radio_power_mtcap(struct device *dev, { int value; int err; + int radio_model = get_radio_model_from_product_id(); if (sscanf(buf, "%i", &value) != 1) { return -EINVAL; @@ -300,9 +327,9 @@ static ssize_t mts_attr_store_radio_power_mtcap(struct device *dev, mutex_lock(&mts_io_mutex); if (value == 0) { - err = radio_off_mtcap(); + err = radio_off_mtcap(radio_model); } else { - err = radio_on_mtcap(); + err = radio_on_mtcap(radio_model); } mutex_unlock(&mts_io_mutex); @@ -318,6 +345,7 @@ static ssize_t mts_attr_store_radio_reset_mtcap(struct device *dev, { int value; int err; + int radio_model = get_radio_model_from_product_id(); if (sscanf(buf, "%i", &value) != 1) { return -EINVAL; @@ -351,7 +379,7 @@ static ssize_t mts_attr_store_radio_reset_mtcap(struct device *dev, mutex_lock(&mts_io_mutex); - err = radio_reset_mtcap(); + err = radio_reset_mtcap(radio_model); mutex_unlock(&mts_io_mutex); diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 1217250..f47e2ea 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -47,7 +47,7 @@ #include "mts_io.h" -#define DRIVER_VERSION "v1.5.11" +#define DRIVER_VERSION "v1.5.12" #define DRIVER_AUTHOR "James Maki <jmaki@multitech.com>" #define DRIVER_DESC "MTS-IO Controller" #define DRIVER_NAME "mts-io" @@ -642,6 +642,17 @@ static DEVICE_ATTR_RO_MTS(dev_attr_imei, "imei", static DEVICE_ATTR_RO_MTS(dev_attr_eth_mac, "mac-eth", mts_attr_show_product_info); +static int get_radio_model_from_product_id() { + int rc = RADIO_UNKNOWN; + + if (strstr(id_eeprom.product_id, "LEU1")) rc = RADIO_LEU1; + else if (strstr(id_eeprom.product_id, "LNA3")) rc = RADIO_LNA3; + + // Add other radios as needed. + return rc; +} + + /* include on-board lora peripheral */ #include "mts_lora.c" diff --git a/io-module/mts_io.h b/io-module/mts_io.h index 05111c7..99bfcbb 100644 --- a/io-module/mts_io.h +++ b/io-module/mts_io.h @@ -108,6 +108,12 @@ enum { LED_FLASHING, }; +enum { + RADIO_UNKNOWN, + RADIO_LEU1, + RADIO_LNA3, +}; + enum ap { port_1 = 1, port_2, |