Lines Matching full:sensor

3  * Analog Devices LTC2983 Multi-Sensor Digital Temperature Measurement System
192 container_of(_sensor, struct ltc2983_thermocouple, sensor)
195 container_of(_sensor, struct ltc2983_rtd, sensor)
198 container_of(_sensor, struct ltc2983_thermistor, sensor)
201 container_of(_sensor, struct ltc2983_diode, sensor)
204 container_of(_sensor, struct ltc2983_rsense, sensor)
207 container_of(_sensor, struct ltc2983_adc, sensor)
210 container_of(_sensor, struct ltc2983_temp, sensor)
245 const struct ltc2983_sensor *sensor);
246 /* specifies the sensor channel */
248 /* sensor type */
253 /* raw table sensor data */
262 struct ltc2983_sensor sensor; member
269 struct ltc2983_sensor sensor; member
278 struct ltc2983_sensor sensor; member
286 struct ltc2983_sensor sensor; member
293 struct ltc2983_sensor sensor; member
298 struct ltc2983_sensor sensor; member
303 struct ltc2983_sensor sensor; member
340 dev_err(dev, "Invalid conversion: Sensor HARD fault\n"); in __ltc2983_fault_handler()
344 dev_warn(dev, "Suspicious conversion: Sensor SOFT fault\n"); in __ltc2983_fault_handler()
351 const struct ltc2983_sensor *sensor, in __ltc2983_chan_assign_common() argument
354 u32 reg = LTC2983_CHAN_START_ADDR(sensor->chan); in __ltc2983_chan_assign_common()
356 chan_val |= LTC2983_CHAN_TYPE(sensor->type); in __ltc2983_chan_assign_common()
374 * configuring the sensor channel, we must write the number of in __ltc2983_chan_custom_sensor_assign()
388 * sensor, a steinhart sensor might have been added changing in __ltc2983_chan_custom_sensor_assign()
395 "Not space left(%d) for new custom sensor(%zu)", in __ltc2983_chan_custom_sensor_assign()
410 dev_dbg(dev, "Assign custom sensor, reg:0x%04X, off:%d, sz:%zu", in __ltc2983_chan_custom_sensor_assign()
413 /* write custom sensor table */ in __ltc2983_chan_custom_sensor_assign()
456 "No space left(%d) for new custom sensor(%zu)\n", in __ltc2983_custom_sensor_new()
508 * sensor will sit in a correct address without the need of filling in __ltc2983_custom_sensor_new()
540 const struct ltc2983_sensor *sensor) in ltc2983_thermocouple_assign_chan() argument
542 struct ltc2983_thermocouple *thermo = to_thermocouple(sensor); in ltc2983_thermocouple_assign_chan()
556 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_thermocouple_assign_chan()
560 const struct ltc2983_sensor *sensor) in ltc2983_rtd_assign_chan() argument
562 struct ltc2983_rtd *rtd = to_rtd(sensor); in ltc2983_rtd_assign_chan()
578 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_rtd_assign_chan()
582 const struct ltc2983_sensor *sensor) in ltc2983_thermistor_assign_chan() argument
584 struct ltc2983_thermistor *thermistor = to_thermistor(sensor); in ltc2983_thermistor_assign_chan()
601 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_thermistor_assign_chan()
605 const struct ltc2983_sensor *sensor) in ltc2983_diode_assign_chan() argument
607 struct ltc2983_diode *diode = to_diode(sensor); in ltc2983_diode_assign_chan()
614 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_diode_assign_chan()
618 const struct ltc2983_sensor *sensor) in ltc2983_r_sense_assign_chan() argument
620 struct ltc2983_rsense *rsense = to_rsense(sensor); in ltc2983_r_sense_assign_chan()
625 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_r_sense_assign_chan()
629 const struct ltc2983_sensor *sensor) in ltc2983_adc_assign_chan() argument
631 struct ltc2983_adc *adc = to_adc(sensor); in ltc2983_adc_assign_chan()
636 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_adc_assign_chan()
640 const struct ltc2983_sensor *sensor) in ltc2983_temp_assign_chan() argument
642 struct ltc2983_temp *temp = to_temp(sensor); in ltc2983_temp_assign_chan()
652 return __ltc2983_chan_assign_common(st, sensor, chan_val); in ltc2983_temp_assign_chan()
657 const struct ltc2983_sensor *sensor) in ltc2983_thermocouple_new() argument
670 ret = fwnode_property_read_u32(child, "adi,sensor-oc-current-microamp", &oc_current); in ltc2983_thermocouple_new()
699 sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_thermocouple_new()
702 sensor->chan); in ltc2983_thermocouple_new()
719 /* check custom sensor */ in ltc2983_thermocouple_new()
720 if (sensor->type == LTC2983_SENSOR_THERMOCOUPLE_CUSTOM) { in ltc2983_thermocouple_new()
731 thermo->sensor.fault_handler = ltc2983_thermocouple_fault_handler; in ltc2983_thermocouple_new()
732 thermo->sensor.assign_chan = ltc2983_thermocouple_assign_chan; in ltc2983_thermocouple_new()
734 return &thermo->sensor; in ltc2983_thermocouple_new()
739 const struct ltc2983_sensor *sensor) in ltc2983_rtd_new() argument
819 if (sensor->chan < min || sensor->chan > max) in ltc2983_rtd_new()
822 sensor->chan); in ltc2983_rtd_new()
825 if (sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_rtd_new()
828 sensor->chan); in ltc2983_rtd_new()
831 /* check custom sensor */ in ltc2983_rtd_new()
832 if (sensor->type == LTC2983_SENSOR_RTD_CUSTOM) { in ltc2983_rtd_new()
841 rtd->sensor.fault_handler = ltc2983_common_fault_handler; in ltc2983_rtd_new()
842 rtd->sensor.assign_chan = ltc2983_rtd_assign_chan; in ltc2983_rtd_new()
884 return &rtd->sensor; in ltc2983_rtd_new()
889 const struct ltc2983_sensor *sensor) in ltc2983_thermistor_new() argument
924 sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_thermistor_new()
927 sensor->chan); in ltc2983_thermistor_new()
929 /* check custom sensor */ in ltc2983_thermistor_new()
930 if (sensor->type >= LTC2983_SENSOR_THERMISTOR_STEINHART) { in ltc2983_thermistor_new()
934 if (sensor->type == LTC2983_SENSOR_THERMISTOR_STEINHART) { in ltc2983_thermistor_new()
949 thermistor->sensor.fault_handler = ltc2983_common_fault_handler; in ltc2983_thermistor_new()
950 thermistor->sensor.assign_chan = ltc2983_thermistor_assign_chan; in ltc2983_thermistor_new()
956 if (sensor->type >= LTC2983_SENSOR_THERMISTOR_STEINHART) in ltc2983_thermistor_new()
966 if (sensor->type >= LTC2983_SENSOR_THERMISTOR_STEINHART) in ltc2983_thermistor_new()
1012 return &thermistor->sensor; in ltc2983_thermistor_new()
1017 const struct ltc2983_sensor *sensor) in ltc2983_diode_new() argument
1038 sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_diode_new()
1041 sensor->chan); in ltc2983_diode_new()
1044 diode->sensor.fault_handler = ltc2983_common_fault_handler; in ltc2983_diode_new()
1045 diode->sensor.assign_chan = ltc2983_diode_assign_chan; in ltc2983_diode_new()
1075 return &diode->sensor; in ltc2983_diode_new()
1080 const struct ltc2983_sensor *sensor) in ltc2983_r_sense_new() argument
1091 if (sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_r_sense_new()
1094 sensor->chan); in ltc2983_r_sense_new()
1109 rsense->sensor.assign_chan = ltc2983_r_sense_assign_chan; in ltc2983_r_sense_new()
1111 return &rsense->sensor; in ltc2983_r_sense_new()
1116 const struct ltc2983_sensor *sensor) in ltc2983_adc_new() argument
1127 if (!adc->single_ended && sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_adc_new()
1130 sensor->chan); in ltc2983_adc_new()
1133 adc->sensor.assign_chan = ltc2983_adc_assign_chan; in ltc2983_adc_new()
1134 adc->sensor.fault_handler = ltc2983_common_fault_handler; in ltc2983_adc_new()
1136 return &adc->sensor; in ltc2983_adc_new()
1141 const struct ltc2983_sensor *sensor) in ltc2983_temp_new() argument
1152 if (!temp->single_ended && sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) in ltc2983_temp_new()
1155 sensor->chan); in ltc2983_temp_new()
1163 temp->sensor.assign_chan = ltc2983_temp_assign_chan; in ltc2983_temp_new()
1164 temp->sensor.fault_handler = ltc2983_common_fault_handler; in ltc2983_temp_new()
1166 return &temp->sensor; in ltc2983_temp_new()
1170 const struct ltc2983_sensor *sensor, int *val) in ltc2983_chan_read() argument
1177 start_conversion |= LTC2983_STATUS_CHAN_SEL(sensor->chan); in ltc2983_chan_read()
1179 sensor->chan, start_conversion); in ltc2983_chan_read()
1189 * Depending on the sensor configuration, there are 2/3 conversions in ltc2983_chan_read()
1200 ret = regmap_bulk_read(st->regmap, LTC2983_CHAN_RES_ADDR(sensor->chan), in ltc2983_chan_read()
1212 ret = sensor->fault_handler(st, *val); in ltc2983_chan_read()
1316 struct ltc2983_sensor sensor; in ltc2983_parse_fw() local
1318 ret = fwnode_property_read_u32(child, "reg", &sensor.chan); in ltc2983_parse_fw()
1324 if (sensor.chan < LTC2983_MIN_CHANNELS_NR || in ltc2983_parse_fw()
1325 sensor.chan > st->info->max_channels_nr) in ltc2983_parse_fw()
1328 sensor.chan, in ltc2983_parse_fw()
1332 if (channel_avail_mask & BIT(sensor.chan)) in ltc2983_parse_fw()
1335 sensor.chan); in ltc2983_parse_fw()
1337 ret = fwnode_property_read_u32(child, "adi,sensor-type", &sensor.type); in ltc2983_parse_fw()
1340 "adi,sensor-type property must given for child nodes\n"); in ltc2983_parse_fw()
1342 dev_dbg(dev, "Create new sensor, type %u, chann %u", in ltc2983_parse_fw()
1343 sensor.type, sensor.chan); in ltc2983_parse_fw()
1345 if (sensor.type >= LTC2983_SENSOR_THERMOCOUPLE && in ltc2983_parse_fw()
1346 sensor.type <= LTC2983_SENSOR_THERMOCOUPLE_CUSTOM) { in ltc2983_parse_fw()
1348 &sensor); in ltc2983_parse_fw()
1349 } else if (sensor.type >= LTC2983_SENSOR_RTD && in ltc2983_parse_fw()
1350 sensor.type <= LTC2983_SENSOR_RTD_CUSTOM) { in ltc2983_parse_fw()
1351 st->sensors[chan] = ltc2983_rtd_new(child, st, &sensor); in ltc2983_parse_fw()
1352 } else if (sensor.type >= LTC2983_SENSOR_THERMISTOR && in ltc2983_parse_fw()
1353 sensor.type <= LTC2983_SENSOR_THERMISTOR_CUSTOM) { in ltc2983_parse_fw()
1355 &sensor); in ltc2983_parse_fw()
1356 } else if (sensor.type == LTC2983_SENSOR_DIODE) { in ltc2983_parse_fw()
1358 &sensor); in ltc2983_parse_fw()
1359 } else if (sensor.type == LTC2983_SENSOR_SENSE_RESISTOR) { in ltc2983_parse_fw()
1361 &sensor); in ltc2983_parse_fw()
1364 } else if (sensor.type == LTC2983_SENSOR_DIRECT_ADC) { in ltc2983_parse_fw()
1365 st->sensors[chan] = ltc2983_adc_new(child, st, &sensor); in ltc2983_parse_fw()
1367 sensor.type == LTC2983_SENSOR_ACTIVE_TEMP) { in ltc2983_parse_fw()
1368 st->sensors[chan] = ltc2983_temp_new(child, st, &sensor); in ltc2983_parse_fw()
1371 "Unknown sensor type %d\n", in ltc2983_parse_fw()
1372 sensor.type); in ltc2983_parse_fw()
1377 "Failed to create sensor\n"); in ltc2983_parse_fw()
1379 /* set generic sensor parameters */ in ltc2983_parse_fw()
1380 st->sensors[chan]->chan = sensor.chan; in ltc2983_parse_fw()
1381 st->sensors[chan]->type = sensor.type; in ltc2983_parse_fw()
1383 channel_avail_mask |= BIT(sensor.chan); in ltc2983_parse_fw()
1487 * reference the sensor given the iio_chan_spec in ltc2983_setup()