tmp006.c (8d05abfaeff52bdf66aba3a3a337dcdbdb4911bf) tmp006.c (57f7d509c8f60e66d69ac216a03ef39c5ea1ddb8)
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.

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

31#define TMP006_DEVICE_ID 0xff
32
33#define TMP006_TAMBIENT_SHIFT 2
34
35#define TMP006_CONFIG_RESET BIT(15)
36#define TMP006_CONFIG_DRDY_EN BIT(8)
37#define TMP006_CONFIG_DRDY BIT(7)
38
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.

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

31#define TMP006_DEVICE_ID 0xff
32
33#define TMP006_TAMBIENT_SHIFT 2
34
35#define TMP006_CONFIG_RESET BIT(15)
36#define TMP006_CONFIG_DRDY_EN BIT(8)
37#define TMP006_CONFIG_DRDY BIT(7)
38
39#define TMP006_CONFIG_MOD_MASK 0x7000
39#define TMP006_CONFIG_MOD_MASK GENMASK(14, 12)
40
40
41#define TMP006_CONFIG_CR_MASK 0x0e00
41#define TMP006_CONFIG_CR_MASK GENMASK(11, 9)
42#define TMP006_CONFIG_CR_SHIFT 9
43
44#define TMP006_MANUFACTURER_MAGIC 0x5449
45#define TMP006_DEVICE_MAGIC 0x0067
46
47struct tmp006_data {
48 struct i2c_client *client;
49 u16 config;

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

127 struct iio_chan_spec const *chan,
128 int val,
129 int val2,
130 long mask)
131{
132 struct tmp006_data *data = iio_priv(indio_dev);
133 int i;
134
42#define TMP006_CONFIG_CR_SHIFT 9
43
44#define TMP006_MANUFACTURER_MAGIC 0x5449
45#define TMP006_DEVICE_MAGIC 0x0067
46
47struct tmp006_data {
48 struct i2c_client *client;
49 u16 config;

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

127 struct iio_chan_spec const *chan,
128 int val,
129 int val2,
130 long mask)
131{
132 struct tmp006_data *data = iio_priv(indio_dev);
133 int i;
134
135 if (mask != IIO_CHAN_INFO_SAMP_FREQ)
136 return -EINVAL;
137
138 for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
139 if ((val == tmp006_freqs[i][0]) &&
140 (val2 == tmp006_freqs[i][1])) {
141 data->config &= ~TMP006_CONFIG_CR_MASK;
142 data->config |= i << TMP006_CONFIG_CR_SHIFT;
143
144 return i2c_smbus_write_word_swapped(data->client,
145 TMP006_CONFIG,

--- 148 unchanged lines hidden ---
135 for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
136 if ((val == tmp006_freqs[i][0]) &&
137 (val2 == tmp006_freqs[i][1])) {
138 data->config &= ~TMP006_CONFIG_CR_MASK;
139 data->config |= i << TMP006_CONFIG_CR_SHIFT;
140
141 return i2c_smbus_write_word_swapped(data->client,
142 TMP006_CONFIG,

--- 148 unchanged lines hidden ---