OSDN Git Service

staging: comedi: s626: expand standardized IndxSrc values
authorIan Abbott <abbotti@mev.co.uk>
Mon, 21 Oct 2013 09:10:37 +0000 (10:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2013 16:09:54 +0000 (09:09 -0700)
commit2cea19faf16304125ce12e4b5518110ef77f32a1
tree3d9a271cef84978b62d352ff229c5322480d2184
parent0830ada537ae50db3b2184df423e886b538989fa
staging: comedi: s626: expand standardized IndxSrc values

The 'IndxSrc' value for the standardized encoder setup is currently 1
bit wide and takes one of the following values:

  S626_INDXSRC_HARD = 0 // index source from hardware encoder
  S626_INDXSRC_SOFT = 1 // index source software controlled by IndxPol

However the hardware 'IndxSrcA' and 'IndxSrcB' values for the 'A' and
'B' counters are 2 bits wide.  The above standardized values 0 and 1
correspond to the hardware values 0 and 2.

In order to simplify conversions between the standardized values and
hardware values, expand the range of standardized values to cover all
four possible values.  The new values are as follows:

  S626_INDXSRC_ENCODER = 0  // index source from hardware encoder
  S626_INDXSRC_DIGIN = 1    // index source from digital inputs
  S626_INDXSRC_SOFT = 2     // index source s/w controlled by IndxPol
  S626_INDXSRC_DISABLED = 2 // index source disabled

(Note the change in value for `S626_INDXSRC_SOFT` and the replacement of
`S626_INDXSRC_HARD` with `S626_INDXSRC_ENCODER` for consistency with the
`CntSrc` values.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/s626.c
drivers/staging/comedi/drivers/s626.h