All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/therm/fan: add a fallback if no fan control is specified in the vbios
@ 2016-09-29  0:41 Martin Peres
       [not found] ` <20160929004135.21959-1-martin.peres-GANU6spQydw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Peres @ 2016-09-29  0:41 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

This seems to be absolutely necessary for a lot of NV40.

Reported-by: gsgf on IRC/freenode
Signed-off-by: Martin Peres <martin.peres@free.fr>
---
 drm/nouveau/nvkm/subdev/therm/base.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drm/nouveau/nvkm/subdev/therm/base.c b/drm/nouveau/nvkm/subdev/therm/base.c
index 8894fee..df949fa 100644
--- a/drm/nouveau/nvkm/subdev/therm/base.c
+++ b/drm/nouveau/nvkm/subdev/therm/base.c
@@ -64,10 +64,9 @@ nvkm_therm_update_trip(struct nvkm_therm *therm)
 }
 
 static int
-nvkm_therm_update_linear(struct nvkm_therm *therm)
+nvkm_therm_compute_linear_duty(struct nvkm_therm *therm, u8 linear_min_temp,
+                               u8 linear_max_temp)
 {
-	u8  linear_min_temp = therm->fan->bios.linear_min_temp;
-	u8  linear_max_temp = therm->fan->bios.linear_max_temp;
 	u8  temp = therm->func->temp_get(therm);
 	u16 duty;
 
@@ -85,6 +84,21 @@ nvkm_therm_update_linear(struct nvkm_therm *therm)
 	return duty;
 }
 
+static int
+nvkm_therm_update_linear(struct nvkm_therm *therm)
+{
+	u8  min = therm->fan->bios.linear_min_temp;
+	u8  max = therm->fan->bios.linear_max_temp;
+	return nvkm_therm_compute_linear_duty(therm, min, max);
+}
+
+static int
+nvkm_therm_update_linear_fallback(struct nvkm_therm *therm)
+{
+	u8 max = therm->bios_sensor.thrs_fan_boost.temp;
+	return nvkm_therm_compute_linear_duty(therm, 30, max);
+}
+
 static void
 nvkm_therm_update(struct nvkm_therm *therm, int mode)
 {
@@ -119,6 +133,8 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode)
 		case NVBIOS_THERM_FAN_OTHER:
 			if (therm->cstate)
 				duty = therm->cstate;
+			else
+				duty = nvkm_therm_update_linear_fallback(therm);
 			poll = false;
 			break;
 		}
-- 
2.8.0

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/therm/fan: add a fallback if no fan control is specified in the vbios
       [not found] ` <20160929004135.21959-1-martin.peres-GANU6spQydw@public.gmane.org>
@ 2016-10-03 23:22   ` Martin Peres
       [not found]     ` <ba13d4bf-c1be-68ff-0ec6-2c9af5edd8f2-GANU6spQydw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Peres @ 2016-10-03 23:22 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 29/09/16 03:41, Martin Peres wrote:
> This seems to be absolutely necessary for a lot of NV40.
>
> Reported-by: gsgf on IRC/freenode
> Signed-off-by: Martin Peres <martin.peres@free.fr>

I of course forgot to tag this patch for stable. The thing has been
broken on some nv40 ... forever?


> ---
>   drm/nouveau/nvkm/subdev/therm/base.c | 22 +++++++++++++++++++---
>   1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drm/nouveau/nvkm/subdev/therm/base.c b/drm/nouveau/nvkm/subdev/therm/base.c
> index 8894fee..df949fa 100644
> --- a/drm/nouveau/nvkm/subdev/therm/base.c
> +++ b/drm/nouveau/nvkm/subdev/therm/base.c
> @@ -64,10 +64,9 @@ nvkm_therm_update_trip(struct nvkm_therm *therm)
>   }
>   
>   static int
> -nvkm_therm_update_linear(struct nvkm_therm *therm)
> +nvkm_therm_compute_linear_duty(struct nvkm_therm *therm, u8 linear_min_temp,
> +                               u8 linear_max_temp)
>   {
> -	u8  linear_min_temp = therm->fan->bios.linear_min_temp;
> -	u8  linear_max_temp = therm->fan->bios.linear_max_temp;
>   	u8  temp = therm->func->temp_get(therm);
>   	u16 duty;
>   
> @@ -85,6 +84,21 @@ nvkm_therm_update_linear(struct nvkm_therm *therm)
>   	return duty;
>   }
>   
> +static int
> +nvkm_therm_update_linear(struct nvkm_therm *therm)
> +{
> +	u8  min = therm->fan->bios.linear_min_temp;
> +	u8  max = therm->fan->bios.linear_max_temp;
> +	return nvkm_therm_compute_linear_duty(therm, min, max);
> +}
> +
> +static int
> +nvkm_therm_update_linear_fallback(struct nvkm_therm *therm)
> +{
> +	u8 max = therm->bios_sensor.thrs_fan_boost.temp;
> +	return nvkm_therm_compute_linear_duty(therm, 30, max);
> +}
> +
>   static void
>   nvkm_therm_update(struct nvkm_therm *therm, int mode)
>   {
> @@ -119,6 +133,8 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode)
>   		case NVBIOS_THERM_FAN_OTHER:
>   			if (therm->cstate)
>   				duty = therm->cstate;
> +			else
> +				duty = nvkm_therm_update_linear_fallback(therm);
>   			poll = false;
>   			break;
>   		}


