From: Manivannan Sadhasivam <mani@kernel.org>
To: Can Guo <quic_cang@quicinc.com>
Cc: quic_nguyenb@quicinc.com, quic_nitirawa@quicinc.com,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Bean Huo <beanhuo@micron.com>,
Arthur Simchaev <arthur.simchaev@wdc.com>,
Lu Hongfei <luhongfei@vivo.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/6] scsi: ufs: ufs-sysfs: Expose UFS power info
Date: Tue, 19 Sep 2023 14:16:27 +0200 [thread overview]
Message-ID: <20230919121627.GE4732@thinkpad> (raw)
In-Reply-To: <1694411968-14413-6-git-send-email-quic_cang@quicinc.com>
On Sun, Sep 10, 2023 at 10:59:26PM -0700, Can Guo wrote:
> Having UFS power info available in sysfs makes it easier to tell the state
> of the link during runtime considering we have a bounch of power saving
> features and various combinations for backward compatiblity.
>
Please move the sysfs patches to a separate series.
- Mani
> Signed-off-by: Can Guo <quic_cang@quicinc.com>
> ---
> drivers/ufs/core/ufs-sysfs.c | 71 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 71 insertions(+)
>
> diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
> index c959064..53af490 100644
> --- a/drivers/ufs/core/ufs-sysfs.c
> +++ b/drivers/ufs/core/ufs-sysfs.c
> @@ -628,6 +628,76 @@ static const struct attribute_group ufs_sysfs_monitor_group = {
> .attrs = ufs_sysfs_monitor_attrs,
> };
>
> +static ssize_t gear_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%u\n", hba->pwr_info.gear_rx);
> +}
> +
> +static ssize_t lane_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%u\n", hba->pwr_info.lane_rx);
> +}
> +
> +static ssize_t mode_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%u\n", hba->pwr_info.pwr_rx);
> +}
> +
> +static ssize_t rate_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%u\n", hba->pwr_info.hs_rate);
> +}
> +
> +static ssize_t dev_pm_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%d\n", hba->curr_dev_pwr_mode);
> +}
> +
> +static ssize_t link_state_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct ufs_hba *hba = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%d\n", hba->uic_link_state);
> +}
> +
> +static DEVICE_ATTR_RO(gear);
> +static DEVICE_ATTR_RO(lane);
> +static DEVICE_ATTR_RO(mode);
> +static DEVICE_ATTR_RO(rate);
> +static DEVICE_ATTR_RO(dev_pm);
> +static DEVICE_ATTR_RO(link_state);
> +
> +static struct attribute *ufs_power_info_attrs[] = {
> + &dev_attr_gear.attr,
> + &dev_attr_lane.attr,
> + &dev_attr_mode.attr,
> + &dev_attr_rate.attr,
> + &dev_attr_dev_pm.attr,
> + &dev_attr_link_state.attr,
> + NULL
> +};
> +
> +static const struct attribute_group ufs_sysfs_power_info_group = {
> + .name = "power_info",
> + .attrs = ufs_power_info_attrs,
> +};
> +
> static ssize_t ufs_sysfs_read_desc_param(struct ufs_hba *hba,
> enum desc_idn desc_id,
> u8 desc_index,
> @@ -1233,6 +1303,7 @@ static const struct attribute_group *ufs_sysfs_groups[] = {
> &ufs_sysfs_default_group,
> &ufs_sysfs_capabilities_group,
> &ufs_sysfs_monitor_group,
> + &ufs_sysfs_power_info_group,
> &ufs_sysfs_device_descriptor_group,
> &ufs_sysfs_interconnect_descriptor_group,
> &ufs_sysfs_geometry_descriptor_group,
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-09-19 12:17 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 5:59 [PATCH 0/6] Enable HS-G5 support on SM8550 Can Guo
2023-09-11 5:59 ` [PATCH 1/6] scsi: ufs: ufs-qcom: Setup host power mode during init Can Guo
2023-09-14 12:40 ` Nitin Rawat
2023-09-19 10:36 ` Manivannan Sadhasivam
2023-10-31 13:09 ` Can Guo
2023-09-11 5:59 ` [PATCH 2/6] scsi: ufs: ufs-qcom: Add support for UFS device version detection Can Guo
2023-09-11 9:17 ` Konrad Dybcio
2023-09-11 9:42 ` Can Guo
2023-09-11 9:46 ` Konrad Dybcio
2023-09-11 10:02 ` Can Guo
2023-09-15 2:31 ` Dmitry Baryshkov
2023-09-19 12:08 ` Manivannan Sadhasivam
2023-09-19 22:27 ` Dmitry Baryshkov
2023-09-20 10:23 ` Manivannan Sadhasivam
2023-09-20 11:13 ` Dmitry Baryshkov
2023-09-20 11:51 ` Manivannan Sadhasivam
2023-10-18 12:47 ` Manivannan Sadhasivam
2023-10-26 19:31 ` Konrad Dybcio
2023-10-27 12:22 ` Manivannan Sadhasivam
2023-09-15 12:48 ` Konrad Dybcio
2023-10-18 14:02 ` Neil Armstrong
[not found] ` <059cc112-7fb6-4da4-bc25-4eede0252f0e@linaro.org>
2023-10-31 5:06 ` Can Guo
2023-10-31 9:30 ` neil.armstrong
2023-09-11 5:59 ` [PATCH 3/6] phy: qualcomm: phy-qcom-qmp-ufs: Add High Speed Gear 5 support for SM8550 Can Guo
2023-09-14 12:26 ` Nitin Rawat
2023-09-15 2:07 ` Can Guo
2023-09-19 12:10 ` Manivannan Sadhasivam
2023-09-11 5:59 ` [PATCH 4/6] phy: qualcomm: phy-qcom-qmp-ufs: Move data structs and setting tables to header Can Guo
2023-09-14 11:44 ` Nitin Rawat
2023-09-14 12:28 ` Dmitry Baryshkov
2023-09-19 12:15 ` Manivannan Sadhasivam
2023-09-19 22:30 ` Dmitry Baryshkov
2023-09-20 10:19 ` Manivannan Sadhasivam
2023-09-21 14:02 ` Bjorn Andersson
2023-09-22 18:23 ` Manivannan Sadhasivam
2023-09-21 13:58 ` Bjorn Andersson
2023-09-11 5:59 ` [PATCH 5/6] scsi: ufs: ufs-sysfs: Expose UFS power info Can Guo
2023-09-14 11:33 ` Nitin Rawat
2023-09-15 1:59 ` Can Guo
2023-09-19 12:16 ` Manivannan Sadhasivam [this message]
2023-10-31 8:08 ` Can Guo
2023-10-26 19:53 ` Bart Van Assche
2023-10-31 4:46 ` Can Guo
2023-09-11 5:59 ` [PATCH 6/6] scsi: ufs: ufs-sysfs: Introduce UFS power info sysfs nodes Can Guo
2023-09-14 11:35 ` Nitin Rawat
2023-09-15 2:00 ` Can Guo
2023-09-18 15:36 ` Bart Van Assche
2023-10-31 4:53 ` Can Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230919121627.GE4732@thinkpad \
--to=mani@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=arthur.simchaev@wdc.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=luhongfei@vivo.com \
--cc=martin.petersen@oracle.com \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_nitirawa@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).