1 找到 在要编译的rk3288-evb-android-rk808-edp.dts
加入以下mipi dts配置:
/dts-v1/;
#include "rk3288-evb.dtsi"
#include "rk3288-android.dtsi"
#include
#include
#include
。。。。。。。。
// added for mipi dsi start <<<
&dsi0 {
status = "okay";
rockchip,lane-rate = <420>;
panel: panel {
status = "okay";
compatible = "simple-panel-dsi";
reg = <0>;
backlight = <&backlight>;
//由于我们项目中有两个1V8和3V3的使能引脚,所以要配置
3v3_gpio = <&gpio0 13 GPIO_ACTIVE_LOW>;//3v3使能引脚
enable = <&gpio5 13 GPIO_ACTIVE_HIGH>; //1V8使能引脚
reset = <&gpio7 4 GPIO_ACTIVE_LOW>;//复位引脚
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM)>;
dsi,format = ;
bus-format = ;
dsi,lanes = <4>;
//dsi,channel = <1>;
reset-delay-ms = <30>;
init-delay-ms = <120>;
enable-delay-ms = <30>;
prepare-delay-ms = <30>;
unprepare-delay-ms = <30>;
panel-init-sequence = [ //此部分初始化命令一定要正确,此部分命令可找fae要
15 00 02 E0 00
//15:表示DCS 命 令 的 类 型,其长度等于2,
// 00:表示 发送完该命令以后需要延时的时间,单位为 ms
//02:表示命令 payload 的长度
//E0 00 表示实际发送的 payload命令 其中 E0代表要发送的寄存器地址,00代表往0xe0写入的数据
15 00 02 E1 93
15 00 02 E2 65
15 00 02 E3 F8
15 00 02 E0 00
15 00 02 70 02
15 00 02 71 23
15 00 02 72 06
15 00 02 80 03
15 00 02 E6 02
15 00 02 E7 02
15 00 02 E0 01
15 00 02 00 00
15 00 02 01 A0
15 00 02 03 00
15 00 02 04 A0
15 00 02 17 00
15 00 02 18 B1
15 00 02 19 00
15 00 02 1A 00
15 00 02 1B B1
15 00 02 1C 00
15 00 02 1F 3E
15 00 02 20 2D
15 00 02 21 2D
15 00 02 22 0E
15 00 02 37 19
15 00 02 38 05
15 00 02 39 08
15 00 02 3A 12
15 00 02 3C 78
15 00 02 3E 80
15 00 02 3F 80
15 00 02 40 06
15 00 02 41 A0
//15 00 02 4A 35 // test mode on
15 00 02 55 0F
15 00 02 56 01
15 00 02 57 69
15 00 02 58 0A
15 00 02 59 0A
15 00 02 5A 28
15 00 02 5B 19
15 00 02 5D 7C
15 00 02 5E 5E
15 00 02 5F 4E
15 00 02 60 41
15 00 02 61 3F
15 00 02 62 31
15 00 02 63 37
15 00 02 64 23
15 00 02 65 3E
15 00 02 66 3F
15 00 02 67 40
15 00 02 68 5E
15 00 02 69 4F
15 00 02 6A 57
15 00 02 6B 4B
15 00 02 6C 49
15 00 02 6D 2F
15 00 02 6E 03
15 00 02 6F 00
15 00 02 70 7C
15 00 02 71 5E
15 00 02 72 4E
15 00 02 73 41
15 00 02 74 3F
15 00 02 75 31
15 00 02 76 37
15 00 02 77 23
15 00 02 78 3E
15 00 02 79 3F
15 00 02 7A 40
15 00 02 7B 5E
15 00 02 7C 4F
15 00 02 7D 57
15 00 02 7E 4B
15 00 02 7F 49
15 00 02 80 2F
15 00 02 81 03
15 00 02 82 00
15 00 02 E0 02
15 00 02 00 47
15 00 02 01 47
15 00 02 02 45
15 00 02 03 45
15 00 02 04 4B
15 00 02 05 4B
15 00 02 06 49
15 00 02 07 49
15 00 02 08 41
15 00 02 09 1F
15 00 02 0A 1F
15 00 02 0B 1F
15 00 02 0C 1F
15 00 02 0D 1F
15 00 02 0E 1F
15 00 02 0F 43
15 00 02 10 1F
15 00 02 11 1F
15 00 02 12 1F
15 00 02 13 1F
15 00 02 14 1F
15 00 02 15 1F
15 00 02 16 46
15 00 02 17 46
15 00 02 18 44
15 00 02 19 44
15 00 02 1A 4A
15 00 02 1B 4A
15 00 02 1C 48
15 00 02 1D 48
15 00 02 1E 40
15 00 02 1F 1F
15 00 02 20 1F
15 00 02 21 1F
15 00 02 22 1F
15 00 02 23 1F
15 00 02 24 1F
15 00 02 25 42
15 00 02 26 1F
15 00 02 27 1F
15 00 02 28 1F
15 00 02 29 1F
15 00 02 2A 1F
15 00 02 2B 1F
15 00 02 58 10
15 00 02 59 00
15 00 02 5A 00
15 00 02 5B 30
15 00 02 5C 03
15 00 02 5D 30
15 00 02 5E 01
15 00 02 5F 02
15 00 02 60 30
15 00 02 61 01
15 00 02 62 02
15 00 02 63 04
15 00 02 64 7F
15 00 02 65 05
15 00 02 66 12
15 00 02 67 73
15 00 02 68 05
15 00 02 69 04
15 00 02 6A 7F
15 00 02 6B 09
15 00 02 6C 00
15 00 02 6D 04
15 00 02 6E 04
15 00 02 6F 88
15 00 02 70 00
15 00 02 71 00
15 00 02 72 06
15 00 02 73 7B
15 00 02 74 00
15 00 02 75 3C
15 00 02 76 00
15 00 02 77 0D
15 00 02 78 2C
15 00 02 79 00
15 00 02 7A 00
15 00 02 7B 00
15 00 02 7C 00
15 00 02 7D 03
15 00 02 7E 7B
15 00 02 E0 01
15 00 02 0E 01
15 00 02 E0 03
15 00 02 98 2F
15 00 02 E0 04
15 00 02 2B 2B
15 00 02 2E 44
15 00 02 09 10
15 00 02 2D 03
15 00 02 E0 00
05 78 01 11
05 32 01 29
//05:表示DCS 命 令 的 类 型,其长度等于1,还有一个39表示这是一个 DCS 长包命令,payload 长度大于 2。
];
panel-exit-sequence = [
05 16 01 28
05 78 01 10
];
display-timings {
native-mode = <&timing0>;
timing0: timing0 {
clock-frequency = <67000000>;
hactive = <800>;
vactive = <1280>;
hback-porch = <10>;
hfront-porch = <42>;
hsync-len = <20>;
vback-porch = <4>;
vfront-porch = <8>;
vsync-len = <4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
};
};
&route_dsi0 {
status = "okay";
};
&dsi0_in_vopb {
status = "okay";
};
&dsi0_in_vopl {
status = "disabled";
};
// added mipi dsi end
。。。。。。。。。。。。。。
注:由原理图可以知道1v8使能引脚是GPIO5_B5(gpio5 13)和3v3使能引脚是GPIO0_B5(gpio0 13), reset引脚是GPIO7_A4(gpio7 4)
在驱动中增加3v3使能引脚的配置,注意3v3使能引脚是低电平有效
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
old mode 100644
new mode 100755
index daf891c..adbdc7d
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
//增加3v3gpio
@@ -114,6 +114,7 @@ struct panel_simple {
struct gpio_desc *enable_gpio;
struct gpio_desc *reset_gpio;
+ struct gpio_desc *vdd3_3_gpio;
int cmd_type;
struct gpio_desc *spi_sdi_gpio;
//掉电时序 3v3使能引脚是低电平有效,空闲电平是高电平
@@ -603,6 +611,8 @@ static int panel_simple_unprepare(struct drm_panel *panel)
if (p->enable_gpio)
gpiod_direction_output(p->enable_gpio, 0);
+ if (p->vdd3_3_gpio)
+ gpiod_direction_output(p->vdd3_3_gpio, 1);
panel_simple_regulator_disable(panel);
//上电时序 3v3使能引脚是低电平有效,空闲电平是高电平
@@ -630,6 +641,8 @@ static int panel_simple_prepare(struct drm_panel *panel)
if (p->enable_gpio)
gpiod_direction_output(p->enable_gpio, 1);
+ if (p->vdd3_3_gpio)
+ gpiod_direction_output(p->vdd3_3_gpio, 0);
if (p->desc && p->desc->delay.prepare)
msleep(p->desc->delay.prepare);
return -ENOMEM;
//3v3_gpio的dts
@@ -799,6 +818,12 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
dev_err(dev, "failed to request enable GPIO: %d\n", err);
return err;
}
+ panel->vdd3_3_gpio = devm_gpiod_get_optional(dev, "3v3_gpio", 0);
+ if (IS_ERR(panel->vdd3_3_gpio)) {
+ err = PTR_ERR(panel->vdd3_3_gpio);
+ dev_err(dev, "failed to request vdd3_3_gpio GPIO: %d\n", err);
+ return err;
+ }
panel->reset_gpio = devm_gpiod_get_optional(dev, "reset", 0);
if (IS_ERR(panel->reset_gpio)) {
//关机函数,3v3使能引脚是低电平有效,空闲电平是高电平
@@ -935,6 +963,8 @@ static void panel_simple_shutdown(struct device *dev)
if (panel->enable_gpio)
gpiod_direction_output(panel->enable_gpio, 0);
+ if (panel->vdd3_3_gpio)
+ gpiod_direction_output(panel->vdd3_3_gpio, 1);
panel_simple_regulator_disable(&panel->base);
}
2.编译kernel,烧写固件,绑定mipi成功会有以下log出现
Line 618: [ 0.923158] rockchip-drm display-subsystem: bound ff960000.dsi (ops dw_mipi_dsi_ops)
Line 619: [ 0.923170] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
在rk3288.dtsi中可以知道mipi地址是 ff960000
。。。。。。。。
dsi0: dsi@ff960000 {
compatible = "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi";
reg = <0x0 0xff960000 0x0 0x4000>;
interrupts = ;
clocks = <&cru SCLK_MIPIDSI_24M>, <&cru PCLK_MIPI_DSI0>;
clock-names = "ref", "pclk";
resets = <&cru SRST_MIPIDSI0>;
reset-names = "apb";
power-domains = <&power RK3288_PD_VIO>;
rockchip,grf = <&grf>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
ports {
#address-cells = <1>;
#size-cells = <0>;
dsi0_in: port {
#address-cells = <1>;
#size-cells = <0>;
dsi0_in_vopb: endpoint@0 {
reg = <0>;
remote-endpoint = <&vopb_out_dsi0>;
};
dsi0_in_vopl: endpoint@1 {
reg = <1>;
remote-endpoint = <&vopl_out_dsi0>;
};
};
};
};
。。。。。。。。