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

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
...@@ -126,7 +126,7 @@ nv84_therm_intr(struct nouveau_subdev *subdev) ...@@ -126,7 +126,7 @@ nv84_therm_intr(struct nouveau_subdev *subdev)
spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags); spin_lock_irqsave(&priv->sensor.alarm_program_lock, flags);
intr = nv_rd32(therm, 0x20100); intr = nv_rd32(therm, 0x20100) & 0x3ff;
/* THRS_4: downclock */ /* THRS_4: downclock */
if (intr & 0x002) { if (intr & 0x002) {
...@@ -209,6 +209,19 @@ nv84_therm_ctor(struct nouveau_object *parent, ...@@ -209,6 +209,19 @@ nv84_therm_ctor(struct nouveau_object *parent,
return nouveau_therm_preinit(&priv->base.base); 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 struct nouveau_oclass
nv84_therm_oclass = { nv84_therm_oclass = {
.handle = NV_SUBDEV(THERM, 0x84), .handle = NV_SUBDEV(THERM, 0x84),
...@@ -216,6 +229,6 @@ nv84_therm_oclass = { ...@@ -216,6 +229,6 @@ nv84_therm_oclass = {
.ctor = nv84_therm_ctor, .ctor = nv84_therm_ctor,
.dtor = _nouveau_therm_dtor, .dtor = _nouveau_therm_dtor,
.init = _nouveau_therm_init, .init = _nouveau_therm_init,
.fini = _nouveau_therm_fini, .fini = nv84_therm_fini,
}, },
}; };
...@@ -94,6 +94,6 @@ nva3_therm_oclass = { ...@@ -94,6 +94,6 @@ nva3_therm_oclass = {
.ctor = nva3_therm_ctor, .ctor = nva3_therm_ctor,
.dtor = _nouveau_therm_dtor, .dtor = _nouveau_therm_dtor,
.init = nva3_therm_init, .init = nva3_therm_init,
.fini = _nouveau_therm_fini, .fini = nv84_therm_fini,
}, },
}; };
...@@ -148,6 +148,6 @@ nvd0_therm_oclass = { ...@@ -148,6 +148,6 @@ nvd0_therm_oclass = {
.ctor = nvd0_therm_ctor, .ctor = nvd0_therm_ctor,
.dtor = _nouveau_therm_dtor, .dtor = _nouveau_therm_dtor,
.init = nvd0_therm_init, .init = nvd0_therm_init,
.fini = _nouveau_therm_fini, .fini = nv84_therm_fini,
}, },
}; };
...@@ -144,6 +144,7 @@ int nv50_fan_pwm_get(struct nouveau_therm *, int, u32 *, u32 *); ...@@ -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_set(struct nouveau_therm *, int, u32, u32);
int nv50_fan_pwm_clock(struct nouveau_therm *); int nv50_fan_pwm_clock(struct nouveau_therm *);
int nv84_temp_get(struct nouveau_therm *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 *); int nva3_therm_fan_sense(struct nouveau_therm *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment