前言
本文着重介绍 ADV7533 芯片在高通 msm8909 平台上调通的经验
硬件平台:msm8909
软件平台:Android5.0 Android8.0 (均已经调通)
芯片IC:ADV7533
功能实现:MIPI 转HDMI
简介:
ADV7533 是一款能够将标准MIPI信号转换为HDMI 信号的转换芯片。
即从msm8909的主控端信号,转换成HDMI信号后输出到HDMI 显示器上。
即原本输出到LCD的mipi信号,去连接到ADV7533 芯片上,然后输出到HDMI接口。
有以下几个特点:
- MIPI 接收特性
- 支持2、3、4 lane
- 支持 MIPI输入16bit、24bit(默认)、30bit、
- 最大速率,800Mz *4 lane
- 控制接口
- IIC
- HDMI标准
- HDMI v1.3 标准,兼容V1.0
- Audio
- 逻辑电平 1.8V – 3.3V
- 音频输出、输出转换(默认不用)
- 热插拔支持
- 利用中断实现HDMI热插拔检测(默认不用)
最终效果:
从企鹅Logo开始显示,到开机动画、桌面、息屏唤醒都显示正常。和接普通的MIPI LCD屏幕显示一样。
注意点:
1. 总体修改流程
- 先在项目基础上适配新的一套LCD的驱动,或者在默认的LCD驱动上修改参数配置。
- 去除多余的 init-code 参数,只保留退出休眠、开启显示,进入休眠、关闭显示的参数。
- 适当调整前后肩参数及相关的 Timing 参数
- 增加LK和kernel的ADV7533 驱动
- 设置mipi时钟为高速模式
- 设置mipi时钟为连续模式
这里的配置流程为,在正常的新增一套LCD驱动流程的基础上。在LK和Kernel分别配置IIC + ADV7533 驱动。以这里新增lcd 驱动名字为rm68200为例,进行讲述。
2. LK 修改
主要包含3部分
- 适配LK LCD驱动
- 配置LK IIC
- 增加LK ADV 7533 驱动
2.1 适配 lcd 驱动
配置lcd 控制宏
+#Begin: add by leo for RM68200_720P & adv7533
+LCD_RM68200_720P_SUPPORT_PROJECTS := N1
+ifneq ($(filter $(TARGET_PRODUCT), $(LCD_RM68200_720P_SUPPORT_PROJECTS)),)
+ DEFINES += FEATURE_XXX_LCD_RM68200_720P_SUPPORT=1
+endif
+#End: add by leo for RM68200_720P & adv7533
修改LK lcd驱动加载(这里也包含了lk的adv7533驱动的头文件,要引用adv7533的入口函数)
包含lcd和adv7533的头文件
bootable/bootloader/lk/target/msm8909/oem_panel.c
+#if FEATURE_XXX_LCD_RM68200_720P_SUPPORT
+#include "include/panel_rm68200_720p_video.h"
+#include "include/mipi_adv7533_dsi2hdmi.h"
+#endif
配置 lcd的 ID 枚举变量
@@ -148,6 +153,9 @@ enum {
#endif
#if DSI2DPI_TC358762
ST7789V_VIDEO_PANEL,
+#endif
+#if FEATURE_XXX_LCD_RM68200_720P_SUPPORT
+ RM68200_720P_VIDEO_PANEL_XXX,
#endif
UNKNOWN_PANEL
};
声明adv7533 入口函数
+#if FEATURE_XXX_LCD_RM68200_720P_SUPPORT
+extern int adv7533_init(void);
+#endif
根据项目,指定lcd id,选择lcd 驱动
@@ -337,8 +349,43 @@ static int init_panel_data(struct panel_struct *panelstruct,
panel_id = ST101XBJ05_720P_VIDEO_PANEL_XXX;
#endif
+
+#if FEATURE_XXX_LCD_RM68200_720P_SUPPORT
+ panel_id = RM68200_720P_VIDEO_PANEL_XXX;
+ dprintf(CRITICAL, "select RM68200 720P \n");
+#endif
+
配置 lcd 属性参数和 加入ADV7533驱动的入口函数
+#if FEATURE_XXX_LCD_RM68200_720P_SUPPORT
+ case RM68200_720P_VIDEO_PANEL_XXX:
+ panelstruct->paneldata = &rm68200_720p_video_panel_data;
+ panelstruct->panelres = &rm68200_720p_video_panel_res;
+ panelstruct->color = &rm68200_720p_video_color;
+ panelstruct->videopanel = &rm68200_720p_video_panel;
+ panelstruct->commandpanel = &rm68200_720p_video_command_panel;
+ panelstruct->state = &rm68200_720p_video_state;
+ panelstruct->laneconfig = &rm68200_720p_video_lane_config;
+ panelstruct->paneltiminginfo
+ = &rm68200_720p_video_timing_info;
+ panelstruct->panelresetseq
+ = &rm68200_720p_video_reset_seq;
+ panelstruct->backlightinfo
+ = &rm68200_720p_video_backlight;
+ pinfo->mipi.panel_on_cmds
+ = rm68200_720p_video_on_command;
+ pinfo->mipi.num_of_panel_on_cmds
+ = RM68200_720P_VIDEO_ON_COMMAND;
+ memcpy(phy_db->timing,
+ rm68200_720p_video_timings, TIMING_SIZE);
+ if (adv7533_init() < 0) {
+ dprintf(CRITICAL, "%s leo adv7533_init failed \n", __func__);
+ break;
+ }
+ break;
+#endif
2.2 配置LK IIC
参考文档和博客
80-nu767-1_h_linux_bam_low-speed_peripherals_configuration_and_debug_guide.pdf
Qcom平台 ADV7533 调试指南
更详细的内容,参考我的上一篇博客
Qcom平台 ADV7533 调试指南
配置过程略过
2.3 增加ADV7533驱动
增加 mipi_adv7533_dsi2hdmi.c 到 bootable/bootloader/lk/dev/gcdb/display/
增加 mipi_adv7533_dsi2hdmi.h 到bootable/bootloader/lk/dev/gcdb/display/include/
配置 mk编译驱动文件
bootable/bootloader/lk/dev/gcdb/display/rules.mk
@@ -6,7 +6,8 @@ OBJS += \
$(LOCAL_DIR)/gcdb_display.o \
$(LOCAL_DIR)/gcdb_display_param.o \
$(LOCAL_DIR)/panel_display.o \
- $(LOCAL_DIR)/gcdb_autopll.o
+ $(LOCAL_DIR)/gcdb_autopll.o \
+ $(LOCAL_DIR)/mipi_adv7533_dsi2hdmi.o
附件略过
3. Kernel 修改
也是主要包含3部分
- 适配Kernel LCD驱动
- 配置Kernel IIC 节点
- 增加Kernel ADV 7533 驱动
3.1 适配Kernel LCD驱动
包含 lcd 驱动头文件
kernel/msm-3.18/arch/arm/boot/dts/xxx/XXX_msm8909-qrd-skue.dtsi
+#include "dsi-panel-rm68200_720p_video.dtsi"
新增 lcd 驱动节点,并修改为默认的lcd 加载选项。
(这里客户的主板修改了lcd的rst引脚控制,由于不是重点,略过描述)
+#if 1
+&dsi_rm68200_720p_video {
+ qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
+ qcom,cont-splash-enabled;
+};
+#endif
+
&mdss_dsi0 {
- qcom,dsi-pref-prim-pan = <&dsi_nt35521_720p_vid>;
+ qcom,dsi-pref-prim-pan = <&dsi_rm68200_720p_video>;
pinctrl-names = "mdss_default", "mdss_sleep";
pinctrl-0 = <&mdss_dsi_active &mdss_te_active>;
pinctrl-1 = <&mdss_dsi_suspend &mdss_te_suspend>;
- qcom,platform-reset-gpio = <&msm_gpio 25 0>;
+ qcom,platform-reset-gpio = <&msm_gpio 8 0>;
};
3.2 配置 Kernel IIC 节点
由前面客户主板原理图得知,IIC 是 gpio10、gpio11,qup 地址为78ba000。
从硬件设计和gpio功能描述,gpio10、gpio11,默认配置为SPI0,需要屏蔽掉SPI的功能配置,修改为IIC-6的功能配置。
主要包含两方面
- 屏蔽SPI0 配置节点,新增IIC-6 配置节点
- 屏蔽SPI0 pinctrl 配置,新增IIC-6 pinctrl 配置
- 添加 ADV7533 从设备节点
屏蔽SPI0 配置节点
kernel/msm-3.18/arch/arm/boot/dts/XXX/xxx_msm8909.dtsi
@@ -42,10 +42,11 @@
- spi0 = &spi_0; /* SPI0 controller device */
+ // spi0 = &spi_0; /* SPI0 controller device */
+ i2c6 = &i2c_6; /* I2c6 cntroller device for addr7533 */
新增IIC-6 配置节点
+ i2c_6: i2c@78ba000 { /* BLSP1 QUP6 */
+ compatible = "qcom,i2c-msm-v2";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg-names = "qup_phys_addr";
+ reg = <0x78ba000 0x1000>;
+ interrupt-names = "qup_irq";
+ interrupts = <0 100 0>;
+ clocks = <&clock_gcc clk_gcc_blsp1_ahb_clk>,
+ <&clock_gcc clk_gcc_blsp1_qup6_i2c_apps_clk>;
+ clock-names = "iface_clk", "core_clk";
+ qcom,clk-freq-out = <100000>;
+ qcom,clk-freq-in = <19200000>;
+ pinctrl-names = "i2c_active", "i2c_sleep";
+ pinctrl-0 = <&i2c_6_active>;
+ pinctrl-1 = <&i2c_6_sleep>;
+ qcom,noise-rjct-scl = <0>;
+ qcom,noise-rjct-sda = <0>;
+ dmas = <&dma_blsp1 14 64 0x20000020 0x20>,
+ <&dma_blsp1 15 32 0x20000020 0x20>;
+ dma-names = "tx", "rx";
+ qcom,master-id = <86>;
+ };
然后,屏蔽SPI-0的pinctrl配置,新增IIC-6的pinctrl配置
+#if 0
spi0 {
spi0_default: spi0_default {
mux {
@@ -431,6 +433,7 @@
};
};
};
+#endif
+#if 1
+ pmx_i2c_6 {
+ i2c_6_active: i2c_6_active {
+ mux {
+ pins = "gpio11", "gpio10";
+ function = "blsp_i2c6";
+ };
+ config {
+ pins = "gpio11", "gpio10";
+ drive-strength = <2>; /* 2 MA */
+ bias-disable; /* No PULL */
+ };
+ };
+ i2c_6_sleep: i2c_6_sleep {
+ mux {
+ pins = "gpio11", "gpio10";
+ function = "blsp_i2c6";
+ };
+ config {
+ pins = "gpio11", "gpio10";
+ drive-strength = <2>; /* 2 MA */
+ bias-disable; /* No PULL */
+ };
+ };
+ };
+#endif
添加 ADV7533 i2C 从设备节点
+#if 1
+ i2c@78ba000 {
+ adv7533@39 {
+ compatible = "adv,adv7533";
+ reg = <0x39>;
+ adv7533,main-addr = <0x39>;
+ adv7533,cec-dsi-addr = <0x3C>;
+ adv7533,video-mode = <2>;
+ qcom,hdmi-pwr-en = <&msm_gpio 3 0x0>;
+ vdd-supply = <&pm8909_l17>;
+ vcc_i2c-supply = <&pm8909_l6>;
+ };
+ };
+#endif
4. ADV7533 驱动流程详解
前言: ADV7533的驱动无论是在LK 还是Kernle,基本套路都是一样的。都是获取配置基本的gpio脚,用于上电控制(gpio控制外部ldo上电),中断配置(这里不用)。
然后写入需要的寄存器配置,只要输入符合格式的mipi信号,就能成功转换出HDMI 信号。
4.1 入口函数
入口函数
int adv7533_init(void)
{
int rev = -1;
int soc_ver = board_soc_version();
// soc_ver shoudle <= BOARD_SOC_VERSION2
dprintf(CRITICAL, "Enter %s soc_ver 0x%x\n", __func__, soc_ver);
mdelay(5);
#if 1
// config adv7533
adv7533_hw_config();
// config i2c-6
i2c6_dev = qup_blsp_i2c_init(BLSP_ID_1, QUP_ID_5, 100000, 19200000);
mdelay(1200);
if (!i2c6_dev) {
dprintf(CRITICAL, "%s Failed to init i2c-6 \n", __func__);
return -1;
}
#endif
// read adv7533 test
rev = adv7533_read_test();
if (rev < 0) {
dprintf(CRITICAL, "adv7533_read_test faile, exit \n");
return rev;
}
// init adv7533 reg
rev = adv7533_write_init_config();
if (rev < 0) {
dprintf(CRITICAL, "adv7533_write_init_config faile, exit \n");
return rev;
}
#if DUMP_ADV7533_REG
dump_adv7533_registers();
#endif
return 0;
}
4.2 驱动流程
主要包含几部分:
- 硬件配置函数
- 申请配置IIC
- 读ADV7533从设备测试
- 初始化ADV7533
4.2.1 硬件配置函数
static void adv7533_hw_config(void)
{
dprintf(CRITICAL, "%s leo enter \n", __func__);
// enable vdd and i2c-supply
regulator_enable(REG_LDO2 | REG_LDO6 | REG_LDO17);
mdelay(5);
// enable adv7533 power
gpio_tlmm_config(3, 0, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA, GPIO_DISABLE);
mdelay(5);
gpio_set(3, GPIO_STATE_HIGH);
mdelay(10);
}
分析:
LDO2、6、17 是lk 阶段,lcd 的相关的ldo 上电配置,这里直接先配置好。
gpio_3 是ADV7533 的外部上电控制,需要先上电
gpio_3 控制ADV7533 上电,如图:
4.2.2 申请配置IIC
略过
4.2.3 读从设备测试
略过
4.2.4 写入初始化参数
略过
4.3 注意事项
- ADV7533 需要全程保持时钟高速
- ADV7533 需要配置MIPI 信号为连续模式
ADV7533 需要全程保持时钟高速
bootable\bootloader\lk\dev\gcdb\display\include\panel_rm68200_720p_video.h
设置 lane_config 参数,配置 mipi clk hs 模式
/*---------------------------------------------------------------------------*/
/* Lane configuration */
/*---------------------------------------------------------------------------*/
static struct lane_configuration rm68200_720p_video_lane_config = {
3, 0, 1, 1, 1, 0, 1
};
lane_configuration 定义
struct lane_configuration {
uint8_t dsi_lanes;
uint8_t dsi_lanemap;
uint8_t lane0_state;
uint8_t lane1_state;
uint8_t lane2_state;
uint8_t lane3_state;
uint8_t force_clk_lane_hs;
};
ADV7533 需要配置MIPI 信号为连续模式
bootable\bootloader\lk\dev\gcdb\display\include\panel_rm68200_720p_video.h
traffic_mode; 配置为0,即为连续模式
/*---------------------------------------------------------------------------*/
/* Video mode panel information */
/*---------------------------------------------------------------------------*/
static struct videopanel_info rm68200_720p_video_panel = {
1, 0, 0, 0, 1, 1, 0, 0, 0x9
};
videopanel_info 定义
struct videopanel_info {
uint8_t hsync_pulse;
uint8_t hfp_power_mode;
uint8_t hbp_power_mode;
uint8_t hsa_power_mode;
uint8_t bllp_eof_power_mode;
uint8_t bllp_power_mode;
uint8_t traffic_mode;
uint8_t dma_delayafter_vsync;
uint32_t bllp_eof_power;
};
bootable\bootloader\lk\platform\msm_shared\include\mipi_dsi.h
#define DSI_NON_BURST_SYNCH_PULSE 0
#define DSI_NON_BURST_SYNCH_EVENT 1
#define DSI_BURST_MODE 2
因此,同理。LCD Kernel 驱动也要配置这两项。
kernel\msm-3.18\arch\arm\boot\dts\XXX\dsi-panel-rm68200_720p_video.dtsi
qcom,mdss-dsi-traffic-mode = "non_burst_sync_pulse";
qcom,mdss-dsi-force-clock-lane-hs;
4.3.1 MIPI traffic_mode
Kernel 中的定义
kernel\msm-3.18\drivers\video\msm\mdss\mdss_dsi.h
#define DSI_NON_BURST_SYNCH_PULSE 0
#define DSI_NON_BURST_SYNCH_EVENT 1
#define DSI_BURST_MODE 2
今天的文章qca9377_adg98120使用方法分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/66599.html