[PATCH 22/29] staging: comedi: dt282x: fix Analog Input se/diff channel configuration

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

 



Most of the boards supported by this driver can do either single-ended or
differential Analog Input but there are a couple that can only do one or
the other. On the boards that can do both the type of input is set with
jumpers on the board.

The 'it->options[4]' passed by the user during the board (*attach) is used
to determine how the Analog Inputs are configured. This is used to set
the subdevice flags and number of channels correctly.

Fix the check of this option so that it only applies when the board can
actually do differential input. Also, default to differential inputs if
that is the only mode the board supports.

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

diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c
index 9c512da..66f15aa 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -1215,7 +1215,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	s = &dev->subdevices[0];
 	s->type		= COMEDI_SUBD_AI;
 	s->subdev_flags	= SDF_READABLE;
-	if (it->options[4]) {
+	if ((it->options[4] && board->adchan_di) || board->adchan_se == 0) {
 		s->subdev_flags	|= SDF_DIFF;
 		s->n_chan	= board->adchan_di;
 	} else {
-- 
1.9.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