• Home
  • Raw
  • Download

Lines Matching +full:open +full:- +full:circuit

1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (C) 2018-2019 Rockwell Collins
18 #include <dt-bindings/iio/temperature/thermocouple.h>
88 return spi_write_then_read(data->spi, &reg, 1, val, read_size); in max31856_read()
99 return spi_write(data->spi, buf, 2); in max31856_write()
126 reg_cr1_val |= data->thermocouple_type; in max31856_init()
129 reg_cr1_val |= data->averaging << MAX31856_AVERAGING_SHIFT; in max31856_init()
136 * Enable Open circuit fault detection in max31856_init()
147 if (data->filter_50hz) in max31856_init()
162 switch (chan->channel2) { in max31856_thermocouple_read()
175 *val -= 0x80000; in max31856_thermocouple_read()
194 *val -= 0x4000; in max31856_thermocouple_read()
198 return -EINVAL; in max31856_thermocouple_read()
204 /* Check for over/under voltage or open circuit fault */ in max31856_thermocouple_read()
206 return -EIO; in max31856_thermocouple_read()
225 switch (chan->channel2) { in max31856_read_raw()
240 *val = 1 << data->averaging; in max31856_read_raw()
243 *val = max31856_tc_types[data->thermocouple_type]; in max31856_read_raw()
246 ret = -EINVAL; in max31856_read_raw()
275 return -EINVAL; in max31856_write_raw()
276 msb = fls(val) - 1; in max31856_write_raw()
281 data->averaging = msb; in max31856_write_raw()
286 int tc_type = -1; in max31856_write_raw()
296 return -EINVAL; in max31856_write_raw()
298 data->thermocouple_type = tc_type; in max31856_write_raw()
303 return -EINVAL; in max31856_write_raw()
347 return sprintf(buf, "%d\n", data->filter_50hz ? 50 : 60); in show_filter()
366 data->filter_50hz = true; in set_filter()
369 data->filter_50hz = false; in set_filter()
372 return -EINVAL; in set_filter()
409 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*data)); in max31856_probe()
411 return -ENOMEM; in max31856_probe()
414 data->spi = spi; in max31856_probe()
415 data->filter_50hz = false; in max31856_probe()
419 indio_dev->info = &max31856_info; in max31856_probe()
420 indio_dev->name = id->name; in max31856_probe()
421 indio_dev->modes = INDIO_DIRECT_MODE; in max31856_probe()
422 indio_dev->channels = max31856_channels; in max31856_probe()
423 indio_dev->num_channels = ARRAY_SIZE(max31856_channels); in max31856_probe()
425 ret = of_property_read_u32(spi->dev.of_node, "thermocouple-type", in max31856_probe()
426 &data->thermocouple_type); in max31856_probe()
429 dev_info(&spi->dev, in max31856_probe()
430 "Could not read thermocouple type DT property, configuring as a K-Type\n"); in max31856_probe()
431 data->thermocouple_type = THERMOCOUPLE_TYPE_K; in max31856_probe()
438 switch (data->thermocouple_type) { in max31856_probe()
449 dev_err(&spi->dev, in max31856_probe()
450 "error: thermocouple-type %u not supported by max31856\n" in max31856_probe()
451 , data->thermocouple_type); in max31856_probe()
452 return -EINVAL; in max31856_probe()
457 dev_err(&spi->dev, "error: Failed to configure max31856\n"); in max31856_probe()
461 return devm_iio_device_register(&spi->dev, indio_dev); in max31856_probe()