tmp006.c (b7d3622a39fde7658170b7f3cf6c6889bb8db30d) tmp006.c (49064b5a618df70dbe1ba58a122fd218c58d381d)
1/*
2 * tmp006.c - Support for TI TMP006 IR thermopile sensor
3 *
4 * Copyright (c) 2013 Peter Meerwald <pmeerw@pmeerw.net>
5 *
6 * This file is subject to the terms and conditions of version 2 of
7 * the GNU General Public License. See the file COPYING in the main
8 * directory of this archive for more details.

--- 27 unchanged lines hidden (view full) ---

36#define TMP006_CONFIG_DRDY_EN BIT(8)
37#define TMP006_CONFIG_DRDY BIT(7)
38
39#define TMP006_CONFIG_MOD_MASK 0x7000
40
41#define TMP006_CONFIG_CR_MASK 0x0e00
42#define TMP006_CONFIG_CR_SHIFT 9
43
1/*
2 * tmp006.c - Support for TI TMP006 IR thermopile sensor
3 *
4 * Copyright (c) 2013 Peter Meerwald <pmeerw@pmeerw.net>
5 *
6 * This file is subject to the terms and conditions of version 2 of
7 * the GNU General Public License. See the file COPYING in the main
8 * directory of this archive for more details.

--- 27 unchanged lines hidden (view full) ---

36#define TMP006_CONFIG_DRDY_EN BIT(8)
37#define TMP006_CONFIG_DRDY BIT(7)
38
39#define TMP006_CONFIG_MOD_MASK 0x7000
40
41#define TMP006_CONFIG_CR_MASK 0x0e00
42#define TMP006_CONFIG_CR_SHIFT 9
43
44#define MANUFACTURER_MAGIC 0x5449
45#define DEVICE_MAGIC 0x0067
44#define TMP006_MANUFACTURER_MAGIC 0x5449
45#define TMP006_DEVICE_MAGIC 0x0067
46
47struct tmp006_data {
48 struct i2c_client *client;
49 u16 config;
50};
51
52static int tmp006_read_measurement(struct tmp006_data *data, u8 reg)
53{

--- 132 unchanged lines hidden (view full) ---

186 mid = i2c_smbus_read_word_swapped(client, TMP006_MANUFACTURER_ID);
187 if (mid < 0)
188 return false;
189
190 did = i2c_smbus_read_word_swapped(client, TMP006_DEVICE_ID);
191 if (did < 0)
192 return false;
193
46
47struct tmp006_data {
48 struct i2c_client *client;
49 u16 config;
50};
51
52static int tmp006_read_measurement(struct tmp006_data *data, u8 reg)
53{

--- 132 unchanged lines hidden (view full) ---

186 mid = i2c_smbus_read_word_swapped(client, TMP006_MANUFACTURER_ID);
187 if (mid < 0)
188 return false;
189
190 did = i2c_smbus_read_word_swapped(client, TMP006_DEVICE_ID);
191 if (did < 0)
192 return false;
193
194 return mid == MANUFACTURER_MAGIC && did == DEVICE_MAGIC;
194 return mid == TMP006_MANUFACTURER_MAGIC && did == TMP006_DEVICE_MAGIC;
195}
196
197static int tmp006_probe(struct i2c_client *client,
198 const struct i2c_device_id *id)
199{
200 struct iio_dev *indio_dev;
201 struct tmp006_data *data;
202 int ret;

--- 88 unchanged lines hidden ---
195}
196
197static int tmp006_probe(struct i2c_client *client,
198 const struct i2c_device_id *id)
199{
200 struct iio_dev *indio_dev;
201 struct tmp006_data *data;
202 int ret;

--- 88 unchanged lines hidden ---