[PATCH 02/12] iio: adc: rohm-bd79124: Fix channel initialization

Matti Vaittinen <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <4abf69bc827f57d301839d123ae184cfdfc31953.1786347811.git.mazziesaccount@gmail.com>
From: Matti Vaittinen <[email protected]>

The alarm limit register on BD79124 span to two consecutive registers.
The first register for high-limit containing also hysteresis
configuration. The initialization in driver writes only one 8-bit
register, overwriting the hysteresis and leaving the other limit
register uninitialized.

Fix the limit initialization by using the bd79124_write_int_to_reg(),
which correctly initializes the limit on both of the registers.

Signed-off-by: Matti Vaittinen <[email protected]>
Fixes: 3f57a3b9ab74 ("iio: adc: Support ROHM BD79124 ADC")
---
 drivers/iio/adc/rohm-bd79124.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/rohm-bd79124.c b/drivers/iio/adc/rohm-bd79124.c
index f703c74309cc..72207e0c60b8 100644
--- a/drivers/iio/adc/rohm-bd79124.c
+++ b/drivers/iio/adc/rohm-bd79124.c
@@ -920,13 +920,13 @@ static int bd79124_chan_init(struct bd79124_data *data, int channel)
 {
 	int ret;
 
-	ret = regmap_write(data->map, BD79124_GET_HIGH_LIMIT_REG(channel),
-			   BD79124_HIGH_LIMIT_MAX);
+	ret = bd79124_write_int_to_reg(data, BD79124_GET_HIGH_LIMIT_REG(channel),
+				       BD79124_HIGH_LIMIT_MAX);
 	if (ret)
 		return ret;
 
-	return regmap_write(data->map, BD79124_GET_LOW_LIMIT_REG(channel),
-			    BD79124_LOW_LIMIT_MIN);
+	return bd79124_write_int_to_reg(data, BD79124_GET_LOW_LIMIT_REG(channel),
+					BD79124_LOW_LIMIT_MIN);
 }
 
 static int bd79124_get_gpio_pins(const struct iio_chan_spec *cs, int num_channels)
-- 
2.55.0
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmp5gr0ACgkQeFA3/03a
ocUpXAf9FMCB8qWxWv5NdTfRnmRYUJOmkG6thaRBnomZpmp2vfJskacIbIGFAQw+
EkA5cSi9btg1xqejot5oTWVgi0WwgLgSN0kPH+B77lSiF2sqwXtGkSm37KbnlOOq
VYAeroqukMUC/8aCelvSvh4gzgFoZL0fsfK+Alf4fCCxYYoNpQOp2qCpyG7VERfP
pBh5XHIWez0226FYMM1kyoHid4qz3mbSQhejyz4SU98Nc5dckAfvilBQvCQrn6uy
19bWrolvMiXujBMFzl28U1xUjD21IGF5oX0bf75earGw5YcFecHmtAQnF7eqeZ+X
8oYqp0wnLZLP/paQB5l7k791vgoVwA==
=4xAQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.