};
static ssize_t show_pid(struct device *dev, struct device_attribute
- *attr, char *buf);
+ *attr, char *buf);
static ssize_t store_pid(struct device *dev, struct device_attribute
- *devattr, char *buf, size_t count);
+ *devattr, char *buf, size_t count);
static ssize_t show_list(struct device *dev, struct device_attribute
- *attr, char *buf);
-
+ *attr, char *buf);
+static ssize_t show_version(struct device *dev, struct device_attribute
+ *attr, char *buf);
/* structures specific for sysfs entries */
static struct kobj_attribute pid_attr =
__ATTR(pid, 0644, (void *)show_pid, (void *)store_pid);
static struct kobj_attribute list_protocols =
__ATTR(protocols, 0444, (void *)show_list, NULL);
+static struct kobj_attribute chip_version =
+__ATTR(version, 0444, (void *)show_version, NULL);
+
static struct attribute *uim_attrs[] = {
&pid_attr.attr,
/* add more debug sysfs entries */
&list_protocols.attr,
+ &chip_version.attr,
NULL,
};
}
version =
- MAKEWORD(kim_gdata->resp_buffer[13], kim_gdata->resp_buffer[14]);
+ MAKEWORD(kim_gdata->resp_buffer[13],
+ kim_gdata->resp_buffer[14]);
chip = (version & 0x7C00) >> 10;
min_ver = (version & 0x007F);
maj_ver = (version & 0x0380) >> 7;
maj_ver |= 0x0008;
sprintf(bts_scr_name, "TIInit_%d.%d.%d.bts", chip, maj_ver, min_ver);
+
+ /* to be accessed later via sysfs entry */
+ kim_gdata->version.full = version;
+ kim_gdata->version.chip = chip;
+ kim_gdata->version.maj_ver = maj_ver;
+ kim_gdata->version.min_ver = min_ver;
+
pr_info("%s", bts_scr_name);
return ST_SUCCESS;
}
/**********************************************************************/
/* functions called from subsystems */
+/* called when sysfs entry is read from */
+
+static ssize_t show_version(struct device *dev, struct device_attribute
+ *attr, char *buf)
+{
+ sprintf(buf, "%04X %d.%d.%d", kim_gdata->version.full,
+ kim_gdata->version.chip, kim_gdata->version.maj_ver,
+ kim_gdata->version.min_ver);
+ return strlen(buf);
+}
/* called when sysfs entry is written to */
static ssize_t store_pid(struct device *dev, struct device_attribute
}
pr_info("rfkill entry created for %ld", gpios[proto]);
}
+
+ if (sysfs_create_group(&pdev->dev.kobj, &uim_attr_grp)) {
+ pr_err(" sysfs entry creation failed");
+ return -1;
+ }
+ pr_info(" sysfs entries created ");
return ST_SUCCESS;
}
kim_gdata->rfkill[proto] = NULL;
}
pr_info("kim: GPIO Freed");
+ sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
kim_gdata->kim_pdev = NULL;
st_core_exit(kim_gdata->core_data);
return ST_SUCCESS;