Title: [9092] trunk/drivers/staging/iio/meter/ade7758_core.c: ade7758: fix sampling frequency error
Revision
9092
Author
bhsong
Date
2010-08-19 03:57:24 -0400 (Thu, 19 Aug 2010)

Log Message

ade7758: fix sampling frequency error

reported-by: Allister Mannion <[email protected]>

refer to:
http://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=42091&action="">

Modified Paths

Diff

Modified: trunk/drivers/staging/iio/meter/ade7758_core.c (9091 => 9092)


--- trunk/drivers/staging/iio/meter/ade7758_core.c	2010-08-18 09:17:25 UTC (rev 9091)
+++ trunk/drivers/staging/iio/meter/ade7758_core.c	2010-08-19 07:57:24 UTC (rev 9092)
@@ -497,8 +497,8 @@
 	if (ret)
 		return ret;
 
-	t = (t >> 3) & 0x3;
-	sps = 26000 / (1 + t);
+	t = (t >> 5) & 0x3;
+	sps = 26040 / (1 << t);
 
 	len = sprintf(buf, "%d SPS\n", sps);
 	return len;
@@ -521,9 +521,9 @@
 
 	mutex_lock(&indio_dev->mlock);
 
-	t = (26000 / val);
+	t = (26040 / val);
 	if (t > 0)
-		t--;
+		t >>= 1;
 
 	if (t > 1)
 		st->us->max_speed_hz = ADE7758_SPI_SLOW;
@@ -536,8 +536,8 @@
 	if (ret)
 		goto out;
 
-	reg &= ~(3 << 3);
-	reg |= t << 3;
+	reg &= ~(5 << 3);
+	reg |= t << 5;
 
 	ret = ade7758_spi_write_reg_8(dev,
 			ADE7758_WAVMODE,
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to