RE: [PATCH v2 10/13] staging: comedi: usbduxfast: fix analog input 'maxdata'

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

 



On Monday, August 24, 2015 6:36 AM, Ian Abbott wrote:
> On 17/08/15 19:31, H Hartley Sweeten wrote:
>> The analog inputs have 12-bit resoultion. The subdevice 'maxdata' is
>> a mask value for the resolution. Fix the 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..c8687b0 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	= 0x0fff;
>>   	s->range_table	= &range_usbduxfast_ai_range;
>>
>>   	up(&devpriv->sem);
>>
>
> I've just got confirmation from the driver author Bernd Porr, that the 
> maximum value it can produce is 0x1000, not 0xfff.  This is due to an 
> overflow bit from the ADC.
>
> Probably best not to mess with it for now, as the current comedilib 
> library's 'comedi_to_phys()' function returns NAN by default if the raw 
> value is either 0 or maxdata as that means the value is probably pegged. 
>   However, it does not currently return NAN for raw values above maxdata 
>  (although it probably ought to).

Ian,

Good to know.   Will drop this patch and update the series. I'll also add a
comment about the odd 0x1000 maxdata so that it will not get "fixed" in
the future.

Thanks,
Hartley

_______________________________________________
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