diff mbox

[1/3] mmc: replacing hardcoded value for runtime PM suspend

Message ID 1472739890-3384-2-git-send-email-alex.lemberg@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Lemberg Sept. 1, 2016, 2:24 p.m. UTC
Add MMC_AUTOSUSPEND_DELAY_MS define

Signed-off-by: alex lemberg <alex.lemberg@sandisk.com>
---
 drivers/mmc/card/block.c | 3 ++-
 include/linux/mmc/host.h | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Shawn Lin Sept. 2, 2016, 7:39 a.m. UTC | #1
Hi

On 2016/9/1 22:24, alex lemberg wrote:
> Add MMC_AUTOSUSPEND_DELAY_MS define

I'm thinking should we expose it to userspace
via sysfs, since I don't know why it should be 3ms, not 4ms, 5ms, etc.


>
> Signed-off-by: alex lemberg <alex.lemberg@sandisk.com>
> ---
>  drivers/mmc/card/block.c | 3 ++-
>  include/linux/mmc/host.h | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 48a5dd7..f4386ed 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -2610,7 +2610,8 @@ static int mmc_blk_probe(struct mmc_card *card)
>  			goto out;
>  	}
>
> -	pm_runtime_set_autosuspend_delay(&card->dev, 3000);
> +	pm_runtime_set_autosuspend_delay(&card->dev,
> +		MMC_RUNTIME_SUSPEND_DELAY_MS);
>  	pm_runtime_use_autosuspend(&card->dev);
>
>  	/*
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index aa4bfbf..8cb8218 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -22,6 +22,8 @@
>  #include <linux/mmc/mmc.h>
>  #include <linux/mmc/pm.h>
>
> +#define MMC_RUNTIME_SUSPEND_DELAY_MS	3000
> +
>  struct mmc_ios {
>  	unsigned int	clock;			/* clock rate */
>  	unsigned short	vdd;
>
Alex Lemberg Sept. 4, 2016, 1:30 p.m. UTC | #2
Hi Shawn,

On 9/2/16, 10:39 AM, "Shawn Lin" <shawn.lin@rock-chips.com> wrote:

>Hi

>

>On 2016/9/1 22:24, alex lemberg wrote:

>> Add MMC_AUTOSUSPEND_DELAY_MS define

>

>I'm thinking should we expose it to userspace

>via sysfs, since I don't know why it should be 3ms, not 4ms, 5ms, etc.


Agree, we can consider exposing it to the user space.
The exposure to the user space is less critical to the current
patchset, but we can do it as a “follow-up change” once its approved.

>

>

>>

>> Signed-off-by: alex lemberg <alex.lemberg@sandisk.com>

>> ---

>>  drivers/mmc/card/block.c | 3 ++-

>>  include/linux/mmc/host.h | 2 ++

>>  2 files changed, 4 insertions(+), 1 deletion(-)

>>

>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c

>> index 48a5dd7..f4386ed 100644

>> --- a/drivers/mmc/card/block.c

>> +++ b/drivers/mmc/card/block.c

>> @@ -2610,7 +2610,8 @@ static int mmc_blk_probe(struct mmc_card *card)

>>  			goto out;

>>  	}

>>

>> -	pm_runtime_set_autosuspend_delay(&card->dev, 3000);

>> +	pm_runtime_set_autosuspend_delay(&card->dev,

>> +		MMC_RUNTIME_SUSPEND_DELAY_MS);

>>  	pm_runtime_use_autosuspend(&card->dev);

>>

>>  	/*

>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h

>> index aa4bfbf..8cb8218 100644

>> --- a/include/linux/mmc/host.h

>> +++ b/include/linux/mmc/host.h

>> @@ -22,6 +22,8 @@

>>  #include <linux/mmc/mmc.h>

>>  #include <linux/mmc/pm.h>

>>

>> +#define MMC_RUNTIME_SUSPEND_DELAY_MS	3000

>> +

>>  struct mmc_ios {

>>  	unsigned int	clock;			/* clock rate */

>>  	unsigned short	vdd;

>>

>

>

>-- 

>Best Regards

>Shawn Lin

