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

iio:adc:berlin2-adc: Fix register definition

Active channel number is stored in BERLIN2_SM_CTRL as value, instead of a
bit map.
The masks for channel interrupts and data ready are a 16 bits wide bit
map each, instead of just 4 bits.

Also correct the data mask for the temperature sensor, which was
Reported-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Hartmut Knaack and committed by
Jonathan Cameron
57cb0676 95ddd3f4

+4 -4
+4 -4
drivers/iio/adc/berlin2-adc.c
··· 26 26 #define BERLIN2_SM_CTRL 0x14 27 27 #define BERLIN2_SM_CTRL_SM_SOC_INT BIT(1) 28 28 #define BERLIN2_SM_CTRL_SOC_SM_INT BIT(2) 29 - #define BERLIN2_SM_CTRL_ADC_SEL(x) (BIT(x) << 5) /* 0-15 */ 29 + #define BERLIN2_SM_CTRL_ADC_SEL(x) ((x) << 5) /* 0-15 */ 30 30 #define BERLIN2_SM_CTRL_ADC_SEL_MASK (0xf << 5) 31 31 #define BERLIN2_SM_CTRL_ADC_POWER BIT(9) 32 32 #define BERLIN2_SM_CTRL_ADC_CLKSEL_DIV2 (0x0 << 10) ··· 53 53 #define BERLIN2_SM_ADC_MASK 0x3ff 54 54 #define BERLIN2_SM_ADC_STATUS 0x1c 55 55 #define BERLIN2_SM_ADC_STATUS_DATA_RDY(x) BIT(x) /* 0-15 */ 56 - #define BERLIN2_SM_ADC_STATUS_DATA_RDY_MASK 0xf 56 + #define BERLIN2_SM_ADC_STATUS_DATA_RDY_MASK GENMASK(15, 0) 57 57 #define BERLIN2_SM_ADC_STATUS_INT_EN(x) (BIT(x) << 16) /* 0-15 */ 58 - #define BERLIN2_SM_ADC_STATUS_INT_EN_MASK (0xf << 16) 58 + #define BERLIN2_SM_ADC_STATUS_INT_EN_MASK GENMASK(31, 16) 59 59 #define BERLIN2_SM_TSEN_STATUS 0x24 60 60 #define BERLIN2_SM_TSEN_STATUS_DATA_RDY BIT(0) 61 61 #define BERLIN2_SM_TSEN_STATUS_INT_EN BIT(1) 62 62 #define BERLIN2_SM_TSEN_DATA 0x28 63 - #define BERLIN2_SM_TSEN_MASK 0xfff 63 + #define BERLIN2_SM_TSEN_MASK GENMASK(9, 0) 64 64 #define BERLIN2_SM_TSEN_CTRL 0x74 65 65 #define BERLIN2_SM_TSEN_CTRL_START BIT(8) 66 66 #define BERLIN2_SM_TSEN_CTRL_SETTLING_4 (0x0 << 21) /* 4 us */