Lines Matching +full:temperature +full:- +full:sensor

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * cgbc-hwmon - Congatec Board Controller hardware monitoring driver
43 "CPU Temperature",
44 "Box Temperature",
45 "Ambient Temperature",
46 "Board Temperature",
47 "Carrier Temperature",
48 "Chipset Temperature",
49 "Video Temperature",
50 "Other Temperature",
51 "TOPDIM Temperature",
52 "BOTTOMDIM Temperature",
98 struct cgbc_device_data *cgbc = hwmon->cgbc; in cgbc_hwmon_probe_sensors()
99 struct cgbc_hwmon_sensor *sensor = hwmon->sensors; in cgbc_hwmon_probe_sensors() local
109 hwmon->sensors = devm_kzalloc(dev, sizeof(*hwmon->sensors) * nb_sensors, GFP_KERNEL); in cgbc_hwmon_probe_sensors()
110 sensor = hwmon->sensors; in cgbc_hwmon_probe_sensors()
117 * No need to request data for the first sensor. in cgbc_hwmon_probe_sensors()
118 * We got data for the first sensor when we ask the number of sensors to the Board in cgbc_hwmon_probe_sensors()
128 channel = FIELD_GET(CGBC_HWMON_ID_MASK, data[1]) - 1; in cgbc_hwmon_probe_sensors()
131 sensor->type = hwmon_temp; in cgbc_hwmon_probe_sensors()
132 sensor->label = cgbc_hwmon_labels_temp[channel]; in cgbc_hwmon_probe_sensors()
137 * Get the sensor type from cgbc_hwmon_labels_in[channel].type instead. in cgbc_hwmon_probe_sensors()
139 sensor->type = cgbc_hwmon_labels_in[channel].type; in cgbc_hwmon_probe_sensors()
140 sensor->label = cgbc_hwmon_labels_in[channel].label; in cgbc_hwmon_probe_sensors()
143 sensor->type = hwmon_fan; in cgbc_hwmon_probe_sensors()
144 sensor->label = cgbc_hwmon_labels_fan[channel]; in cgbc_hwmon_probe_sensors()
146 dev_warn(dev, "Board Controller returned an unknown sensor (type=%d, channel=%d), ignore it", in cgbc_hwmon_probe_sensors()
151 sensor->active = FIELD_GET(CGBC_HWMON_ACTIVE_BIT, data[1]); in cgbc_hwmon_probe_sensors()
152 sensor->channel = channel; in cgbc_hwmon_probe_sensors()
153 sensor->index = i; in cgbc_hwmon_probe_sensors()
154 sensor++; in cgbc_hwmon_probe_sensors()
155 hwmon->nb_sensors++; in cgbc_hwmon_probe_sensors()
164 struct cgbc_hwmon_sensor *sensor = NULL; in cgbc_hwmon_find_sensor() local
175 for (i = 0; i < hwmon->nb_sensors; i++) { in cgbc_hwmon_find_sensor()
176 if (hwmon->sensors[i].type == type && hwmon->sensors[i].channel == channel) { in cgbc_hwmon_find_sensor()
177 sensor = &hwmon->sensors[i]; in cgbc_hwmon_find_sensor()
182 return sensor; in cgbc_hwmon_find_sensor()
189 struct cgbc_hwmon_sensor *sensor = cgbc_hwmon_find_sensor(hwmon, type, channel); in cgbc_hwmon_read() local
190 struct cgbc_device_data *cgbc = hwmon->cgbc; in cgbc_hwmon_read()
194 ret = cgbc_hwmon_cmd(cgbc, sensor->index, &data[0]); in cgbc_hwmon_read()
204 if (sensor->type == hwmon_temp) in cgbc_hwmon_read()
214 struct cgbc_hwmon_sensor *sensor; in cgbc_hwmon_is_visible() local
216 sensor = cgbc_hwmon_find_sensor(data, type, channel); in cgbc_hwmon_is_visible()
217 if (!sensor) in cgbc_hwmon_is_visible()
220 return sensor->active ? 0444 : 0; in cgbc_hwmon_is_visible()
227 struct cgbc_hwmon_sensor *sensor = cgbc_hwmon_find_sensor(hwmon, type, channel); in cgbc_hwmon_read_string() local
229 *str = sensor->label; in cgbc_hwmon_read_string()
272 struct cgbc_device_data *cgbc = dev_get_drvdata(pdev->dev.parent); in cgbc_hwmon_probe()
273 struct device *dev = &pdev->dev; in cgbc_hwmon_probe()
280 return -ENOMEM; in cgbc_hwmon_probe()
282 data->cgbc = cgbc; in cgbc_hwmon_probe()
295 .name = "cgbc-hwmon",