drm/nouveau/therm: add hook for clk to suggest fanspeed to therm
authorBen Skeggs <bskeggs@redhat.com>
Thu, 25 Jul 2013 23:15:57 +0000 (09:15 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 8 Nov 2013 05:40:01 +0000 (15:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/include/core/device.h
drivers/gpu/drm/nouveau/core/include/subdev/therm.h
drivers/gpu/drm/nouveau/core/subdev/therm/base.c
drivers/gpu/drm/nouveau/core/subdev/therm/priv.h

index 6b14174c9b60e1e7c2e1e485e8da3d19366daf25..0709ed520eb29a0e7015eeb0c5daa5c50407196f 100644 (file)
@@ -35,8 +35,8 @@ enum nv_subdev_type {
        NVDEV_SUBDEV_BAR,
        NVDEV_SUBDEV_PWR,
        NVDEV_SUBDEV_VOLT,
-       NVDEV_SUBDEV_CLOCK,
        NVDEV_SUBDEV_THERM,
+       NVDEV_SUBDEV_CLOCK,
 
        NVDEV_ENGINE_DMAOBJ,
        NVDEV_ENGINE_FIFO,
index c075998d82e6605272fd40a6be1d3e1e1d221b8f..69891d4a3fe7e3f50a840e4cdc2a34196bcd0010 100644 (file)
@@ -71,6 +71,8 @@ void _nouveau_therm_dtor(struct nouveau_object *);
 int  _nouveau_therm_init(struct nouveau_object *);
 int  _nouveau_therm_fini(struct nouveau_object *, bool);
 
+int  nouveau_therm_cstate(struct nouveau_therm *, int, int);
+
 extern struct nouveau_oclass nv40_therm_oclass;
 extern struct nouveau_oclass nv50_therm_oclass;
 extern struct nouveau_oclass nv84_therm_oclass;
index d2f10ad047a86f87e44f831d741415df0ea5155f..1f28249df026f08be70b35a4a6e7263525b296a5 100644 (file)
@@ -127,6 +127,19 @@ done:
        spin_unlock_irqrestore(&priv->lock, flags);
 }
 
+int
+nouveau_therm_cstate(struct nouveau_therm *ptherm, int fan, int dir)
+{
+       struct nouveau_therm_priv *priv = (void *)ptherm;
+       if (!dir || (dir < 0 && fan < priv->cstate) ||
+                   (dir > 0 && fan > priv->cstate)) {
+               nv_debug(ptherm, "default fan speed -> %d%%\n", fan);
+               priv->cstate = fan;
+               nouveau_therm_update(ptherm, -1);
+       }
+       return 0;
+}
+
 static void
 nouveau_therm_alarm(struct nouveau_alarm *alarm)
 {
index 508b1ec4e6e63f0bf4457b4c15a4fcf5b2bacc5f..96f8f95693ce10654a1a4339a1e0eb16dba6848e 100644 (file)
@@ -76,6 +76,7 @@ struct nouveau_therm_priv {
        spinlock_t lock;
        struct nouveau_therm_trip_point *last_trip;
        int mode;
+       int cstate;
        int suspend;
 
        /* bios */