Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: temperature: tmp117: add TI TMP116 support

The TMP116 is the predecessor of the TMP117. The TMP116 don't support
custom offset calibration data, instead this register is used as generic
EEPROM storage as well.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20230228090518.529811-5-m.felsch@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Marco Felsch and committed by
Jonathan Cameron
0cd2889d 9225efe0

+19 -1
+19 -1
drivers/iio/temperature/tmp117.c
··· 32 32 #define TMP117_REG_DEVICE_ID 0xF 33 33 34 34 #define TMP117_RESOLUTION_10UC 78125 35 - #define TMP117_DEVICE_ID 0x0117 36 35 #define MICRODEGREE_PER_10MILLIDEGREE 10000 36 + 37 + #define TMP116_DEVICE_ID 0x1116 38 + #define TMP117_DEVICE_ID 0x0117 37 39 38 40 struct tmp117_data { 39 41 struct i2c_client *client; ··· 111 109 }, 112 110 }; 113 111 112 + static const struct iio_chan_spec tmp116_channels[] = { 113 + { 114 + .type = IIO_TEMP, 115 + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 116 + BIT(IIO_CHAN_INFO_SCALE), 117 + }, 118 + }; 119 + 114 120 static const struct iio_info tmp117_info = { 115 121 .read_raw = tmp117_read_raw, 116 122 .write_raw = tmp117_write_raw, ··· 135 125 return dev_id; 136 126 137 127 switch (dev_id) { 128 + case TMP116_DEVICE_ID: 138 129 case TMP117_DEVICE_ID: 139 130 return dev_id; 140 131 } ··· 183 172 indio_dev->info = &tmp117_info; 184 173 185 174 switch (dev_id) { 175 + case TMP116_DEVICE_ID: 176 + indio_dev->channels = tmp116_channels; 177 + indio_dev->num_channels = ARRAY_SIZE(tmp116_channels); 178 + indio_dev->name = "tmp116"; 179 + break; 186 180 case TMP117_DEVICE_ID: 187 181 indio_dev->channels = tmp117_channels; 188 182 indio_dev->num_channels = ARRAY_SIZE(tmp117_channels); ··· 199 183 } 200 184 201 185 static const struct of_device_id tmp117_of_match[] = { 186 + { .compatible = "ti,tmp116", .data = (void *)TMP116_DEVICE_ID }, 202 187 { .compatible = "ti,tmp117", .data = (void *)TMP117_DEVICE_ID }, 203 188 { } 204 189 }; 205 190 MODULE_DEVICE_TABLE(of, tmp117_of_match); 206 191 207 192 static const struct i2c_device_id tmp117_id[] = { 193 + { "tmp116", TMP116_DEVICE_ID }, 208 194 { "tmp117", TMP117_DEVICE_ID }, 209 195 { } 210 196 };