RK3288 5.1添加HDMI特殊分辨率

时间:2024-04-10 10:00:24

添加HDMI特殊分辨率

 

一、下面以添加2560x1440P为例子

  1. 根据kernel中打印的参数

RK3288 5.1添加HDMI特殊分辨率

进行相对应的填写参数配置

diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

index 8f694f6d8e9..7430a4a7823 100644

--- a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

+++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

@@ -771,6 +771,28 @@ static const struct hdmi_video_timing hdmi_mode[] = {

  .pixelrepeat = 1,

  .interface = OUT_P888,

  },

+        {

+                .mode = {

+                        .name = "[email protected]",

+                        .refresh = 59,

+                        .xres = 2560,

+                        .yres = 1440,

+                        .pixclock = 241000000,

+                        .left_margin = 80,

+                        .right_margin = 48,

+                        .upper_margin = 33,

+                        .lower_margin = 3,

+                        .hsync_len = 32,

+                        .vsync_len = 5,

+                        .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,

+                        .vmode = 0,

+                        .flag = 0,

+                },

+                .vic = HDMI_VIDEO_DMT | 10,

+                .vic_2nd = 0,

+                .pixelrepeat = 1,

+                .interface = OUT_P888,

+        },

 };

 

 static int hdmi_set_info(struct rk_screen *screen, struct hdmi *hdmi)

diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/drivers/video/rockchip/hdmi/rockchip-hdmi.h

index 3e576d8b78e..c0d48003176 100644

--- a/drivers/video/rockchip/hdmi/rockchip-hdmi.h

+++ b/drivers/video/rockchip/hdmi/rockchip-hdmi.h

