• Lukas Wunner's avatar
    iio: adc: mcp320x: Fix readout of negative voltages · e6f47943
    Lukas Wunner authored
    Commit f686a36b ("iio: adc: mcp320x: Add support for mcp3301")
    returns a signed voltage from mcp320x_adc_conversion() but neglects that
    the caller interprets a negative return value as failure.  Only mcp3301
    (and the upcoming mcp3550/1/3) is affected as the other chips are
    incapable of measuring negative voltages.
    
    Fix and while at it, add mcp3301 to the list of supported chips at the
    top of the file.
    
    Fixes: f686a36b ("iio: adc: mcp320x: Add support for mcp3301")
    Cc: Andrea Galbusera <gizero@gmail.com>
    Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    e6f47943
mcp320x.c 10.9 KB