]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: adc: mcp320x: Fix readout of negative voltages
authorLukas Wunner <lukas@wunner.de>
Tue, 22 Aug 2017 13:33:00 +0000 (15:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:56:12 +0000 (11:56 +0200)
commitd91dc0183e1427ff8cd50747dcdfb1e4c37bc402
tree1b5bb7455e427f85c061dee45c1e247f6a177e3f
parentff24f487dd3ae03324d0c802161824e6a5554ac7
iio: adc: mcp320x: Fix readout of negative voltages

commit e6f4794371ee7cce1339e7ca9542f1e703c5f84a upstream.

Commit f686a36b4b79 ("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: f686a36b4b79 ("iio: adc: mcp320x: Add support for mcp3301")
Cc: Andrea Galbusera <gizero@gmail.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/mcp320x.c