Lines Matching full:sensor

3  * System Control and Power Interface(SCPI) based hwmon sensor driver
57 static void scpi_scale_reading(u64 *value, struct sensor_data *sensor) in scpi_scale_reading() argument
59 if (scpi_scale[sensor->info.class] != sensor->scale) { in scpi_scale_reading()
60 *value *= scpi_scale[sensor->info.class]; in scpi_scale_reading()
61 do_div(*value, sensor->scale); in scpi_scale_reading()
70 struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id]; in scpi_read_temp() local
74 ret = scpi_ops->sensor_get_value(sensor->info.sensor_id, &value); in scpi_read_temp()
78 scpi_scale_reading(&value, sensor); in scpi_read_temp()
90 struct sensor_data *sensor; in scpi_show_sensor() local
94 sensor = container_of(attr, struct sensor_data, dev_attr_input); in scpi_show_sensor()
96 ret = scpi_ops->sensor_get_value(sensor->info.sensor_id, &value); in scpi_show_sensor()
100 scpi_scale_reading(&value, sensor); in scpi_show_sensor()
103 * Temperature sensor values are treated as signed values based on in scpi_show_sensor()
108 if (sensor->info.class == TEMPERATURE) in scpi_show_sensor()
117 struct sensor_data *sensor; in scpi_show_label() local
119 sensor = container_of(attr, struct sensor_data, dev_attr_label); in scpi_show_label()
121 return sprintf(buf, "%s\n", sensor->info.name); in scpi_show_label()
180 struct sensor_data *sensor = &scpi_sensors->data[idx]; in scpi_hwmon_probe() local
182 ret = scpi_ops->sensor_get_info(i, &sensor->info); in scpi_hwmon_probe()
186 switch (sensor->info.class) { in scpi_hwmon_probe()
188 snprintf(sensor->input, sizeof(sensor->input), in scpi_hwmon_probe()
190 snprintf(sensor->label, sizeof(sensor->input), in scpi_hwmon_probe()
195 snprintf(sensor->input, sizeof(sensor->input), in scpi_hwmon_probe()
197 snprintf(sensor->label, sizeof(sensor->input), in scpi_hwmon_probe()
202 snprintf(sensor->input, sizeof(sensor->input), in scpi_hwmon_probe()
204 snprintf(sensor->label, sizeof(sensor->input), in scpi_hwmon_probe()
209 snprintf(sensor->input, sizeof(sensor->input), in scpi_hwmon_probe()
211 snprintf(sensor->label, sizeof(sensor->input), in scpi_hwmon_probe()
216 snprintf(sensor->input, sizeof(sensor->input), in scpi_hwmon_probe()
218 snprintf(sensor->label, sizeof(sensor->input), in scpi_hwmon_probe()
226 sensor->scale = scale[sensor->info.class]; in scpi_hwmon_probe()
228 sensor->dev_attr_input.attr.mode = 0444; in scpi_hwmon_probe()
229 sensor->dev_attr_input.show = scpi_show_sensor; in scpi_hwmon_probe()
230 sensor->dev_attr_input.attr.name = sensor->input; in scpi_hwmon_probe()
232 sensor->dev_attr_label.attr.mode = 0444; in scpi_hwmon_probe()
233 sensor->dev_attr_label.show = scpi_show_label; in scpi_hwmon_probe()
234 sensor->dev_attr_label.attr.name = sensor->label; in scpi_hwmon_probe()
236 scpi_sensors->attrs[idx << 1] = &sensor->dev_attr_input.attr; in scpi_hwmon_probe()
237 scpi_sensors->attrs[(idx << 1) + 1] = &sensor->dev_attr_label.attr; in scpi_hwmon_probe()
265 struct sensor_data *sensor = &scpi_sensors->data[i]; in scpi_hwmon_probe() local
269 if (sensor->info.class != TEMPERATURE) in scpi_hwmon_probe()
279 sensor->info.sensor_id, in scpi_hwmon_probe()