summaryrefslogtreecommitdiff
path: root/io-module/mts_capab.c
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-02-25 17:55:49 -0600
committerJohn Klug <john.klug@multitech.com>2020-02-25 17:55:49 -0600
commit62f1d67abe1f4e79542c3cca683b40beb2eeda02 (patch)
tree554b675f8a972c73961dd615bd50093d8cd9a9f7 /io-module/mts_capab.c
parent0a4a5f96dd649a5c5e18d43d7bd206f35845e1cb (diff)
downloadmts-io-62f1d67abe1f4e79542c3cca683b40beb2eeda02.tar.gz
mts-io-62f1d67abe1f4e79542c3cca683b40beb2eeda02.tar.bz2
mts-io-62f1d67abe1f4e79542c3cca683b40beb2eeda02.zip
mts-io based on thud/4.19 kernel for mt100eocg4.3.1
Diffstat (limited to 'io-module/mts_capab.c')
-rw-r--r--io-module/mts_capab.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/io-module/mts_capab.c b/io-module/mts_capab.c
index 8495d87..38e8442 100644
--- a/io-module/mts_capab.c
+++ b/io-module/mts_capab.c
@@ -25,6 +25,7 @@ static struct capab_map_s capabilities_map[] = {
{ CAPA_BLUETOOTH, "bluetooth"},
{ CAPA_WIFI, "wifi"},
{ CAPA_LORA, "lora"},
+ { CAPA_BATTERY, "battery"},
};
static ssize_t capab_show_value(struct device *dev, struct device_attribute *at, char *buf) {
@@ -48,6 +49,7 @@ static DEVICE_ATTR_RO_MTS(capa_attr_adc, "adc", capab_show_value);
static DEVICE_ATTR_RO_MTS(capa_attr_bt, "bluetooth", capab_show_value);
static DEVICE_ATTR_RO_MTS(capa_attr_wifi, "wifi", capab_show_value);
static DEVICE_ATTR_RO_MTS(capa_attr_lora, "lora", capab_show_value);
+static DEVICE_ATTR_RO_MTS(capa_attr_battery, "battery", capab_show_value);
static struct attribute *mts_capa_attributes[] = {
&capa_attr_gps.attr,
@@ -57,6 +59,7 @@ static struct attribute *mts_capa_attributes[] = {
&capa_attr_bt.attr,
&capa_attr_wifi.attr,
&capa_attr_lora.attr,
+ &capa_attr_battery.attr,
NULL,
};
@@ -65,21 +68,34 @@ static struct attribute_group mts_capa_attr_group = {
};
static struct kobject *mts_capa_kobject = NULL;
+EXPORT_SYMBOL(mts_capa_kobject);
-static int mts_capab_dir_create(void)
+static int mts_capab_dir_create(uint8_t hw_version)
{
- mts_capa_kobject = kobject_create_and_add("capability", &mts_io_platform_device->dev.kobj);
- if (!mts_capa_kobject) {
- log_error("kobject_create_and_add for capability directory failed");
- return -ENOMEM;
- }
+ int i,j;
+
+ if (hw_version == MTCPM_0_0) {
+ for (i=0; mts_capa_attributes[i]; i++) {
+ /* Remove capa_lora for MTCPM mts-io driver */
+ if (mts_capa_attributes[i] == &capa_attr_lora.attr) {
+ for(j=i; mts_capa_attributes[j]; j++)
+ mts_capa_attributes[j] = mts_capa_attributes[j+1];
+ break;
+ }
+ }
+ }
+ mts_capa_kobject = kobject_create_and_add("capability", &mts_io_platform_device->dev.kobj);
+ if (!mts_capa_kobject) {
+ log_error("kobject_create_and_add for capability directory failed");
+ return -ENOMEM;
+ }
- if (sysfs_create_group(mts_capa_kobject, &mts_capa_attr_group)) {
- log_error("sysfs_create_group failed to create capability group");
- return -ENOMEM;
- }
+ if (sysfs_create_group(mts_capa_kobject, &mts_capa_attr_group)) {
+ log_error("sysfs_create_group failed to create capability group");
+ return -ENOMEM;
+ }
- return 0;
+ return 0;
}
static void mts_capab_dir_delete(void)