From 07b8de9f8b9a8dd650145d46607dd9aeb4dc02aa Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 2 Nov 2020 13:10:20 -0600 Subject: Fix conflict between mts-io and mtcdt3b over has-radio attribute --- io-module/mts-io.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'io-module/mts-io.c') diff --git a/io-module/mts-io.c b/io-module/mts-io.c index 807df78..069e84b 100644 --- a/io-module/mts-io.c +++ b/io-module/mts-io.c @@ -664,7 +664,8 @@ mts_id_eeprom_load(void) int current_count; // Number of items in array struct attribute **all_attrs = NULL; char *tmp; - int noradio, has_cellular_capaflag = 0; + int noradio = 0; // MTCPM-0.0 does not trim off radio-reset, etc. + int has_cellular_capaflag = 0; int need_append; int ret; const struct firmware* fw = NULL; @@ -685,16 +686,16 @@ mts_id_eeprom_load(void) return -ENODEV; } - // If we are an MTCPM-0.0, the base board sets the radio existance. + /* If we are an MTCPM-0.0, the base board sets the radio existance, and we always + * add the radio-reset, etc */ if (strncmp(id_eeprom.hw_version,HW_VERSION_MTCPM_0_0,sizeof HW_VERSION_MTCPM_0_0) != 0) { if (id_eeprom.eeprom_layout_version == 0) { noradio = ! mts_has_radio(id_eeprom.product_id,sizeof id_eeprom.product_id); - log_debug("mts_id_eeprom_load: noradio=%d",noradio); } else { has_cellular_capaflag = 1; noradio = ! DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR); - log_debug("mts_id_eeprom_load: noradio=%d",noradio); } + log_debug("mts_id_eeprom_load: noradio=%d",noradio); } if (((tmp=HW_VERSION_MTCAP_0_0),(mts_hw_version=MTCAP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || @@ -959,12 +960,12 @@ mts_id_eeprom_load(void) current_blength = attr_blength = sizeof mtcpm_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 */ + /* See if we have no radio (never executed for MTCPM_0_0), and if so, prune out the stuff that follows */ if(noradio) { struct attribute **ap = mtcpm_platform_attribute_group.attrs; while(1) { if(ap[j] == NULL) { - log_info("Did not find radio power attribute. Possible driver fault."); + log_info("Did not find radio reset attribute. Possible driver fault."); break; } j++; @@ -977,7 +978,10 @@ mts_id_eeprom_load(void) } } } - + if (tmp != HW_VERSION_MTCPM_0_0) { + attr_blength += sizeof mtcpm_has_radio_attribute; + need_append = 1; + } if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcpm_wifi_bt_attributes; need_append = 1; @@ -990,6 +994,12 @@ mts_id_eeprom_load(void) freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); current_count = current_blength/(sizeof (struct attribute *)); memcpy(all_attrs,mtcpm_platform_attributes,current_blength); + if(tmp != HW_VERSION_MTCPM_0_0) { + log_info("Adding has_radio to mts-io driver"); + memcpy(all_attrs + current_count,mtcpm_has_radio_attribute,sizeof mtcpm_has_radio_attribute); + current_count += sizeof mtcpm_has_radio_attribute / (sizeof (struct attribute *)); + } + if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { log_info("Adding WiFi/BT to mts-io driver"); memcpy(all_attrs + current_count,mtcpm_wifi_bt_attributes,sizeof mtcpm_wifi_bt_attributes); -- cgit v1.2.3