_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/therm/fan: add a fallback if no fan control is specified in the vbios
       [not found]     ` <ba13d4bf-c1be-68ff-0ec6-2c9af5edd8f2-GANU6spQydw@public.gmane.org>
@ 2017-02-11  0:32       ` Ilia Mirkin
  0 siblings, 0 replies; 3+ messages in thread
From: Ilia Mirkin @ 2017-02-11  0:32 UTC (permalink / raw)
  To: Martin Peres, Ben Skeggs; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

ping?

On Mon, Oct 3, 2016 at 7:22 PM, Martin Peres <martin.peres@free.fr> wrote:
> On 29/09/16 03:41, Martin Peres wrote:
>>
>> This seems to be absolutely necessary for a lot of NV40.
>>
>> Reported-by: gsgf on IRC/freenode
>> Signed-off-by: Martin Peres <martin.peres@free.fr>
>
>
> I of course forgot to tag this patch for stable. The thing has been
> broken on some nv40 ... forever?
>
>
>
>> ---
>>   drm/nouveau/nvkm/subdev/therm/base.c | 22 +++++++++++++++++++---
>>   1 file changed, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/drm/nouveau/nvkm/subdev/therm/base.c
>> b/drm/nouveau/nvkm/subdev/therm/base.c
>> index 8894fee..df949fa 100644
>> --- a/drm/nouveau/nvkm/subdev/therm/base.c
>> +++ b/drm/nouveau/nvkm/subdev/therm/base.c
>> @@ -64,10 +64,9 @@ nvkm_therm_update_trip(struct nvkm_therm *therm)
>>   }
>>     static int
>> -nvkm_therm_update_linear(struct nvkm_therm *therm)
>> +nvkm_therm_compute_linear_duty(struct nvkm_therm *therm, u8
>> linear_min_temp,
>> +                               u8 linear_max_temp)
>>   {
>> -       u8  linear_min_temp = therm->fan->bios.linear_min_temp;
>> -       u8  linear_max_temp = therm->fan->bios.linear_max_temp;
>>         u8  temp = therm->func->temp_get(therm);
>>         u16 duty;
>>   @@ -85,6 +84,21 @@ nvkm_therm_update_linear(struct nvkm_therm *therm)
>>         return duty;
>>   }
>>   +static int
>> +nvkm_therm_update_linear(struct nvkm_therm *therm)
>> +{
>> +       u8  min = therm->fan->bios.linear_min_temp;
>> +       u8  max = therm->fan->bios.linear_max_temp;
>> +       return nvkm_therm_compute_linear_duty(therm, min, max);
>> +}
>> +
>> +static int
>> +nvkm_therm_update_linear_fallback(struct nvkm_therm *therm)
>> +{
>> +       u8 max = therm->bios_sensor.thrs_fan_boost.temp;
>> +       return nvkm_therm_compute_linear_duty(therm, 30, max);
>> +}
>> +
>>   static void
>>   nvkm_therm_update(struct nvkm_therm *therm, int mode)
>>   {
>> @@ -119,6 +133,8 @@ nvkm_therm_update(struct nvkm_therm *therm, int mode)
>>                 case NVBIOS_THERM_FAN_OTHER:
>>                         if (therm->cstate)
>>                                 duty = therm->cstate;
>> +                       else
>> +                               duty =
>> nvkm_therm_update_linear_fallback(therm);
>>                         poll = false;
>>                         break;
>>                 }
>
>
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-11  0:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29  0:41 [PATCH] drm/therm/fan: add a fallback if no fan control is specified in the vbios Martin Peres
     [not found] ` <20160929004135.21959-1-martin.peres-GANU6spQydw@public.gmane.org>
2016-10-03 23:22   ` Martin Peres
     [not found]     ` <ba13d4bf-c1be-68ff-0ec6-2c9af5edd8f2-GANU6spQydw@public.gmane.org>
2017-02-11  0:32       ` Ilia Mirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.