diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/therm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c | 9 |
3 files changed, 19 insertions, 13 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c index 43fff761a177..e017607673a5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c @@ -126,8 +126,9 @@ int nvkm_therm_fan_sense(struct nvkm_therm *obj) { struct nvkm_therm_priv *therm = container_of(obj, typeof(*therm), base); - struct nvkm_timer *tmr = nvkm_timer(therm); - struct nvkm_gpio *gpio = nvkm_gpio(therm); + struct nvkm_device *device = therm->base.subdev.device; + struct nvkm_timer *tmr = device->timer; + struct nvkm_gpio *gpio = device->gpio; u32 cycles, cur, prev; u64 start, end, tach; @@ -139,12 +140,14 @@ nvkm_therm_fan_sense(struct nvkm_therm *obj) * We get 4 changes (0 -> 1 -> 0 -> 1) per complete rotation. */ start = tmr->read(tmr); - prev = gpio->get(gpio, 0, therm->fan->tach.func, therm->fan->tach.line); + prev = nvkm_gpio_get(gpio, 0, therm->fan->tach.func, + therm->fan->tach.line); cycles = 0; do { usleep_range(500, 1000); /* supports 0 < rpm < 7500 */ - cur = gpio->get(gpio, 0, therm->fan->tach.func, therm->fan->tach.line); + cur = nvkm_gpio_get(gpio, 0, therm->fan->tach.func, + therm->fan->tach.line); if (prev != cur) { if (!start) start = tmr->read(tmr); @@ -237,7 +240,7 @@ nvkm_therm_fan_ctor(struct nvkm_therm *obj) int ret; /* attempt to locate a drivable fan, and determine control method */ - ret = gpio->find(gpio, 0, DCB_GPIO_FAN, 0xff, &func); + ret = nvkm_gpio_find(gpio, 0, DCB_GPIO_FAN, 0xff, &func); if (ret == 0) { /* FIXME: is this really the place to perform such checks ? */ if (func.line != 16 && func.log[0] & DCB_GPIO_LOG_DIR_IN) { @@ -263,7 +266,8 @@ nvkm_therm_fan_ctor(struct nvkm_therm *obj) therm->fan->percent = nvkm_therm_fan_get(&therm->base); /* attempt to detect a tachometer connection */ - ret = gpio->find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, &therm->fan->tach); + ret = nvkm_gpio_find(gpio, 0, DCB_GPIO_FAN_SENSE, 0xff, + &therm->fan->tach); if (ret) therm->fan->tach.func = DCB_GPIO_UNUSED; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c index ac4847f2912d..944b7905b4a5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c @@ -39,8 +39,9 @@ nvkm_fanpwm_get(struct nvkm_therm *obj) { struct nvkm_therm_priv *therm = container_of(obj, typeof(*therm), base); struct nvkm_fanpwm *fan = (void *)therm->fan; - struct nvkm_gpio *gpio = nvkm_gpio(therm); - int card_type = nv_device(therm)->card_type; + struct nvkm_device *device = therm->base.subdev.device; + struct nvkm_gpio *gpio = device->gpio; + int card_type = device->card_type; u32 divs, duty; int ret; @@ -52,7 +53,7 @@ nvkm_fanpwm_get(struct nvkm_therm *obj) return (duty * 100) / divs; } - return gpio->get(gpio, 0, fan->func.func, fan->func.line) * 100; + return nvkm_gpio_get(gpio, 0, fan->func.func, fan->func.line) * 100; } static int diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c index 88cc190f5a3e..7e1f21d81eb1 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c @@ -39,8 +39,9 @@ static void nvkm_fantog_update(struct nvkm_fantog *fan, int percent) { struct nvkm_therm_priv *therm = (void *)fan->base.parent; - struct nvkm_timer *tmr = nvkm_timer(therm); - struct nvkm_gpio *gpio = nvkm_gpio(therm); + struct nvkm_device *device = therm->base.subdev.device; + struct nvkm_timer *tmr = device->timer; + struct nvkm_gpio *gpio = device->gpio; unsigned long flags; int duty; @@ -49,8 +50,8 @@ nvkm_fantog_update(struct nvkm_fantog *fan, int percent) percent = fan->percent; fan->percent = percent; - duty = !gpio->get(gpio, 0, DCB_GPIO_FAN, 0xff); - gpio->set(gpio, 0, DCB_GPIO_FAN, 0xff, duty); + duty = !nvkm_gpio_get(gpio, 0, DCB_GPIO_FAN, 0xff); + nvkm_gpio_set(gpio, 0, DCB_GPIO_FAN, 0xff, duty); if (list_empty(&fan->alarm.head) && percent != (duty * 100)) { u64 next_change = (percent * fan->period_us) / 100; |