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

Commit b449a43f authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs
Browse files

drm/nouveau/therm: ack any pending IRQ at init



This is safe because ptherm hasn't been configured yet and will be a
little further down the initialization path. Ptherm should be safe
regarding to runtime reconfiguration.

v2:
  - do not limit this patch to nv84-a3 and make it nv84+

v3:
  - move the ack to fini()
  - disable IRQs on fini()
  - silently ignore un-requested IRQs

Signed-off-by: default avatarMartin Peres <martin.peres@labri.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent be0dd4dd
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ nv84_therm_intr(struct nouveau_subdev *subdev)

	spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);

	intr = nv_rd32(therm, 0x20100);
	intr = nv_rd32(therm, 0x20100) & 0x3ff;

	/* THRS_4: downclock */
	if (intr & 0x002) {
@@ -209,6 +209,19 @@ nv84_therm_ctor(struct nouveau_object *parent,
	return nouveau_therm_preinit(&priv->base.base);
}

int
nv84_therm_fini(struct nouveau_object *object, bool suspend)
{
	/* Disable PTherm IRQs */
	nv_wr32(object, 0x20000, 0x00000000);

	/* ACK all PTherm IRQs */
	nv_wr32(object, 0x20100, 0xffffffff);
	nv_wr32(object, 0x1100, 0x10000); /* PBUS */

	return _nouveau_therm_fini(object, suspend);
}

struct nouveau_oclass
nv84_therm_oclass = {
	.handle = NV_SUBDEV(THERM, 0x84),
@@ -216,6 +229,6 @@ nv84_therm_oclass = {
		.ctor = nv84_therm_ctor,
		.dtor = _nouveau_therm_dtor,
		.init = _nouveau_therm_init,
		.fini = _nouveau_therm_fini,
		.fini = nv84_therm_fini,
	},
};
+1 −1
Original line number Diff line number Diff line
@@ -94,6 +94,6 @@ nva3_therm_oclass = {
		.ctor = nva3_therm_ctor,
		.dtor = _nouveau_therm_dtor,
		.init = nva3_therm_init,
		.fini = _nouveau_therm_fini,
		.fini = nv84_therm_fini,
	},
};
+1 −1
Original line number Diff line number Diff line
@@ -148,6 +148,6 @@ nvd0_therm_oclass = {
		.ctor = nvd0_therm_ctor,
		.dtor = _nouveau_therm_dtor,
		.init = nvd0_therm_init,
		.fini = _nouveau_therm_fini,
		.fini = nv84_therm_fini,
	},
};
+1 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *);
int nv50_fan_pwm_set(struct nouveau_therm *, int, u32, u32);
int nv50_fan_pwm_clock(struct nouveau_therm *);
int nv84_temp_get(struct nouveau_therm *therm);
int nv84_therm_fini(struct nouveau_object *object, bool suspend);

int nva3_therm_fan_sense(struct nouveau_therm *);