aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorDenis CIOCCA <denis.ciocca@st.com>2014-10-09 08:55:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-09-14 13:21:23 -0400
commita31d0928999fbf33b3a6042e8bcb7b7f7e07d094 (patch)
tree9f5a7eb318b6597020d007470bae3ef9d9c5c253 /drivers/iio
parentd4f51956ac8ad302db9b0c4e4232775b1baa7b44 (diff)
iio:magnetometer: bugfix magnetometers gain values
This patch fix gains values. The first driver was designed using engineering samples, in mass production the values are changed. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/magnetometer/st_magn_core.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index a4b64130ac2f..68cae86dbd29 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -42,7 +42,8 @@
42#define ST_MAGN_FS_AVL_5600MG 5600 42#define ST_MAGN_FS_AVL_5600MG 5600
43#define ST_MAGN_FS_AVL_8000MG 8000 43#define ST_MAGN_FS_AVL_8000MG 8000
44#define ST_MAGN_FS_AVL_8100MG 8100 44#define ST_MAGN_FS_AVL_8100MG 8100
45#define ST_MAGN_FS_AVL_10000MG 10000 45#define ST_MAGN_FS_AVL_12000MG 12000
46#define ST_MAGN_FS_AVL_16000MG 16000
46 47
47/* CUSTOM VALUES FOR SENSOR 1 */ 48/* CUSTOM VALUES FOR SENSOR 1 */
48#define ST_MAGN_1_WAI_EXP 0x3c 49#define ST_MAGN_1_WAI_EXP 0x3c
@@ -69,20 +70,20 @@
69#define ST_MAGN_1_FS_AVL_4700_VAL 0x05 70#define ST_MAGN_1_FS_AVL_4700_VAL 0x05
70#define ST_MAGN_1_FS_AVL_5600_VAL 0x06 71#define ST_MAGN_1_FS_AVL_5600_VAL 0x06
71#define ST_MAGN_1_FS_AVL_8100_VAL 0x07 72#define ST_MAGN_1_FS_AVL_8100_VAL 0x07
72#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100 73#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909
73#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855 74#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169
74#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670 75#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492
75#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450 76#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222
76#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400 77#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500
77#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330 78#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030
78#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230 79#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347
79#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980 80#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020
80#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760 81#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315
81#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600 82#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666
82#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400 83#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500
83#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355 84#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816
84#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295 85#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389
85#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205 86#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878
86#define ST_MAGN_1_MULTIREAD_BIT false 87#define ST_MAGN_1_MULTIREAD_BIT false
87 88
88/* CUSTOM VALUES FOR SENSOR 2 */ 89/* CUSTOM VALUES FOR SENSOR 2 */
@@ -105,10 +106,12 @@
105#define ST_MAGN_2_FS_MASK 0x60 106#define ST_MAGN_2_FS_MASK 0x60
106#define ST_MAGN_2_FS_AVL_4000_VAL 0x00 107#define ST_MAGN_2_FS_AVL_4000_VAL 0x00
107#define ST_MAGN_2_FS_AVL_8000_VAL 0x01 108#define ST_MAGN_2_FS_AVL_8000_VAL 0x01
108#define ST_MAGN_2_FS_AVL_10000_VAL 0x02 109#define ST_MAGN_2_FS_AVL_12000_VAL 0x02
109#define ST_MAGN_2_FS_AVL_4000_GAIN 430 110#define ST_MAGN_2_FS_AVL_16000_VAL 0x03
110#define ST_MAGN_2_FS_AVL_8000_GAIN 230 111#define ST_MAGN_2_FS_AVL_4000_GAIN 146
111#define ST_MAGN_2_FS_AVL_10000_GAIN 230 112#define ST_MAGN_2_FS_AVL_8000_GAIN 292
113#define ST_MAGN_2_FS_AVL_12000_GAIN 438
114#define ST_MAGN_2_FS_AVL_16000_GAIN 584
112#define ST_MAGN_2_MULTIREAD_BIT false 115#define ST_MAGN_2_MULTIREAD_BIT false
113#define ST_MAGN_2_OUT_X_L_ADDR 0x28 116#define ST_MAGN_2_OUT_X_L_ADDR 0x28
114#define ST_MAGN_2_OUT_Y_L_ADDR 0x2a 117#define ST_MAGN_2_OUT_Y_L_ADDR 0x2a
@@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = {
266 .gain = ST_MAGN_2_FS_AVL_8000_GAIN, 269 .gain = ST_MAGN_2_FS_AVL_8000_GAIN,
267 }, 270 },
268 [2] = { 271 [2] = {
269 .num = ST_MAGN_FS_AVL_10000MG, 272 .num = ST_MAGN_FS_AVL_12000MG,
270 .value = ST_MAGN_2_FS_AVL_10000_VAL, 273 .value = ST_MAGN_2_FS_AVL_12000_VAL,
271 .gain = ST_MAGN_2_FS_AVL_10000_GAIN, 274 .gain = ST_MAGN_2_FS_AVL_12000_GAIN,
275 },
276 [3] = {
277 .num = ST_MAGN_FS_AVL_16000MG,
278 .value = ST_MAGN_2_FS_AVL_16000_VAL,
279 .gain = ST_MAGN_2_FS_AVL_16000_GAIN,
272 }, 280 },
273 }, 281 },
274 }, 282 },