[PATCH 06/15] iio: ti_am335x_adc: Handle set to clear IRQENABLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Russ Dill <Russ.Dill@xxxxxx>

The driver is currently mishandling the IRQENABLE register. The driver
should write a 1 for bits it wishes to set, and a zero for bits it does not
wish to change. The read of the current register contents is not
necessary.

Write 0 = No action.
Read 0 = Interrupt disabled (masked).
Read 1 = Interrupt enabled.
Write 1 = Enable interrupt.

The current read/update/write method is currently not causing any
problems, but could cause confusion in the future.

Signed-off-by: Russ Dill <Russ.Dill@xxxxxx>
Signed-off-by: Zubair Lutfullah <zubair.lutfullah@xxxxxxxxx>
---
 drivers/iio/adc/ti_am335x_adc.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index c1b051c..b566e6a 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -207,7 +207,7 @@ static void tiadc_poll_handler(struct work_struct *work_s)
 		container_of(work_s, struct tiadc_device, poll_work);
 	struct iio_dev *idev = iio_priv_to_dev(adc_dev);
 	struct iio_buffer *buffer = idev->buffer;
-	unsigned int fifo1count, readx1, status;
+	unsigned int fifo1count, readx1;
 	int i;
 	u32 *inputbuffer;
 
@@ -223,9 +223,8 @@ static void tiadc_poll_handler(struct work_struct *work_s)
 	}
 
 	buffer->access->store_to(buffer, (u8 *) inputbuffer);
-	status = tiadc_readl(adc_dev, REG_IRQENABLE);
 	tiadc_writel(adc_dev, REG_IRQENABLE,
-			(status | IRQENB_FIFO1THRES));
+			IRQENB_FIFO1THRES);
 
 	kfree(inputbuffer);
 }
@@ -242,7 +241,7 @@ static int tiadc_buffer_postenable(struct iio_dev *idev)
 {
 	struct tiadc_device *adc_dev = iio_priv(idev);
 	struct iio_buffer *buffer = idev->buffer;
-	unsigned int enb, status, fifo1count;
+	unsigned int enb, fifo1count;
 	int stepnum, i;
 	u8 bit;
 
@@ -250,11 +249,10 @@ static int tiadc_buffer_postenable(struct iio_dev *idev)
 		pr_info("Data cannot be read continuously in one shot mode\n");
 		return -EINVAL;
 	} else {
-		status = tiadc_readl(adc_dev, REG_IRQENABLE);
 		tiadc_writel(adc_dev, REG_IRQENABLE,
-				(status | IRQENB_FIFO1THRES)|
-				 IRQENB_FIFO1OVRRUN |
-				 IRQENB_FIFO1UNDRFLW);
+				(IRQENB_FIFO1THRES |
+				IRQENB_FIFO1OVRRUN |
+				IRQENB_FIFO1UNDRFLW));
 
 		fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
 		for (i = 0; i < fifo1count; i++)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux