Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: addac: ad74413: don't set DIN_SINK for functions other than digital input

Apparently, despite the name Digital Input Configuration Register, the
settings in the DIN_CONFIGx registers also affect other channel
functions. In particular, setting a non-zero value in the DIN_SINK
field breaks the resistance measurement function.

Now, one can of course argue that specifying a drive-strength-microamp
property along with a adi,ch-func which is not one of the digital
input functions is a bug in the device tree. However, we have a rather
complicated setup with instances of ad74412r on external hardware
modules, and have set a default drive-strength-microamp in our DT
fragments describing those, merely modifying the adi,ch-func settings
to reflect however the modules have been wired up. And restricting
this setting to just being done for digital input doesn't make the
driver any more complex.

Fixes: 504eb485589d1 (iio: ad74413r: wire up support for drive-strength-microamp property)
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://lore.kernel.org/r/20230503105042.453755-1-linux@rasmusvillemoes.dk
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Rasmus Villemoes and committed by
Jonathan Cameron
a4cba07e 48e15602

+6 -5
+6 -5
drivers/iio/addac/ad74413r.c
··· 1317 1317 } 1318 1318 1319 1319 if (config->func == CH_FUNC_DIGITAL_INPUT_LOGIC || 1320 - config->func == CH_FUNC_DIGITAL_INPUT_LOOP_POWER) 1320 + config->func == CH_FUNC_DIGITAL_INPUT_LOOP_POWER) { 1321 1321 st->comp_gpio_offsets[comp_gpio_i++] = i; 1322 1322 1323 - strength = config->drive_strength; 1324 - ret = ad74413r_set_comp_drive_strength(st, i, strength); 1325 - if (ret) 1326 - return ret; 1323 + strength = config->drive_strength; 1324 + ret = ad74413r_set_comp_drive_strength(st, i, strength); 1325 + if (ret) 1326 + return ret; 1327 + } 1327 1328 1328 1329 ret = ad74413r_set_gpo_config(st, i, gpo_config); 1329 1330 if (ret)