1 dtsi中的 & 怎么理解呢?
可以把它理解引用,因为dtsi中的每个模块(驱动程序)都是用{}包在内的,所以当你要修改某个模块A时,可以不直接在它定义的地方修改,可以别的地方(不在同一个文件,需要#include “被访问到的.dtsi”)采用如下方式:
==&=={
==modified: xxx==
};
2 举例说明
2.1 两个模块的原始定义如下:
第一个 ==simple-panel-dsi== 设备
dsi0_panel: panel@0 {
status = "okay";
compatible = "simple-panel-dsi";
reg = <0>;
num = <0>;
id = [83 94];
id-reg = <0x04>;
backlight = <&backlight1>;
pinctrl-names = "default";
pinctrl-0 = <&lcd_rst>;
reset-gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_LOW>;
init-delay-ms = <20>;
reset-delay-ms = <60>;
enable-delay-ms = <60>;
prepare-delay-ms = <60>;
unprepare-delay-ms = <60>;
disable-delay-ms = <60>;
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
dsi,lanes = <4>;
第二个 ==regulator-fixed== 设备
vcc3v3_lcd0_n: vcc3v3-lcd0-n {
compatible = "regulator-fixed";
regulator-name = "vcc3v3_lcd0_n";
regulator-boot-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
2.2 通过 ==&== 引用并修改
&DSI0_PANEL {
POWER-SUPPLY = <&VCC3V3_LCD0_N>; // POWER-SUPPLY 接收的是另一个设备VCC3V3_LCD0_N
};
VCC3V3_LCD0_N设备我要使用到它,但是也需要修改,继续用 &
&VCC3V3_LCD0_N {
GPIO = <&GPIO3 RK_PC6 GPIO_ACTIVE_HIGH>;
ENABLE-ACTIVE-HIGH;
};
3 一个补丁中用到的&
在rockchip某型开发板中,只支持显示3路输出(hdmi, mipi, lvds, edp四选三),以下补丁的内容是把关掉的hdmi重新打开,从中也可以体会到 ==&==的使用技法
diff --git a/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb.dtsi b/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb.dtsi
index f200c1cda..67a349d91 100755
--- a/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb.dtsi
+++ b/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb.dtsi
@@ -228,7 +228,7 @@
};
edp-panel {
- status = "okay";
+ status = "disabled";
compatible = "simple-panel";
backlight = <&backlight2>;
bus-format = <MEDIA_BUS_FMT_RGB888_1X24>;
@@ -1286,7 +1286,7 @@
};
&hdmi {
- status = "disabled";
+ status = "okay";
rockchip,phy-table =
<92812500 0x8009 0x0000 0x0270>,
<165000000 0x800b 0x0000 0x026d>,
@@ -1297,7 +1297,7 @@
};
&hdmi_in_vp0 {
- status = "disabled";
+ status = "okay";
};
&hdmi_in_vp1 {
@@ -1305,7 +1305,7 @@
};
&hdmi_sound {
- status = "disabled";
+ status = "okay";
};
&i2c0 {
diff --git a/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb1-ddr4-v10.dtsi b/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb1-ddr4-v10.dtsi
index 37c013724..93206858b 100755
--- a/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb1-ddr4-v10.dtsi
+++ b/kernel/arch/arm64/boot/dts/rockchip/rk3568-evb1-ddr4-v10.dtsi
@@ -370,7 +370,7 @@
};
&route_hdmi {
- status = "disabled";
+ status = "okay";
connect = <&vp0_out_hdmi>;
};
@@ -395,15 +395,15 @@
&edp {
force-hpd;
//hpd-gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
- status = "okay";
+ status = "disabled";
};
&edp_phy {
- status = "okay";
+ status = "disabled";
};
&edp_in_vp0 {
- status = "okay";
+ status = "disabled";
};
&edp_in_vp1 {
4 还可以用父与子的方式去理解
下图中提到的默认关闭是指 “status = "disabled",在子dtsi中去打开它。
rk3568.dtsi理解为父dtsi, rk3568-evb.dtsi是子dtsi, rk3568-pinctrl.dtsi是专门用来书写pinctrl的dtsi
5 引发的问题
如此灵活的&运行,某个模块看起来是关的,结果却在另外一个地方打开了,如果没有仔细分析,会导致修改某个模块老是不成功,
GPIO占用怎么也消除不掉,让人抓狂。