mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-04-27 08:03:12 +00:00
staging: iio: ad5933: Correct settling cycles encoding per datasheet
commit 60638e2a2d4bc03798f00d5ab65ce9b83cb8b03b upstream.
The AD5933 datasheet (Table 13) lists the maximum cycles to be 0x7FC
(2044).
Clamp the user input to the maximum effective value of 0x7FC cycles.
Fixes: f94aa354d6 ("iio: impedance-analyzer: New driver for AD5933/4 Impedance Converter, Network Analyzer")
Cc: stable@vger.kernel.org
Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250420013009.847851-1-gshahrouzi@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
This commit is contained in:
committed by
Ulrich Hecht
parent
4d0298eea2
commit
33c54cad60
@ -428,7 +428,7 @@ static ssize_t ad5933_store(struct device *dev,
|
||||
ret = ad5933_cmd(st, 0);
|
||||
break;
|
||||
case AD5933_OUT_SETTLING_CYCLES:
|
||||
val = clamp(val, (u16)0, (u16)0x7FF);
|
||||
val = clamp(val, (u16)0, (u16)0x7FC);
|
||||
st->settling_cycles = val;
|
||||
|
||||
/* 2x, 4x handling, see datasheet */
|
||||
|
||||
Reference in New Issue
Block a user