staging: comedi: ni_65xx: don't invert outputs by default
commitd484e33728f13ce1f0a0014d6b4068d053ed69b3
authorIan Abbott <abbotti@mev.co.uk>
Mon, 21 Jul 2014 13:53:31 +0000 (21 14:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jul 2014 23:07:04 +0000 (22 16:07 -0700)
treed770d82286f70793bf9f82df289b63003e9b0e7d
parentfae062ad57def6abf344ba1765a90c83f1a2d143
staging: comedi: ni_65xx: don't invert outputs by default

This driver currently inverts the outputs for the DO (digital output)
subdevice for some of the boards it supports, indicated by the
`invert_outputs` member in the board-specific data being initialized to
1.  It seems this driver shouldn't really be inverting outputs for these
boards at all, but has done so since the driver was first written back
in October 2006.  I've had confirmation that for the PCI-6515 at least,
the output voltage levels are opposite to the values set by the user
program.

The driver by Jon Grierson originally supported only PCI-6514 and
PXI-6514 (and was originally called "ni_6514").  The driver was based on
"ni_6527", which is where the inversion of outputs appears to have come
from.  Over a period of a few days, the driver was enhanced by Frank
Mori Hess to support other boards.  Some of these plainly didn't require
inverted outputs and some guesswork was used to decide which boards
should have inverted outputs.  Some of the boards in question are
described in the manual as having "Sink Outputs" and others are
described as having "Source Outputs", but this does not correspond in
any way with which boards are marked as having inverted outputs, so the
criterion that Frank used is a bit of a mystery!

Change the driver so it doesn't invert the outputs of these by boards by
default, but add a module parameter, "legacy_invert_outputs", that can
be set to 'true' to restore the old behaviour.  Also rename the
`invert_outputs` member of `struct ni_65xx_board` to `legacy_invert`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_65xx.c