[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220729090521.v2.1.Id612b86fd30936dfd4c456b3341547c15cecf321@changeid>
Date: Fri, 29 Jul 2022 09:05:50 +1000
From: Daniil Lunev <dlunev@...omium.org>
To: Adrian Hunter <adrian.hunter@...el.com>,
Bart Van Assche <bvanassche@....org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Daniil Lunev <dlunev@...omium.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Bean Huo <beanhuo@...ron.com>,
Daejun Park <daejun7.park@...sung.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Sohaib Mohamed <sohaib.amhmd@...il.com>,
Stanley Chu <stanley.chu@...iatek.com>,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: [PATCH v2] ufs: core: print capabilities in controller's sysfs node
Allows userspace to check supported by the controller/device
functionality, e.g. write booster.
Signed-off-by: Daniil Lunev <dlunev@...omium.org>
---
Changes in v2:
* Add documentation entry for the new sysfs node.
Documentation/ABI/testing/sysfs-driver-ufs | 9 +++++++++
drivers/ufs/core/ufs-sysfs.c | 10 ++++++++++
2 files changed, 19 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs
index 6b248abb1bd71..97e42e4763eaf 100644
--- a/Documentation/ABI/testing/sysfs-driver-ufs
+++ b/Documentation/ABI/testing/sysfs-driver-ufs
@@ -1591,6 +1591,15 @@ Description: This entry shows the status of HPB.
The file is read only.
+What: /sys/bus/platform/drivers/ufshcd/*/caps
+What: /sys/bus/platform/devices/*.ufs/caps
+Date: July 2022
+Contact: Daniil Lunev <dlunev@...omium.org>
+Description: Read-only attribute. Enabled capabilities of the UFS driver. The
+ enabled capabilities are determined by what is supported by the
+ host controller and the UFS device.
+ Format: 0x%08llx
+
What: /sys/class/scsi_device/*/device/hpb_param_sysfs/activation_thld
Date: February 2021
Contact: Avri Altman <avri.altman@....com>
diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
index 0a088b47d5570..b0c294c367519 100644
--- a/drivers/ufs/core/ufs-sysfs.c
+++ b/drivers/ufs/core/ufs-sysfs.c
@@ -254,6 +254,14 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr,
return res < 0 ? res : count;
}
+static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct ufs_hba *hba = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "0x%08llx\n", hba->caps);
+}
+
static DEVICE_ATTR_RW(rpm_lvl);
static DEVICE_ATTR_RO(rpm_target_dev_state);
static DEVICE_ATTR_RO(rpm_target_link_state);
@@ -262,6 +270,7 @@ static DEVICE_ATTR_RO(spm_target_dev_state);
static DEVICE_ATTR_RO(spm_target_link_state);
static DEVICE_ATTR_RW(auto_hibern8);
static DEVICE_ATTR_RW(wb_on);
+static DEVICE_ATTR_RO(caps);
static struct attribute *ufs_sysfs_ufshcd_attrs[] = {
&dev_attr_rpm_lvl.attr,
@@ -272,6 +281,7 @@ static struct attribute *ufs_sysfs_ufshcd_attrs[] = {
&dev_attr_spm_target_link_state.attr,
&dev_attr_auto_hibern8.attr,
&dev_attr_wb_on.attr,
+ &dev_attr_caps.attr,
NULL
};
--
2.31.0
Powered by blists - more mailing lists