diff mbox series

[1/2] hwmon: (pwm-fan) add option to leave fan on shutdown

Message ID 20210923023448.4190-1-akinobu.mita@gmail.com (mailing list archive)
State Rejected
Headers show
Series [1/2] hwmon: (pwm-fan) add option to leave fan on shutdown | expand

Commit Message

Akinobu Mita Sept. 23, 2021, 2:34 a.m. UTC
This adds an optional property "retain-state-shutdown" as requested by
Billy Tsai.

Billy said:
 "Our platform is BMC that will use a PWM-FAN driver to control the fan
 on the managed host. In our case, we do not want to stop the fan when
 the BMC is reboot, which may cause the temperature of the managed host
 not to be lowered."

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/hwmon/pwm-fan.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Oct. 11, 2021, 2:34 p.m. UTC | #1
On Thu, Sep 23, 2021 at 11:34:47AM +0900, Akinobu Mita wrote:
> This adds an optional property "retain-state-shutdown" as requested by
> Billy Tsai.
> 
> Billy said:
>  "Our platform is BMC that will use a PWM-FAN driver to control the fan
>  on the managed host. In our case, we do not want to stop the fan when
>  the BMC is reboot, which may cause the temperature of the managed host
>  not to be lowered."
> 
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Billy Tsai <billy_tsai@aspeedtech.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

For my reference (waiting for DT property approval):

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Guenter

