|
The MCP47A1 has 64 resistors but exposes 65 wiper positions. The valid
DAC codes are 0 through 64, and code 64 selects VREF.
The driver currently advertises 0 through 63 and uses 64 as the length
argument to in_range(), which also rejects 64. Therefore userspace
cannot select full-scale output.
Advertise code 64 and make validation cover all 65 codes. Keep 64 as
the scale denominator because the output voltage is VREF multiplied by
the code and divided by 64.
Fixes: 350d1fb9204b ("iio: dac: mcp47a1: add support for new device")
Signed-off-by: Tuna Kılıç <tuna@tunakilic.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Tested-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
|