diff options
author | John Klug <john.klug@multitech.com> | 2020-10-20 10:53:55 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2020-10-20 10:53:55 -0500 |
commit | e49bd7bdea873ec11db79d97dd8aebad3f69164d (patch) | |
tree | ea0608740e1bc0afc167e26adbfdd569346766d5 /io-module/mts-io.c | |
parent | 9b727313435b84868f5f16c5e8a3aaf955ba13c8 (diff) | |
download | mts-io-e49bd7bdea873ec11db79d97dd8aebad3f69164d.tar.gz mts-io-e49bd7bdea873ec11db79d97dd8aebad3f69164d.tar.bz2 mts-io-e49bd7bdea873ec11db79d97dd8aebad3f69164d.zip |
Add radio-enable, the cellular power supply control4.4.2
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r-- | io-module/mts-io.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c index 0f4854b..09f0eef 100644 --- a/io-module/mts-io.c +++ b/io-module/mts-io.c @@ -540,7 +540,7 @@ static ssize_t mts_attr_show_product_info(struct device *dev, value = sprintf(buf, "%.32s\n", id_eeprom.product_id); } else if (strcmp(attr->attr.name, "has-radio") == 0) { if(id_eeprom.eeprom_layout_version == 0) - value = sprintf(buf, "%1lu\n", + value = sprintf(buf, "%d\n", mts_has_radio(id_eeprom.product_id,sizeof id_eeprom.product_id)); else /* Newer EEPROM version with CAPA_CELLULAR */ @@ -700,8 +700,9 @@ mts_id_eeprom_load(void) ((tmp=HW_VERSION_MTCAP_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCAP_0_2),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCAP_0_3),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { - current_blength = attr_blength = sizeof mtcap_0_0_platform_attributes; - current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */ + int need_radio_enable = 0; + current_blength = attr_blength = sizeof mtcap_0_0_platform_attributes; + current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */ /* See if we have no radio, and if so, prune out the stuff that follows */ if(noradio) { struct attribute **ap = mtcap_0_0_platform_attribute_group.attrs; @@ -729,6 +730,12 @@ mts_id_eeprom_load(void) if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcap_0_0_wifi_attributes; } + if(((tmp=HW_VERSION_MTCAP_0_2),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || + ((tmp=HW_VERSION_MTCAP_0_3),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { + need_radio_enable = 1; + attr_blength += sizeof mtcap_0_2_enable_radio_attribute; + } + if (current_blength+(sizeof(struct attribute *)) != attr_blength) { freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); current_count = current_blength/(sizeof (struct attribute *)); @@ -748,12 +755,18 @@ mts_id_eeprom_load(void) memcpy(all_attrs + current_count,mtcap_0_0_wifi_attributes,sizeof mtcap_0_0_wifi_attributes); current_count += sizeof mtcap_0_0_wifi_attributes / (sizeof (struct attribute *)); } + if (need_radio_enable) { + log_info("Adding Radio Enable to mts-io driver"); + memcpy(all_attrs + current_count,mtcap_0_2_enable_radio_attribute,sizeof mtcap_0_2_enable_radio_attribute); + current_count += sizeof mtcap_0_2_enable_radio_attribute / (sizeof (struct attribute *)); + } + all_attrs[current_count] = (struct attribute *)NULL; mtcap_0_0_platform_attribute_group.attrs = all_attrs; } attr_group = &mtcap_0_0_platform_attribute_group; - gpio_pins = gpio_pins_mtcap_0_0; - set_buttons(default_buttons); + gpio_pins = gpio_pins_mtcap_0_0; + set_buttons(default_buttons); if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) { attr_group_lora = &mtcap_0_0_lora_attribute_group; } @@ -983,12 +996,12 @@ mts_id_eeprom_load(void) log_info("capa-adc: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_ADC) ? "yes" : "no"); log_info("capa-wifi: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI) ? "yes" : "no"); log_info("capa-bluetooth: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH) ? "yes" : "no"); - if (!(mts_hw_version != HW_VERSION_MTCPM_0_0)) /* Moved to mtcdt3b driver in MTCDT3 baseboard hardware */ - log_info("capa-lora: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) ? "yes" : "no"); - log_info("capa-battery: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_BATTERY) ? "yes" : "no"); + if (!(mts_hw_version != MTCPM_0_0)) /* Moved to mtcdt3b driver in MTCDT3 baseboard hardware */ + log_info("capa-lora: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) ? "yes" : "no"); + log_info("capa-battery: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_BATTERY) ? "yes" : "no"); log_info("capa-supercap: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_SUPERCAP) ? "yes" : "no"); - if(has_cellular_capaflag) - log_info("capa-cellular: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR) ? "yes" : "no"); + if(has_cellular_capaflag) + log_info("capa-cellular: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR) ? "yes" : "no"); if (DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH)) { log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X", |