From patchwork Fri Aug 9 22:20:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 170987 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp10585124ile; Fri, 9 Aug 2019 15:21:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzftH+wc70Lgk0Tz19QftPgK90XoBc2S43CPS395vH+l2nkjUoXpuECdpn5cfJ+UzdooiFm X-Received: by 2002:a63:7a01:: with SMTP id v1mr19886096pgc.310.1565389281738; Fri, 09 Aug 2019 15:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565389281; cv=none; d=google.com; s=arc-20160816; b=Aj3g/8ZFdcuafa1a+SjOaMCqqFhGTtQF0n4sLitUnCYIJxaf6A38JN7h4sCbprZT9G jBQfUBX3uKyR0fJJ2B8xNkFN09mmYiq54Sa+/3FzZkydedETxQpK7nHWgMlVXS/ARYo1 8ZALuOCRqbLglMU+Z09EJyDmJn0hRjlURONiMmL1JFRwVc+l2e0/nB6rMK/NV/OI7bVC cyg4KhIlZYK9QUxpPDol7amzQaaOCYurfLZ0oaL12ZL/inhTxU/t90AYlVcV3SZepfw+ Zm0NEQzLPuw6x+8Jt7wOHVsHfhKN14IKAg9ZE3bRyLm2m2FhGfWOUubUfJV1Dgy81jQ/ SrcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0sRKy0ahKs6KSh6b8fYHSjedNqmA9zJmx8GJm3JPAbA=; b=nuakbhenVWgdY/LHEo12CjNHJPaBdf/1WOGYr6jHTh5Z5Ry3V5omqgkwXf/Npm97jn gvzzb0hWxdvwP3UjQ/tvQGA3JHEeQWgz53cAtwk85gTyVth9ADNROKVF0s8SzlHMW4mu NrfIgWxWK3taAt7b6g/KkIP5Y+Rcf3k5xNviUc7l3Tq/6j78jKcl7rygfAFLt/8ZeZJu UbZmqgLe7Zlol9l87jWrhIn8F1CYMQZCcVS1B68Qbe2Xng8pdebXYmnAHG0fz4fdrLYE yqyBkMEc47wuGGUOTCPsOWUGhQU5L370rQhMj24UxiVn8Y/oz0ZlsUjbcURj90a311pX 6L6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ehV5teT2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b41si6250777pla.155.2019.08.09.15.21.21; Fri, 09 Aug 2019 15:21:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ehV5teT2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728539AbfHIWVT (ORCPT + 28 others); Fri, 9 Aug 2019 18:21:19 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:37724 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbfHIWVT (ORCPT ); Fri, 9 Aug 2019 18:21:19 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x79MLDhL021121; Fri, 9 Aug 2019 17:21:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1565389273; bh=0sRKy0ahKs6KSh6b8fYHSjedNqmA9zJmx8GJm3JPAbA=; h=From:To:CC:Subject:Date; b=ehV5teT2Z/L2AK55GBDmjtWhaRlrqNkVDmF64pBhmYrjqUl3QTiFZLPpqzvpOmL21 THMrNPqWM8jk+5B0+oQBKSqxpS3MNqEvfd2FOTj+IhMdhpH4tPdUNeJB9MPGFdaniT yQowAC48yFxNy7F38U1ym5iMCAptFcw+peOyaE+Y= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x79MLDNG095931 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Aug 2019 17:21:13 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 9 Aug 2019 17:21:13 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 9 Aug 2019 17:21:13 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x79MLCgL080777; Fri, 9 Aug 2019 17:21:12 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id x79MLCZ28077; Fri, 9 Aug 2019 17:21:12 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: Ohad Ben-Cohen , Matt Redfearn , Loic Pallardy , Fabien Dessenne , Arnaud Pouliquen , , , Suman Anna Subject: [PATCH] remoteproc: Add a sysfs interface for name Date: Fri, 9 Aug 2019 17:20:57 -0500 Message-ID: <20190809222057.13924-1-s-anna@ti.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Suman Anna --- Documentation/ABI/testing/sysfs-class-remoteproc | 10 ++++++++++ drivers/remoteproc/remoteproc_sysfs.c | 11 +++++++++++ 2 files changed, 21 insertions(+) -- 2.22.0 Acked-by:Arnaud POULIQUEN diff --git a/Documentation/ABI/testing/sysfs-class-remoteproc b/Documentation/ABI/testing/sysfs-class-remoteproc index c3afe9fab646..36094fbeb974 100644 --- a/Documentation/ABI/testing/sysfs-class-remoteproc +++ b/Documentation/ABI/testing/sysfs-class-remoteproc @@ -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 +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. diff --git a/drivers/remoteproc/remoteproc_sysfs.c b/drivers/remoteproc/remoteproc_sysfs.c index fa4131930106..7f8536b73295 100644 --- a/drivers/remoteproc/remoteproc_sysfs.c +++ b/drivers/remoteproc/remoteproc_sysfs.c @@ -113,9 +113,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 };