目录
一、如何实现双屏同显/异显
A.最简单的原理:
使用你的主板先将第一个屏点亮,然后再将第二个屏点亮;之后再整合一下你点2个屏的代码,相同的部分,只留其中一个,不同部分,分别写上,就这么简单。之后编译烧录你会看到2个屏是同显的;异显的话,安装你能测试异显的apk,能验证可以显示2个屏是不同的画面即可,具体的需要应用去做。
细节:需要注意的是,先确认你的主板IC是否支持双屏功能。
B.设备树文件:实例:
以下是我点的2个mipi 的dts文件:
a.编译所需的dts文件:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2020 Rockchip Electronics Co., Ltd.
*
*/
#include "vz-k58-yx-v10-2mipi.dtsi"
//#include "vz-ms-camera.dtsi"
/ {
backlight1: backlight1 {
compatible = "pwm-backlight";
pwms = <&pwm4 0 25000 0>;
brightness-levels = <0 85 86 87 87 88 89 89 90 91 91 92 93 93 94 95
95 96 97 97 98 99 99 100 101 101 102 103 103 104 105 105
106 107 107 108 109 109 110 111 111 112 113 113 114 115 115 116
117 117 118 119 119 120 121 121 122 123 123 124 125 125 126 127
127 128 129 129 130 131 131 132 133 133 134 135 135 136 137 137
138 139 139 140 141 141 142 143 143 144 145 145 146 147 147 148
149 149 150 151 151 152 153 153 154 155 155 156 157 157 158 159
159 160 161 161 162 163 163 164 165 165 166 167 167 168 169 169
170 171 171 172 173 173 174 175 175 176 177 177 178 179 179 180
181 181 182 183 183 184 185 185 186 187 187 188 189 189 190 191
191 192 193 193 194 195 195 196 197 197 198 199 199 200 201 201
202 203 203 204 205 205 206 207 207 208 209 209 210 211 211 212
213 213 214 215 215 216 217 217 218 219 219 220 221 221 222 223
223 224 225 225 226 227 227 228 229 229 230 231 231 232 233 233
234 235 235 236 237 237 238 239 239 240 241 241 242 243 243 244
245 245 246 247 247 248 249 249 250 251 251 252 253 253 254 255 >;
default-brightness-level = <200>;
enable-gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>;
vin-supply = <&vcc_5v_lcd>;
};
backlight2: backlight2 {
compatible = "pwm-backlight";
pwms = <&pwm5 0 25000 0>;
brightness-levels = <0 85 86 87 87 88 89 89 90 91 91 92 93 93 94 95
95 96 97 97 98 99 99 100 101 101 102 103 103 104 105 105
106 107 107 108 109 109 110 111 111 112 113 113 114 115 115 116
117 117 118 119 119 120 121 121 122 123 123 124 125 125 126 127
127 128 129 129 130 131 131 132 133 133 134 135 135 136 137 137
138 139 139 140 141 141 142 143 143 144 145 145 146 147 147 148
149 149 150 151 151 152 153 153 154 155 155 156 157 157 158 159
159 160 161 161 162 163 163 164 165 165 166 167 167 168 169 169
170 171 171 172 173 173 174 175 175 176 177 177 178 179 179 180
181 181 182 183 183 184 185 185 186 187 187 188 189 189 190 191
191 192 193 193 194 195 195 196 197 197 198 199 199 200 201 201
202 203 203 204 205 205 206 207 207 208 209 209 210 211 211 212
213 213 214 215 215 216 217 217 218 219 219 220 221 221 222 223
223 224 225 225 226 227 227 228 229 229 230 231 231 232 233 233
234 235 235 236 237 237 238 239 239 240 241 241 242 243 243 244
245 245 246 247 247 248 249 249 250 251 251 252 253 253 254 255 >;
default-brightness-level = <200>;
// enable-gpios = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>;
vin-supply = <&vcc_5v_lcd>;
};
vcc_5v_lcd: vcc-5v-lcd-regulator {
compatible = "regulator-fixed";
//gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
//pinctrl-names = "default";
//pinctrl-0 = <&lcd_avdd_en>;
regulator-name = "vcc_5v_lcd";
regulator-boot-on;
regulator-always-on;
enable-active-high;
};
vcc_1v8_lcd: vcc-1v8-lcd-regulator {
compatible = "regulator-fixed";
gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&lcd_1v8_en>;
regulator-name = "vcc_1v8_lcd";
regulator-boot-on;
regulator-always-on;
enable-active-high;
};
};
&pwm4 {
status = "okay";
};
&pwm5 {
status = "okay";
};
/*****************************************************************************************************************************************************************/
/*** vp and display config ***/
// vp 0
&hdmi_in_vp0 {
status = "okay";
};
&dsi1_in_vp0 {
status = "disabled";
};
&dsi0_in_vp0 {
status = "okay";
};
&edp_in_vp0 {
status = "disabled";
};
&route_dsi0 {
status = "okay";
connect = <&vp0_out_dsi0>;
};
&route_dsi1 {
status = "disabled";
connect = <&vp0_out_dsi1>;
};
// vp 1
&edp_in_vp1 {
status = "disabled";
};
&hdmi_in_vp1 {
status = "disabled";
};
&dsi1_in_vp1 {
status = "okay";
};
&dsi0_in_vp1 {
status = "disabled";
};
&route_dsi0 {
status = "disabled";
connect = <&vp1_out_dsi0>;
};
&route_dsi1 {
status = "okay";
connect = <&vp1_out_dsi1>;
};
/
&route_edp {
status = "disabled";
// connect = <&vp0_out_edp>;
connect = <&vp1_out_edp>;
};
&route_hdmi {
status = "disabled";
connect = <&vp0_out_hdmi>;
// connect = <&vp1_out_hdmi>;
};
/**** end vp config ****/
/*****************************************************************************************************************************************************************/
&hdmi {
status = "okay";
rockchip,phy-table =
<92812500 0x8009 0x0000 0x0270>,
<165000000 0x800b 0x0000 0x026d>,
<185625000 0x800b 0x0000 0x01ed>,
<297000000 0x800b 0x0000 0x01ad>,
<594000000 0x8029 0x0000 0x0088>,
<000000000 0x0000 0x0000 0x0000>;
};
&hdmi_sound {
status = "okay";
};
/*****************************************************************************************************************************************************************/
/**** mipi panle ****/
&video_phy1 {
status = "okay";
};
&video_phy0 {
status = "okay";
};
&dsi0 {
status = "okay";
//rockchip,lane-rate = <1000>;
dsi0_panel: panel1@0 {
status = "okay";
compatible = "simple-panel-dsi";
reg = <0>;
backlight = <&backlight1>;
enable-gpios = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
// pwd-gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&lcd1_rst_gpio &lcd1_pwren>;
init-delay-ms = <120>;
reset-delay-ms = <120>;
enable-delay-ms = <120>;
prepare-delay-ms = <120>;
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
dsi,lanes = <4>;
// #include "BNS101B40HD965D104C.cfg"
// #include "MX080IN21811457A.cfg"
// #include "MX101BA1340-48C.cfg"
// #include "XMZ080AS020A0-31D.cfg"
#include "MX080B2140-L038C.cfg"
// #include "AYF080R1140B11.cfg"
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
panel_in_dsi: endpoint {
remote-endpoint = <&dsi_out_panel>;
};
};
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@1 {
reg = <1>;
dsi_out_panel: endpoint {
remote-endpoint = <&panel_in_dsi>;
};
};
};
};
&xin32k {
status = "disabled";
};
&dsi1 {
sta