Lines Matching full:fan
39 nvkm_fantog_update(struct nvkm_fantog *fan, int percent) in nvkm_fantog_update() argument
41 struct nvkm_therm *therm = fan->base.parent; in nvkm_fantog_update()
48 spin_lock_irqsave(&fan->lock, flags); in nvkm_fantog_update()
50 percent = fan->percent; in nvkm_fantog_update()
51 fan->percent = percent; in nvkm_fantog_update()
57 u64 next_change = (percent * fan->period_us) / 100; in nvkm_fantog_update()
59 next_change = fan->period_us - next_change; in nvkm_fantog_update()
60 nvkm_timer_alarm(tmr, next_change * 1000, &fan->alarm); in nvkm_fantog_update()
62 spin_unlock_irqrestore(&fan->lock, flags); in nvkm_fantog_update()
68 struct nvkm_fantog *fan = in nvkm_fantog_alarm() local
70 nvkm_fantog_update(fan, -1); in nvkm_fantog_alarm()
76 struct nvkm_fantog *fan = (void *)therm->fan; in nvkm_fantog_get() local
77 return fan->percent; in nvkm_fantog_get()
83 struct nvkm_fantog *fan = (void *)therm->fan; in nvkm_fantog_set() local
85 therm->func->pwm_ctrl(therm, fan->func.line, false); in nvkm_fantog_set()
86 nvkm_fantog_update(fan, percent); in nvkm_fantog_set()
93 struct nvkm_fantog *fan; in nvkm_fantog_create() local
102 fan = kzalloc(sizeof(*fan), GFP_KERNEL); in nvkm_fantog_create()
103 if (!fan) in nvkm_fantog_create()
106 therm->fan = &fan->base; in nvkm_fantog_create()
107 fan->base.type = "toggle"; in nvkm_fantog_create()
108 fan->base.get = nvkm_fantog_get; in nvkm_fantog_create()
109 fan->base.set = nvkm_fantog_set; in nvkm_fantog_create()
110 nvkm_alarm_init(&fan->alarm, nvkm_fantog_alarm); in nvkm_fantog_create()
111 fan->period_us = 100000; /* 10Hz */ in nvkm_fantog_create()
112 fan->percent = 100; in nvkm_fantog_create()
113 fan->func = *func; in nvkm_fantog_create()
114 spin_lock_init(&fan->lock); in nvkm_fantog_create()