Jump to content

Mainline:Broadcom Kona/BCM590xx/ADC: Difference between revisions

From dissonant.dev wiki
No edit summary
Line 48: Line 48:


The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.
The last ADC channel, RTM, is reserved for RTM (Real-Time Measurment) mode.
The process for performing an RTM read is as follows:
* In <code>ADCCTRL1</code>: (these can all be performed in one write)
** Set the the <code>RTM_CONVERSION</code> bit to enable RTM mode
** Write the channel number to read to the <code>RTM_CHAN</code> offset
** Write the <code>RTM_START</code> bit to start the RTM read
* Wait for the <code>ADC_RTM_DATA_READY</code> interrupt.
* Perform a standard data read from the RTM ADC channel registers (see [[#Reading the data]]).
* Clear the <code>RTM_CONVERSION</code> bit to disable RTM mode.

Revision as of 17:26, 31 August 2025

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.

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_CHAN offset
    • Write the RTM_START bit to start the RTM read
  • Wait for the ADC_RTM_DATA_READY interrupt.
  • Perform a standard data read from the RTM ADC channel registers (see #Reading the data).
  • Clear the RTM_CONVERSION bit to disable RTM mode.