Tests:i2c-demux-pinctrl
This document describes testing ofI2C Demux Pinctl a facility that allows switching between I2C cores and GPIO fallback for I2C using pinctl.
Contents
Kernel Version and Configuration
I2C Demux Pinctl integration for a wide range of boards for R-Car Gen 2 SoCs which are supported in mainline is available in a topic branch:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git topic/i2c-demux-v3
For the tests described here the kernel was compiled with the shmobile_defconfig.
Hardware Environment
Board/Soc: Lager/r8a7795 (Gen 2 R-Car H1 SoC)
Verify I2C Demux Pinctl Support
The presence of an available_masters file in the sysfs directory for an i2c device indicates that it is a demuxer.
$ ls /sys/devices/platform/i2c-*/available_masters /sys/devices/platform/i2c-11/available_masters /sys/devices/platform/i2c-13/available_masters /sys/devices/platform/i2c-8/available_masters /sys/devices/platform/i2c-9/available_masters
The use of the I2C demux pinctl driver by an I2C demux device can be confirmed by inspecting the driver link in its sysctl directory.
e.g.
$ ls -l /sys/devices/platform/i2c-9/driver lrwxrwxrwx 1 root root 0 Jan 1 00:05 /sys/devices/platform/i2c-9/driver -> ../../../bus/platform/drivers/i2c-demux-pinctrl
Core Switching
The cores available for use by an i2c demux device may be retrieved from the available_masters file in the device's sysfs directory.
# cat /sys/devices/platform/i2c-9/available_masters 0:/i2c@e6510000 1:/i2c@e6518000 2:/i2c-10
The core currently used by an i2c demux device may be retrieved from the available_masters file in the device's sysfs directory.
$ cat /sys/devices/platform/i2c-9/available_masters 0:/i2c@e6510000 1:/i2c@e6518000 2:/i2c-10