Lines Matching full:fan

3  *  fan_core.c - ACPI Fan core Driver
20 #include "fan.h"
33 struct acpi_fan *fan = acpi_driver_data(device); in fan_get_max_state() local
35 if (fan->acpi4) { in fan_get_max_state()
36 if (fan->fif.fine_grain_ctrl) in fan_get_max_state()
37 *state = 100 / fan->fif.step_size; in fan_get_max_state()
39 *state = fan->fps_count - 1; in fan_get_max_state()
56 dev_err(&device->dev, "Get fan state failed\n"); in acpi_fan_get_fst()
80 struct acpi_fan *fan = acpi_driver_data(device); in fan_get_state_acpi4() local
88 if (fan->fif.fine_grain_ctrl) { in fan_get_state_acpi4()
95 *state = (int) fst.control / fan->fif.step_size; in fan_get_state_acpi4()
100 for (i = 0; i < fan->fps_count; i++) { in fan_get_state_acpi4()
101 if (fst.control == fan->fps[i].control) in fan_get_state_acpi4()
104 if (i == fan->fps_count) { in fan_get_state_acpi4()
133 struct acpi_fan *fan = acpi_driver_data(device); in fan_get_cur_state() local
135 if (fan->acpi4) in fan_get_cur_state()
152 struct acpi_fan *fan = acpi_driver_data(device); in fan_set_state_acpi4() local
157 if (fan->fif.fine_grain_ctrl) in fan_set_state_acpi4()
158 max_state = 100 / fan->fif.step_size; in fan_set_state_acpi4()
160 max_state = fan->fps_count - 1; in fan_set_state_acpi4()
165 if (fan->fif.fine_grain_ctrl) { in fan_set_state_acpi4()
166 value *= fan->fif.step_size; in fan_set_state_acpi4()
168 if (value + fan->fif.step_size > 100) in fan_set_state_acpi4()
171 value = fan->fps[state].control; in fan_set_state_acpi4()
187 struct acpi_fan *fan = acpi_driver_data(device); in fan_set_cur_state() local
189 if (fan->acpi4) in fan_set_cur_state()
217 struct acpi_fan *fan = acpi_driver_data(device); in acpi_fan_get_fif() local
242 fan->fif.revision = fields[0]; in acpi_fan_get_fif()
243 fan->fif.fine_grain_ctrl = fields[1]; in acpi_fan_get_fif()
244 fan->fif.step_size = fields[2]; in acpi_fan_get_fif()
245 fan->fif.low_speed_notification = fields[3]; in acpi_fan_get_fif()
248 if (!fan->fif.step_size) in acpi_fan_get_fif()
249 fan->fif.step_size = 1; in acpi_fan_get_fif()
251 else if (fan->fif.step_size > 9) in acpi_fan_get_fif()
252 fan->fif.step_size = 9; in acpi_fan_get_fif()
267 struct acpi_fan *fan = acpi_driver_data(device); in acpi_fan_get_fps() local
284 fan->fps_count = obj->package.count - 1; /* minus revision field */ in acpi_fan_get_fps()
285 fan->fps = devm_kcalloc(&device->dev, in acpi_fan_get_fps()
286 fan->fps_count, sizeof(struct acpi_fan_fps), in acpi_fan_get_fps()
288 if (!fan->fps) { in acpi_fan_get_fps()
293 for (i = 0; i < fan->fps_count; i++) { in acpi_fan_get_fps()
296 &fan->fps[i] }; in acpi_fan_get_fps()
305 /* sort the state array according to fan speed in increase order */ in acpi_fan_get_fps()
306 sort(fan->fps, fan->fps_count, sizeof(*fan->fps), in acpi_fan_get_fps()
318 struct acpi_fan *fan; in acpi_fan_probe() local
322 fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); in acpi_fan_probe()
323 if (!fan) { in acpi_fan_probe()
324 dev_err(&device->dev, "No memory for fan\n"); in acpi_fan_probe()
327 device->driver_data = fan; in acpi_fan_probe()
328 platform_set_drvdata(pdev, fan); in acpi_fan_probe()
347 fan->acpi4 = true; in acpi_fan_probe()
357 name = "Fan"; in acpi_fan_probe()
370 fan->cdev = cdev; in acpi_fan_probe()
388 if (fan->acpi4) in acpi_fan_probe()
396 struct acpi_fan *fan = platform_get_drvdata(pdev); in acpi_fan_remove() local
398 if (fan->acpi4) { in acpi_fan_remove()
404 sysfs_remove_link(&fan->cdev->device.kobj, "device"); in acpi_fan_remove()
405 thermal_cooling_device_unregister(fan->cdev); in acpi_fan_remove()
411 struct acpi_fan *fan = dev_get_drvdata(dev); in acpi_fan_suspend() local
412 if (fan->acpi4) in acpi_fan_suspend()
423 struct acpi_fan *fan = dev_get_drvdata(dev); in acpi_fan_resume() local
425 if (fan->acpi4) in acpi_fan_resume()
430 dev_err(dev, "Error updating fan power state\n"); in acpi_fan_resume()
453 .name = "acpi-fan",
462 MODULE_DESCRIPTION("ACPI Fan Driver");