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 if (!hwmon->sensors) in cgbc_hwmon_probe_sensors()
111 return -ENOMEM; in cgbc_hwmon_probe_sensors()
113 sensor = hwmon->sensors; in cgbc_hwmon_probe_sensors()
120 * No need to request data for the first sensor. in cgbc_hwmon_probe_sensors()
121 * We got data for the first sensor when we ask the number of sensors to the Board in cgbc_hwmon_probe_sensors()
131 channel = FIELD_GET(CGBC_HWMON_ID_MASK, data[1]) - 1; in cgbc_hwmon_probe_sensors()
134 sensor->type = hwmon_temp; in cgbc_hwmon_probe_sensors()
135 sensor->label = cgbc_hwmon_labels_temp[channel]; in cgbc_hwmon_probe_sensors()
140 * Get the sensor type from cgbc_hwmon_labels_in[channel].type instead. in cgbc_hwmon_probe_sensors()
142 sensor->type = cgbc_hwmon_labels_in[channel].type; in cgbc_hwmon_probe_sensors()
143 sensor->label = cgbc_hwmon_labels_in[channel].label; in cgbc_hwmon_probe_sensors()
146 sensor->type = hwmon_fan; in cgbc_hwmon_probe_sensors()
147 sensor->label = cgbc_hwmon_labels_fan[channel]; in cgbc_hwmon_probe_sensors()
149 dev_warn(dev, "Board Controller returned an unknown sensor (type=%d, channel=%d), ignore it", in cgbc_hwmon_probe_sensors()
154 sensor->active = FIELD_GET(CGBC_HWMON_ACTIVE_BIT, data[1]); in cgbc_hwmon_probe_sensors()
155 sensor->channel = channel; in cgbc_hwmon_probe_sensors()
156 sensor->index = i; in cgbc_hwmon_probe_sensors()
157 sensor++; in cgbc_hwmon_probe_sensors()
158 hwmon->nb_sensors++; in cgbc_hwmon_probe_sensors()
167 struct cgbc_hwmon_sensor *sensor = NULL; in cgbc_hwmon_find_sensor() local
178 for (i = 0; i < hwmon->nb_sensors; i++) { in cgbc_hwmon_find_sensor()
179 if (hwmon->sensors[i].type == type && hwmon->sensors[i].channel == channel) { in cgbc_hwmon_find_sensor()
180 sensor = &hwmon->sensors[i]; in cgbc_hwmon_find_sensor()
185 return sensor; in cgbc_hwmon_find_sensor()
192 struct cgbc_hwmon_sensor *sensor = cgbc_hwmon_find_sensor(hwmon, type, channel); in cgbc_hwmon_read() local
193 struct cgbc_device_data *cgbc = hwmon->cgbc; in cgbc_hwmon_read()
197 ret = cgbc_hwmon_cmd(cgbc, sensor->index, &data[0]); in cgbc_hwmon_read()
207 if (sensor->type == hwmon_temp) in cgbc_hwmon_read()
217 struct cgbc_hwmon_sensor *sensor; in cgbc_hwmon_is_visible() local
219 sensor = cgbc_hwmon_find_sensor(data, type, channel); in cgbc_hwmon_is_visible()
220 if (!sensor) in cgbc_hwmon_is_visible()
223 return sensor->active ? 0444 : 0; in cgbc_hwmon_is_visible()
230 struct cgbc_hwmon_sensor *sensor = cgbc_hwmon_find_sensor(hwmon, type, channel); in cgbc_hwmon_read_string() local
232 *str = sensor->label; in cgbc_hwmon_read_string()
275 struct cgbc_device_data *cgbc = dev_get_drvdata(pdev->dev.parent); in cgbc_hwmon_probe()
276 struct device *dev = &pdev->dev; in cgbc_hwmon_probe()
283 return -ENOMEM; in cgbc_hwmon_probe()
285 data->cgbc = cgbc; in cgbc_hwmon_probe()
298 .name = "cgbc-hwmon",