* [PATCH] iio:magnetometer: bugfix magnetometers gain values
@ 2014-09-10 12:55 Denis CIOCCA
2014-09-14 17:21 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Denis CIOCCA @ 2014-09-10 12:55 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Denis Ciocca
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>
---
drivers/iio/magnetometer/st_magn_core.c | 52 +++++++++++++++++++--------------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index a4b6413..68cae86 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -42,7 +42,8 @@
#define ST_MAGN_FS_AVL_5600MG 5600
#define ST_MAGN_FS_AVL_8000MG 8000
#define ST_MAGN_FS_AVL_8100MG 8100
-#define ST_MAGN_FS_AVL_10000MG 10000
+#define ST_MAGN_FS_AVL_12000MG 12000
+#define ST_MAGN_FS_AVL_16000MG 16000
/* CUSTOM VALUES FOR SENSOR 1 */
#define ST_MAGN_1_WAI_EXP 0x3c
@@ -69,20 +70,20 @@
#define ST_MAGN_1_FS_AVL_4700_VAL 0x05
#define ST_MAGN_1_FS_AVL_5600_VAL 0x06
#define ST_MAGN_1_FS_AVL_8100_VAL 0x07
-#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100
-#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855
-#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670
-#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450
-#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400
-#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330
-#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230
-#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980
-#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760
-#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600
-#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400
-#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355
-#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295
-#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205
+#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909
+#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169
+#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492
+#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222
+#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500
+#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030
+#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347
+#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020
+#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315
+#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666
+#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500
+#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816
+#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389
+#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878
#define ST_MAGN_1_MULTIREAD_BIT false
/* CUSTOM VALUES FOR SENSOR 2 */
@@ -105,10 +106,12 @@
#define ST_MAGN_2_FS_MASK 0x60
#define ST_MAGN_2_FS_AVL_4000_VAL 0x00
#define ST_MAGN_2_FS_AVL_8000_VAL 0x01
-#define ST_MAGN_2_FS_AVL_10000_VAL 0x02
-#define ST_MAGN_2_FS_AVL_4000_GAIN 430
-#define ST_MAGN_2_FS_AVL_8000_GAIN 230
-#define ST_MAGN_2_FS_AVL_10000_GAIN 230
+#define ST_MAGN_2_FS_AVL_12000_VAL 0x02
+#define ST_MAGN_2_FS_AVL_16000_VAL 0x03
+#define ST_MAGN_2_FS_AVL_4000_GAIN 146
+#define ST_MAGN_2_FS_AVL_8000_GAIN 292
+#define ST_MAGN_2_FS_AVL_12000_GAIN 438
+#define ST_MAGN_2_FS_AVL_16000_GAIN 584
#define ST_MAGN_2_MULTIREAD_BIT false
#define ST_MAGN_2_OUT_X_L_ADDR 0x28
#define ST_MAGN_2_OUT_Y_L_ADDR 0x2a
@@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = {
.gain = ST_MAGN_2_FS_AVL_8000_GAIN,
},
[2] = {
- .num = ST_MAGN_FS_AVL_10000MG,
- .value = ST_MAGN_2_FS_AVL_10000_VAL,
- .gain = ST_MAGN_2_FS_AVL_10000_GAIN,
+ .num = ST_MAGN_FS_AVL_12000MG,
+ .value = ST_MAGN_2_FS_AVL_12000_VAL,
+ .gain = ST_MAGN_2_FS_AVL_12000_GAIN,
+ },
+ [3] = {
+ .num = ST_MAGN_FS_AVL_16000MG,
+ .value = ST_MAGN_2_FS_AVL_16000_VAL,
+ .gain = ST_MAGN_2_FS_AVL_16000_GAIN,
},
},
},
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio:magnetometer: bugfix magnetometers gain values
2014-09-10 12:55 [PATCH] iio:magnetometer: bugfix magnetometers gain values Denis CIOCCA
@ 2014-09-14 17:21 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2014-09-14 17:21 UTC (permalink / raw)
To: Denis CIOCCA; +Cc: linux-iio
On 10/09/14 13:55, Denis CIOCCA wrote:
> 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>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
> ---
> drivers/iio/magnetometer/st_magn_core.c | 52 +++++++++++++++++++--------------
> 1 file changed, 30 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
> index a4b6413..68cae86 100644
> --- a/drivers/iio/magnetometer/st_magn_core.c
> +++ b/drivers/iio/magnetometer/st_magn_core.c
> @@ -42,7 +42,8 @@
> #define ST_MAGN_FS_AVL_5600MG 5600
> #define ST_MAGN_FS_AVL_8000MG 8000
> #define ST_MAGN_FS_AVL_8100MG 8100
> -#define ST_MAGN_FS_AVL_10000MG 10000
> +#define ST_MAGN_FS_AVL_12000MG 12000
> +#define ST_MAGN_FS_AVL_16000MG 16000
>
> /* CUSTOM VALUES FOR SENSOR 1 */
> #define ST_MAGN_1_WAI_EXP 0x3c
> @@ -69,20 +70,20 @@
> #define ST_MAGN_1_FS_AVL_4700_VAL 0x05
> #define ST_MAGN_1_FS_AVL_5600_VAL 0x06
> #define ST_MAGN_1_FS_AVL_8100_VAL 0x07
> -#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100
> -#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855
> -#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670
> -#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450
> -#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400
> -#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330
> -#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230
> -#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980
> -#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760
> -#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600
> -#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400
> -#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355
> -#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295
> -#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205
> +#define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909
> +#define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169
> +#define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492
> +#define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222
> +#define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500
> +#define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030
> +#define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347
> +#define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020
> +#define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315
> +#define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666
> +#define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500
> +#define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816
> +#define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389
> +#define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878
> #define ST_MAGN_1_MULTIREAD_BIT false
>
> /* CUSTOM VALUES FOR SENSOR 2 */
> @@ -105,10 +106,12 @@
> #define ST_MAGN_2_FS_MASK 0x60
> #define ST_MAGN_2_FS_AVL_4000_VAL 0x00
> #define ST_MAGN_2_FS_AVL_8000_VAL 0x01
> -#define ST_MAGN_2_FS_AVL_10000_VAL 0x02
> -#define ST_MAGN_2_FS_AVL_4000_GAIN 430
> -#define ST_MAGN_2_FS_AVL_8000_GAIN 230
> -#define ST_MAGN_2_FS_AVL_10000_GAIN 230
> +#define ST_MAGN_2_FS_AVL_12000_VAL 0x02
> +#define ST_MAGN_2_FS_AVL_16000_VAL 0x03
> +#define ST_MAGN_2_FS_AVL_4000_GAIN 146
> +#define ST_MAGN_2_FS_AVL_8000_GAIN 292
> +#define ST_MAGN_2_FS_AVL_12000_GAIN 438
> +#define ST_MAGN_2_FS_AVL_16000_GAIN 584
> #define ST_MAGN_2_MULTIREAD_BIT false
> #define ST_MAGN_2_OUT_X_L_ADDR 0x28
> #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a
> @@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = {
> .gain = ST_MAGN_2_FS_AVL_8000_GAIN,
> },
> [2] = {
> - .num = ST_MAGN_FS_AVL_10000MG,
> - .value = ST_MAGN_2_FS_AVL_10000_VAL,
> - .gain = ST_MAGN_2_FS_AVL_10000_GAIN,
> + .num = ST_MAGN_FS_AVL_12000MG,
> + .value = ST_MAGN_2_FS_AVL_12000_VAL,
> + .gain = ST_MAGN_2_FS_AVL_12000_GAIN,
> + },
> + [3] = {
> + .num = ST_MAGN_FS_AVL_16000MG,
> + .value = ST_MAGN_2_FS_AVL_16000_VAL,
> + .gain = ST_MAGN_2_FS_AVL_16000_GAIN,
> },
> },
> },
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-14 17:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 12:55 [PATCH] iio:magnetometer: bugfix magnetometers gain values Denis CIOCCA
2014-09-14 17:21 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).