From: Ian Abbott Date: Fri, 18 Oct 2013 13:40:49 +0000 (+0100) Subject: staging: comedi: s626: clock polarity and direction are the same X-Git-Tag: omap-for-v3.13/fixes-for-merge-window-take2~62^2~176 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c661434f98dfe0ad301a4910b6209b0541c0239;p=pandora-kernel.git staging: comedi: s626: clock polarity and direction are the same When setting up an encoder channel, the setup value includes a polarity and direction, but these are the same bit of the setup value: S626_CLKPOL_POS = S626_CNTDIR_UP = 0 S626_CLKPOL_NEG = S626_CNTDIR_DOWN = 1 In the construction of the setup value, both the CLKPOL and the CNTDIR constants are shifted by the same amount `S626_BF_CLKPOL`. Only the following combinations are set up currently (this may change if user configuration of the encoder is implemented properly): (S626_CLKPOL_POS << S626_BF_CLKPOL) (S626_CLKPOL_POS << S626_BF_CLKPOL) | (S626_CNTDIR_UP << S626_BF_CLKPOL) (S626_CLKPOL_POS << S626_BF_CLKPOL) | (S626_CNTDIR_DOWN << S626_BF_CLKPOL) The first two are used in "counter" mode and is equivalent to: (S626_CLKPOL_POS << S626_BF_CLKPOL) The last one is used in "timer" mode and is equivalent to: (S626_CNTDIR_DOWN << S626_BF_CLKPOL) Use the shorter equivalents. The comments in "s626.h" indicate that the 'CLKPOL' constants make more sense for the "counter" mode (when the encoders operate as up/down counters) and the 'CNTDIR' constants make more sense for the "timer" mode. Signed-off-by: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed