summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2023-01-18 15:59:24 -0600
committerJohn Klug <john.klug@multitech.com>2023-01-18 16:10:55 -0600
commit617fdc8bb7853f468936fb827c136cd2c12b599f (patch)
tree5f48b6973cc16ad313b261ca7608992c062af869
parent69645a71d82453a59b9fbfe4ccbf2ceaa2f0696f (diff)
downloadmts-io-617fdc8bb7853f468936fb827c136cd2c12b599f.tar.gz
mts-io-617fdc8bb7853f468936fb827c136cd2c12b599f.tar.bz2
mts-io-617fdc8bb7853f468936fb827c136cd2c12b599f.zip
Switch mts-io messages to kernel dev_* messaging
-rw-r--r--io-module/mts-io.c247
1 files changed, 127 insertions, 120 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 0072d2e..f5c61ac 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -124,7 +124,7 @@ static int mts_io_probe(struct platform_device *pdev)
if (!dev->parent) {
dev_info(dev, "Parent device is not found");
} else if (dev->parent == &platform_bus) {
- dev_info(dev "Parent device is platform_bus. No need to create symlink");
+ dev_info(dev, "Parent device is platform_bus. No need to create symlink");
goto exit;
}
dev_info(dev "Creating symlink on platform_bus to %s", symlink_name);
@@ -148,7 +148,7 @@ static int mts_io_remove(struct platform_device *pdev)
struct mts_io_drvdata *mts_io_dd = platform_get_drvdata(pdev);
const char *symlink_name = kobject_name(&pdev->dev.kobj);
if (mts_io_dd && mts_io_dd->f_platform_bus_symlink) {
- dev_info(&mts_io_platform_device->dev,"Removing %s symlink from platform_bus", symlink_name); //JAK
+ dev_info(pdev->dev,"Removing %s symlink from platform_bus", symlink_name);
sysfs_remove_link(&platform_bus.kobj, symlink_name);
}
#endif // PLATFORM_BUS_SYMLINK
@@ -321,7 +321,7 @@ static ssize_t mts_attr_store_radio_reset(struct device *dev,
if (value != -1 && NULL != timings_data) {
/* check reset timer is started */
if (radio_reset_timer_is_start == 1) {
- log_info("radio reset timer is running. \n");
+ dev_info(dev,"radio reset timer is running. \n");
return count;
}
@@ -333,14 +333,14 @@ static ssize_t mts_attr_store_radio_reset(struct device *dev,
/* reset timer not started, start it */
mod_timer(&radio_reset_timer, jiffies + msecs_to_jiffies((timings_data[timings_data_index]) * 1000));
- //log_info("radio reset timer is start = [%d]\n", time_now_secs());
+ //dev_info(dev,"radio reset timer is start = [%d]\n", time_now_secs());
/* save timings_data_stop_seconds */
timings_data_stop_seconds = timings_data[timings_data_index] + time_now_secs();
radio_reset_timer_is_start = 1;
}
reset_radio_udev_discovery();
- log_info("radio is reset\n");
+ dev_info(dev,"radio is reset\n");
pin = gpio_pin_by_attr_name("radio-reset");
@@ -396,12 +396,12 @@ static void radio_reset_available_timer_callback( unsigned long data )
#endif
{
/* do your timer stuff here */
- //log_info("radio_reset_available_timer_callback\n");
- //log_info("radio reset available timer is stop = [%d]\n", time_now_secs());
+ //dev_info(&mts_io_platform_device->dev,"radio_reset_available_timer_callback\n");
+ //dev_info(&mts_io_platform_device->dev,"radio reset available timer is stop = [%d]\n", time_now_secs());
/* zero timings_data_index */
timings_data_index = 0;
- //log_info("timings data index is zero = [%d]\n", timings_data_index);
+ //dev_info(&mts_io_platform_device->dev,"timings data index is zero = [%d]\n", timings_data_index);
radio_reset_available_timer_is_start = 0;
}
@@ -412,8 +412,8 @@ static void radio_reset_timer_callback( unsigned long data )
#endif
{
/* do your timer stuff here */
- //log_info("radio_reset_timer_callback\n");
- //log_info("radio reset timer is stop = [%d]\n", time_now_secs());
+ //dev_info(&mts_io_platform_device->dev,"radio_reset_timer_callback\n");
+ //dev_info(&mts_io_platform_device->dev,"radio reset timer is stop = [%d]\n", time_now_secs());
/* increment timings_data_index */
timings_data_index++;
@@ -421,11 +421,11 @@ static void radio_reset_timer_callback( unsigned long data )
timings_data_index = timings_data_size-1;
}
- //log_info("timings data index = [%d]\n", timings_data_index);
+ //dev_info(&mts_io_platform_device->dev,"timings data index = [%d]\n", timings_data_index);
/* reset available timer not started, start it */
mod_timer(&radio_reset_available_timer, jiffies + msecs_to_jiffies((timings_data[timings_data_index]) * 1000));
- //log_info("radio reset available timer is start = [%d]\n", time_now_secs());
+ //dev_info(&mts_io_platform_device->dev,"radio reset available timer is start = [%d]\n", time_now_secs());
radio_reset_available_timer_is_start = 1;
radio_reset_timer_is_start = 0;
}
@@ -447,7 +447,7 @@ static ssize_t mts_attr_store_radio_reset_backoffs(struct device *dev,
radio_reset_timer_is_start = 0;
radio_reset_available_timer_is_start = 0;
- //log_info("free previous timings_data\n");
+ //dev_info(&mts_io_platform_device->dev,"free previous timings_data\n");
kfree(timings_data);
timings_data = NULL;
timings_data_size = 0;
@@ -455,30 +455,30 @@ static ssize_t mts_attr_store_radio_reset_backoffs(struct device *dev,
/* make a copy */
if( NULL == (timings_data_str = kzalloc((strlen(buf) + 1), GFP_KERNEL)) ){
- log_error("can`t allocate memory\n");
+ dev_err(&mts_io_platform_device->dev,"can`t allocate memory\n");
return -EINVAL;
}
- //log_info("radio_reset_backoffs buf: [%s]", buf);
+ //dev_info(&mts_io_platform_device->dev,"radio_reset_backoffs buf: [%s]", buf);
strncpy(timings_data_str, buf, (strlen(buf) + 1));
/* get number of tokens */
while (NULL != (pch = strsep (&timings_data_str, delimiter))) {
int value = 0;
sscanf(pch, "%d", &value);
- //log_info("radio reset backoffs pch = [%s]\n", pch);
+ //dev_info(&mts_io_platform_device->dev,"radio reset backoffs pch = [%s]\n", pch);
if (value > 0){
size++;
if (NULL == timings_data) {
/* make alloc */
if (NULL == (timings_data = kmalloc(sizeof(unsigned int), GFP_KERNEL))) {
- log_error("radio reset backoffs can`t allocate memory\n");
+ dev_err(&mts_io_platform_device->dev,"radio reset backoffs can`t allocate memory\n");
goto free;
}
} else {
/* make realloc */
if (NULL == (timings_data = krealloc(timings_data, size * sizeof(unsigned int), GFP_KERNEL))) {
- log_error("radio reset backoffs can`t allocate memory\n");
+ dev_err(&mts_io_platform_device->dev,"radio reset backoffs can`t allocate memory\n");
goto free;
}
}
@@ -488,7 +488,7 @@ static ssize_t mts_attr_store_radio_reset_backoffs(struct device *dev,
}
timings_data_size = size;
- //log_info("timings_data_size = %d\n", timings_data_size);
+ //dev_info(&mts_io_platform_device->dev,"timings_data_size = %d\n", timings_data_size);
if (NULL != timings_data_str) {
/* free timings_data_str */
@@ -521,7 +521,7 @@ static ssize_t mts_attr_store_radio_reset_backoffs_index(struct device *dev,
}
if ((value < 0) || (value >= timings_data_size)) {
- log_error("incorrect data\n");
+ dev_err(dev,"incorrect data\n");
return -EINVAL;
}
@@ -565,7 +565,7 @@ static ssize_t mts_attr_show_radio_reset_backoff_index(struct device *dev,
value = sprintf(buf, "%d", timings_data_index);
}
else {
- log_error("attribute '%s' not found", attr->attr.name);
+ dev_err(dev,"attribute '%s' not found", attr->attr.name);
value = -1;
}
@@ -585,7 +585,7 @@ static ssize_t mts_attr_show_radio_reset_backoff_seconds(struct device *dev,
value = sprintf(buf, "%d", 0);
}
} else {
- log_error("attribute '%s' not found", attr->attr.name);
+ dev_err(dev,"attribute '%s' not found", attr->attr.name);
value = -1;
}
@@ -723,7 +723,7 @@ static ssize_t mts_attr_show_product_info(struct device *dev,
#endif
}
else {
- log_error("attribute '%s' not found", attr->attr.name);
+ dev_err(dev,"attribute '%s' not found", attr->attr.name);
value = -1;
}
@@ -832,24 +832,29 @@ mts_id_eeprom_load(void)
if((ret = request_firmware_direct(&fw, "0-0056/eeprom", &mts_io_platform_device->dev)) == 0) {
if(fw->size == sizeof(id_eeprom)) {
memcpy(&id_eeprom, fw->data, sizeof(id_eeprom));
- log_info("Platform EEPROM contents loaded");
+ dev_info(&mts_io_platform_device->dev,"Platform EEPROM contents loaded");
} else {
- log_error("Invalid platform EEPROM length (%d)", fw->size);
+ dev_err(&mts_io_platform_device->dev,"Invalid platform EEPROM length (%d)", fw->size);
return -EINVAL;
}
release_firmware(fw);
} else {
- log_error("Unable to load EEPROM contents (%d)", ret);
+ dev_err(&mts_io_platform_device->dev,"Unable to load EEPROM contents (%d)", ret);
return -ENODEV;
}
- if (id_eeprom.eeprom_layout_version == 0) {
- noradio = ! mts_has_radio(id_eeprom.product_id,sizeof id_eeprom.product_id);
- } else {
- has_cellular_capaflag = 1;
- noradio = ! DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR);
- }
+ /* 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);
+ } else {
+ has_cellular_capaflag = 1;
+ noradio = ! DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR);
+ }
+ dev_dbg(&mts_io_platform_device->dev,"mts_id_eeprom_load: noradio=%d",noradio);
+ }
if (is_mtr()) {
noradio = 0;
@@ -870,12 +875,12 @@ mts_id_eeprom_load(void)
struct attribute **ap = mtcap_0_0_platform_attribute_group.attrs;
while(1) {
if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
+ dev_info(&mts_io_platform_device->dev,"Did not find radio power attribute. Possible driver fault.");
break;
}
j++;
if (is_radio_power_attr_mtcap(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
current_blength = attr_blength = j * sizeof (ap[j]);
/* account for removed attributes in table length */
@@ -906,22 +911,22 @@ mts_id_eeprom_load(void)
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");
+ dev_info(&mts_io_platform_device->dev,"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");
+ dev_info(&mts_io_platform_device->dev,"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");
+ dev_info(&mts_io_platform_device->dev,"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 *));
}
if (need_radio_enable) {
- log_info("Adding Radio Enable to mts-io driver");
+ dev_info(&mts_io_platform_device->dev,"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 *));
}
@@ -935,7 +940,7 @@ mts_id_eeprom_load(void)
if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) {
attr_group_lora = &mtcap_0_0_lora_attribute_group;
}
- log_info("detected board %s", hw_version_str);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", hw_version_str);
} else if (found_board(HW_VERSION_MTCAP3_0_0,MTCAP3_0_0,&hw_version_str,&mts_hw_version)) {
current_blength = attr_blength = sizeof mtcap3_0_0_platform_attributes;
current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */
@@ -944,12 +949,12 @@ mts_id_eeprom_load(void)
struct attribute **ap = mtcap3_0_0_platform_attribute_group.attrs;
while(1) {
if (ap[j] == NULL) {
- log_info("Did not find radio reset attribute. Possible driver fault.");
+ dev_info(&mts_io_platform_device->dev,"Did not find radio reset attribute. Possible driver fault.");
break;
}
j++;
if (is_radio_power_attr_mtcap3(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
current_blength = j * sizeof (ap[j]); /* Size without NULL */
attr_blength += sizeof (ap[j]); /* Size of attr array with NULL */
@@ -973,7 +978,7 @@ mts_id_eeprom_load(void)
current_lora_count = current_lora_blength/(sizeof (struct attribute *));
memcpy(all_lora_attrs, mtcap3_0_0_lora_attributes, current_lora_blength);
if (DEVICE_CAPA (id_eeprom.capa, CAPA_LORA_LBT)) {
- log_info("Adding lora-lbt to mts-io driver");
+ dev_info(&mts_io_platform_device->dev,"Adding lora-lbt to mts-io driver");
memcpy(all_lora_attrs + current_lora_count, mtcap3_0_0_lora_lbt_attributes, sizeof mtcap3_0_0_lora_lbt_attributes);
current_lora_count += sizeof mtcap3_0_0_lora_lbt_attributes / (sizeof (struct attribute *));
}
@@ -988,69 +993,69 @@ mts_id_eeprom_load(void)
gpio_pins = gpio_pins_mtcap3_0_0;
set_buttons(default_buttons);
mts_hw_version = MTCAP3_0_0;
- log_info("detected board %s", HW_VERSION_MTCAP3_0_0);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTCAP3_0_0);
} else if (found_board(HW_VERSION_MTRE,MTRE_0_0,&hw_version_str,&mts_hw_version)) {
attr_group = &mtre_0_0_platform_attribute_group;
gpio_pins = gpio_pins_mtre_0_0;
set_buttons(default_buttons);
mts_leds = mtre_0_0_leds;
mts_hw_version = MTRE_0_0;
- log_info("detected board %s", HW_VERSION_MTRE);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTRE);
} else if (found_board(HW_VERSION_MTR_0_0,MTR_0_0,&hw_version_str,&mts_hw_version)) {
attr_group = &mtr_platform_attribute_group;
gpio_pins = gpio_pins_mtr_0_0;
set_buttons(default_buttons);
mts_hw_version = MTR_0_0;
- log_info("detected board %s", HW_VERSION_MTR_0_0);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTR_0_0);
} else if (found_board(HW_VERSION_MTR_0_1,MTR_0_1,&hw_version_str,&mts_hw_version)) {
attr_group = &mtr_platform_attribute_group;
gpio_pins = gpio_pins_mtr_0_1;
set_buttons(default_buttons);
mts_hw_version = MTR_0_1;
- log_info("detected board %s", HW_VERSION_MTR_0_1);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTR_0_1);
} else if (found_board(HW_VERSION_MTRV1_0_0,MTRV1_0_0,&hw_version_str,&mts_hw_version)) {
attr_group = &mtr_platform_attribute_group;
gpio_pins = gpio_pins_mtrv1_0_0;
set_buttons(default_buttons);
mts_hw_version = MTRV1_0_0;
- log_info("detected board %s", HW_VERSION_MTRV1_0_0);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTRV1_0_0);
} else if (found_board(HW_VERSION_MTRV1_0_1,MTRV1_0_1,&hw_version_str,&mts_hw_version)) {
attr_group = &mtrv1_0_1_platform_attribute_group;
gpio_pins = gpio_pins_mtrv1_0_1;
set_buttons(default_buttons);
mts_hw_version = MTRV1_0_1;
- log_info("detected board %s", HW_VERSION_MTRV1_0_1);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTRV1_0_1);
} else if (found_board(HW_VERSION_MTRV1_0_2,MTRV1_0_2,&hw_version_str,&mts_hw_version)) {
attr_group = &mtrv1_0_2_platform_attribute_group;
gpio_pins = gpio_pins_mtrv1_0_2;
set_buttons(default_buttons);
mts_hw_version = MTRV1_0_2;
- log_info("detected board %s", HW_VERSION_MTRV1_0_2);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTRV1_0_2);
} else if (found_board(HW_VERSION_MTRV1_0_3,MTRV1_0_3,&hw_version_str,&mts_hw_version)) {
attr_group = &mtrv1_0_3_platform_attribute_group;
gpio_pins = gpio_pins_mtrv1_0_3;
set_buttons(default_buttons);
mts_hw_version = MTRV1_0_3;
- log_info("detected board %s", HW_VERSION_MTRV1_0_3);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTRV1_0_3);
} else if (found_board(HW_VERSION_MTRV1_0_4,MTRV1_0_4,&hw_version_str,&mts_hw_version)) {
attr_group = &mtrv1_0_4_platform_attribute_group;
gpio_pins = gpio_pins_mtrv1_0_4;
set_buttons(default_buttons);
mts_hw_version = MTRV1_0_4;
mtr_setup_radio_status(id_eeprom.product_id);
- log_info("detected board %s", HW_VERSION_MTRV1_0_4);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTRV1_0_4);
} else if (found_board(HW_VERSION_MTHS_0_0,MTHS_0_0,&hw_version_str,&mts_hw_version)) {
attr_group = &mths_0_0_platform_attribute_group;
gpio_pins = gpio_pins_mths_0_0;
set_buttons(mths_buttons_0_0);
mts_hw_version = MTHS_0_0;
- log_info("detected board %s", HW_VERSION_MTHS_0_0);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTHS_0_0);
} else if (found_board(HW_VERSION_MTHS_0_1,MTHS_0_1,&hw_version_str,&mts_hw_version)) {
attr_group = &mths_0_0_platform_attribute_group;
gpio_pins = gpio_pins_mths_0_1;
set_buttons(mths_buttons_0_0); /* Only one button version */
mts_hw_version = MTHS_0_1;
- log_info("detected board %s", HW_VERSION_MTHS_0_1);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MTHS_0_1);
} else if (found_board(HW_VERSION_MTCDT_0_1,MTCDT_0_1,&hw_version_str,&mts_hw_version) ||
found_board(HW_VERSION_MTCDTIP_0_0,MTCDTIP_0_0,&hw_version_str,&mts_hw_version)) {
need_append = 0;
@@ -1062,12 +1067,12 @@ mts_id_eeprom_load(void)
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.");
+ dev_info(&mts_io_platform_device->dev,"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);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
current_blength = j * sizeof (ap[j]); /* Size without NULL */
attr_blength += sizeof (ap[j]); /* Size of attr array with NULL */
@@ -1089,12 +1094,12 @@ mts_id_eeprom_load(void)
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");
+ dev_info(&mts_io_platform_device->dev,"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");
+ dev_info(&mts_io_platform_device->dev,"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 *));
@@ -1106,7 +1111,7 @@ mts_id_eeprom_load(void)
attr_group = &mtcdt_0_1_platform_attribute_group;
gpio_pins = gpio_pins_mtcdt_0_1;
set_buttons(default_buttons);
- log_info("detected board %s", hw_version_str);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", hw_version_str);
} else if (found_board(HW_VERSION_MTCDT_0_2,MTCDT_0_2,&hw_version_str,&mts_hw_version) ||
found_board(HW_VERSION_MTCDTIP_0_1,MTCDTIP_0_1,&hw_version_str,&mts_hw_version)) {
need_append = 0;
@@ -1118,12 +1123,12 @@ mts_id_eeprom_load(void)
struct attribute **ap = mtcdt_0_2_platform_attribute_group.attrs;
while(1) {
if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
+ dev_info(&mts_io_platform_device->dev,"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);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
current_blength = j * sizeof (ap[j]); /* Size without NULL */
attr_blength += sizeof (ap[j]); /* Size of attr array with NULL */
@@ -1145,12 +1150,12 @@ mts_id_eeprom_load(void)
current_count = current_blength/(sizeof (struct attribute *));
memcpy(all_attrs,mtcdt_0_2_platform_attributes,current_blength);
if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
- log_info("Adding WiFi/BT to mts-io driver");
+ dev_info(&mts_io_platform_device->dev,"Adding WiFi/BT to mts-io driver");
memcpy(all_attrs + current_count,mtcdt_0_2_wifi_bt_attributes,sizeof mtcdt_0_2_wifi_bt_attributes);
current_count += sizeof mtcdt_0_2_wifi_bt_attributes / (sizeof (struct attribute *));
}
if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
- log_info("Adding GPS to mts-io driver");
+ dev_info(&mts_io_platform_device->dev,"Adding GPS to mts-io driver");
attr_blength += sizeof mtcdt_0_2_gnss_attributes;
memcpy(all_attrs + current_count,mtcdt_0_2_gnss_attributes,sizeof mtcdt_0_2_gnss_attributes);
current_count += sizeof mtcdt_0_2_gnss_attributes / (sizeof (struct attribute *));
@@ -1162,7 +1167,7 @@ mts_id_eeprom_load(void)
attr_group = &mtcdt_0_2_platform_attribute_group;
gpio_pins = gpio_pins_mtcdt_0_2;
set_buttons(default_buttons);
- log_info("detected board %s", hw_version_str);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", hw_version_str);
} else if (found_board(HW_VERSION_MTCDTIPHP_0_0,MTCDTIPHP_0_0,&hw_version_str,&mts_hw_version)) {
need_append = 0;
current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes;
@@ -1173,12 +1178,12 @@ mts_id_eeprom_load(void)
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.");
+ dev_info(&mts_io_platform_device->dev,"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);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
current_blength = j * sizeof (ap[j]); /* Size without NULL */
attr_blength += sizeof (ap[j]); /* Size of attr array with NULL */
@@ -1195,7 +1200,7 @@ mts_id_eeprom_load(void)
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");
+ dev_info(&mts_io_platform_device->dev,"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 *));
}
@@ -1212,18 +1217,18 @@ mts_id_eeprom_load(void)
}
set_buttons(default_buttons);
mts_hw_version = MTCDTIPHP_0_0;
- log_info("detected board %s", hw_version_str);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", hw_version_str);
} else if (found_board(HW_VERSION_MTCDT_0_0,MTCDT_0_0,&hw_version_str,&mts_hw_version)) {
if(noradio) {
struct attribute **ap = mtcdt_platform_attribute_group.attrs;
while(1) {
if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
+ dev_info(&mts_io_platform_device->dev,"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);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
break;
}
@@ -1234,7 +1239,7 @@ mts_id_eeprom_load(void)
gpio_pins = gpio_pins_mtcdt_0_0;
mts_hw_version = MTCDT_0_0;
set_buttons(default_buttons);
- log_info("detected board %s", hw_version_str);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", hw_version_str);
} else if (found_board(HW_VERSION_MTCPM_0_0,MTCPM_0_0,&hw_version_str,&mts_hw_version) ||
found_board(HW_VERSION_MTCPM_0_1,MTCPM_0_1,&hw_version_str,&mts_hw_version) ||
found_board(HW_VERSION_MTCPM_0_2,MTCPM_0_2,&hw_version_str,&mts_hw_version)) {
@@ -1247,12 +1252,12 @@ mts_id_eeprom_load(void)
struct attribute **ap = mtcpm_platform_attribute_group.attrs;
while(1) {
if(ap[j] == NULL) {
- log_info("Did not find radio reset attribute. Possible driver fault.");
+ dev_info(&mts_io_platform_device->dev,"Did not find radio reset attribute. Possible driver fault.");
break;
}
j++;
if (is_radio_reset_attr_mtcpm(ap[j])) {
- log_info("Pruning radio feature from mts-io",j);
+ dev_info(&mts_io_platform_device->dev,"Pruning radio feature from mts-io");
ap[j] = NULL;
current_blength = j * sizeof (ap[j]); /* Size without NULL */
attr_blength += sizeof (ap[j]); /* Size of attr array with NULL */
@@ -1277,18 +1282,18 @@ mts_id_eeprom_load(void)
current_count = current_blength/(sizeof (struct attribute *));
memcpy(all_attrs,mtcpm_platform_attributes,current_blength);
if (strncmp(hw_version_str,HW_VERSION_MTCPM_DASH,strlen(HW_VERSION_MTCPM_DASH))!=0) {
- log_info("Adding has_radio to mts-io driver");
+ dev_info(&mts_io_platform_device->dev,"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");
+ dev_info(&mts_io_platform_device->dev,"Adding WiFi/BT to mts-io driver");
memcpy(all_attrs + current_count,mtcpm_wifi_bt_attributes,sizeof mtcpm_wifi_bt_attributes);
current_count += sizeof mtcpm_wifi_bt_attributes / (sizeof (struct attribute *));
}
if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
- log_info("Adding GPS to mts-io driver");
+ dev_info(&mts_io_platform_device->dev,"Adding GPS to mts-io driver");
attr_blength += sizeof mtcpm_gnss_attributes;
memcpy(all_attrs + current_count,mtcpm_gnss_attributes,sizeof mtcpm_gnss_attributes);
current_count += sizeof mtcpm_gnss_attributes / (sizeof (struct attribute *));
@@ -1301,13 +1306,13 @@ mts_id_eeprom_load(void)
gpio_pins = gpio_pins_mtcpm;
set_buttons(default_buttons);
mts_leds = mtcpmhs_leds;
- log_info("detected board %s", hw_version_str);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", hw_version_str);
} else if (found_board(HW_VERSION_MT100EOCG_0_0,MT100EOCG_0_0,&hw_version_str,&mts_hw_version)) {
attr_group = &mt100eocg_platform_attribute_group;
gpio_pins = gpio_pins_mt100eocg_0_0;
mts_hw_version = MT100EOCG_0_0;
set_buttons(default_buttons);
- log_info("detected board %s", HW_VERSION_MT100EOCG_0_0);
+ dev_info(&mts_io_platform_device->dev,"detected board %s", HW_VERSION_MT100EOCG_0_0);
} else {
int i;
@@ -1319,24 +1324,24 @@ mts_id_eeprom_load(void)
if(! isprint(id_eeprom.hw_version[i]))
break;
}
- log_alert("Unsupported EEPROM settings or device");
+ dev_alert(&mts_io_platform_device->dev,"Unsupported EEPROM settings or device");
if(i)
- log_alert("Found unsupported EEPROM HW_VERSION: %.*s",i,id_eeprom.hw_version);
- log_alert("Check log for HW_VERSION dump");
+ dev_alert(&mts_io_platform_device->dev,"Found unsupported EEPROM HW_VERSION: %.*s",i,id_eeprom.hw_version);
+ dev_alert(&mts_io_platform_device->dev,"Check log for HW_VERSION dump");
print_hex_dump_bytes("HW_VERSION: ", DUMP_PREFIX_OFFSET, id_eeprom.hw_version, sizeof id_eeprom.hw_version);
return -ENODEV;
}
- log_info("EEPROM-Layout-Version: %u",id_eeprom.eeprom_layout_version);
- log_info("sizeof: %lu", (unsigned long) sizeof(struct mts_id_eeprom_layout));
- log_info("vendor-id: %.32s", id_eeprom.vendor_id);
- log_info("product-id: %.32s", id_eeprom.product_id);
- log_info("device-id: %.32s", id_eeprom.device_id);
- log_info("hw-version: %.32s", id_eeprom.hw_version);
- log_info("mac-addr: %02X:%02X:%02X:%02X:%02X:%02X",
+ dev_info(&mts_io_platform_device->dev,"EEPROM-Layout-Version: %u",id_eeprom.eeprom_layout_version);
+ dev_info(&mts_io_platform_device->dev,"sizeof: %lu", (unsigned long) sizeof(struct mts_id_eeprom_layout));
+ dev_info(&mts_io_platform_device->dev,"vendor-id: %.32s", id_eeprom.vendor_id);
+ dev_info(&mts_io_platform_device->dev,"product-id: %.32s", id_eeprom.product_id);
+ dev_info(&mts_io_platform_device->dev,"device-id: %.32s", id_eeprom.device_id);
+ dev_info(&mts_io_platform_device->dev,"hw-version: %.32s", id_eeprom.hw_version);
+ dev_info(&mts_io_platform_device->dev,"mac-addr: %02X:%02X:%02X:%02X:%02X:%02X",
id_eeprom.mac_addr[0],
id_eeprom.mac_addr[1],
id_eeprom.mac_addr[2],
@@ -1344,26 +1349,26 @@ mts_id_eeprom_load(void)
id_eeprom.mac_addr[4],
id_eeprom.mac_addr[5]);
- log_info("imei: %.32s", id_eeprom.imei);
- log_info("capa-gps: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_GPS) ? "yes" : "no");
- log_info("capa-din: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_DIN) ? "yes" : "no");
- log_info("capa-dout: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT) ? "yes" : "no");
- 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");
+ dev_info(&mts_io_platform_device->dev,"imei: %.32s", id_eeprom.imei);
+ dev_info(&mts_io_platform_device->dev,"capa-gps: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_GPS) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-din: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_DIN) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-dout: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-adc: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_ADC) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-wifi: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-bluetooth: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH) ? "yes" : "no");
if ((mts_hw_version != MTCPM_0_0) && (mts_hw_version != MTCPM_0_1) && (mts_hw_version != MTCPM_0_2)) {
/* 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-lora-lbt: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_LORA_LBT) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-lora: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-lora-lbt: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_LORA_LBT) ? "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");
+ dev_info(&mts_io_platform_device->dev,"capa-battery: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_BATTERY) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"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");
- log_info("capa-user-data-encryption: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_USER_DATA_ENCRYPTION) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-cellular: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR) ? "yes" : "no");
+ dev_info(&mts_io_platform_device->dev,"capa-user-data-encryption: %s", DEVICE_CAPA(id_eeprom.capa, CAPA_USER_DATA_ENCRYPTION) ? "yes" : "no");
if (DEVICE_CAPA(id_eeprom.capa, CAPA_BLUETOOTH)) {
- log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X",
+ dev_info(&mts_io_platform_device->dev,"mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X",
id_eeprom.mac_bluetooth[0],
id_eeprom.mac_bluetooth[1],
id_eeprom.mac_bluetooth[2],
@@ -1372,7 +1377,7 @@ mts_id_eeprom_load(void)
id_eeprom.mac_bluetooth[5]);
}
if (DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
- log_info("mac-wifi: %02X:%02X:%02X:%02X:%02X:%02X",
+ dev_info(&mts_io_platform_device->dev,"mac-wifi: %02X:%02X:%02X:%02X:%02X:%02X",
id_eeprom.mac_wifi[0],
id_eeprom.mac_wifi[1],
id_eeprom.mac_wifi[2],
@@ -1385,10 +1390,10 @@ mts_id_eeprom_load(void)
for(i = 0; i < 16; i++) {
ptr += sprintf(ptr, "%02X", id_eeprom.uuid[i]);
}
- log_info("uuid: %s", (char*)buf);
+ dev_info(&mts_io_platform_device->dev,"uuid: %s", (char*)buf);
if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) {
- log_info("lora-eui: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+ dev_info(&mts_io_platform_device->dev,"lora-eui: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
id_eeprom.lora_eui[0],
id_eeprom.lora_eui[1],
id_eeprom.lora_eui[2],
@@ -1398,19 +1403,19 @@ mts_id_eeprom_load(void)
id_eeprom.lora_eui[6],
id_eeprom.lora_eui[7]);
- log_info("lora-product-id: %.32s", id_eeprom.lora_product_id);
- log_info("lora-hw-version: %.32s", id_eeprom.lora_hw_version);
+ dev_info(&mts_io_platform_device->dev,"lora-product-id: %.32s", id_eeprom.lora_product_id);
+ dev_info(&mts_io_platform_device->dev,"lora-hw-version: %.32s", id_eeprom.lora_hw_version);
}
#ifdef MTRE
- log_info("oem-string1: %.32s", id_eeprom.oem_string1);
- log_info("oem-string2: %.32s", id_eeprom.oem_string2);
+ dev_info(&mts_io_platform_device->dev,"oem-string1: %.32s", id_eeprom.oem_string1);
+ dev_info(&mts_io_platform_device->dev,"oem-string2: %.32s", id_eeprom.oem_string2);
#endif
return 0;
}
static void cleanup(void)
{
- printk(KERN_INFO "mts-io: cleaning up....");
+ dev_info(&mts_io_platform_device->dev,"mts-io: cleaning up....");
if (mts_io_platform_device != NULL && attr_group != NULL) {
sysfs_remove_group(&mts_io_platform_device->dev.kobj, attr_group);
@@ -1438,13 +1443,13 @@ static int __init mts_io_init(void)
int ret;
- log_info("init: " VERSION);
+ dev_info(&mts_io_platform_device->dev,"mts-io init: " VERSION);
/* We do a platform_driver_register to do a probe
* of device tree and set the pinctrl/gpio settings. */
ret = platform_driver_register(&mts_io_driver);
if (ret) {
- printk(KERN_ERR "mts-io: probe failed: %d\n", ret);
+ dev_err(&mts_io_platform_device->dev,"mts-io: probe failed: %d\n", ret);
cleanup();
return ret;
}
@@ -1452,7 +1457,7 @@ static int __init mts_io_init(void)
/* Without a platform device our EEPROM load will
* not work, and we cannot continue. */
if (mts_io_platform_device == NULL) {
- pr_err("mts-io: probe failed, possible bad device tree\n");
+ dev_err(&mts_io_platform_device->dev,"mts-io: probe failed, possible bad device tree\n");
return -ENODEV;
}
@@ -1467,18 +1472,18 @@ static int __init mts_io_init(void)
if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) {
ret = spi_register_driver(&mts_spi_dout_driver);
if (ret) {
- printk(KERN_ERR "mts-io:mts-io-dout: probe failed: %d\n", ret);
+ dev_err(&mts_io_platform_device->dev,"mts-io:mts-io-dout: probe failed: %d\n", ret);
}
}
if (DEVICE_CAPA(id_eeprom.capa, CAPA_DIN)) {
ret = spi_register_driver(&mts_spi_din_driver);
if (ret) {
- printk(KERN_ERR "mts-io:mts-io-din: probe failed: %d\n", ret);
+ dev_err(&mts_io_platform_device->dev,"mts-io:mts-io-din: probe failed: %d\n", ret);
}
}
ret = spi_register_driver(&mts_spi_board_temp_driver);
if (ret) {
- printk(KERN_ERR "mts-io:mts-io-board-temp: probe failed: %d\n", ret);
+ dev_err(&mts_io_platform_device->dev,"mts-io:mts-io-board-temp: probe failed: %d\n", ret);
}
if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) {
@@ -1556,6 +1561,8 @@ static void __exit mts_io_exit(void)
int old_last = 0;
int i,found;
struct gpio_pin *pin;
+ struct device *dev = &mts_io_platform_device->dev;
+
if (DEVICE_CAPA(id_eeprom.capa, CAPA_DOUT)) {
spi_unregister_driver(&mts_spi_dout_driver);
}
@@ -1572,16 +1579,16 @@ static void __exit mts_io_exit(void)
for (pin = gpio_pins; *pin->name; pin++) {
if (pin->capability == 0 || DEVICE_CAPA(id_eeprom.capa,pin->capability)) {
if (pin->do_gpio_desc) {
- dev_dbg(&mts_io_platform_device->dev,"Kernel removes when module is unloaded: GPIO descriptor case: pin->name=%s\n",
+ dev_dbg(dev,"Kernel removes when module is unloaded: GPIO descriptor case: pin->name=%s\n",
pin->name);
} else {
// TODO: Remove this code when the last pin is converted to the new GPIO model
- dev_dbg(&mts_io_platform_device->dev,"Deprecated GPIO pin # case: pin->name=%s\n",
+ dev_dbg(dev,"Deprecated GPIO pin # case: pin->name=%s\n",
pin->name);
found = 0;
for(i=0; i<old_last; i++) {
if (pin->pin.gpio == old_pin[i]) {
- dev_dbg(&mts_io_platform_device->dev,"Deprecated GPIO pin #, skipping free of: pin->name=%s\n",
+ dev_dbg(dev,"Deprecated GPIO pin #, skipping free of: pin->name=%s\n",
pin->name);
found = 1;
break;
@@ -1606,7 +1613,7 @@ static void __exit mts_io_exit(void)
}
cleanup();
-
+ // platform device does not exist
if (mts_leds) {
mts_leds_unregister();
}
@@ -1614,7 +1621,7 @@ static void __exit mts_io_exit(void)
if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) {
mts_teardown_lora_port();
}
- printk(KERN_INFO "mts-io exiting");
+ printk(KERN_INFO "mts-io exiting dev");
}
module_init(mts_io_init);