Mainline:Broadcom Kona/BCM590xx/ADC
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.
The process for performing an RTM read is as follows:
- In
ADCCTRL1
: (these can all be performed in one write)- Set the the
RTM_CONVERSION
bit to enable RTM mode - Write the channel number to read to the
RTM_CHANN
offset - Write the
RTM_START
bit to start the RTM read
- Set the the
- Wait for the
ADC_RTM_DATA_READY
interrupt. - Perform a standard data read from the RTM ADC channel registers (see #Reading the ADC data).
- Clear the
RTM_CONVERSION
bit to disable RTM mode.
Register layout
Values given here are for the BCM59054. These registers are located on map 1.
ADCCTRL1 (0x20)
Contains settings for RTM mode.
Name | Bit | Description |
---|---|---|
RTM_CHANN
|
7:4 | Channel to read in RTM mode. |
RTM_CONVERSION
|
3 | Enable (0) or disable (1) RTM mode. Prerequisite for performing an RTM read. |
RTM_START
|
2 | When set to 1, starts the RTM reading. |
RTM_MAX_RST_CNT
|
1:0 | Max reset count for RTM mode. Valid values are:
|
ADCCTRL2 (0x21)
Note | These are taken from the BCM59055 driver, and haven't been tested on the BCM59054 yet. Still, given that the ADCCTRL1 layout is the same, I suspect this one should be the same as well... |
Name | Bit | Description |
---|---|---|
Reserved/unknown | 7:6 | Reserved/unknown |
GSM_DEBOUNCE
|
5 | If set to 1, enables ADC burst mode (todo, how does it work?). |
RTM_DLY
|
4:0 | RTM read delay. Valid values:
|
ADCCTRL3 - ADCCTRL28
ADC channel registers; see layout above.
ADCCTRL29 and ADCCTRL30
Unknown.