diff options
author | Dr. Matthew Swabey <matthew@swabey.org> | 2023-03-14 21:03:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 21:03:07 -0400 |
commit | 9d77f4499529ad2274883d95e5aad1cadb402a0b (patch) | |
tree | df06f2297e8b3e979113801ae54f4e22bb5111f0 /src/linux/gpio.h | |
parent | ca6e5fe5147c8b5a76b9665b81d5efb806f316c7 (diff) | |
download | kutter-9d77f4499529ad2274883d95e5aad1cadb402a0b.tar.gz kutter-9d77f4499529ad2274883d95e5aad1cadb402a0b.tar.xz kutter-9d77f4499529ad2274883d95e5aad1cadb402a0b.zip |
linux: Fast Linux MCU i2c_read() with I2C_RDRW (#6101)
Reading an I2C device from the Linux MCU used a separate write(2)
to select the target register & read(2) to get the value(s). This
implementation uses ioctl(file, I2C_RDWR, ...) to skip a large bus idle
period and extra process sleep by combining them like the stm32.
I2C_RDRW requires I2C_FUNC_I2C flag in the I2C driver. I2C_FUNC_I2C
is defined in:
BCM2835: Pi 1 Models A, A+, B, B+, the Raspberry Pi Zero, the
Raspberry Pi Zero W, and the Raspberry Pi Compute Module 1
BCM2836: Pi 2 Model B
Identical to BCM2835 except Cortex
BCM2837: Pi 3 Model B, later models of the Raspberry Pi 2 Model B,
and the Raspberry Pi Compute Module 3
BCM2837B0: Pi 3 Models A+, B+, and the Raspberry Pi Compute Module 3+
BCM2711: Pi 4 Model B, the Raspberry Pi 400, and the Raspberry Pi
Compute Module 4
RK3xxx: Rockchips SoCs NanoPi, RockPi, Tinker, etc.
SUNXI: H2, H3, etc. Orange Pi
AMLOGIC: S905x, Banana Pi, Odroid, etc.
TEGRA: NVidia Jetson etc.
MediaTek: Several SBCs in other ranges
Signed-off-by: Matthew Swabey <matthew@swabey.org>
Diffstat (limited to 'src/linux/gpio.h')
-rw-r--r-- | src/linux/gpio.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/linux/gpio.h b/src/linux/gpio.h index e2a39be0..df9de752 100644 --- a/src/linux/gpio.h +++ b/src/linux/gpio.h @@ -45,6 +45,7 @@ void gpio_pwm_write(struct gpio_pwm g, uint16_t val); struct i2c_config { int fd; + uint8_t addr; }; struct i2c_config i2c_setup(uint32_t bus, uint32_t rate, uint8_t addr); |