diff options
| author | Matt Wagantall <mattw@codeaurora.org> | 2015-06-08 19:42:54 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:02:30 -0700 |
| commit | 7b6a57e6588401e469e1fcd126ccda9855391d29 (patch) | |
| tree | 119118718f2fe1fe41a4f27f5e670e4382c689a8 | |
| parent | 2dddd088d1c58704364d4c9253ce6ee5c251a00f (diff) | |
soc: qcom: expose serial_number field via sysfs
socinfo format v0.10 introduced a serial number field, which is
presently only printed at boot, and not made visible via sysfs.
Make it readable from sysfs also.
Change-Id: I523c6cb8829c0dfee31b35913e085cf3996ef21a
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
| -rw-r--r-- | drivers/soc/qcom/socinfo.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index 6b4c2c24da04..36249ef2ccc6 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -635,6 +635,14 @@ static uint32_t socinfo_get_foundry_id(void) : 0; } +static uint32_t socinfo_get_serial_number(void) +{ + return socinfo ? + (socinfo->v0_1.format >= SOCINFO_VERSION(0, 10) ? + socinfo->v0_10.serial_number : 0) + : 0; +} + enum pmic_model socinfo_get_pmic_model(void) { return socinfo ? @@ -774,6 +782,15 @@ msm_get_foundry_id(struct device *dev, } static ssize_t +msm_get_serial_number(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%u\n", + socinfo_get_serial_number()); +} + +static ssize_t msm_get_pmic_model(struct device *dev, struct device_attribute *attr, char *buf) @@ -972,6 +989,10 @@ static struct device_attribute msm_soc_attr_foundry_id = __ATTR(foundry_id, S_IRUGO, msm_get_foundry_id, NULL); +static struct device_attribute msm_soc_attr_serial_number = + __ATTR(serial_number, S_IRUGO, + msm_get_serial_number, NULL); + static struct device_attribute msm_soc_attr_pmic_model = __ATTR(pmic_model, S_IRUGO, msm_get_pmic_model, NULL); @@ -1069,6 +1090,8 @@ static void __init populate_soc_sysfs_files(struct device *msm_soc_device) switch (legacy_format) { case SOCINFO_VERSION(0, 10): + device_create_file(msm_soc_device, + &msm_soc_attr_serial_number); case SOCINFO_VERSION(0, 9): device_create_file(msm_soc_device, &msm_soc_attr_foundry_id); |
