Lines Matching +full:fan +full:- +full:0
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * fan_attr.c - Create extra attributes for ACPI Fan driver
15 #include "fan.h"
24 if (fps->control == 0xFFFFFFFF || fps->control > 100) in show_state()
25 count = scnprintf(buf, PAGE_SIZE, "not-defined:"); in show_state()
27 count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control); in show_state()
29 if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9) in show_state()
30 count += sysfs_emit_at(buf, count, "not-defined:"); in show_state()
32 count += sysfs_emit_at(buf, count, "%lld:", fps->trip_point); in show_state()
34 if (fps->speed == 0xFFFFFFFF) in show_state()
35 count += sysfs_emit_at(buf, count, "not-defined:"); in show_state()
37 count += sysfs_emit_at(buf, count, "%lld:", fps->speed); in show_state()
39 if (fps->noise_level == 0xFFFFFFFF) in show_state()
40 count += sysfs_emit_at(buf, count, "not-defined:"); in show_state()
42 count += sysfs_emit_at(buf, count, "%lld:", fps->noise_level * 100); in show_state()
44 if (fps->power == 0xFFFFFFFF) in show_state()
45 count += sysfs_emit_at(buf, count, "not-defined\n"); in show_state()
47 count += sysfs_emit_at(buf, count, "%lld\n", fps->power); in show_state()
68 struct acpi_fan *fan = acpi_driver_data(acpi_dev); in show_fine_grain_control() local
70 return sprintf(buf, "%d\n", fan->fif.fine_grain_ctrl); in show_fine_grain_control()
75 struct acpi_fan *fan = acpi_driver_data(device); in acpi_fan_create_attributes() local
78 sysfs_attr_init(&fan->fine_grain_control.attr); in acpi_fan_create_attributes()
79 fan->fine_grain_control.show = show_fine_grain_control; in acpi_fan_create_attributes()
80 fan->fine_grain_control.store = NULL; in acpi_fan_create_attributes()
81 fan->fine_grain_control.attr.name = "fine_grain_control"; in acpi_fan_create_attributes()
82 fan->fine_grain_control.attr.mode = 0444; in acpi_fan_create_attributes()
83 status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr); in acpi_fan_create_attributes()
88 sysfs_attr_init(&fan->fst_speed.attr); in acpi_fan_create_attributes()
89 fan->fst_speed.show = show_fan_speed; in acpi_fan_create_attributes()
90 fan->fst_speed.store = NULL; in acpi_fan_create_attributes()
91 fan->fst_speed.attr.name = "fan_speed_rpm"; in acpi_fan_create_attributes()
92 fan->fst_speed.attr.mode = 0444; in acpi_fan_create_attributes()
93 status = sysfs_create_file(&device->dev.kobj, &fan->fst_speed.attr); in acpi_fan_create_attributes()
97 for (i = 0; i < fan->fps_count; ++i) { in acpi_fan_create_attributes()
98 struct acpi_fan_fps *fps = &fan->fps[i]; in acpi_fan_create_attributes()
100 snprintf(fps->name, ACPI_FPS_NAME_LEN, "state%d", i); in acpi_fan_create_attributes()
101 sysfs_attr_init(&fps->dev_attr.attr); in acpi_fan_create_attributes()
102 fps->dev_attr.show = show_state; in acpi_fan_create_attributes()
103 fps->dev_attr.store = NULL; in acpi_fan_create_attributes()
104 fps->dev_attr.attr.name = fps->name; in acpi_fan_create_attributes()
105 fps->dev_attr.attr.mode = 0444; in acpi_fan_create_attributes()
106 status = sysfs_create_file(&device->dev.kobj, &fps->dev_attr.attr); in acpi_fan_create_attributes()
110 for (j = 0; j < i; ++j) in acpi_fan_create_attributes()
111 sysfs_remove_file(&device->dev.kobj, &fan->fps[j].dev_attr.attr); in acpi_fan_create_attributes()
116 return 0; in acpi_fan_create_attributes()
119 sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr); in acpi_fan_create_attributes()
122 sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr); in acpi_fan_create_attributes()
129 struct acpi_fan *fan = acpi_driver_data(device); in acpi_fan_delete_attributes() local
132 for (i = 0; i < fan->fps_count; ++i) in acpi_fan_delete_attributes()
133 sysfs_remove_file(&device->dev.kobj, &fan->fps[i].dev_attr.attr); in acpi_fan_delete_attributes()
135 sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr); in acpi_fan_delete_attributes()
136 sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr); in acpi_fan_delete_attributes()