Browse Source

Merge branch 'rproc-linux-4.19.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg-ti-linux-4.19.y

Pull in the updated remoteproc feature branch that adds a new sysfs
file 'name' to allow userspace to easily identify a remoteproc. An
equivalent file was already present in debugfs as well, but sysfs
provides a more standardized userspace interface since debugfs is
optional.

* 'rproc-linux-4.19.y' of git://git.ti.com/rpmsg/remoteproc:
  remoteproc: Add a sysfs interface for name

Signed-off-by: Suman Anna <s-anna@ti.com>
Suman Anna 6 years ago
parent
commit
1d51bf27ad

+ 10 - 0
Documentation/ABI/testing/sysfs-class-remoteproc

@@ -48,3 +48,13 @@ Description:	Remote processor state
 
 
 		Writing "stop" will attempt to halt the remote processor and
 		Writing "stop" will attempt to halt the remote processor and
 		return it to the "offline" state.
 		return it to the "offline" state.
+
+What:		/sys/class/remoteproc/.../name
+Date:		August 2019
+KernelVersion:	5.4
+Contact:	Suman Anna <s-anna@ti.com>
+Description:	Remote processor name
+
+		Reports the name of the remote processor. This can be used by
+		userspace in exactly identifying a remote processor and ease
+		up the usage in modifying the 'firmware' or 'state' files.

+ 11 - 0
drivers/remoteproc/remoteproc_sysfs.c

@@ -115,9 +115,20 @@ static ssize_t state_store(struct device *dev,
 }
 }
 static DEVICE_ATTR_RW(state);
 static DEVICE_ATTR_RW(state);
 
 
+/* Expose the name of the remote processor via sysfs */
+static ssize_t name_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct rproc *rproc = to_rproc(dev);
+
+	return sprintf(buf, "%s\n", rproc->name);
+}
+static DEVICE_ATTR_RO(name);
+
 static struct attribute *rproc_attrs[] = {
 static struct attribute *rproc_attrs[] = {
 	&dev_attr_firmware.attr,
 	&dev_attr_firmware.attr,
 	&dev_attr_state.attr,
 	&dev_attr_state.attr,
+	&dev_attr_name.attr,
 	NULL
 	NULL
 };
 };