[PATCH v3 10/13] staging: comedi: usbduxfast: document strange ai maxdata

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

 



The subdevice 'maxdata' is typically a mask of the valid bits that can
be returned by a subdevice, (1 << bits) - 1. The analog inputs of this
device have a resolution of 12-bits so the 'maxdata' should be 0x0fff.
But, this hardware can produce a value of 0x1000 indicating an overflow
from the ADC. The comedilib library's comedi_to_phys() function will
then return NAN when this value is read from the hardware.

Add a comment to clarify the strage 'maxdata' value.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/usbduxfast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 60f1c5e..9e846b4 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -865,7 +865,7 @@ static int usbduxfast_attach_common(struct comedi_device *dev)
 	s->do_cmdtest	= usbduxfast_ai_cmdtest;
 	s->do_cmd	= usbduxfast_ai_cmd;
 	s->cancel	= usbduxfast_ai_cancel;
-	s->maxdata	= 0x1000;
+	s->maxdata	= 0x1000;	/* 12-bit + 1 overflow bit */
 	s->range_table	= &range_usbduxfast_ai_range;
 
 	up(&devpriv->sem);
-- 
2.4.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux