aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/pressure
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-09-10 08:49:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-09-14 16:17:16 -0400
commit302fbd50ef31a93aee67061ed4594dceb94b0783 (patch)
tree10175092c22966105fd6644ab2e29840c1631b46 /drivers/iio/pressure
parent5bb8e72d5de375c855ce5ec9b818c7836feeb301 (diff)
iio: pressure-core: st: Describe LPS331AP defines by name
They're currently named *_1_*, for 'Sensor 1', but the code will be much more readable if we use the naming convention *_LPS331AP_* instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/pressure')
-rw-r--r--drivers/iio/pressure/st_pressure_core.c94
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 16cfbc530769..541340b874f1 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -36,94 +36,92 @@
36 ST_PRESS_LSB_PER_CELSIUS) 36 ST_PRESS_LSB_PER_CELSIUS)
37#define ST_PRESS_NUMBER_DATA_CHANNELS 1 37#define ST_PRESS_NUMBER_DATA_CHANNELS 1
38 38
39/* DEFAULT VALUE FOR SENSORS */
40#define ST_PRESS_DEFAULT_OUT_XL_ADDR 0x28
41#define ST_TEMP_DEFAULT_OUT_L_ADDR 0x2b
42
43/* FULLSCALE */ 39/* FULLSCALE */
44#define ST_PRESS_FS_AVL_1260MB 1260 40#define ST_PRESS_FS_AVL_1260MB 1260
45 41
46/* CUSTOM VALUES FOR SENSOR 1 */ 42/* CUSTOM VALUES FOR LPS331AP SENSOR */
47#define ST_PRESS_1_WAI_EXP 0xbb 43#define ST_PRESS_LPS331AP_WAI_EXP 0xbb
48#define ST_PRESS_1_ODR_ADDR 0x20 44#define ST_PRESS_LPS331AP_ODR_ADDR 0x20
49#define ST_PRESS_1_ODR_MASK 0x70 45#define ST_PRESS_LPS331AP_ODR_MASK 0x70
50#define ST_PRESS_1_ODR_AVL_1HZ_VAL 0x01 46#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL 0x01
51#define ST_PRESS_1_ODR_AVL_7HZ_VAL 0x05 47#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL 0x05
52#define ST_PRESS_1_ODR_AVL_13HZ_VAL 0x06 48#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL 0x06
53#define ST_PRESS_1_ODR_AVL_25HZ_VAL 0x07 49#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL 0x07
54#define ST_PRESS_1_PW_ADDR 0x20 50#define ST_PRESS_LPS331AP_PW_ADDR 0x20
55#define ST_PRESS_1_PW_MASK 0x80 51#define ST_PRESS_LPS331AP_PW_MASK 0x80
56#define ST_PRESS_1_FS_ADDR 0x23 52#define ST_PRESS_LPS331AP_FS_ADDR 0x23
57#define ST_PRESS_1_FS_MASK 0x30 53#define ST_PRESS_LPS331AP_FS_MASK 0x30
58#define ST_PRESS_1_FS_AVL_1260_VAL 0x00 54#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00
59#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE 55#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE
60#define ST_PRESS_1_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE 56#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE
61#define ST_PRESS_1_BDU_ADDR 0x20 57#define ST_PRESS_LPS331AP_BDU_ADDR 0x20
62#define ST_PRESS_1_BDU_MASK 0x04 58#define ST_PRESS_LPS331AP_BDU_MASK 0x04
63#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 59#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22
64#define ST_PRESS_1_DRDY_IRQ_INT1_MASK 0x04 60#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK 0x04
65#define ST_PRESS_1_DRDY_IRQ_INT2_MASK 0x20 61#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK 0x20
66#define ST_PRESS_1_MULTIREAD_BIT true 62#define ST_PRESS_LPS331AP_MULTIREAD_BIT true
67#define ST_PRESS_1_TEMP_OFFSET 42500 63#define ST_PRESS_LPS331AP_TEMP_OFFSET 42500
64#define ST_PRESS_LPS331AP_OUT_XL_ADDR 0x28
65#define ST_TEMP_LPS331AP_OUT_L_ADDR 0x2b
68 66
69static const struct iio_chan_spec st_press_channels[] = { 67static const struct iio_chan_spec st_press_channels[] = {
70 ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE, 68 ST_SENSORS_LSM_CHANNELS(IIO_PRESSURE,
71 BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), 69 BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
72 ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24, 70 ST_SENSORS_SCAN_X, 0, IIO_NO_MOD, 'u', IIO_LE, 24, 24,
73 ST_PRESS_DEFAULT_OUT_XL_ADDR), 71 ST_PRESS_LPS331AP_OUT_XL_ADDR),
74 ST_SENSORS_LSM_CHANNELS(IIO_TEMP, 72 ST_SENSORS_LSM_CHANNELS(IIO_TEMP,
75 BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | 73 BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) |
76 BIT(IIO_CHAN_INFO_OFFSET), 74 BIT(IIO_CHAN_INFO_OFFSET),
77 -1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16, 75 -1, 0, IIO_NO_MOD, 's', IIO_LE, 16, 16,
78 ST_TEMP_DEFAULT_OUT_L_ADDR), 76 ST_TEMP_LPS331AP_OUT_L_ADDR),
79 IIO_CHAN_SOFT_TIMESTAMP(1) 77 IIO_CHAN_SOFT_TIMESTAMP(1)
80}; 78};
81 79
82static const struct st_sensors st_press_sensors[] = { 80static const struct st_sensors st_press_sensors[] = {
83 { 81 {
84 .wai = ST_PRESS_1_WAI_EXP, 82 .wai = ST_PRESS_LPS331AP_WAI_EXP,
85 .sensors_supported = { 83 .sensors_supported = {
86 [0] = LPS331AP_PRESS_DEV_NAME, 84 [0] = LPS331AP_PRESS_DEV_NAME,
87 }, 85 },
88 .ch = (struct iio_chan_spec *)st_press_channels, 86 .ch = (struct iio_chan_spec *)st_press_channels,
89 .odr = { 87 .odr = {
90 .addr = ST_PRESS_1_ODR_ADDR, 88 .addr = ST_PRESS_LPS331AP_ODR_ADDR,
91 .mask = ST_PRESS_1_ODR_MASK, 89 .mask = ST_PRESS_LPS331AP_ODR_MASK,
92 .odr_avl = { 90 .odr_avl = {
93 { 1, ST_PRESS_1_ODR_AVL_1HZ_VAL, }, 91 { 1, ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL, },
94 { 7, ST_PRESS_1_ODR_AVL_7HZ_VAL, }, 92 { 7, ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL, },
95 { 13, ST_PRESS_1_ODR_AVL_13HZ_VAL, }, 93 { 13, ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL, },
96 { 25, ST_PRESS_1_ODR_AVL_25HZ_VAL, }, 94 { 25, ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL, },
97 }, 95 },
98 }, 96 },
99 .pw = { 97 .pw = {
100 .addr = ST_PRESS_1_PW_ADDR, 98 .addr = ST_PRESS_LPS331AP_PW_ADDR,
101 .mask = ST_PRESS_1_PW_MASK, 99 .mask = ST_PRESS_LPS331AP_PW_MASK,
102 .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, 100 .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
103 .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, 101 .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
104 }, 102 },
105 .fs = { 103 .fs = {
106 .addr = ST_PRESS_1_FS_ADDR, 104 .addr = ST_PRESS_LPS331AP_FS_ADDR,
107 .mask = ST_PRESS_1_FS_MASK, 105 .mask = ST_PRESS_LPS331AP_FS_MASK,
108 .fs_avl = { 106 .fs_avl = {
109 [0] = { 107 [0] = {
110 .num = ST_PRESS_FS_AVL_1260MB, 108 .num = ST_PRESS_FS_AVL_1260MB,
111 .value = ST_PRESS_1_FS_AVL_1260_VAL, 109 .value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL,
112 .gain = ST_PRESS_1_FS_AVL_1260_GAIN, 110 .gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN,
113 .gain2 = ST_PRESS_1_FS_AVL_TEMP_GAIN, 111 .gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN,
114 }, 112 },
115 }, 113 },
116 }, 114 },
117 .bdu = { 115 .bdu = {
118 .addr = ST_PRESS_1_BDU_ADDR, 116 .addr = ST_PRESS_LPS331AP_BDU_ADDR,
119 .mask = ST_PRESS_1_BDU_MASK, 117 .mask = ST_PRESS_LPS331AP_BDU_MASK,
120 }, 118 },
121 .drdy_irq = { 119 .drdy_irq = {
122 .addr = ST_PRESS_1_DRDY_IRQ_ADDR, 120 .addr = ST_PRESS_LPS331AP_DRDY_IRQ_ADDR,
123 .mask_int1 = ST_PRESS_1_DRDY_IRQ_INT1_MASK, 121 .mask_int1 = ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK,
124 .mask_int2 = ST_PRESS_1_DRDY_IRQ_INT2_MASK, 122 .mask_int2 = ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK,
125 }, 123 },
126 .multi_read_bit = ST_PRESS_1_MULTIREAD_BIT, 124 .multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT,
127 .bootime = 2, 125 .bootime = 2,
128 }, 126 },
129}; 127};