Skip to content

Commit 805c422

Browse files
mhennerichSRaus
authored andcommitted
iio: frequency: ltc6952: keep unused channels disabled
* On POR all channels are fully enabled. This patch keeps those disabled which are not represented by a node in the device-tree. * We also clear the POR reset bit, which might not be necessary but looks cleaner. * We also fix LTC6952_PD(x) mask which wasn't doing anything until now. Signed-off-by: Michael Hennerich <[email protected]> (cherry picked from commit 0ba34a1)
1 parent 20e9045 commit 805c422

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/iio/frequency/ltc6952.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
#define LTC6952_PD8(x) FIELD_PREP(LTC6952_PD8_MSK, x)
8585

8686
#define LTC6952_PD_MSK(ch) GENMASK(((ch) & 0x03) * 2 + 1, ((ch) & 0x03) * 2)
87-
#define LTC6952_PD(ch, x) ((x) << ((ch) & 0x03))
87+
#define LTC6952_PD(ch, x) ((x) << ((ch) & 0x03) * 2)
8888

8989
/* LTC6952_REG6 */
9090
#define LTC6952_RAO_MSK BIT(7)
@@ -618,6 +618,23 @@ static int ltc6952_setup(struct iio_dev *indio_dev)
618618
if (ret < 0)
619619
goto err_unlock;
620620

621+
ret = ltc6952_write_mask(indio_dev, LTC6952_REG(0x02),
622+
LTC6952_POR_MSK, LTC6952_POR(0));
623+
if (ret < 0)
624+
goto err_unlock;
625+
626+
ret = ltc6952_write(indio_dev, LTC6952_REG(0x03), 0xFF);
627+
if (ret < 0)
628+
goto err_unlock;
629+
630+
ret = ltc6952_write(indio_dev, LTC6952_REG(0x04), 0xFF);
631+
if (ret < 0)
632+
goto err_unlock;
633+
634+
ret = ltc6952_write(indio_dev, LTC6952_REG(0x05), 0x3F);
635+
if (ret < 0)
636+
goto err_unlock;
637+
621638
ret = ltc6952_write_mask(indio_dev, LTC6952_REG(0x02),
622639
LTC6952_FILTV_MSK,
623640
LTC6952_FILTV(st->filtv_enable));

0 commit comments

Comments
 (0)