Skip to content

Commit

Permalink
staging: comedi: adv_pci1710: fix AI channels 16-31 for PCI-1713
Browse files Browse the repository at this point in the history
The Advantech PCI-1713 has 32 analog input channels, but an incorrect
bit-mask in the definition of the `PCI171X_MUX_CHANH(x)` and
PCI171X_MUX_CHANL(x)` macros is causing channels 16 to 31 to be aliases
of channels 0 to 15.  Change the bit-mask value from 0xf to 0xff to fix
it.  Note that the channel numbers will have been range checked already,
so the bit-mask isn't really needed.

Fixes: 92c65e5 ("staging: comedi: adv_pci1710: define the mux control register bits")
Reported-by: Dmytro Fil <[email protected]>
Cc: <[email protected]> # v4.5+
Signed-off-by: Ian Abbott <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ian-abbott authored and gregkh committed Jan 3, 2020
1 parent c0bcf9f commit a9d3a9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/comedi/drivers/adv_pci1710.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
#define PCI171X_RANGE_UNI BIT(4)
#define PCI171X_RANGE_GAIN(x) (((x) & 0x7) << 0)
#define PCI171X_MUX_REG 0x04 /* W: A/D multiplexor control */
#define PCI171X_MUX_CHANH(x) (((x) & 0xf) << 8)
#define PCI171X_MUX_CHANL(x) (((x) & 0xf) << 0)
#define PCI171X_MUX_CHANH(x) (((x) & 0xff) << 8)
#define PCI171X_MUX_CHANL(x) (((x) & 0xff) << 0)
#define PCI171X_MUX_CHAN(x) (PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x))
#define PCI171X_STATUS_REG 0x06 /* R: status register */
#define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */
Expand Down

0 comments on commit a9d3a9c

Please sign in to comment.