From bf97eddfe29544407203edd9d46466e9e3601839 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 2 Apr 2018 18:21:34 -0500 Subject: Add support for MTCDTIPHP hardware version --- io-module/mtcap.c | 13 ++++++++++ io-module/mtcdt.c | 25 ++++++++++++++----- io-module/mts_io.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++- io-module/mts_io.h | 5 +++- 4 files changed, 108 insertions(+), 8 deletions(-) (limited to 'io-module') diff --git a/io-module/mtcap.c b/io-module/mtcap.c index 804b364..b28e8eb 100644 --- a/io-module/mtcap.c +++ b/io-module/mtcap.c @@ -505,3 +505,16 @@ static struct attribute *mtcap_0_0_lora_attributes[] = { static struct attribute_group mtcap_0_0_lora_attribute_group = { .attrs = mtcap_0_0_lora_attributes }; + +// Reset for LoRa firmware is done using the I2C bus +// on the MTCDTIPHP LoRa board. +static struct attribute *mtcdtiphp_0_0_lora_attributes[] = { + &dev_attr_lora_eui_mtcap.attr, + &dev_attr_lora_product_id_mtcap.attr, + &dev_attr_lora_hw_version_mtcap.attr, + NULL, +}; + +static struct attribute_group mtcdtiphp_0_0_lora_attribute_group = { + .attrs = mtcdtiphp_0_0_lora_attributes +}; diff --git a/io-module/mtcdt.c b/io-module/mtcdt.c index 048e11c..b84e67a 100644 --- a/io-module/mtcdt.c +++ b/io-module/mtcdt.c @@ -714,12 +714,6 @@ static struct attribute *mtcdt_0_1_platform_attributes[] = { &dev_attr_reset.attr, &dev_attr_reset_monitor.attr, &dev_attr_reset_monitor_intervals.attr, - &dev_attr_radio_power.attr, - &dev_attr_radio_reset.attr, - - &dev_attr_radio_reset_backoffs.attr, - &dev_attr_radio_reset_backoff_index.attr, - &dev_attr_radio_reset_backoff_seconds.attr, &dev_attr_led_status.attr, &dev_attr_led_cd_gpio.attr, @@ -734,6 +728,18 @@ static struct attribute *mtcdt_0_1_platform_attributes[] = { &dev_attr_usbhub_reset.attr, &dev_attr_eth_reset.attr, + + // radio feature is last to be able to + // easily remove radio. + // is_radio_power_attr_mtcdt() truncates + // this list. + &dev_attr_radio_power.attr, + &dev_attr_radio_reset.attr, + + &dev_attr_radio_reset_backoffs.attr, + &dev_attr_radio_reset_backoff_index.attr, + &dev_attr_radio_reset_backoff_seconds.attr, + NULL, }; @@ -757,3 +763,10 @@ static struct attribute_group mtcdt_platform_attribute_group = { static struct attribute_group mtcdt_0_1_platform_attribute_group = { .attrs = mtcdt_0_1_platform_attributes }; + + +static int +is_radio_power_attr_mtcdt(struct attribute *attr) +{ + return (attr == &dev_attr_radio_power.attr); +} \ No newline at end of file diff --git a/io-module/mts_io.c b/io-module/mts_io.c index ebb1b22..d2e36c3 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.16" +#define DRIVER_VERSION "v1.6.0" #define DRIVER_AUTHOR "James Maki " #define DRIVER_DESC "MTS-IO Controller" #define DRIVER_NAME "mts-io" @@ -883,6 +883,7 @@ mts_id_eeprom_load(void) log_info("detected board %s", HW_VERSION_MTRV1_0_1); } else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { + int j=0; attr_blength = sizeof mtcdt_0_1_platform_attributes; if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes; @@ -907,10 +908,80 @@ mts_id_eeprom_load(void) all_attrs[current_count] = (struct attribute *)NULL; mtcdt_0_1_platform_attribute_group.attrs = all_attrs; } + + if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) && + (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT] == '-') && + isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT])) { + struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; + while(1) { + if(ap[j] == NULL) { + log_info("Did not find radio power attribute. Possible driver fault."); + break; + } + j++; + if (is_radio_power_attr_mtcdt(ap[j])) { + log_info("Pruning radio feature from mts-io",j); + ap[j] = NULL; + break; + } + } + } + attr_group = &mtcdt_0_1_platform_attribute_group; gpio_pins = gpio_pins_mtcdt_0_1; log_info("detected board %s", tmp); + } else if ((tmp=HW_VERSION_MTCDTIPHP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) { + attr_blength = sizeof mtcdt_0_1_platform_attributes; + if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { + attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes; + } + if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { + attr_blength += sizeof mtcdt_0_1_gnss_attributes; + } + if (attr_blength != sizeof mtcdt_0_1_platform_attributes) { + freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); + current_blength = sizeof mtcdt_0_1_platform_attributes - sizeof (struct attribute *); + current_count = current_blength/(sizeof (struct attribute *)); + memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength); + if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { + memcpy(all_attrs + current_count,mtcdt_0_1_wifi_bt_attributes,sizeof mtcdt_0_1_wifi_bt_attributes); + current_count += sizeof mtcdt_0_1_wifi_bt_attributes / (sizeof (struct attribute *)); + } + if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { + attr_blength += sizeof mtcdt_0_1_gnss_attributes; + memcpy(all_attrs + current_count,mtcdt_0_1_gnss_attributes,sizeof mtcdt_0_1_gnss_attributes); + current_count += sizeof mtcdt_0_1_gnss_attributes / (sizeof (struct attribute *)); + } + all_attrs[current_count] = (struct attribute *)NULL; + mtcdt_0_1_platform_attribute_group.attrs = all_attrs; + } + + int j=0; + /* See if we have no radio, and if so, prune out the stuff that follows */ + if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDTIPHP, sizeof PRODUCT_ID_MTCDTIPHP - 1) == 0) && + (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP-1] == '-') && + isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP])) { + struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; + while(1) { + if(ap[j] == NULL) { + log_info("Did not find radio power attribute. Possible driver fault."); + break; + } + j++; + if (is_radio_power_attr_mtcdt(ap[j])) { + log_info("Pruning radio feature from mts-io",j); + ap[j] = NULL; + break; + } + } + } + attr_group = &mtcdt_0_1_platform_attribute_group; + gpio_pins = gpio_pins_mtcdt_0_1; + if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) { + attr_group_lora = &mtcdtiphp_0_0_lora_attribute_group; + } + log_info("detected board %s", tmp); } else { attr_group = &mtcdt_platform_attribute_group; gpio_pins = gpio_pins_mtcdt_0_0; diff --git a/io-module/mts_io.h b/io-module/mts_io.h index 7c2a969..241ed1d 100644 --- a/io-module/mts_io.h +++ b/io-module/mts_io.h @@ -45,7 +45,8 @@ struct device_attribute _dev_name = { \ #define PRODUCT_ID_MTR "MTR" #define PRODUCT_ID_MTCDT "MTCDT" #define PRODUCT_ID_MTCAP "MTCAP" -#define PRODCUT_ID_MTCDTIP "MTCDTIP" +#define PRODUCT_ID_MTCDTIP "MTCDTIP" +#define PRODUCT_ID_MTCDTIPHP "MTCDTIPHP" #define PRODUCT_ID_MTAC_GPIOB "MTAC-GPIOB" #define PRODUCT_ID_MTAC_MFSER "MTAC-MFSER" @@ -72,6 +73,7 @@ struct device_attribute _dev_name = { \ #define HW_VERSION_MTCDT_0_0 "MTCDT-0.0" #define HW_VERSION_MTCDT_0_1 "MTCDT-0.1" #define HW_VERSION_MTCDTIP_0_0 "MTCDTIP-0.0" +#define HW_VERSION_MTCDTIPHP_0_0 "MTCDTIPHP-0.0" #define HW_VERSION_MTCAP_0_0 "MTCAP-0.0" #define HW_VERSION_MTCAP_0_1 "MTCAP-0.1" @@ -85,6 +87,7 @@ enum { MTRV1_0_1, MTCDT_0_0, MTCDT_0_1, + MTCDTIPHP_0_0, MTCAP_0_0, MTCAP_0_1, }; -- cgit v1.2.3 From e7040f65cbb2b275ee25eff79fef9a1bcdf23dbe Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Apr 2018 15:07:24 -0500 Subject: Bring mts_io level up to match package name --- io-module/mts_io.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index d2e36c3..14029a3 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.6.0" +#define DRIVER_VERSION "v2.0.0" #define DRIVER_AUTHOR "James Maki " #define DRIVER_DESC "MTS-IO Controller" #define DRIVER_NAME "mts-io" @@ -910,7 +910,7 @@ mts_id_eeprom_load(void) } if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) && - (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT] == '-') && + (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT-1] == '-') && isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT])) { struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; while(1) { @@ -983,6 +983,24 @@ mts_id_eeprom_load(void) } log_info("detected board %s", tmp); } else { + if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) && + (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT-1] == '-') && + isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT])) { + struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; + while(1) { + if(ap[j] == NULL) { + log_info("Did not find radio power attribute. Possible driver fault."); + break; + } + j++; + if (is_radio_power_attr_mtcdt(ap[j])) { + log_info("Pruning radio feature from mts-io",j); + ap[j] = NULL; + break; + } + } + } + attr_group = &mtcdt_platform_attribute_group; gpio_pins = gpio_pins_mtcdt_0_0; mts_hw_version = MTCDT_0_0; -- cgit v1.2.3 From 1249f820f29bf4dd3701a3bb0f4b78e8d96ca2c4 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Apr 2018 15:28:56 -0500 Subject: Undefined variable issue --- io-module/mts_io.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 14029a3..c9a0c71 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -817,7 +817,7 @@ struct attribute *freelater = NULL; // Storage to free when driver is unloaded. static int mts_id_eeprom_load(void) { - int i; + int i, j = 0; char buf[64] = {0}; char* ptr; int attr_blength; // Byte length of base attribute array @@ -836,7 +836,6 @@ mts_id_eeprom_load(void) return -EIO; } else if (((tmp=HW_VERSION_MTCAP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCAP_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { - int j=0; /* See if we have no radio, and if so, prune out the stuff that follows */ if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCAP, sizeof PRODUCT_ID_MTCAP - 1) == 0) && (id_eeprom.product_id[sizeof PRODUCT_ID_MTCAP-1] == '-') && @@ -883,7 +882,6 @@ mts_id_eeprom_load(void) log_info("detected board %s", HW_VERSION_MTRV1_0_1); } else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { - int j=0; attr_blength = sizeof mtcdt_0_1_platform_attributes; if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes; @@ -957,7 +955,6 @@ mts_id_eeprom_load(void) mtcdt_0_1_platform_attribute_group.attrs = all_attrs; } - int j=0; /* See if we have no radio, and if so, prune out the stuff that follows */ if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDTIPHP, sizeof PRODUCT_ID_MTCDTIPHP - 1) == 0) && (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP-1] == '-') && -- cgit v1.2.3 From aea9aa1335ae1d5837bcd53096ff3763d3da8543 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 16 Apr 2018 17:57:01 -0500 Subject: Add the WiFi Bluetooth control features. --- io-module/mts_io.c | 70 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 34 deletions(-) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index c9a0c71..dd3a9ae 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -882,16 +882,36 @@ mts_id_eeprom_load(void) log_info("detected board %s", HW_VERSION_MTRV1_0_1); } else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { - attr_blength = sizeof mtcdt_0_1_platform_attributes; + current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes; + + /* See if we have no radio, and if so, prune out the stuff that follows */ + if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) && + (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT-1] == '-') && + isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT])) { + struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; + while(1) { + if(ap[j] == NULL) { + log_info("Did not find radio power attribute. Possible driver fault."); + break; + } + j++; + if (is_radio_power_attr_mtcdt(ap[j])) { + log_info("Pruning radio feature from mts-io",j); + ap[j] = NULL; + current_blength = attr_blength = j * sizeof (ap[j]); + break; + } + } + } + if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes; } if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { attr_blength += sizeof mtcdt_0_1_gnss_attributes; } - if (attr_blength != sizeof mtcdt_0_1_platform_attributes) { + if (current_blength != attr_blength) { freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); - current_blength = sizeof mtcdt_0_1_platform_attributes - sizeof (struct attribute *); current_count = current_blength/(sizeof (struct attribute *)); memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength); if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { @@ -906,10 +926,17 @@ mts_id_eeprom_load(void) all_attrs[current_count] = (struct attribute *)NULL; mtcdt_0_1_platform_attribute_group.attrs = all_attrs; } - - if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) && - (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT-1] == '-') && - isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDT])) { + + attr_group = &mtcdt_0_1_platform_attribute_group; + gpio_pins = gpio_pins_mtcdt_0_1; + log_info("detected board %s", tmp); + } else if ((tmp=HW_VERSION_MTCDTIPHP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) { + current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes; + + /* See if we have no radio, and if so, prune out the stuff that follows */ + if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDTIPHP, sizeof PRODUCT_ID_MTCDTIPHP - 1) == 0) && + (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP-1] == '-') && + isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP])) { struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; while(1) { if(ap[j] == NULL) { @@ -920,26 +947,19 @@ mts_id_eeprom_load(void) if (is_radio_power_attr_mtcdt(ap[j])) { log_info("Pruning radio feature from mts-io",j); ap[j] = NULL; + current_blength = attr_blength = j * sizeof (ap[j]); break; } } } - - - attr_group = &mtcdt_0_1_platform_attribute_group; - gpio_pins = gpio_pins_mtcdt_0_1; - log_info("detected board %s", tmp); - } else if ((tmp=HW_VERSION_MTCDTIPHP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) { - attr_blength = sizeof mtcdt_0_1_platform_attributes; if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes; } if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { attr_blength += sizeof mtcdt_0_1_gnss_attributes; } - if (attr_blength != sizeof mtcdt_0_1_platform_attributes) { + if (current_blength != attr_blength) { freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); - current_blength = sizeof mtcdt_0_1_platform_attributes - sizeof (struct attribute *); current_count = current_blength/(sizeof (struct attribute *)); memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength); if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { @@ -955,24 +975,6 @@ mts_id_eeprom_load(void) mtcdt_0_1_platform_attribute_group.attrs = all_attrs; } - /* See if we have no radio, and if so, prune out the stuff that follows */ - if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDTIPHP, sizeof PRODUCT_ID_MTCDTIPHP - 1) == 0) && - (id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP-1] == '-') && - isdigit(id_eeprom.product_id[sizeof PRODUCT_ID_MTCDTIPHP])) { - struct attribute **ap = mtcdt_0_1_platform_attribute_group.attrs; - while(1) { - if(ap[j] == NULL) { - log_info("Did not find radio power attribute. Possible driver fault."); - break; - } - j++; - if (is_radio_power_attr_mtcdt(ap[j])) { - log_info("Pruning radio feature from mts-io",j); - ap[j] = NULL; - break; - } - } - } attr_group = &mtcdt_0_1_platform_attribute_group; gpio_pins = gpio_pins_mtcdt_0_1; if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) { -- cgit v1.2.3 From 971eb0896a2024211bcef15e64b93138233f7563 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 17 Apr 2018 13:24:15 -0500 Subject: Add back missing ethernet reset --- io-module/mts_io.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index dd3a9ae..8794785 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -883,6 +883,7 @@ mts_id_eeprom_load(void) } else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || ((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { current_blength = attr_blength = sizeof mtcdt_0_1_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((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) && @@ -910,15 +911,17 @@ mts_id_eeprom_load(void) if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { attr_blength += sizeof mtcdt_0_1_gnss_attributes; } - if (current_blength != attr_blength) { + if (current_blength+(sizeof(struct attribute *)) != attr_blength) { freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); current_count = current_blength/(sizeof (struct attribute *)); memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength); if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { + log_info("Adding WiFi/BT to mts-io driver"); memcpy(all_attrs + current_count,mtcdt_0_1_wifi_bt_attributes,sizeof mtcdt_0_1_wifi_bt_attributes); current_count += sizeof mtcdt_0_1_wifi_bt_attributes / (sizeof (struct attribute *)); } if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { + log_info("Adding GPS to mts-io driver"); attr_blength += sizeof mtcdt_0_1_gnss_attributes; memcpy(all_attrs + current_count,mtcdt_0_1_gnss_attributes,sizeof mtcdt_0_1_gnss_attributes); current_count += sizeof mtcdt_0_1_gnss_attributes / (sizeof (struct attribute *)); @@ -932,6 +935,7 @@ mts_id_eeprom_load(void) log_info("detected board %s", tmp); } else if ((tmp=HW_VERSION_MTCDTIPHP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) { current_blength = attr_blength = sizeof mtcdt_0_1_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((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDTIPHP, sizeof PRODUCT_ID_MTCDTIPHP - 1) == 0) && @@ -958,15 +962,17 @@ mts_id_eeprom_load(void) if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { attr_blength += sizeof mtcdt_0_1_gnss_attributes; } - if (current_blength != attr_blength) { + if (current_blength+(sizeof(struct attribute *)) != attr_blength) { freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); current_count = current_blength/(sizeof (struct attribute *)); memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength); if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { + log_info("Adding WiFi/BT to mts-io driver"); memcpy(all_attrs + current_count,mtcdt_0_1_wifi_bt_attributes,sizeof mtcdt_0_1_wifi_bt_attributes); current_count += sizeof mtcdt_0_1_wifi_bt_attributes / (sizeof (struct attribute *)); } if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { + log_info("Adding GPS to mts-io driver"); attr_blength += sizeof mtcdt_0_1_gnss_attributes; memcpy(all_attrs + current_count,mtcdt_0_1_gnss_attributes,sizeof mtcdt_0_1_gnss_attributes); current_count += sizeof mtcdt_0_1_gnss_attributes / (sizeof (struct attribute *)); -- cgit v1.2.3 From 5239aa1a5133ff48fc3003bf9ffb119d1659f748 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 17 Apr 2018 14:59:04 -0500 Subject: Remove GPS CPU GPIO reset and interrupt for MTCDTHPIP --- io-module/mts_io.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 8794785..fba83de 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -959,9 +959,6 @@ mts_id_eeprom_load(void) if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) { attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes; } - if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { - attr_blength += sizeof mtcdt_0_1_gnss_attributes; - } if (current_blength+(sizeof(struct attribute *)) != attr_blength) { freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL); current_count = current_blength/(sizeof (struct attribute *)); @@ -971,12 +968,8 @@ mts_id_eeprom_load(void) memcpy(all_attrs + current_count,mtcdt_0_1_wifi_bt_attributes,sizeof mtcdt_0_1_wifi_bt_attributes); current_count += sizeof mtcdt_0_1_wifi_bt_attributes / (sizeof (struct attribute *)); } - if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) { - log_info("Adding GPS to mts-io driver"); - attr_blength += sizeof mtcdt_0_1_gnss_attributes; - memcpy(all_attrs + current_count,mtcdt_0_1_gnss_attributes,sizeof mtcdt_0_1_gnss_attributes); - current_count += sizeof mtcdt_0_1_gnss_attributes / (sizeof (struct attribute *)); - } + /* MTCDTIPHP does not have GPS reset/interrupt tied to the CPU + * so do not instantiate the GPS attributes */ all_attrs[current_count] = (struct attribute *)NULL; mtcdt_0_1_platform_attribute_group.attrs = all_attrs; } -- cgit v1.2.3