Skip to content

Commit

Permalink
feat: add i2c sensors for ROCK 3C/ZERO3
Browse files Browse the repository at this point in the history
Signed-off-by: Nascs Fang <[email protected]>
  • Loading branch information
nascs committed Sep 14, 2024
1 parent cfc96d0 commit 1570b87
Show file tree
Hide file tree
Showing 16 changed files with 469 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ dtb-$(CONFIG_CLK_RK3568) += \
rk3568-can0-m0.dtbo \
rk3568-can1-m0.dtbo \
rk3568-can1-m1.dtbo \
rk3568-dht11-gpio3-a5.dtbo \
rk3568-disable-fiq-debugger.dtbo \
rk3568-dwc3-host.dtbo \
rk3568-dwc3-otg.dtbo \
Expand All @@ -198,8 +199,22 @@ dtb-$(CONFIG_CLK_RK3568) += \
rk3568-i2c2-m0-pca9555.dtbo \
rk3568-i2c2-m0.dtbo \
rk3568-i2c2-m1.dtbo \
rk3568-i2c3-m0-jc42.dtbo \
rk3568-i2c3-m0-mcp980x.dtbo \
rk3568-i2c3-m0-sc16is750.dtbo \
rk3568-i2c3-m0.dtbo \
rk3568-i2c3-m1.dtbo \
rk3568-i2c4-m0-bme280.dtbo \
rk3568-i2c4-m0-bme680.dtbo \
rk3568-i2c4-m0-bmp280.dtbo \
rk3568-i2c4-m0-bmp380.dtbo \
rk3568-i2c4-m0-htu21.dtbo \
rk3568-i2c4-m0-lm75.dtbo \
rk3568-i2c4-m0-pcf8574.dtbo \
rk3568-i2c4-m0-pcf8575.dtbo \
rk3568-i2c4-m0-sht41.dtbo \
rk3568-i2c4-m0-si7020.dtbo \
rk3568-i2c4-m0-tmp102.dtbo \
rk3568-i2c4-m0.dtbo \
rk3568-i2c5-m0.dtbo \
rk3568-npu-disable.dtbo \
Expand Down
34 changes: 34 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-dht11-gpio3-a5.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>

/ {
metadata {
title = "Enable DHT11 on GPIO3_A5";
compatible = "radxa,rock-3c", "radxa,zero3";
category = "misc";
exclusive = "GPIO3_A5";
description = "Enable DHT11 on GPIO3_A5.
On Radxa NX5 IO this is pin 40.";
};
};

&{/} {
dht11: dht11@0 {
compatible = "dth11";
pinctrl-names = "default";
pinctrl-0 = <&dth11_pin>;
gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>;
status = "okay";
};
};

&pinctrl {
dth11 {
dth11_pin: dth11-pin {
rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
11 changes: 11 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c3-m0-jc42.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "rk3568-i2c3-m0.dts"

&i2c3 {
#address-cells = <1>;
#size-cells = <0>;

mcp980x: mcp980x@18 {
compatible = "jedec,jc-42.4-temp";
reg = <0x1a>;
};
};
11 changes: 11 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c3-m0-mcp980x.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "rk3568-i2c3-m0.dts"

&i2c3 {
#address-cells = <1>;
#size-cells = <0>;

mcp980x: mcp980x@18 {
compatible = "maxim,mcp980x";
reg = <0x18>;
};
};
24 changes: 24 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c3-m0-sc16is750.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "rk3568-i2c3-m0.dts"

&i2c3 {
#address-cells = <1>;
#size-cells = <0>;

sc16is750: sc16is750@48 {
compatible = "nxp,sc16is750";
reg = <0x48>;
clocks = <&sc16is750_clk>;
interrupt-parent = <&gpio>;
interrupts = <24 2>;
pinctrl-0 = <&int_pins>;
pinctrl-names = "default";
gpio-controller;
#gpio-cells = <2>;
i2c-max-frequency = <400000>;
};
};


&{/} {

};
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-bme280.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/dts-v1/;
/plugin/;

/ {
metadata {
title = "Enable BME280 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable BME280 on I2C4-M0.
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;

bme280: bme280@76 {
compatible = "bme280";
reg = <0x76>;
status = "okay";
};
};
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-bme680.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/dts-v1/;
/plugin/;

/ {
metadata {
title = "Enable BME680 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable BME680 on I2C4-M0.
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;

bme680: bme680@76 {
compatible = "bme680";
reg = <0x76>;
status = "okay";
};
};
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-bmp280.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/dts-v1/;
/plugin/;

/ {
metadata {
title = "Enable BMP280 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable BMP280 on I2C4-M0.
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;

bmp280: bmp280@76 {
compatible = "bosch,bmp280";
reg = <0x76>;
status = "okay";
};
};
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-bmp380.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/dts-v1/;
/plugin/;

/ {
metadata {
title = "Enable BMP380 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable BMP380 on I2C4-M0.
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;

bmp380: bmp380@76 {
compatible = "bosch,bmp380";
reg = <0x76>;
status = "okay";
};
};
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-htu21.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/dts-v1/;
/plugin/;

/ {
metadata {
title = "Enable HTU21 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable HTU21 on I2C4-M0.
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;

htu21: htu21@76 {
compatible = "meas,htu21";
reg = <0x40>;
status = "okay";
};
};
33 changes: 33 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-lm75.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/dts-v1/;
/plugin/;

/ {
metadata {
title = "Enable LM75 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable LM75 on I2C4-M0 .
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
#address-cells = <1>;
#size-cells = <0>;

lm75: lm75@48 {
compatible = "st,stlm75";
reg = <0x48>;
vs-supply = <&vcc3v3_sys>;
status = "okay";
};
};
38 changes: 38 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-pcf8574.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
metadata {
title = "Enable PCF8574 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,cm3-io", "radxa,cm3-rpi-cm4-io", "radxa,cm3s-io", "radxa,radxa-cm3-sodimm-io", "radxa,e23", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable PCF8574 on I2C4-M0 .
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28.
On Radxa CM3 IO this is SDA pin 19 and SCL pin 23.
On Radxa CM3 RPI CM4 IO this SDA pin 19 and SCL pin 23.
On Radxa CM3S IO this is SDA pin 19 and SCL pin 23.
On Radxa E23 this is SDA pin 19 and SCL pin 23..
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
#address-cells = <1>;
#size-cells = <0>;

pcf8574: pcf8574@20 {
compatible = "nxp,pcf8574";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
status = "okay";
};
};
38 changes: 38 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c4-m0-pcf8575.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rockchip.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
metadata {
title = "Enable PCF8575 on I2C4-M0";
compatible = "radxa,rock-3c", "radxa,zero3";
category = "misc";
exclusive = "GPIO4_B2", "GPIO4_B3";
description = "Enable PCF8575 on I2C4-M0.
On Radxa ROCK 3C this is SDA pin 27 and SCL pin 28, INT=3.
On Radxa ZERO 3 this is SDA pin 27 and SCL pin 28, INT=3";
};
};

&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c4m0_xfer>;
#address-cells = <1>;
#size-cells = <0>;

pcf8575: pcf8575@20 {
compatible = "nxp,pcf8575";
reg = <0x20>;
#gpio-controller;
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PC4 IRQ_TYPE_EDGE_FALLING>;
status = "okay";
};
};
Loading

0 comments on commit 1570b87

Please sign in to comment.