Mainline:Broadcom Kona/BCM590xx/ADC
Appearance
Downstream driver: drivers/hwmon/bcmpmu59xxx-hwmon.c, drivers/misc/bcm59055-adc.c (for BCM59055 but very well commented, and seems to be about the same as other models).
The BCM590xx PMUs provide a 10-bit SAR (Successive Approximation) ADC.
Reading the ADC data
Each ADC channel has two registers which immediately succeed each other. These registers follow the layout outlined below.
To read the ADC data, one needs to combine the DATA_MSB bits (upper 2 bits, first two bits of the first register) with the DATA_LSB (lower 8 bits, entire value of the second register). An additional value at bit 2 is available to check the validity of the read data.
data = ((reg1 & 0x3) << 8) | reg2;
ADCCTRLx
Name | Bit | Description |
---|---|---|
Reserved/unknown | 7:3 | Reserved/unknown |
READ_INVALID
|
2 | If 1, the read is invalid; 0 otherwise. |
DATA_MSB
|
1:0 | Upper (most significant) 2 bits of the ADC data. |
ADCCTRLx+1
Name | Bit | Description |
---|---|---|
DATA_LSB
|
7:0 | Lower (least significant) 8 bits of the ADC data. |
RTM (Real-Time Measurment)
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.