Qualcomm platform debugging ADV7533

Preface

This article focuses on the experience of ADV7533 chip debugging on the Qualcomm msm8909 platform

Hardware platform: msm8909

Software platform: Android5.0 Android8.0 (both have been adjusted)

Chip IC: ADV7533

Function realization: MIPI to HDMI

 

Introduction:

ADV7533 is a conversion chip that can convert standard MIPI signals into HDMI signals.

That is, the master control terminal signal from msm8909 is converted into HDMI signal and then output to the HDMI display.

That is, the mipi signal originally output to the LCD is connected to the ADV7533 chip, and then output to the HDMI interface.

It has the following characteristics:

  1. MIPI receiving characteristics
    1. Support 2, 3, 4 lane
    2. Support MIPI input 16bit, 24bit (default), 30bit,
    3. Maximum speed, 800Mz *4 lane
  2. Control interface
    1. IIC
  3. HDMI standard
    1. HDMI v1.3 standard, compatible with V1.0
  4. Audio
    1. Logic level 1.8V – 3.3V
    2. Audio output, output conversion (not used by default)
  5. Hot plug support
    1. Use interrupts to realize HDMI hot plug detection (not used by default)

final effect:

From the start of the penguin logo, to the boot animation, desktop, and wake-up are all displayed normally. It is the same as connecting to the ordinary MIPI LCD screen.

important point:

  1. LK needs to configure IIC and initialize ADV7533
  2. MIPI clock uses high-speed mode throughout
  3. Use clock continuous mode

 

1. Overall revision process

  1. First adapt a new set of LCD drivers based on the project, or modify the parameter configuration on the default LCD driver.
  2. Remove redundant init-code parameters, and only keep the parameters for exiting sleep, turning on display, entering sleep, and turning off display.
  3. Properly adjust the front and back shoulder parameters and related Timing parameters
  4. Add LK and kernel ADV7533 driver
  5. Set the mipi clock to high-speed mode
  6. Set the mipi clock to continuous mode

The configuration process here is based on the normal addition of a set of LCD drive processes. Configure IIC + ADV7533 driver in LK and Kernel respectively. Take the newly added lcd driver name rm68200 as an example to describe.

 2.  LK modification

Mainly contains 3 parts

  1. Adapt to LK LCD driver
  2. Configure LK IIC
  3. Add LK ADV 7533 driver

2.1 Adapt lcd driver

Configure lcd control macro

+#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

Modify the LK lcd driver loading (here also contains the header file of the adv7533 driver of lk, to reference the entry function of adv7533)

Contains lcd and adv7533 header files

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

Configure the ID enumeration variable of lcd

@@ -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
 };

Declare adv7533 entry function

+#if FEATURE_XXX_LCD_RM68200_720P_SUPPORT
+extern int adv7533_init(void);
+#endif

According to the project, specify the lcd id and select the lcd driver

@@ -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
+

Configure lcd attribute parameters and join the entry function of ADV7533 driver

+#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 Configure LK IIC

Reference documents and blogs

  80-nu767-1_h_linux_bam_low-speed_peripherals_configuration_and_debug_guide.pdf

  https://blog.csdn.net/eliot_shao/article/details/53351759

For more detailed content, refer to my previous blog

  https://blog.csdn.net/FANG_YISHAO/article/details/113180983

The configuration process is skipped

2.3 Add ADV7533 driver

Add mipi_adv7533_dsi2hdmi.c to bootable/bootloader/lk/dev/gcdb/display/

Add mipi_adv7533_dsi2hdmi.h to bootable/bootloader/lk/dev/gcdb/display/include/

Configure mk to compile the driver file

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

Attachment skip

3. Kernel modification

It also mainly contains 3 parts

  1. Adapt to Kernel LCD driver
  2. Configure Kernel IIC node
  3. Add Kernel ADV 7533 driver

3.1 Adapt to Kernel LCD driver

Contains lcd driver header files

kernel/msm-3.18/arch/arm/boot/dts/xxx/XXX_msm8909-qrd-skue.dtsi
+#include "dsi-panel-rm68200_720p_video.dtsi"

 

Add a new lcd driver node and modify it to the default lcd loading option.

( Here the customer's board revised the lcd the rst pin control, because it is not the focus, skip the description )


+#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 Configure Kernel IIC node

According to the previous customer motherboard schematic diagram, the IIC is gpio10 and gpio11, and the qup address is 78ba000.

From the hardware design and gpio function description, gpio10, gpio11, the default configuration is SPI0, need to shield the function configuration of SPI, and modify it to the function configuration of IIC-6.

Mainly contains two aspects

  1. Shield the SPI0 configuration node and add an IIC-6 configuration node
  2. Shield SPI0 pinctrl configuration, add IIC-6 pinctrl configuration
  3. Add ADV7533 slave node

Shield SPI0 configuration node

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 */

New IIC-6 configuration node

+	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>;
+	};

Then, shield the pinctrl configuration of SPI-0 and add the pinctrl configuration of IIC-6

+#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

Add ADV7533 i2C slave node

+#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 drive process detailed explanation

Foreword: No matter whether the driver of ADV7533 is in LK or Kernle, the basic routine is the same. They are used to obtain the basic gpio pins of the configuration for power-on control (gpio controls external ldo power-on) and interrupt configuration (not used here).

Then write the required register configuration, as long as input the mipi signal that conforms to the format, the HDMI signal can be successfully converted.

 

4.1   Entry function

Entry function

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   Drive process

It mainly contains several parts:

  1. Hardware configuration function
  2. Apply to configure IIC
  3. Read ADV7533 slave device test
  4. Initialize ADV7533

 

4.2.1   Hardware configuration function

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);
}

analysis:

LDO2, 6, 17 are the lk stage, and the related ldo power-on configuration of lcd, configure it directly here.

gpio_3 is the external power-on control of ADV7533 and needs to be powered on first

gpio_3 controls the power on of ADV7533, as shown in the figure:

 

4.2.2  Apply to configure IIC

Skip

4.2.3 Read slave device test

Skip

4.2.4 Write initialization parameters

Skip

 

 4.3  matters needing attention

  1. ADV7533 needs to keep the clock high speed throughout
  2. ADV7533 needs to configure MIPI signal to continuous mode

ADV7533 needs to keep the clock high speed throughout

bootable\bootloader\lk\dev\gcdb\display\include\panel_rm68200_720p_video.h

Set lane_config parameters, configure mipi clk hs mode

/*---------------------------------------------------------------------------*/
/* Lane configuration                                                        */
/*---------------------------------------------------------------------------*/
static struct lane_configuration rm68200_720p_video_lane_config = {
	3, 0, 1, 1, 1, 0, 1
};

lane_configuration definition

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 needs to configure MIPI signal to continuous mode

bootable\bootloader\lk\dev\gcdb\display\include\panel_rm68200_720p_video.h

traffic_mode; configured to 0 , which means continuous mode

/*---------------------------------------------------------------------------*/
/* Video mode panel information                     */
/*---------------------------------------------------------------------------*/
static struct videopanel_info rm68200_720p_video_panel = {
	1, 0, 0, 0, 1, 1, 0, 0, 0x9
};

videopanel_info definition

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

 

Therefore, the same applies. The LCD Kernel driver also needs to configure these two items.

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

Definition in 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

 

Guess you like

Origin blog.csdn.net/FANG_YISHAO/article/details/113183494