summaryrefslogtreecommitdiff
path: root/io-module/mts-io.c
diff options
context:
space:
mode:
authorMike Nicholson <mike.nicholson@multitech.com>2020-08-28 16:36:45 -0500
committerMike Nicholson <mike.nicholson@multitech.com>2020-08-28 16:36:45 -0500
commit49ca346b1165e6def3e683802cfbb769d23c559a (patch)
treec0e99653ff017df25b27b905a1996297fa0eee1b /io-module/mts-io.c
parentee7303faf58c120db4819dfa69b4597346115de4 (diff)
downloadmts-io-49ca346b1165e6def3e683802cfbb769d23c559a.tar.gz
mts-io-49ca346b1165e6def3e683802cfbb769d23c559a.tar.bz2
mts-io-49ca346b1165e6def3e683802cfbb769d23c559a.zip
MTCAP2, MTCDTIP2 support, initial revision4.3.4
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r--io-module/mts-io.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 5897da7..0477f2e 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -664,7 +664,10 @@ mts_id_eeprom_load(void)
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) ||
- ((tmp=HW_VERSION_MTCAP_0_2),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 */
/* 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;
@@ -677,10 +680,43 @@ mts_id_eeprom_load(void)
if (is_radio_power_attr_mtcap(ap[j])) {
log_info("Pruning radio feature from mts-io",j);
ap[j] = NULL;
+ current_blength = attr_blength = j * sizeof (ap[j]);
+ /* account for removed attributes in table length */
break;
}
}
}
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
+ attr_blength += sizeof mtcap_0_3_gnss_attributes;
+ }
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_SUPERCAP)) {
+ attr_blength += sizeof mtcap_0_3_supercap_attributes;
+ }
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
+ attr_blength += sizeof mtcap_0_0_wifi_attributes;
+ }
+ 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,mtcap_0_0_platform_attributes,current_blength);
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
+ log_info("Adding GPS to mts-io driver");
+ memcpy(all_attrs + current_count,mtcap_0_3_gnss_attributes,sizeof mtcap_0_3_gnss_attributes);
+ current_count += sizeof mtcap_0_3_gnss_attributes / (sizeof (struct attribute *));
+ }
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_SUPERCAP)) {
+ log_info("Adding supercap to mts-io driver");
+ memcpy(all_attrs + current_count,mtcap_0_3_supercap_attributes,sizeof mtcap_0_3_supercap_attributes);
+ current_count += sizeof mtcap_0_3_supercap_attributes / (sizeof (struct attribute *));
+ }
+ if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
+ log_info("Adding Wi-Fi to mts-io driver");
+ 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 *));
+ }
+ 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);
@@ -913,6 +949,7 @@ mts_id_eeprom_load(void)
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");
+ log_info("capa-supercap: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_SUPERCAP) ? "yes" : "no");
if (DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH)) {