Skip to contentSkip to conversation

iio:adc:mcp3422 Fix incorrect scales table

PATCH Applied Angelo Compagnucci 2 participants 2 messages Feb 4, 2015 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio:adc:mcp3422 Fix incorrect scales table

This patch fixes uncorrect order of mcp3422_scales table, the values was erroneously transposed.
It removes also an unused array and a wrong comment.

---
 drivers/iio/adc/mcp3422.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/iio/adc/mcp3422.c +4 -13
index 5167225..b96c636 100644
@@ -58,20 +58,11 @@
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
 	}
 
-/* LSB is in nV to eliminate floating point */
-static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625};
-
-/*
- *  scales calculated as:
- *  rates_to_lsb[sample_rate] / (1 << pga);
- *  pga is 1 for 0, 2
- */
-
 static const int mcp3422_scales[4][4] = {
-	{ 1000000, 250000, 62500, 15625 },
-	{ 500000 , 125000, 31250, 7812 },
-	{ 250000 , 62500 , 15625, 3906 },
-	{ 125000 , 31250 , 7812 , 1953 } };
+	{ 1000000, 500000, 250000, 125000 },
+	{ 250000 , 125000, 62500 , 31250  },
+	{ 62500  , 31250 , 15625 , 7812   },
+	{ 15625  , 7812  , 3906  , 1953   } };
 
 /* Constant msleep times for data acquisitions */
 static const int mcp3422_read_times[4] = {
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Angelo Compagnucci

This patch fixes uncorrect order of mcp3422_scales table, the values was erroneously transposed.
It removes also an unused array and a wrong comment.

Applied to the fixes-togreg branch of iio.git. Given timing this will got to Greg after the merge windows closes.

I'm travelling without my ssh key so this won't hit git.kernel.org until at least Sunday.

(Mind you Manchester airport's wifi isn't working in the bar, so who knows when the email will go out!)

Quoted 34 lines
---
 drivers/iio/adc/mcp3422.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/iio/adc/mcp3422.c +4 -13
index 5167225..b96c636 100644
@@ -58,20 +58,11 @@
 		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
 	}
 
-/* LSB is in nV to eliminate floating point */
-static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625};
-
-/*
- *  scales calculated as:
- *  rates_to_lsb[sample_rate] / (1 << pga);
- *  pga is 1 for 0, 2
- */
-
 static const int mcp3422_scales[4][4] = {
-	{ 1000000, 250000, 62500, 15625 },
-	{ 500000 , 125000, 31250, 7812 },
-	{ 250000 , 62500 , 15625, 3906 },
-	{ 125000 , 31250 , 7812 , 1953 } };
+	{ 1000000, 500000, 250000, 125000 },
+	{ 250000 , 125000, 62500 , 31250  },
+	{ 62500  , 31250 , 15625 , 7812   },
+	{ 15625  , 7812  , 3906  , 1953   } };
 
 /* Constant msleep times for data acquisitions */
 static const int mcp3422_read_times[4] = {