>
Ulf Hansson Oct. 13, 2016, 7:36 a.m. UTC | #3
On 4 September 2016 at 15:30, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
> Hi Shawn,
>
> On 9/2/16, 10:39 AM, "Shawn Lin" <shawn.lin@rock-chips.com> wrote:
>
>>Hi
>>
>>On 2016/9/1 22:24, alex lemberg wrote:
>>> Add MMC_AUTOSUSPEND_DELAY_MS define
>>
>>I'm thinking should we expose it to userspace
>>via sysfs, since I don't know why it should be 3ms, not 4ms, 5ms, etc.
>
> Agree, we can consider exposing it to the user space.
> The exposure to the user space is less critical to the current
> patchset, but we can do it as a “follow-up change” once its approved.

No need for that, is already available for user-space. :-)

Each device with runtime PM autosuspend enabled, allows userspace to
change the delay via the "autosuspend_delay_ms" sysfs file.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Lin Oct. 13, 2016, 8:30 a.m. UTC | #4
在 2016/10/13 15:36, Ulf Hansson 写道:
> On 4 September 2016 at 15:30, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
>> Hi Shawn,
>>
>> On 9/2/16, 10:39 AM, "Shawn Lin" <shawn.lin@rock-chips.com> wrote:
>>
>>> Hi
>>>
>>> On 2016/9/1 22:24, alex lemberg wrote:
>>>> Add MMC_AUTOSUSPEND_DELAY_MS define
>>>
>>> I'm thinking should we expose it to userspace
>>> via sysfs, since I don't know why it should be 3ms, not 4ms, 5ms, etc.
>>
>> Agree, we can consider exposing it to the user space.
>> The exposure to the user space is less critical to the current
>> patchset, but we can do it as a “follow-up change” once its approved.
>
> No need for that, is already available for user-space. :-)
>
> Each device with runtime PM autosuspend enabled, allows userspace to
> change the delay via the "autosuspend_delay_ms" sysfs file.

Indeed, I just check it when enabling runtime PM for dw_mmc and could
able to change the value of autosuspend_delay_ms.

Thanks for sharing this.

>
> Kind regards
> Uffe
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Alex Lemberg Oct. 31, 2016, 9:53 a.m. UTC | #5
Great. Thanks for the information!

On 10/13/16, 11:30 AM, "Shawn Lin" <shawn.lin@rock-chips.com> wrote:

>在 2016/10/13 15:36, Ulf Hansson 写道:

>> On 4 September 2016 at 15:30, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:

>>> Hi Shawn,

>>>

>>> On 9/2/16, 10:39 AM, "Shawn Lin" <shawn.lin@rock-chips.com> wrote:

>>>

>>>> Hi

>>>>

>>>> On 2016/9/1 22:24, alex lemberg wrote:

>>>>> Add MMC_AUTOSUSPEND_DELAY_MS define

>>>>

>>>> I'm thinking should we expose it to userspace

>>>> via sysfs, since I don't know why it should be 3ms, not 4ms, 5ms, etc.

>>>

>>> Agree, we can consider exposing it to the user space.

>>> The exposure to the user space is less critical to the current

>>> patchset, but we can do it as a “follow-up change” once its approved.

>>

>> No need for that, is already available for user-space. :-)

>>

>> Each device with runtime PM autosuspend enabled, allows userspace to

>> change the delay via the "autosuspend_delay_ms" sysfs file.

>

>Indeed, I just check it when enabling runtime PM for dw_mmc and could

>able to change the value of autosuspend_delay_ms.

>

>Thanks for sharing this.

>

>>

>> Kind regards

>> Uffe

>> --

>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in

>> the body of a message to majordomo@vger.kernel.org

>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

>>

>

>

>-- 

>Best Regards

>Shawn Lin

>
diff mbox

Patch

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 48a5dd7..f4386ed 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2610,7 +2610,8 @@  static int mmc_blk_probe(struct mmc_card *card)
 			goto out;
 	}
 
-	pm_runtime_set_autosuspend_delay(&card->dev, 3000);
+	pm_runtime_set_autosuspend_delay(&card->dev,
+		MMC_RUNTIME_SUSPEND_DELAY_MS);
 	pm_runtime_use_autosuspend(&card->dev);
 
 	/*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index aa4bfbf..8cb8218 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -22,6 +22,8 @@ 
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/pm.h>
 
+#define MMC_RUNTIME_SUSPEND_DELAY_MS	3000
+
 struct mmc_ios {
 	unsigned int	clock;			/* clock rate */
 	unsigned short	vdd;