aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-12-05 16:21:59 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-02-20 16:00:18 +1000
commit9c3bd3a53129639f10e129b007862340dba16a09 (patch)
tree3da9e2dcca8215bc87168912b6645fe08abe4bd3 /drivers/gpu/drm/nouveau/core/subdev/therm/base.c
parentdrm/nouveau/therm: add interfaces to allow forcing off pwm fan control (diff)
downloadlinux-dev-9c3bd3a53129639f10e129b007862340dba16a09.tar.xz
linux-dev-9c3bd3a53129639f10e129b007862340dba16a09.zip
drm/nouveau/therm: cleanly separate pwm control logic from therm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Martin Peres <martin.peres@labri.fr>
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/subdev/therm/base.c')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/base.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
index 6260eacb92bd..4ebd3c86f8e1 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
@@ -37,11 +37,11 @@ nouveau_therm_attr_get(struct nouveau_therm *therm,
switch (type) {
case NOUVEAU_THERM_ATTR_FAN_MIN_DUTY:
- return priv->bios_fan.min_duty;
+ return priv->fan->bios.min_duty;
case NOUVEAU_THERM_ATTR_FAN_MAX_DUTY:
- return priv->bios_fan.max_duty;
+ return priv->fan->bios.max_duty;
case NOUVEAU_THERM_ATTR_FAN_MODE:
- return priv->fan.mode;
+ return priv->fan->mode;
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST:
return priv->bios_sensor.thrs_fan_boost.temp;
case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST_HYST:
@@ -73,16 +73,16 @@ nouveau_therm_attr_set(struct nouveau_therm *therm,
case NOUVEAU_THERM_ATTR_FAN_MIN_DUTY:
if (value < 0)
value = 0;
- if (value > priv->bios_fan.max_duty)
- value = priv->bios_fan.max_duty;
- priv->bios_fan.min_duty = value;
+ if (value > priv->fan->bios.max_duty)
+ value = priv->fan->bios.max_duty;
+ priv->fan->bios.min_duty = value;
return 0;
case NOUVEAU_THERM_ATTR_FAN_MAX_DUTY:
if (value < 0)
value = 0;
- if (value < priv->bios_fan.min_duty)
- value = priv->bios_fan.min_duty;
- priv->bios_fan.max_duty = value;
+ if (value < priv->fan->bios.min_duty)
+ value = priv->fan->bios.min_duty;
+ priv->fan->bios.max_duty = value;
return 0;
case NOUVEAU_THERM_ATTR_FAN_MODE:
return nouveau_therm_fan_set_mode(therm, value);
@@ -126,8 +126,8 @@ _nouveau_therm_init(struct nouveau_object *object)
if (ret)
return ret;
- if (priv->fan.percent >= 0)
- therm->fan_set(therm, priv->fan.percent);
+ if (priv->fan->percent >= 0)
+ therm->fan_set(therm, priv->fan->percent);
return 0;
}
@@ -138,7 +138,7 @@ _nouveau_therm_fini(struct nouveau_object *object, bool suspend)
struct nouveau_therm *therm = (void *)object;
struct nouveau_therm_priv *priv = (void *)therm;
- priv->fan.percent = therm->fan_get(therm);
+ priv->fan->percent = therm->fan_get(therm);
return nouveau_subdev_fini(&therm->base, suspend);
}
@@ -158,10 +158,6 @@ nouveau_therm_create_(struct nouveau_object *parent,
if (ret)
return ret;
- nouveau_therm_ic_ctor(&priv->base);
- nouveau_therm_sensor_ctor(&priv->base);
- nouveau_therm_fan_ctor(&priv->base);
-
priv->base.fan_get = nouveau_therm_fan_user_get;
priv->base.fan_set = nouveau_therm_fan_user_set;
priv->base.fan_sense = nouveau_therm_fan_sense;
@@ -169,3 +165,20 @@ nouveau_therm_create_(struct nouveau_object *parent,
priv->base.attr_set = nouveau_therm_attr_set;
return 0;
}
+
+int
+nouveau_therm_preinit(struct nouveau_therm *therm)
+{
+ nouveau_therm_ic_ctor(therm);
+ nouveau_therm_sensor_ctor(therm);
+ nouveau_therm_fan_ctor(therm);
+ return 0;
+}
+
+void
+_nouveau_therm_dtor(struct nouveau_object *object)
+{
+ struct nouveau_therm_priv *priv = (void *)object;
+ kfree(priv->fan);
+ nouveau_subdev_destroy(&priv->base.base);
+}