@@ -482,7 +482,7 @@ struct hdmi {

 #define HDMI_AUTO_CONFIG false

 

 /* HDMI default vide mode */

-#define HDMI_VIDEO_DEFAULT_MODE HDMI_1280X720P_60HZ

+#define HDMI_VIDEO_DEFAULT_MODE (HDMI_VIDEO_DMT | 10)

  /*HDMI_1920X1080P_60HZ*/

 #define HDMI_VIDEO_DEFAULT_COLORMODE HDMI_COLOR_AUTO

 #define HDMI_VIDEO_DEFAULT_COLORDEPTH 8

diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c

index c390a9928aa..75767f98cf3 100755

--- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c

+++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c

@@ -64,6 +64,8 @@ static const struct phy_mpll_config_tab PHY_MPLL_TABLE[] = {

  1, 0, 1, 0, 0, 0, 3},

  {297000000, 297000000, 0, 8, 0, 0, 0,

  1, 0, 0, 0, 0, 0, 3},

+ {241000000, 241000000, 0, 8, 0, 0, 0,

+ 1, 0, 0, 0, 0, 0, 3},

  {297000000, 371250000, 0, 10, 1, 3, 1,

  5, 1, 3, 1, 7, 0, 3},

  {297000000, 445500000, 0, 12, 2, 3, 1,

 

 

 

2.当添加的分辨率超过2K,则需要打上下面补丁

diff --git a/arch/arm/boot/dts/rk3288-tb-808.dts b/arch/arm/boot/dts/rk3288-tb-808.dts

index b8e0933a338..793ff194f50 100644

--- a/arch/arm/boot/dts/rk3288-tb-808.dts

+++ b/arch/arm/boot/dts/rk3288-tb-808.dts

@@ -419,13 +419,13 @@

 };

 

 /*lcdc0 as PRMRY(HDMI)*/

-&lcdc0 {

+&lcdc1 {

  status = "okay";

  rockchip,mirror = <NO_MIRROR>;

  rockchip,cabc_mode = <0>;

 };

 

-&lcdc1 {

+&lcdc0 {

  status = "okay";

  rockchip,mirror = <ROTATE_270>;

 

@@ -433,8 +433,8 @@

 

 &hdmi {

  status = "okay";

- rockchip,defaultmode = <16>; // 1080P

- rockchip,hdmi_video_source = <DISPLAY_SOURCE_LCDC1>;

+ //rockchip,defaultmode = <16>; // 1080P

+ rockchip,hdmi_video_source = <DISPLAY_SOURCE_LCDC0>;

 };

 

 &adc {

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi

index 63d687d71cf..fb3662bf42c 100755

--- a/arch/arm/boot/dts/rk3288.dtsi

+++ b/arch/arm/boot/dts/rk3288.dtsi

@@ -765,31 +765,31 @@

  clock-names = "aclk_hdcp2", "hdcp2_clk_hdmi", "pclk_hdcp2";

  status = "disabled";

  };

-

- lcdc0: [email protected] {

+

+ lcdc1: [email protected] {

  compatible = "rockchip,rk3288-lcdc";

  rockchip,prop = <PRMRY>;

  rockchip,pwr18 = <0>;

  rockchip,iommu-enabled = <0>;

- reg = <0xff930000 0x10000>;

- interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;

+ reg = <0xff940000 0x10000>;

+ interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;

  pinctrl-names = "default", "gpio";

  pinctrl-0 = <&lcdc0_lcdc>;

  pinctrl-1 = <&lcdc0_gpio>;

  status = "disabled";

- clocks = <&clk_gates15 5>, <&dclk_lcdc0>, <&clk_gates15 6>, <&pd_vop0>;

+ clocks = <&clk_gates15 7>, <&dclk_lcdc1>, <&clk_gates15 8>, <&pd_vop1>;

  clock-names = "aclk_lcdc", "dclk_lcdc", "hclk_lcdc", "pd_lcdc";

  };

 

- lcdc1: [email protected] {

+ lcdc0: [email protected] {

  compatible = "rockchip,rk3288-lcdc";

  rockchip,prop = <EXTEND>;

  rockchip,pwr18 = <0>;

  rockchip,iommu-enabled = <0>;

- reg = <0xff940000 0x10000>;

- interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;

+ reg = <0xff930000 0x10000>;

+ interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;

  status = "disabled";

- clocks = <&clk_gates15 7>, <&dclk_lcdc1>, <&clk_gates15 8>, <&pd_vop1>;

+ clocks = <&clk_gates15 5>, <&dclk_lcdc0>, <&clk_gates15 6>, <&pd_vop0>;

  clock-names = "aclk_lcdc", "dclk_lcdc", "hclk_lcdc", "pd_lcdc";

  };

 

 

 

 

 

 

二、下面以添加1280X800为例子

diff --git a/arch/arm/boot/dts/lcd/lcd-lvds1920x1080.dtsi b/arch/arm/boot/dts/lcd/lcd-lvds1920x1080.dtsi

index e9e607231f7..caa37999867 100644

--- a/arch/arm/boot/dts/lcd/lcd-lvds1920x1080.dtsi

+++ b/arch/arm/boot/dts/lcd/lcd-lvds1920x1080.dtsi

@@ -4,23 +4,22 @@

  */

 

 / {

-

  disp_timings: display-timings {

                         native-mode = <&timing0>;

                         timing0: timing0 {

- screen-type = <SCREEN_DUAL_LVDS>;// SCREEN_DUAL_LVDS SCREEN_RGB

+ screen-type = <SCREEN_LVDS>;// SCREEN_DUAL_LVDS SCREEN_RGB

  lvds-format = <LVDS_8BIT_1>;

  out-face    = <OUT_P888>;

  color-mode = <COLOR_RGB>;

- clock-frequency = <75000000>;

- hactive = <1920>;

- vactive = <1080>;

- hback-porch = <100>;

- hfront-porch = <30>;

- vback-porch = <20>;

- vfront-porch = <20>;

- hsync-len = <10>;

- vsync-len = <5>;

+ clock-frequency = <71000000>;

+ hactive = <1280>;

+ vactive = <800>;

+ hback-porch = <80>;

+ hfront-porch = <48>;

+ vback-porch = <14>;

+ vfront-porch = <3>;

+ hsync-len = <32>;

+ vsync-len = <3>;

  hsync-active = <0>;

  vsync-active = <0>;

  de-active = <0>;

diff --git a/arch/arm/boot/dts/rk3288-tb-808.dts b/arch/arm/boot/dts/rk3288-tb-808.dts

index 7904a8ad990..46e031d53a8 100644

--- a/arch/arm/boot/dts/rk3288-tb-808.dts

+++ b/arch/arm/boot/dts/rk3288-tb-808.dts

@@ -433,7 +433,7 @@

 

 &hdmi {

  status = "okay";

- rockchip,defaultmode = <16>; // 1080P

+ //rockchip,defaultmode = <16>; // 1080P

  rockchip,hdmi_video_source = <DISPLAY_SOURCE_LCDC1>;

 };

 

diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

index 8f694f6d8e9..8886471fb2b 100644

--- a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

+++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c

@@ -771,6 +771,28 @@ static const struct hdmi_video_timing hdmi_mode[] = {

  .pixelrepeat = 1,

  .interface = OUT_P888,

  },

+ {

+ .mode = {

+ .name = "[email protected]",

+ .refresh = 59,

+ .xres = 1280,

+ .yres = 800,

+ .pixclock = 71000000,

+ .left_margin = 80,

+ .right_margin = 48,

+ .upper_margin = 14,

+ .lower_margin = 3,

+ .hsync_len = 32,

+ .vsync_len = 6,

+ .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,

+ .vmode = 0,

+ .flag = 0,

+ },

+ .vic = HDMI_VIDEO_DMT | 10,

+ .vic_2nd = 0,

+ .pixelrepeat = 1,

+ .interface = OUT_P888,

+ },

 };

 

diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/drivers/video/rockchip/hdmi/rockchip-hdmi.h

index 3e576d8b78e..c0d48003176 100644

--- a/drivers/video/rockchip/hdmi/rockchip-hdmi.h

+++ b/drivers/video/rockchip/hdmi/rockchip-hdmi.h

@@ -482,7 +482,7 @@ struct hdmi {

 #define HDMI_AUTO_CONFIG false

 

 /* HDMI default vide mode */

-#define HDMI_VIDEO_DEFAULT_MODE HDMI_1280X720P_60HZ

+#define HDMI_VIDEO_DEFAULT_MODE (HDMI_VIDEO_DMT | 10)

  /*HDMI_1920X1080P_60HZ*/

 #define HDMI_VIDEO_DEFAULT_COLORMODE HDMI_COLOR_AUTO

 #define HDMI_VIDEO_DEFAULT_COLORDEPTH 8