Lines Matching +full:spi +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * max31722 - hwmon driver for Maxim Integrated MAX31722/MAX31723 SPI
10 #include <linux/hwmon-sysfs.h>
13 #include <linux/spi/spi.h>
27 u8 mode; member
30 static int max31722_set_mode(struct max31722_data *data, u8 mode) in max31722_set_mode() argument
33 struct spi_device *spi = data->spi_device; in max31722_set_mode() local
36 (data->mode & MAX31722_MODE_MASK) | mode in max31722_set_mode()
39 ret = spi_write(spi, &buf, sizeof(buf)); in max31722_set_mode()
41 dev_err(&spi->dev, "failed to set sensor mode.\n"); in max31722_set_mode()
44 data->mode = (data->mode & MAX31722_MODE_MASK) | mode; in max31722_set_mode()
55 ret = spi_w8r16(data->spi_device, MAX31722_REG_TEMP_LSB); in max31722_temp_show()
71 static int max31722_probe(struct spi_device *spi) in max31722_probe() argument
76 data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); in max31722_probe()
78 return -ENOMEM; in max31722_probe()
80 spi_set_drvdata(spi, data); in max31722_probe()
81 data->spi_device = spi; in max31722_probe()
86 data->mode = MAX31722_MODE_CONTINUOUS | MAX31722_RESOLUTION_12BIT; in max31722_probe()
91 data->hwmon_dev = hwmon_device_register_with_groups(&spi->dev, in max31722_probe()
92 spi->modalias, in max31722_probe()
95 if (IS_ERR(data->hwmon_dev)) { in max31722_probe()
97 return PTR_ERR(data->hwmon_dev); in max31722_probe()
103 static void max31722_remove(struct spi_device *spi) in max31722_remove() argument
105 struct max31722_data *data = spi_get_drvdata(spi); in max31722_remove()
108 hwmon_device_unregister(data->hwmon_dev); in max31722_remove()
113 dev_warn(&spi->dev, "Failed to put device in stand-by mode\n"); in max31722_remove()
139 MODULE_DEVICE_TABLE(spi, max31722_spi_id);