Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36faa2fc authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/therm: if no bios trip/linear info, default to perf-suggested speed



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 6387e2cb
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -92,6 +92,7 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
	struct nouveau_timer *ptimer = nouveau_timer(therm);
	struct nouveau_timer *ptimer = nouveau_timer(therm);
	struct nouveau_therm_priv *priv = (void *)therm;
	struct nouveau_therm_priv *priv = (void *)therm;
	unsigned long flags;
	unsigned long flags;
	bool poll = true;
	int duty;
	int duty;


	spin_lock_irqsave(&priv->lock, flags);
	spin_lock_irqsave(&priv->lock, flags);
@@ -105,16 +106,24 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
		duty = nouveau_therm_fan_get(therm);
		duty = nouveau_therm_fan_get(therm);
		if (duty < 0)
		if (duty < 0)
			duty = 100;
			duty = 100;
		poll = false;
		break;
		break;
	case NOUVEAU_THERM_CTRL_AUTO:
	case NOUVEAU_THERM_CTRL_AUTO:
		if (priv->fan->bios.nr_fan_trip)
		if (priv->fan->bios.nr_fan_trip) {
			duty = nouveau_therm_update_trip(therm);
			duty = nouveau_therm_update_trip(therm);
		else
		} else
		if (priv->fan->bios.linear_min_temp ||
		    priv->fan->bios.linear_max_temp) {
			duty = nouveau_therm_update_linear(therm);
			duty = nouveau_therm_update_linear(therm);
		} else {
			duty = priv->cstate;
			poll = false;
		}
		break;
		break;
	case NOUVEAU_THERM_CTRL_NONE:
	case NOUVEAU_THERM_CTRL_NONE:
	default:
	default:
		ptimer->alarm_cancel(ptimer, &priv->alarm);
		ptimer->alarm_cancel(ptimer, &priv->alarm);
		poll = false;
		goto done;
		goto done;
	}
	}


@@ -122,7 +131,7 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
	nouveau_therm_fan_set(therm, (mode != NOUVEAU_THERM_CTRL_AUTO), duty);
	nouveau_therm_fan_set(therm, (mode != NOUVEAU_THERM_CTRL_AUTO), duty);


done:
done:
	if (list_empty(&priv->alarm.head) && (mode == NOUVEAU_THERM_CTRL_AUTO))
	if (list_empty(&priv->alarm.head) && poll)
		ptimer->alarm(ptimer, 1000000000ULL, &priv->alarm);
		ptimer->alarm(ptimer, 1000000000ULL, &priv->alarm);
	spin_unlock_irqrestore(&priv->lock, flags);
	spin_unlock_irqrestore(&priv->lock, flags);
}
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -185,8 +185,11 @@ nouveau_therm_fan_set_defaults(struct nouveau_therm *therm)
	priv->fan->bios.max_duty = 100;
	priv->fan->bios.max_duty = 100;
	priv->fan->bios.bump_period = 500;
	priv->fan->bios.bump_period = 500;
	priv->fan->bios.slow_down_period = 2000;
	priv->fan->bios.slow_down_period = 2000;
/*XXX: talk to mupuf */
#if 0
	priv->fan->bios.linear_min_temp = 40;
	priv->fan->bios.linear_min_temp = 40;
	priv->fan->bios.linear_max_temp = 85;
	priv->fan->bios.linear_max_temp = 85;
#endif
}
}


static void
static void