• H Hartley Sweeten's avatar
    staging: comedi: ni_65xx: fix digital output reset during attach · dd269473
    H Hartley Sweeten authored
    During the attach of this driver, the digital output ports are all
    initialized to a known state. Some of the boards supported by this
    driver have output ports that are inverted from the comedi view of
    the output state. For these boards the values written to the ports
    needs to be inverted.
    
    Currently, only bit 0 of each port is inverted when the boardinfo
    indicates that the outputs are inverted. This results in channels
    0, 8, 16, etc. being set to '0' and all other channels being set
    to '1'. If the boardinfo does not indicate that the outputs are
    inverted, all the channels are set to '0'.
    
    This initialization is unnecessary for the input only ports. The
    input/output ports also do not need to be initialized since they
    are configured as inputs during the attach.
    
    Move the output port initialization so it occurs when the digital
    output subdevice is setup. Use the 's->io_bits' value to initialize
    the ports so that the correct inverted/non-inverted state is used
    for the comedi '0' value.
    Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
    Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    dd269473
ni_65xx.c 21.2 KB