]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/remoteproc.git/commitdiff
remoteproc: Add a sysfs interface for name
authorSuman Anna <s-anna@ti.com>
Fri, 9 Aug 2019 22:20:57 +0000 (17:20 -0500)
committerSuman Anna <s-anna@ti.com>
Tue, 3 Sep 2019 17:08:14 +0000 (12:08 -0500)
[ Upstream commit 6ed756aa0148a5ad0dbdced6f14f22e2f5748d35 ]

This patch adds a sysfs interface that provides the name of the
remote processor to userspace. This allows the userspace to identify
a remote processor as the remoteproc devices themselves are created
based on probe order and can change from one boot to another or
at runtime.

The name is made available in debugfs originally, and is being
retained for now. This can be cleaned up after couple of releases
once users get familiar with the new interface.

[s-anna@ti.com: cherry-pick commit '6ed756aa0148' from v5.4]
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Documentation/ABI/testing/sysfs-class-remoteproc
drivers/remoteproc/remoteproc_sysfs.c

index c3afe9fab6463beb775709866f75c6f725d63337..36094fbeb97493b74b6952e3ae0ad8eda5a8ff70 100644 (file)
@@ -48,3 +48,13 @@ Description: Remote processor state
 
                Writing "stop" will attempt to halt the remote processor and
                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.
index 0c47bc0bb36a585547d051848a4f8722e411d2c8..f99c7607cdce77c01c938ec7e2026ac017b86c69 100644 (file)
@@ -115,9 +115,20 @@ static ssize_t state_store(struct device *dev,
 }
 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[] = {
        &dev_attr_firmware.attr,
        &dev_attr_state.attr,
+       &dev_attr_name.attr,
        NULL
 };