summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorMatt Wagantall <mattw@codeaurora.org>2015-06-19 18:52:27 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:02:36 -0700
commit176f9fe4654b9bcd425f1aaa283dbc8988acafaa (patch)
tree9f4b2d2ca4f19039b2f7887a44390abea1a3649f /drivers/soc
parentcd31b001c74c8d99d903264bad826bc0b757260f (diff)
soc: qcom: socinfo: add 'images' sysfs device subnode
Although image information is already available in sysfs, only root has the ability to write to the select_image node, a necessary step for reading the CRM, variant and version info for a specific image. Additionally, multiple clients cannot safely read the image information without some caller-side locking to prevent updates of the select_image node while one of the other files are being read. Work around this by introducing a new 'images' node that can be used to dump information about all images without the need to write to select_image, and make it readable to non-root. Change-Id: I71dfda8c7c170b35a66f2f740202a8a79e8b8c0c Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/socinfo.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index faf5804287be..005579ab6cd4 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -940,6 +940,37 @@ msm_select_image(struct device *dev, struct device_attribute *attr,
return count;
}
+static ssize_t
+msm_get_images(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int pos = 0;
+ int image;
+ char *image_address;
+
+ image_address = socinfo_get_image_version_base_address();
+ if (IS_ERR_OR_NULL(image_address))
+ return snprintf(buf, PAGE_SIZE, "Unavailable\n");
+
+ *buf = '\0';
+ for (image = 0; image < SMEM_IMAGE_VERSION_BLOCKS_COUNT; image++) {
+ if (*image_address == '\0')
+ continue;
+
+ pos += snprintf(buf + pos, PAGE_SIZE - pos, "%d:\n",
+ image);
+ pos += snprintf(buf + pos, PAGE_SIZE - pos, "\tCRM:\t\t%-.75s\n",
+ image_address);
+ pos += snprintf(buf + pos, PAGE_SIZE - pos, "\tVariant:\t%-.20s\n",
+ image_address + SMEM_IMAGE_VERSION_VARIANT_OFFSET);
+ pos += snprintf(buf + pos, PAGE_SIZE - pos, "\tVersion:\t%-.32s\n\n",
+ image_address + SMEM_IMAGE_VERSION_OEM_OFFSET);
+
+ image_address += SMEM_IMAGE_VERSION_SINGLE_BLOCK_SIZE;
+ }
+
+ return pos;
+}
static struct device_attribute msm_soc_attr_raw_version =
__ATTR(raw_version, S_IRUGO, msm_get_raw_version, NULL);
@@ -1008,6 +1039,9 @@ static struct device_attribute select_image =
__ATTR(select_image, S_IRUGO | S_IWUSR,
msm_get_image_number, msm_select_image);
+static struct device_attribute images =
+ __ATTR(images, S_IRUGO, msm_get_images, NULL);
+
static void * __init setup_dummy_socinfo(void)
{
if (early_machine_is_apq8084()) {
@@ -1076,6 +1110,7 @@ static void __init populate_soc_sysfs_files(struct device *msm_soc_device)
device_create_file(msm_soc_device, &image_variant);
device_create_file(msm_soc_device, &image_crm_version);
device_create_file(msm_soc_device, &select_image);
+ device_create_file(msm_soc_device, &images);
switch (socinfo_format) {
case SOCINFO_VERSION(0, 11):