RE: [PATCH 31/87] staging: comedi: pcl816: remove incorrect 'ai_chanlist' from boardinfo

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

 



On Tuesday, February 18, 2014 4:36 AM, Ian Abbott wrote:
> On 2014-02-17 21:27, H Hartley Sweeten wrote:
>> The maximum chanlist that this hardware can handle is 16 (the number of
>> input channels).
>>
>> Remove this incorrect data from the boardinfo and just initialize the
>> subdevice 'len_chanlist' to subdevice 'n_chan'.
>
> The driver used to allow repeated channel segments in the channel list 
> (with a maximum segment length of 16), which would be far more 
> restricted by this patch.  Is there any reason to restrict it?

I don't think it's a restriction just a simplification. And it fixes the number of
scans that occur when the chanlist repeats.

The hardware can only handle a first channel (0-16) to last channel (0-16)
scanlist. It will automatically restart the scanlist once the last channel has
been sampled. For instance a first = 12 to last = 3 scanlist results in these
channels being scanned: 12, 13, 14, 15, 0, 1, 2, 3, 12, 13, ...

The cmd->scan_end_src can only be TRIG_COUNT in this driver. This trigger
source argument is validated to be the cmd->chanlist_len, which in the
example above should be 8.

The cmd->stop_src can be TRIG_COUNT or TRIG_NONE. TRIG_NONE indicates
that the scan should be continued until canceled. TRIG_COUNT indicates that
the scan should happen cmd->stop_arg times.

With the longer maximum chanlist value the user could pass a chanlist that
had repeating first/last channels. This then needs to be sanity checked to
make sure the first/last channels are identical with check_channel_list().

As a simple example, the old way a cmd with a chanlist like this could be passed:

	chanlist[0] -> channel 2
	chanlist[1] -> channel 3
	chanlist[2] -> channel 4
	chanlist[0] -> channel 2
	chanlist[1] -> channel 3
	chanlist[2] -> channel 4
	chanlist[0] -> channel 2
	chanlist[1] -> channel 3
	chanlist[2] -> channel 4

This is valid and indicates that channels 2-4 should be scanned 3 times. If the
cmd->stop _src == TRIG_COUNT and cmd->stop_arg = 2 the full scan should
then be 6 (3 repeats of the chanlist * 2) scans of channels 2-4. Unfortunately
check_channel_list() does not return how many times the chanlist repeats so
only 2 actual scans will occur.

By changing the maximum chanlist to 16 we enforce the first/last channel scan
and the cmd->stop_arg then scans the list the correct number of times.

I still need to clean up the check_channel_list() functions to remove the now
unnecessary check for the repeats. These functions should now just need to
verify that the first/last channels are incremental.

Regards,
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