&dsi {
status = "okay";
panel@0 {
compatible = "sitronix,st7703", "simple-panel-dsi";
panel-init-sequence = [
05 fa 01 11
39 00 04 b9 f1 12 83
39 00 1c ba 33 81 05 f9 0e 0e 00 00 00
00 00 00 00 00 44 25 00 91 0a
00 00 02 4f 01 00 00 37
15 00 02 b8 25
39 00 04 bf 02 11 00
39 00 0b b3 0c 10 0a 50 03 ff 00 00 00
00
39 00 0a c0 73 73 50 50 00 00 08 70 00
15 00 02 bc 46
15 00 02 cc 0b
15 00 02 b4 80
39 00 04 b2 c8 12 30
39 00 0f e3 07 07 0b 0b 03 0b 00 00 00
00 ff 00 c0 10
39 00 0d c1 53 00 1e 1e 77 e1 cc dd 67
77 33 33
39 00 07 c6 00 00 ff ff 01 ff
39 00 03 b5 09 09
39 00 03 b6 87 95
39 00 40 e9 c2 10 05 05 10 05 a0 12 31
23 3f 81 0a a0 37 18 00 80 01
00 00 00 00 80 01 00 00 00 48
f8 86 42 08 88 88 80 88 88 88
58 f8 87 53 18 88 88 81 88 88
88 00 00 00 01 00 00 00 00 00
00 00 00 00
39 00 3e ea 00 1a 00 00 00 00 02 00 00
00 00 00 1f 88 81 35 78 88 88
85 88 88 88 0f 88 80 24 68 88
88 84 88 88 88 23 10 00 00 1c
00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 30 05 a0 00 00
00 00
39 00 23 e0 00 06 08 2a 31 3f 38 36 07
0c 0d 11 13 12 13 11 18 00 06
08 2a 31 3f 38 36 07 0c 0d 11
13 12 13 11 18
05 32 01 29
];
panel-exit-sequence = [
05 00 01 28
05 00 01 10
];
};
上面是rk1808中不完整的panel节点,主要是包括了屏幕上电时序:panel-init-sequence;
这个上电时序我们是在panel-simple.c中处理的,处理过程如下:
1、获取上电时序
static int panel_simple_get_cmds(struct panel_simple *panel)
{
const void *data;
int len;
int err;
data = of_get_property(panel->dev->of_node, "panel-init-sequence",
&len);
if (data) {
panel->on_cmds = devm_kzalloc(panel->dev,
sizeof(*panel->on_cmds),
GFP_KERNEL);
if (!panel->on_cmds)
return -ENOMEM;
err = panel_simple_parse_cmds(panel->dev, data, len,
panel->on_cmds);
if (err) {
dev_err(panel->dev, "failed to parse panel init sequencen");
return err;
}
}
首先我们调用of_get_property 通过“panel-init-sequence ”获取了上电时序cmd在内存中首地址赋值给data;
第二步通过panel_simple_parse_cmds函数解析这个cmd(知道了首地址以及长度)
while (len > sizeof(*dchdr)) {
dchdr = (struct cmd_ctrl_hdr *)bp;
if (dchdr->dlen > len) {
dev_err(dev, "%s: error, len=%d", __func__,
dchdr->dlen);
return -EINVAL;
}
bp += sizeof(*dchdr);
len -= sizeof(*dchdr);
bp += dchdr->dlen;
len -= dchdr->dlen;
cnt++;
}
该部分将上电时序按照struct cmd_ctrl_hdr 结构体为基本单位进行了遍历,得到了总的cmd数目记为cnt。
for (i = 0; i < cnt; i++) {
dchdr = (struct cmd_ctrl_hdr *)bp;
len -= sizeof(*dchdr);
bp += sizeof(*dchdr);
pcmds->cmds.dchdr = *dchdr;
pcmds->cmds.payload = bp;
bp += dchdr->dlen;
len -= dchdr->dlen;
}//将一个个命令放入cmd中
再通过这段代码,将一个cmd命令放入pcmd->cmds数组中。
至此我们获取了上电时序了,接下来我们需要通过mipi将其写入lcd中:
当定义了config-drm-mipi-dsi后,我们通过panel_simple_dsi_send_cmds 函数实现cmd命令的发送。
这个函数就是根据mipi dsi协议完成cmd的发送,第一步是区分数据的格式,以调用不同发送接口。
mipi_dsi_generic_write 实现了generic packet 的传送
mipi_dsi_generic_write 实现了DCS command 的发送
如果cmd中有sleep要求时调用mipi_dsi_generic_write 实现。
以上就实现了对dts 中mipi屏幕上电时序的获取、分析、发送着三个过程。
&dsi {
status = "okay";
panel@0 {
compatible = "sitronix,st7703", "simple-panel-dsi";
panel-init-sequence = [
05 fa 01 11
39 00 04 b9 f1 12 83
39 00 1c ba 33 81 05 f9 0e 0e 00 00 00
00 00 00 00 00 44 25 00 91 0a
00 00 02 4f 01 00 00 37
15 00 02 b8 25
39 00 04 bf 02 11 00
39 00 0b b3 0c 10 0a 50 03 ff 00 00 00
00
39 00 0a c0 73 73 50 50 00 00 08 70 00
15 00 02 bc 46
15 00 02 cc 0b
15 00 02 b4 80
39 00 04 b2 c8 12 30
39 00 0f e3 07 07 0b 0b 03 0b 00 00 00
00 ff 00 c0 10
39 00 0d c1 53 00 1e 1e 77 e1 cc dd 67
77 33 33
39 00 07 c6 00 00 ff ff 01 ff
39 00 03 b5 09 09
39 00 03 b6 87 95
39 00 40 e9 c2 10 05 05 10 05 a0 12 31
23 3f 81 0a a0 37 18 00 80 01
00 00 00 00 80 01 00 00 00 48
f8 86 42 08 88 88 80 88 88 88
58 f8 87 53 18 88 88 81 88 88
88 00 00 00 01 00 00 00 00 00
00 00 00 00
39 00 3e ea 00 1a 00 00 00 00 02 00 00
00 00 00 1f 88 81 35 78 88 88
85 88 88 88 0f 88 80 24 68 88
88 84 88 88 88 23 10 00 00 1c
00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 30 05 a0 00 00
00 00
39 00 23 e0 00 06 08 2a 31 3f 38 36 07
0c 0d 11 13 12 13 11 18 00 06
08 2a 31 3f 38 36 07 0c 0d 11
13 12 13 11 18
05 32 01 29
];
panel-exit-sequence = [
05 00 01 28
05 00 01 10
];
};
上面是rk1808中不完整的panel节点,主要是包括了屏幕上电时序:panel-init-sequence;
这个上电时序我们是在panel-simple.c中处理的,处理过程如下:
1、获取上电时序
static int panel_simple_get_cmds(struct panel_simple *panel)
{
const void *data;
int len;
int err;
data = of_get_property(panel->dev->of_node, "panel-init-sequence",
&len);
if (data) {
panel->on_cmds = devm_kzalloc(panel->dev,
sizeof(*panel->on_cmds),
GFP_KERNEL);
if (!panel->on_cmds)
return -ENOMEM;
err = panel_simple_parse_cmds(panel->dev, data, len,
panel->on_cmds);
if (err) {
dev_err(panel->dev, "failed to parse panel init sequencen");
return err;
}
}
首先我们调用of_get_property 通过“panel-init-sequence ”获取了上电时序cmd在内存中首地址赋值给data;
第二步通过panel_simple_parse_cmds函数解析这个cmd(知道了首地址以及长度)
while (len > sizeof(*dchdr)) {
dchdr = (struct cmd_ctrl_hdr *)bp;
if (dchdr->dlen > len) {
dev_err(dev, "%s: error, len=%d", __func__,
dchdr->dlen);
return -EINVAL;
}
bp += sizeof(*dchdr);
len -= sizeof(*dchdr);
bp += dchdr->dlen;
len -= dchdr->dlen;
cnt++;
}
该部分将上电时序按照struct cmd_ctrl_hdr 结构体为基本单位进行了遍历,得到了总的cmd数目记为cnt。
for (i = 0; i < cnt; i++) {
dchdr = (struct cmd_ctrl_hdr *)bp;
len -= sizeof(*dchdr);
bp += sizeof(*dchdr);
pcmds->cmds.dchdr = *dchdr;
pcmds->cmds.payload = bp;
bp += dchdr->dlen;
len -= dchdr->dlen;
}//将一个个命令放入cmd中
再通过这段代码,将一个cmd命令放入pcmd->cmds数组中。
至此我们获取了上电时序了,接下来我们需要通过mipi将其写入lcd中:
当定义了config-drm-mipi-dsi后,我们通过panel_simple_dsi_send_cmds 函数实现cmd命令的发送。
这个函数就是根据mipi dsi协议完成cmd的发送,第一步是区分数据的格式,以调用不同发送接口。
mipi_dsi_generic_write 实现了generic packet 的传送
mipi_dsi_generic_write 实现了DCS command 的发送
如果cmd中有sleep要求时调用mipi_dsi_generic_write 实现。
以上就实现了对dts 中mipi屏幕上电时序的获取、分析、发送着三个过程。
举报