On 19/02/18 08:35, Adrian Hunter wrote: > On 18/02/18 11:45, Avri Altman wrote: >> >> >>> -----Original Message----- >>> From: linux-scsi-owner@xxxxxxxxxxxxxxx [mailto:linux-scsi- >>> owner@xxxxxxxxxxxxxxx] On Behalf Of Adrian Hunter >>> Sent: Friday, February 16, 2018 2:01 PM >>> To: Vinayak Holikatti <vinholikatti@xxxxxxxxx>; Martin K. Petersen >>> <martin.petersen@xxxxxxxxxx>; James E.J. Bottomley >>> <jejb@xxxxxxxxxxxxxxxxxx> >>> Cc: Stanislav Nijnikov <Stanislav.Nijnikov@xxxxxxx>; Jaegeuk Kim >>> <jaegeuk@xxxxxxxxxx>; Bart Van Assche <Bart.VanAssche@xxxxxxx>; linux- >>> scsi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Michal Potomski >>> <michalx.potomski@xxxxxxxxx>; Szymon Mielczarek >>> <szymonx.mielczarek@xxxxxxxxx> >>> Subject: [PATCH 1/1] scsi: ufs: Add support for Auto-Hibernate Idle Timer >>> >>> UFS host controllers may support an autonomous power management >>> feature called the Auto-Hibernate Idle Timer. The timer is set to the number >>> of microseconds of idle time before the UFS host controller will >>> autonomously put the link into Hibernate state. That will save power at the >>> expense of increased latency. Any access to the host controller interface >>> registers will automatically put the link out of Hibernate state. So once >>> configured, the feature is transparent to the driver. >>> >>> Expose the Auto-Hibernate Idle Timer value via SysFS to allow users to >>> choose between power efficiency or lower latency. Set a default value of >>> 150 ms. >>> >>> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> >>> --- >>> Documentation/ABI/testing/sysfs-driver-ufs | 15 ++++++ >>> drivers/scsi/ufs/ufs-sysfs.c | 77 ++++++++++++++++++++++++++++++ >>> drivers/scsi/ufs/ufshcd.c | 26 ++++++++++ >>> drivers/scsi/ufs/ufshcd.h | 3 ++ >>> drivers/scsi/ufs/ufshci.h | 7 +++ >>> 5 files changed, 128 insertions(+) >>> >>> diff --git a/Documentation/ABI/testing/sysfs-driver-ufs >>> b/Documentation/ABI/testing/sysfs-driver-ufs >>> index 07f1c2f8dbfc..c7f9441079eb 100644 >>> --- a/Documentation/ABI/testing/sysfs-driver-ufs >>> +++ b/Documentation/ABI/testing/sysfs-driver-ufs >>> @@ -1,3 +1,18 @@ >>> +What: /sys/bus/*/drivers/ufshcd/*/auto_hibern8 >>> +Date: February 2018 >>> +Contact: linux-scsi@xxxxxxxxxxxxxxx >>> +Description: >>> + This file contains the auto-hibernate idle timer setting of a >>> + UFS host controller. A value of '-1' means auto-hibernate is >>> not >>> + supported. A value of '0' means auto-hibernate is not >>> enabled. >>> + Otherwise the value is the number of microseconds of idle >>> time >>> + before the UFS host controller will autonomously put the link >>> + into hibernate state. That will save power at the expense of >>> + increased latency. Note that the hardware supports 10-bit >>> values >>> + with a power-of-ten multiplier which allows a maximum >>> value of >>> + 102300000. Refer to the UFS Host Controller Interface >>> + specification for more details. >>> + >>> What: >>> /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_type >>> Date: February 2018 >>> Contact: Stanislav Nijnikov <stanislav.nijnikov@xxxxxxx> >>> diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index >>> cd7174d2d225..a0e38776dc92 100644 SNIP >>> @@ -7843,6 +7863,12 @@ int ufshcd_init(struct ufs_hba *hba, void >>> __iomem *mmio_base, unsigned int irq) >>> UFS_SLEEP_PWR_MODE, >>> UIC_LINK_HIBERN8_STATE); >>> >>> + /* Set the default auto-hiberate idle timer value to 150 ms */ >> Your commit said you are setting an idle timer in microseconds, Better use usec to avoid confusion? > > As the SysFS documentation says "Note that the hardware supports 10-bit > values with a power-of-ten multiplier ... Refer to the UFS Host Controller > Interface specification for more details.", so 150,000 us is still a value > of 150 with a power-of-ten multiplier of 3. Are there any other comments?