Browse Source

video-driver: Add sku_version as device attr

Expose sku_version under device attribute.

Change-Id: I6800bf321b5678953a2a616fd3d2e85ad977de44
Signed-off-by: Priyanka Gujjula <[email protected]>
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal 3 years ago
parent
commit
87763b734b
1 changed files with 26 additions and 0 deletions
  1. 26 0
      driver/vidc/src/msm_vidc_probe.c

+ 26 - 0
driver/vidc/src/msm_vidc_probe.c

@@ -82,7 +82,33 @@ exit:
 	return rc;
 }
 
+static ssize_t sku_version_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct msm_vidc_core *core;
+
+	/*
+	 * Default sku version: 0
+	 * driver possibly not probed yet or not the main device.
+	 */
+	if (!dev || !dev->driver ||
+		!of_device_is_compatible(dev->of_node, "qcom,msm-vidc"))
+		return 0;
+
+	core = dev_get_drvdata(dev);
+	if (!core || !core->platform) {
+		d_vpr_e("%s: invalid core\n", __func__);
+		return 0;
+	}
+
+	return scnprintf(buf, PAGE_SIZE, "%d",
+			core->platform->data.sku_version);
+}
+
+static DEVICE_ATTR_RO(sku_version);
+
 static struct attribute *msm_vidc_core_attrs[] = {
+	&dev_attr_sku_version.attr,
 	NULL
 };