I2C communication sequence overview
The following figure shows the communication sequence between the controller and targets in I2C.
Figure : I2C controller and target communication sequence
For example, no device can use 1111-0XX listed in the I2C specification and high-speed mode with 3.4 MHz clock frequency. Following are the I2C modes and supported speeds.- Standard mode: 100 kbps
- Fast mode: 400 kbps
- Fast mode plus: 1 Mbps
I2C data packet format
The controller sends a 7‑bit or 10‑bit address as shown in the following figure. Along with the address, a 1‑bit read/write indicating the type of operation is also sent. Data is transferred in sequences of 8 bits placed on an SDA line. For every byte transferred, the device receiving the data sends back an ACK bit (totaling nine clock pulses).- ACK bit LOW: receives the data and is ready to accept the next byte.
- ACK bit HIGH: receives the data and can’t accept further data. The controller then terminates the transmission with the STOP sequence.

Figure : I2C data packet
I2C sequences
When the SCL is high, the SDA must remain stable and can’t change. Only when the clock line is low can the data line change. However, there are two exceptions: START and STOP sequences.
Figure : I2C sequence
I2C features
This section explains the I2C serial engine transfer modes and the different scenarios where each mode is used. The following table lists the transfer modes enabled in the various I2C subsystem drivers. Table : I2C transfer modes| Subsystem | Transfer mode | Description |
|---|---|---|
| Linux |
|
|
| Boot | FIFO | |
| aDSP/Qualcomm TEE/SDC | FIFO |
I2C interface components
This section provides information about the subsystem driver, kernel device tree nodes, and related documentation. Table : I2C interface: Linux| File type | Description |
|---|---|
| Device tree source |
|
Pinctrl settings |
|
| Qualcomm TEE settings |
|
| File type | Description |
|---|---|
| QUP v3 serial engine configuration |
|
| Qualcomm TEE settings |
|
| File type | Description |
|---|---|
| QUP v3 serial engine configuration |
|
| Firmware configuration settings |
|
| File type | Description |
|---|---|
| QUP v3 serial engine configuration |
|
| Qualcomm TEE settings |
|
I2C APIs
I2C APIs for the following subsystems are listed in this section.- Linux:
- Boot: boot_images/boot/QcomPkg/Include/i2c_api.h
- aDSP/SDC/SLPI: adsp_proc/core/api/buses/i2c_api.h
- Qualcomm TEE: trustzone_images/core/buses/api/i2c/qupv3/i2c_api.h
I2C software device tree configuration
This section provides information on the I2C device tree configuration, and documentation for the device nodes.Linux
For the configuration settings file, see the following DTSI files.- QCS6490 and QCS5430: https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi
- Dragonwing IQ-9075: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi
- Dragonwing IQ-615: https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/tree/arch/arm64/boot/dts/qcom/qcs615.dtsi?h=arm64-for-6.16
i2c-geni-qcom.yaml file at https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/i2c/qcom%2Ci2c-geni-qcom.yaml, and the I2C driver at the https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-qcom-geni.c files.
pinctrl configuration, see the following files.
- QCS6490 and QCS5430: https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi
- Dragonwing IQ-9075: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi
- Dragonwing IQ-615: https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/tree/arch/arm64/boot/dts/qcom/qcs615.dtsi?h=arm64-for-6.16
Documentation/devicetree/bindings/pinctrl/qcom,<chipset>-tlmm.yaml
pinctrl.dtsi file.
QUPAC_Access.c file, ensure that the particular serial engine configuration for the specified protocol is for the I2C protocol. Qualcomm TEE build:
Boot
- Configure I2C in the UEFI. The configuration files can be accessed from the following locations.
- QUP v3 serial engine:
/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/BOOT.MXF.1.0.c1/boot_images/boot/Settings/Soc/<chipset>/Core/Buses/qup_common/<chipset>-qupv3.dtsi - Qualcomm TEE settings:
/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/TZ.XF.5.0/trustzone_images/core/settings/buses/qup_accesscontrol/qupv3/config/<chipset>/QUPAC_Access.c
- QUP v3 serial engine:
Note: For configuration settings in boot, see Boot.
- Enable the I2C protocol in UEFI at
/QcomPkg/SocPkg/<chipset>/LAA/Core.fdf. - The application enables the I2C interface. The application then performs the read and write operation through the I2C interface. For information about I2C function usage, see
boot_images/QcomPkg/QcomTestPkg/I2CApp/I2Ceeprom.c. - Add
i2c_open->i2c_read/i2c_write->i2c_closesequentially in code. - Ensure that the
GpiDxe.infandI2C.efifiles are loaded by verifying the device/UEFI bootup logs before you callI2c_open.
aDSP/SDC
Firmware loading with SSC QUP is performed during the bootup sequence of the aDSP subsystem. The configuration files are present in the aDSP build at:Qualcomm TEE
The QUP v3 serial engine for I2C can be configured as follows. File path:ENABLE_I2C_<num> number is based on the serial number of the serial engine (starting from 0). For example, if there are two QUPs: QUPV3_0 with seven serial engines and QUPV3_1 with eight serial engines, then the user must enable QUPV3_2_SE2. The macro should be ENABLE_I2C_08.
GPIO configuration: drive strength and pull are configured per PIN for SDA at zero index and SCL at one index. File path:
Configure I2C interface
This section provides information about the I2C software driver kernel configuration and device tree node changes.Linux
The following driver kernel configurations are required to support the I2C interface.- Driver source: https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-qcom-geni.c
-
Kernel
defconfigfile path:
CONFIG_QCOM_GENI_SE=yCONFIG_I2C_CHARDEV=mCONFIG_I2C_QCOM_GENI=mto configure user space applicationsCONFIG_QCOM_GPI_DMA=mto enable GSI support
/arch/arm64/boot/dts/qcom/<chipset>.dtsi file.
Note: You should compile the kernel configuration and device tree changes. After compilation, you can load the images to the device to verify the interface. For information about interface verification, see the Verify I2C interface section.
Verify I2C interface
This section describes the validation procedure and test results for the I2C drivers and the Qualcomm drivers.Linux
For upstream I2C kernel test applications, see https://cdn.kernel.org/pub/software/utils/i2c-tools/i2c-tools-4.3.tar.gz. To cross-compile tools, do the following.- Download
i2c-toolfrom https://cdn.kernel.org/pub/software/utils/i2c-tools/i2c-tools-4.3.tar.gz. - Extract the tool from the downloaded
tarfile. - Change the current directory to the
i2c-toolpath. - Install the tool.
- Set up the environment for cross-compilation.
- Compile the tool.
The binary is generated at
<i2c-tool-path>/tools/.
dev node (/dev/i2c-0 and /dev/i2c-1) in the SSH shell or use the ADB shell. For more information about how to run SSH, see the Use SSH section.
Verify I2C driver
- To verify the I2C driver, do the following:
- Open the SSH shell in permissive mode or use the ADB shell.
- Mount the file system.
- Transfer files using SCP or similar tools.
For example,
scp i2cdetect root@10.92.162.185:/bin - Assign permission to execute.
- Verify an I2C device with the
i2cdetecttool. For example,./i2cdetect -y -r <i2c_instance_num>.The following output is displayed.
Debug I2C issues
The section describes the default logging method of the I2C software driver to enable logging the I2C transfer failures.Linux
The I2C driver logs are enabled through the kernel dynamic debugging method. EnableCONFIG_DYNAMIC_DEBUG in the following file to support the dynamic debugging of the kernel drivers.
dmesg), run the following commands.
[ 8.583248] geni_i2c a94000.i2c: Invalid proto 1 for driver protocol load failures, do the following.
- Identify the board type.
Example: QUPV3_1_SE5 board type details
- From the kernel log, locate the platform ID and subtype related details at:
- Obtain the Qualcomm TEE
QUPAC_Access.cfile configurations. - Identify the configuration specific to the serial engine.
- Locate the platform ID type within the
QUPAC_Access.xmlfile. - Map this platform ID type to the corresponding
qupv3_permsstructure within theQUPAC_Access.cfile. - Verify the protocol and mode configurations in the
QUPAC_Access.cfile.
I2C examples
For information about the upstream device tree reference, see the following DTSI files.- QCS6490 and QCS5430: https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi
- Dragonwing IQ-9075: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi
- Dragonwing IQ-615: https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/tree/arch/arm64/boot/dts/qcom/qcs615.dtsi?h=arm64-for-6.16
- QCS6490 and QCS5430: https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
- Dragonwing IQ-9075: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi
- Dragonwing IQ-615: https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/tree/arch/arm64/boot/dts/qcom/qcs615.dtsi?h=arm64-for-6.16

