10 #include <linux/device.h>
11 #include <linux/kernel.h>
12 #include <linux/module.h>
18 #define ADT7316_SPI_MAX_FREQ_HZ 5000000
19 #define ADT7316_SPI_CMD_READ 0x91
20 #define ADT7316_SPI_CMD_WRITE 0x90
38 ret = spi_write(spi_dev, cmd, 2);
40 dev_err(&spi_dev->
dev,
"SPI fail to select reg\n");
48 dev_err(&spi_dev->
dev,
"SPI read data error\n");
66 for (i = 0; i <
count; i++)
69 ret = spi_write(spi_dev, buf, count + 2);
78 static int adt7316_spi_read(
void *client,
u8 reg,
u8 *data)
80 return adt7316_spi_multi_read(client, reg, 1, data);
83 static int adt7316_spi_write(
void *client,
u8 reg,
u8 val)
85 return adt7316_spi_multi_write(client, reg, 1, &val);
98 .read = adt7316_spi_read,
99 .write = adt7316_spi_write,
100 .multi_read = adt7316_spi_multi_read,
101 .multi_write = adt7316_spi_multi_write,
112 adt7316_spi_write(spi_dev, 0, 0);
113 adt7316_spi_write(spi_dev, 0, 0);
114 adt7316_spi_write(spi_dev, 0, 0);
142 .probe = adt7316_spi_probe,
144 .id_table = adt7316_spi_id,
150 "ADT7516/7/9 digital temperature sensor, ADC and DAC");