diff options
author | Mykyta Dorokhin <mykyta.dorokhin@globallogic.com> | 2017-05-23 14:12:28 -0500 |
---|---|---|
committer | Mykyta Dorokhin <mykyta.dorokhin@globallogic.com> | 2017-05-24 09:58:27 -0500 |
commit | 29d8bf9b50bfc3c43efe89961eed6bf61d62eba7 (patch) | |
tree | 8c353433fd2c2d4d53130c9d2c7589b99ed61948 /io-module/mtcap.c | |
parent | 066312ffe878c4bee809684eb1fd59366ed73730 (diff) | |
download | mts-io-29d8bf9b50bfc3c43efe89961eed6bf61d62eba7.tar.gz mts-io-29d8bf9b50bfc3c43efe89961eed6bf61d62eba7.tar.bz2 mts-io-29d8bf9b50bfc3c43efe89961eed6bf61d62eba7.zip |
mtcap: fix radio power sequence for LNA3 radios
Diffstat (limited to 'io-module/mtcap.c')
-rw-r--r-- | io-module/mtcap.c | 50 |
1 files changed, 39 insertions, 11 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); |