diff options
| author | David Carlier <devnexen@gmail.com> | 2026-10-25 21:18:56 +0000 |
|---|---|---|
| committer | Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> | 2026-11-02 00:39:38 +0000 |
| commit | 0516c565878687e1b4952edf32b4a069ca13e9ad (patch) | |
| tree | 11b793a99d5753e2656a7595b63301f0083e557d /tools/perf/scripts/python | |
| parent | 1e50a03490120f1978c323741013457bc5c4582c (diff) | |
iio: dac: mcp47feb02: reject out-of-range raw values
mcp47feb02_write_raw() writes the user supplied raw value to the DAC
register without checking it against the chip resolution. The parts
are 8, 10 or 12 bit, and the bits above the resolution are not
implemented, so writing 300 to out_voltage0_raw on an 8-bit part sets
the output to code 44 instead of failing, and -1 is written as 0xffff.
The out-of-range value is also cached in dac_data, so it is written
back on resume and stored to EEPROM by store_eeprom.
Return -EINVAL for values outside [0, 2^resolution - 1].
Fixes: bf394cc80369 ("iio: dac: adding support for Microchip MCP47FEB02")
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