> ---
>  drivers/hwmon/pwm-fan.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
> index 17518b4cab1b..1ea0d0562c28 100644
> --- a/drivers/hwmon/pwm-fan.c
> +++ b/drivers/hwmon/pwm-fan.c
> @@ -38,6 +38,7 @@ struct pwm_fan_ctx {
>  	struct pwm_fan_tach *tachs;
>  	ktime_t sample_start;
>  	struct timer_list rpm_timer;
> +	bool retain_state_shutdown;
>  
>  	unsigned int pwm_value;
>  	unsigned int pwm_fan_state;
> @@ -312,6 +313,9 @@ static int pwm_fan_probe(struct platform_device *pdev)
>  
>  	mutex_init(&ctx->lock);
>  
> +	ctx->retain_state_shutdown =
> +		of_property_read_bool(dev->of_node, "retain-state-shutdown");
> +
>  	ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
>  	if (IS_ERR(ctx->pwm))
>  		return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
> @@ -492,7 +496,10 @@ static int pwm_fan_disable(struct device *dev)
>  
>  static void pwm_fan_shutdown(struct platform_device *pdev)
>  {
> -	pwm_fan_disable(&pdev->dev);
> +	struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
> +
> +	if (!ctx->retain_state_shutdown)
> +		pwm_fan_disable(&pdev->dev);
>  }
>  
>  #ifdef CONFIG_PM_SLEEP
Billy Tsai Aug. 15, 2022, 6:50 a.m. UTC | #2
On 2021/10/11, 10:34 PM, "Guenter Roeck" <groeck7@gmail.com on behalf of linux@roeck-us.net> wrote:

    On Thu, Sep 23, 2021 at 11:34:47AM +0900, Akinobu Mita wrote:
    > > This adds an optional property "retain-state-shutdown" as requested by
    > > Billy Tsai.
    > > 
    > > Billy said:
    > >  "Our platform is BMC that will use a PWM-FAN driver to control the fan
    > >  on the managed host. In our case, we do not want to stop the fan when
    > >  the BMC is reboot, which may cause the temperature of the managed host
    > >  not to be lowered."
    > > 
    > > Cc: Rob Herring <robh+dt@kernel.org>
    > > Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    > > Cc: Guenter Roeck <linux@roeck-us.net>
    > > Cc: Billy Tsai <billy_tsai@aspeedtech.com>
    > > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

    > For my reference (waiting for DT property approval):

    > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
 
    > Guenter

Reviewed-by: Billy Tsai <billy_tsai@aspeedtech.com>

Billy

    > > ---
    > >  drivers/hwmon/pwm-fan.c | 9 ++++++++-
    > >  1 file changed, 8 insertions(+), 1 deletion(-)
    > > 
    > > diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
    > > index 17518b4cab1b..1ea0d0562c28 100644
    > > --- a/drivers/hwmon/pwm-fan.c
    > > +++ b/drivers/hwmon/pwm-fan.c
    > > @@ -38,6 +38,7 @@ struct pwm_fan_ctx {
    > >  	struct pwm_fan_tach *tachs;
    > >  	ktime_t sample_start;
    > >  	struct timer_list rpm_timer;
    > > +	bool retain_state_shutdown;
    > >  
    > >  	unsigned int pwm_value;
    > >  	unsigned int pwm_fan_state;
    > > @@ -312,6 +313,9 @@ static int pwm_fan_probe(struct platform_device *pdev)
    > >  
    > >  	mutex_init(&ctx->lock);
    > >  
    > > +	ctx->retain_state_shutdown =
    > > +		of_property_read_bool(dev->of_node, "retain-state-shutdown");
    > > +
    > >  	ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
    > >  	if (IS_ERR(ctx->pwm))
    > >  		return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
    > > @@ -492,7 +496,10 @@ static int pwm_fan_disable(struct device *dev)
    > >  
    > >  static void pwm_fan_shutdown(struct platform_device *pdev)
    > >  {
    > > -	pwm_fan_disable(&pdev->dev);
    > > +	struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
    > > +
    > > +	if (!ctx->retain_state_shutdown)
    > > +		pwm_fan_disable(&pdev->dev);
    > >  }
    > >  
    > >  #ifdef CONFIG_PM_SLEEP
Billy Tsai Oct. 23, 2024, 6:08 a.m. UTC | #3
Hi All,

I found that these patches have been rejected. 
Is there any other reason why it can't be merged into the mainline?

Thanks
Rob Herring Oct. 23, 2024, 3:24 p.m. UTC | #4
On Wed, Oct 23, 2024 at 1:08 AM Billy Tsai <billy_tsai@aspeedtech.com> wrote:
>
> Hi All,
>
> I found that these patches have been rejected.

Where did that happen?

> Is there any other reason why it can't be merged into the mainline?

I don't see any replies on the binding. Perhaps that's because it
wasn't sent to the DT list and it doesn't get reviewed if not. In any
case, lots has changed in 3 years such as we have a fan binding now.

Rob
Guenter Roeck Oct. 23, 2024, 3:50 p.m. UTC | #5
On 10/23/24 08:24, Rob Herring wrote:
> On Wed, Oct 23, 2024 at 1:08 AM Billy Tsai <billy_tsai@aspeedtech.com> wrote:
>>
>> Hi All,
>>
>> I found that these patches have been rejected.
> 
> Where did that happen?
> 

https://patchwork.kernel.org/project/linux-hwmon/patch/20210923023448.4190-1-akinobu.mita@gmail.com/

It has been a long time, but from the available history I guess I marked
it as rejected because the DT patch was never approved. That is just a
guess, though; I really don't remember.

Guenter

>> Is there any other reason why it can't be merged into the mainline?
> 
> I don't see any replies on the binding. Perhaps that's because it
> wasn't sent to the DT list and it doesn't get reviewed if not. In any
> case, lots has changed in 3 years such as we have a fan binding now.
> 
> Rob
Akinobu Mita Oct. 26, 2024, 8:08 a.m. UTC | #6
Hi Billy,

I have updated and resubmitted these patches. I don't have the hardware to test
at the moment, so is it possible for you to test it?
Guenter Roeck Oct. 26, 2024, 4:20 p.m. UTC | #7
On 10/26/24 01:08, Akinobu Mita wrote:
> Hi Billy,
> 
> I have updated and resubmitted these patches. I don't have the hardware to test
> at the moment, so is it possible for you to test it?


You did not provide a change log. I do not review patch resubmissions
without change log.

Guenter
Billy Tsai Oct. 29, 2024, 2:22 a.m. UTC | #8
> I have updated and resubmitted these patches. I don't have the hardware to test
> at the moment, so is it possible for you to test it?

Okay, I will try the v2 patch and add the Tested-by.

Thanks
diff mbox series

Patch

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 17518b4cab1b..1ea0d0562c28 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -38,6 +38,7 @@  struct pwm_fan_ctx {
 	struct pwm_fan_tach *tachs;
 	ktime_t sample_start;
 	struct timer_list rpm_timer;
+	bool retain_state_shutdown;
 
 	unsigned int pwm_value;
 	unsigned int pwm_fan_state;
@@ -312,6 +313,9 @@  static int pwm_fan_probe(struct platform_device *pdev)
 
 	mutex_init(&ctx->lock);
 
+	ctx->retain_state_shutdown =
+		of_property_read_bool(dev->of_node, "retain-state-shutdown");
+
 	ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
 	if (IS_ERR(ctx->pwm))
 		return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
@@ -492,7 +496,10 @@  static int pwm_fan_disable(struct device *dev)
 
 static void pwm_fan_shutdown(struct platform_device *pdev)
 {
-	pwm_fan_disable(&pdev->dev);
+	struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
+
+	if (!ctx->retain_state_shutdown)
+		pwm_fan_disable(&pdev->dev);
 }
 
 #ifdef CONFIG_PM_SLEEP