rk3568 Android11/12 适配 E-ink
“EINK”是英语ElectronicInk的缩写。翻译成中文为“电子墨水”。电子墨水由数百万个微胶囊(Microcapsules)所构成,微胶囊的大小约等同于人类头发的直径。每个微胶囊里含有电泳粒子──带负电荷的白色以及带正电荷的黑色粒子,悬浮于透明液体中。利用正负相吸的原理,当电场接通时,该区块对应的黑或白粒子会移动至微胶囊的顶端,使用者在该区块上,就能看见白色或黑色。
提示:E-ink 编译固件时需要匹配对应的源码中 ebook 工程。
文章目录
- rk3568 Android11/12 适配 E-ink
- 圈重点 看想学
- 1. rk3568适配 E-ink屏
- 1.1 核查原理图,适配 E-ink屏
- 1.2 E-ink其它分辨率适配
- 1.3 waveform.img 和 vcom
- 2 E-ink 开机相关
- 2.1 开机过程logo相关图片
- 2.2 E-ink 刷新模式
- Tips
- 总结
圈重点 看想学
a) rk3568 适配 E-ink屏
b) 适配 E-ink屏问题
1. rk3568适配 E-ink屏
E-ink与LCD差别非常大,从显示原理到刷新机制,再到色彩范围应用场景;注定它是特殊领域的专用产品。
1.1 核查原理图,适配 E-ink屏
-
E-ink 屏刷新时需要导入特殊的上电时许,要求比较严苛;需要外挂供电IC
tps65185
。
详细查看原理图,梳理该电源芯片所使用GPIO映射关系如下:
TPS65185 使用 I2C1;
IRQ 占用 GPIO3_A7 高电平有效;
wakeup 占用 GPIO3_C3 高电平有效;
vcomctl 占用 GPIO4_B2 高电平有效;
powerup 占用 GPIO4_C5 高电平有效; -
E-ink 在 rk3568 占用的功能模块
-
E-ink排线接口
-
E-ink 内核设备树适配 (以6英寸的eink屏为例)
/ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
waveform_reserved: waveform@10800000 {
reg = <0x0 0x10800000 0x0 0x100000>;
};
display_reserved: framebuffer@10900000 {
reg = <0x0 0x10900000 0x0 0x2c00000>;
};
};
ebc_dev: ebc-dev {
compatible = "rockchip,ebc-dev";
ebc_tcon = <&ebc>;
eink_tcon = <&eink>;
memory-region = <&display_reserved>;
waveform-region = <&waveform_reserved>;
status = "okay";
};
};
&ebc {
/* clock rate 1000M/n, (n=1~32) */
assigned-clocks = <&cru CPLL_333M>, <&cru DCLK_EBC>;
//assigned-clock-rates = <340000000>, <340000000>;
assigned-clock-rates = <250000000>, <250000000>;
//assigned-clock-rates = <100000000>, <100000000>;
status = "okay";
};
&eink {
status = "okay";
};
&ebc_dev {
pmic = <&tps65185>;
status = "okay";
/* ED060XCD */
panel,width = <1024>;
panel,height = <758>;
panel,vir_width = <1024>;
panel,vir_height = <758>;
panel,sdck = <20000000>;
panel,lsl = <6>;
panel,lbl = <6>;
panel,ldl = <256>;
panel,lel = <38>;
panel,gdck-sta = <4>;
panel,lgonl = <262>;
panel,fsl = <2>;
panel,fbl = <4>;
panel,fdl = <758>;
panel,fel = <5>;
panel,mirror = <0>;
panel,panel_16bit = <0>;
panel,panel_color = <0>;
panel,width-mm = <90>;
panel,height-mm = <122>;
};
&i2c1 {
status = "okay";
tps65185: tps65185@68 {
status = "okay";
compatible = "ti,tps65185";
reg = <0x68>;
pinctrl-names = "default";
pinctrl-0 = <&tps65185_gpio>;
int-gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>;
wakeup-gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_HIGH>;
vcomctl-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;
powerup-gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>;
};
};
&pinctrl {
tps_pmic {
tps65185_gpio: tps65185-gpio {
rockchip,pins =
<4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
<4 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
<3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};
1.2 E-ink其它分辨率适配
硬件EBC所用接口相同,根据 DTS 规则只需要覆写分辨率属性即可。
- 9.7英寸 1200x825分辨 E-ink
&ebc_dev {
pmic = <&tps65185>;
status = "okay";
/* ED097TC2U1 */
panel,width = <1200>;
panel,height = <825>;
panel,vir_width = <1200>;
panel,vir_height = <825>;
panel,sdck = <25000000>;
panel,lsl = <4>;
panel,lbl = <4>;
panel,ldl = <300>;
panel,lel = <36>;
panel,gdck-sta = <18>;
panel,lgonl = <265>;
panel,fsl = <2>;
panel,fbl = <4>;
panel,fdl = <825>;
panel,fel = <24>;
panel,mirror = <0>;
panel,panel_16bit = <0>;
panel,panel_color = <0>;
panel,width-mm = <203>;
panel,height-mm = <140>;
- 10.3英寸 1872x1404分辨 E-ink
&ebc_dev {
pmic = <&tps65185>;
status = "okay";
/* ES103TC1 */
panel,width = <1872>;
panel,height = <1404>;
panel,vir_width = <1872>;
panel,vir_height = <1404>;
panel,sdck = <33300000>;
panel,lsl = <18>;
panel,lbl = <17>;
panel,ldl = <234>;
panel,lel = <7>;
panel,gdck-sta = <34>;
panel,lgonl = <192>;
panel,fsl = <1>;
panel,fbl = <4>;
panel,fdl = <1404>;
panel,fel = <12>;
panel,mirror = <0>;
panel,panel_16bit = <1>;
panel,panel_color = <0>;
panel,width-mm = <157>;
panel,height-mm = <210>;
- 13.3英寸 2208x1650分辨 E-ink
&ebc_dev {
pmic = <&tps65185>;
status = "okay";
/* ES133TC1 */
panel,width = <2200>;
panel,height = <1650>;
panel,vir_width = <2208>;
panel,vir_height = <1650>;
panel,sdck = <37500000>;
panel,lsl = <4>;
panel,lbl = <8>;
panel,ldl = <275>;
panel,lel = <14>;
panel,gdck-sta = <34>;
panel,lgonl = <217>;
panel,fsl = <1>;
panel,fbl = <4>;
panel,fdl = <1650>;
panel,fel = <6>;
panel,mirror = <0>;
panel,panel_16bit = <1>;
panel,panel_color = <0>;
panel,width-mm = <157>;
panel,height-mm = <210>;
- 14英寸 2240x1680分辨 E-ink
&ebc_dev {
pmic = <&tps65185>;
status = "okay";
panel,width = <2232>;
panel,height = <1680>;
panel,vir_width = <2240>;
panel,vir_height = <1680>;
panel,sdck = <33300000>;
panel,lsl = <4>;
panel,lbl = <8>;
panel,ldl = <279>;
panel,lel = <14>;
panel,gdck-sta = <34>;
panel,lgonl = <217>;
panel,fsl = <1>;
panel,fbl = <4>;
panel,fdl = <1680>;
panel,fel = <6>;
panel,mirror = <0>;
panel,panel_16bit = <1>;
panel,panel_color = <0>;
panel,width-mm = <157>;
panel,height-mm = <210>;
};
ebc clk配置说明: 不同的屏,只需根据屏幕sdclk的值计算出ebc的clk rates填写到ebc节点中即可,16位屏计算公式ebc_dclk = sdclk * 8; 8位屏计算公式ebc_dclk = sdclk * 4; 以ES103TC1为例ebc_dclk= 33300000 * 8 = 266400000; 实际需求是266.4M,受限于其父时钟1000M,实际最多只能分配到250M,如下dts配置:
/* ES103TC1 */
&ebc {
/* clock rate 1000M/n, (n=1~32) */
assigned-clocks = <&cru CPLL_333M>, <&cru DCLK_EBC>;
assigned-clock-rates = <250000000>, <250000000>;
status = "okay";
};
1.3 waveform.img 和 vcom
刷写固件时需要烧录正确的 waveform.img 镜像,否则屏幕显示乱码或显示乱码。
除此之外,还有另一个参数vcom电压,每个屏幕都有一个对应的参数—vcom电压;这个数值与屏幕中标签相匹配,切忌刷入正确数值。
- vcom 电压确认
可查看/sys/devices/platform/ebcdev/pmic_vcom
确认是否正确。
# 查看vcom电压值,单位mV
cat /sys/devices/platform/ebcdev/pmic_vcom
1890
# 屏对标程vcom电压 -1.980V,写入方法如下
echo 1890 > /sys/devices/platform/ebcdev/pmic_vcom
- 波形文件确认
# 查看当前使用波形文件版本
cat /sys/devices/platform/ebc-dev/waveform_version
至此 E-ink屏内核适配基本完成。
2 E-ink 开机相关
2.1 开机过程logo相关图片
logo支持uboot kernel 阶段显示,充电动画和 logo所使用格式要求为bmp,并且要求该格式的图片分辨率与屏的分辨率一致,否则无法显示;系统在执行./mkimage.sh时会自动转换bmp格式的图片为灰度图。如果客户需要替换相关图片,请根据目录提示更新相关资源。在源码中对应文件夹:device/rockchip/rk356x/rk3566_eink/eink_logo
eink_logo/
├── android_logo
│ └── bootanimation.zip #Android 开机动画
├── kernel_logo
│ └── kernel.bmp # kernel logo
├── poweroff_logo
│ ├── poweroff_nopower.png # 低电量关机显示图片
│ └── poweroff.png # 关机显示图片
├── standby_logo
│ ├── standby_charge.png #充电休眠显示图片
│ ├── standby_lowpower.png #低电量休显示眠图片
│ └── standby.png #休眠显示图片
└── uboot_logo
├── battery_0.bmp # 电量 ≥0% 且 < 20%
├── battery_1.bmp # 电量 ≥2% 且 < 40%
├── battery_2.bmp # 电量 ≥40% 且 < 60%
├── battery_3.bmp # 电量 ≥60% 且 < 80%
├── battery_4.bmp # 电量 ≥80% 且 < 100%
├── battery_5.bmp # 电量 100%
├── battery_fail.bmp # uboot阶段电量过低,无法开机
├── poweroff.bmp # uboot阶段关机显示图片
└── uboot.bmp # uboot logo图片
以上为Android上层预置的待机、关机等相关图片资源,源码编译完成后会预置到板载系统的/vendor/media/
。系统支持动态待机,关机图片,用户可以把相关图片存放到/data/misc/
,系统优先加载该路径下的图片资源。如果用户资源图片不存在,则使用系统图片。用户预置资源图片格式为png,且分辨率与屏幕分辨率一致,否则显示异常(显示不全或乱码)。
用户关机图片 "/data/misc/poweroff.png"
用户低电关机显示图片 "/data/misc/poweroff_nopower.png"
用户待机显示图片 "/data/misc/standby.png"
用户待机低电显示图片 "/data/misc/standby_lowpower.png"
用户待机充电显示图片 "/data/misc/standby_charge.png"
系统关机显示图片 "/vendor/media/poweroff.png"
系统关机低电显示图片 "/vendor/media/poweroff_nopower.png"
系统待机显示图片 "/vendor/media/standby.png"
系统待机低电显示图片 "/vendor/media/standby_lowpower.png"
系统待机充电显示图片 "/vendor/media/standby_charge.png"
2.2 E-ink 刷新模式
E-ink 刷新模式可参考源码文档 RKDocs/common/Ebook/Rockchip_RK3566_Introduction_EBOOK_Display_Mode_CN.pdf
。
Tips
- rk3568 没有对应的工程示例,可参考rk3566_eink 和 rk3566_einkw6。
- TPS658185 使用频繁,为避免受影响建议单独总线。
- 电磁笔和触屏使用总线数据量比较庞大,建议分开且不与 tps65185共用。
总结
活学活用,做个合格的搬运工。