Skip to content

Commit 736d7f1

Browse files
committed
drivers: adc: ad7768: Fix DCLK divider register encoding
Fix off-by-one error in AD7768_INTERFACE_CFG_DCLK_DIV_MODE macro. The macro was incorrectly calculating register values, causing wrong DCLK division settings to be written to hardware. Corrected mapping: - Divide by 8 → 0 (bits 00) - Divide by 4 → 1 (bits 01) - Divide by 2 → 2 (bits 10) - Divide by 1 → 3 (bits 11) Fixes: 5f17a1b ("drivers: adc: ad7768: Update driver") Signed-off-by: Antoniu Miclaus <[email protected]>
1 parent 6dc4674 commit 736d7f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/adc/ad7768/ad7768.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
#define AD7768_INTERFACE_CFG_CRC_SEL(x) (((x) & 0x3) << 2)
103103
#define AD7768_INTERFACE_CFG_DCLK_DIV(x) (((x) & 0x3) << 0)
104104
#define AD7768_INTERFACE_CFG_DCLK_DIV_MSK NO_OS_GENMASK(1, 0)
105-
#define AD7768_INTERFACE_CFG_DCLK_DIV_MODE(x) (4 - no_os_find_first_set_bit(x))
105+
#define AD7768_INTERFACE_CFG_DCLK_DIV_MODE(x) (3 - no_os_find_first_set_bit(x))
106106
#define AD7768_MAX_DCLK_DIV 8
107107

108108
#define AD7768_RESOLUTION 24

0 commit comments

Comments
 (0)