Files
BPI-CM9-Linux/aml-patches/aml-comp/kernel/aml-6.12/common_drivers/0005-hdmitx-a9-hdmitx-support-vesa-1-1.patch

195 lines
7.5 KiB
Diff

From 15ae4bba2ff812bb31698e14ad67e45f2c15d4d8 Mon Sep 17 00:00:00 2001
From: "zhou.han" <[email protected]>
Date: Tue, 28 Jul 2026 14:57:21 +0800
Subject: [PATCH 5/6] hdmitx: a9 hdmitx support vesa [1/1]
PD#SWPL-281433
Problem:
A9 hdmitx support vesa
Solution:
Add vesa_mode_en property in DTS to enable VESA support (A9 only)
Verify:
A9
Change-Id: Id5ee8100640e579f14ebca56b1f14fe87cb19e73
Signed-off-by: zhou.han <[email protected]>
---
arch/arm64/boot/dts/amlogic/meson-a9.dtsi | 1 +
drivers/drm/meson_hdmi.c | 4 ++++
drivers/drm/meson_logo.c | 2 +-
drivers/drm/meson_sysfs.c | 2 +-
.../vout/hdmi_tx_connector/hdmitx/tx21/hdmitx_hw.c | 6 ++++--
.../media/vout/hdmi_tx_connector/hdmitx_check_valid.c | 10 ++++------
drivers/media/vout/hdmi_tx_connector/hdmitx_drv.c | 7 +++++++
.../media/vout/hdmi_tx_connector/hdmitx_edid_parse.c | 2 +-
drivers/media/vout/hdmi_tx_connector/hdmitx_mode.c | 4 ++--
.../amlogic/media/vout/hdmitx_common/hdmitx_common.h | 2 ++
10 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-a9.dtsi b/arch/arm64/boot/dts/amlogic/meson-a9.dtsi
index 6eb28c27e0..54cc658ae1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a9.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-a9.dtsi
@@ -2712,6 +2712,7 @@
max_refresh_rate = <120>;
/* hdcptx of repeater enable status */
repeater_tx = <0>;
+ vesa_mode_en = <1>;
reg = <0x0 0xff500000 0x0 0x40000>,
<0x0 0xfe310000 0x0 0x10000>,
<0x0 0xfe300000 0x0 0x10000>,
diff --git a/drivers/drm/meson_hdmi.c b/drivers/drm/meson_hdmi.c
index 22c3a3cd0b..c46e58d11b 100644
--- a/drivers/drm/meson_hdmi.c
+++ b/drivers/drm/meson_hdmi.c
@@ -322,6 +322,10 @@ static void meson_hdmitx_add_alter_mode(struct drm_connector *connector,
struct drm_device *dev = connector->dev;
int vrefresh;
+ /* Alternate clocks are defined only for CEA VICs. */
+ if (vic == HDMI_0_UNKNOWN || vic >= HDMI_CEA_VIC_END)
+ return;
+
clock1 = mode->clock;
clock2 = cea_mode_alternate_clock(mode);
diff --git a/drivers/drm/meson_logo.c b/drivers/drm/meson_logo.c
index de6b31aac3..431067606c 100644
--- a/drivers/drm/meson_logo.c
+++ b/drivers/drm/meson_logo.c
@@ -750,7 +750,7 @@ static void am_meson_load_logo(struct drm_device *dev,
if (num_modes) {
list_for_each_entry(mode, &connector->modes, head) {
- if (!strcmp(mode->name, meson_fb->logo->outputmode)) {
+ if (!strcasecmp(mode->name, meson_fb->logo->outputmode)) {
found = 1;
break;
}
diff --git a/drivers/drm/meson_sysfs.c b/drivers/drm/meson_sysfs.c
index 67c1f0ce9e..3e41f83abc 100644
--- a/drivers/drm/meson_sysfs.c
+++ b/drivers/drm/meson_sysfs.c
@@ -1453,7 +1453,7 @@ static ssize_t crtc_mode_store(struct file *filp, struct kobject *kobj,
if (num_modes) {
list_for_each_entry(mode, &connector->modes, head) {
- if (!strcmp(mode->name, mode_name)) {
+ if (!strcasecmp(mode->name, mode_name)) {
found = 1;
break;
}
diff --git a/drivers/media/vout/hdmi_tx_connector/hdmitx/tx21/hdmitx_hw.c b/drivers/media/vout/hdmi_tx_connector/hdmitx/tx21/hdmitx_hw.c
index 28e80e4aee..1852a000de 100644
--- a/drivers/media/vout/hdmi_tx_connector/hdmitx/tx21/hdmitx_hw.c
+++ b/drivers/media/vout/hdmi_tx_connector/hdmitx/tx21/hdmitx_hw.c
@@ -1213,12 +1213,14 @@ static int hdmitx_validate_mode(struct hdmitx_hw_common *tx_hw, u32 vic, u32 max
{
int ret = 0;
const struct hdmi_timing *timing;
+ struct hdmitx21_dev *hdev;
if (!tx_hw || !tx_hw->chip_data)
return -EINVAL;
+ hdev = container_of(tx_hw, struct hdmitx21_dev, hw_comm);
- /*hdmitx21 VESA mode is not supported yet*/
- if (vic == HDMI_0_UNKNOWN || vic > HDMI_CEA_VIC_END)
+ if (vic == HDMI_0_UNKNOWN ||
+ (vic > HDMI_CEA_VIC_END && !hdev->tx_comm.vesa_mode_en))
return -EINVAL;
timing = hdmitx_mode_vic_to_hdmi_timing(vic);
diff --git a/drivers/media/vout/hdmi_tx_connector/hdmitx_check_valid.c b/drivers/media/vout/hdmi_tx_connector/hdmitx_check_valid.c
index 87eac204d7..13f7caf0e2 100644
--- a/drivers/media/vout/hdmi_tx_connector/hdmitx_check_valid.c
+++ b/drivers/media/vout/hdmi_tx_connector/hdmitx_check_valid.c
@@ -45,15 +45,13 @@ int hdmitx_common_validate_vic(struct hdmitx_common *tx_comm, u32 vic)
if (!timing)
return -EINVAL;
+ if (vic == HDMI_0_UNKNOWN ||
+ (vic >= HDMITX_VESA_OFFSET && !tx_comm->vesa_mode_en))
+ return -EINVAL;
+
/* soc level filter */
/* filter 1080p max size. */
if (tx_comm->res_1080p) {
- /*
- * if the vic equals to HDMI_0_UNKNOWN or VESA,
- * then create it as over limited
- */
- if (vic == HDMI_0_UNKNOWN || vic >= HDMITX_VESA_OFFSET)
- return -ERANGE;
/*
* check the resolution is over 1920x1080 or not
* On chips restricted to 1080p via efuse, the venc stops
diff --git a/drivers/media/vout/hdmi_tx_connector/hdmitx_drv.c b/drivers/media/vout/hdmi_tx_connector/hdmitx_drv.c
index 3c35ec10b2..7c880e9c8c 100644
--- a/drivers/media/vout/hdmi_tx_connector/hdmitx_drv.c
+++ b/drivers/media/vout/hdmi_tx_connector/hdmitx_drv.c
@@ -425,6 +425,13 @@ static int amhdmitx_get_dt_info(struct platform_device *pdev, struct hdmitx_comm
tx_comm->hdcptx_comm.hdcp_rpt_en = val;
else
tx_comm->hdcptx_comm.hdcp_rpt_en = 0;
+ ret = of_property_read_u32(pdev->dev.of_node, "vesa_mode_en",
+ &tx_comm->vesa_mode_en);
+ if (ret)
+ tx_comm->vesa_mode_en = 0;
+ else
+ tx_comm->vesa_mode_en = !!tx_comm->vesa_mode_en;
+ HDMITX_INFO("vesa_mode_en: %d\n", tx_comm->vesa_mode_en);
/* Get repeater_tx information */
ret = of_property_read_u32(pdev->dev.of_node,
"hdmi_repeater", &val);
diff --git a/drivers/media/vout/hdmi_tx_connector/hdmitx_edid_parse.c b/drivers/media/vout/hdmi_tx_connector/hdmitx_edid_parse.c
index c0428ea8e8..752a6c4edd 100644
--- a/drivers/media/vout/hdmi_tx_connector/hdmitx_edid_parse.c
+++ b/drivers/media/vout/hdmi_tx_connector/hdmitx_edid_parse.c
@@ -503,7 +503,7 @@ static void edid_standard_timing_iii(struct rx_cap *prxcap, u8 *data)
store_vesa_idx(prxcap, HDMIV_1152x864p75hz);
if (data[1] & (1 << 6))
store_vesa_idx(prxcap, HDMIV_1280x768p60hz);
- if (data[1] & (1 << 2))
+ if (data[1] & (1 << 3))
store_vesa_idx(prxcap, HDMIV_1280x960p60hz);
if (data[1] & (1 << 1))
store_vesa_idx(prxcap, HDMIV_1280x1024p60hz);
diff --git a/drivers/media/vout/hdmi_tx_connector/hdmitx_mode.c b/drivers/media/vout/hdmi_tx_connector/hdmitx_mode.c
index d6ed978c4e..66a9a65274 100644
--- a/drivers/media/vout/hdmi_tx_connector/hdmitx_mode.c
+++ b/drivers/media/vout/hdmi_tx_connector/hdmitx_mode.c
@@ -550,11 +550,11 @@ const struct hdmi_timing *hdmitx_mode_match_timing_name(const char *name)
break;
/* check sname first */
- if (timing->sname && !strncmp(timing->sname, name, strlen(timing->sname)))
+ if (timing->sname && !strcasecmp(timing->sname, name))
return timing;
/* check full name first */
- if (!strncmp(timing->name, name, strlen(timing->name)))
+ if (timing->name && !strcasecmp(timing->name, name))
return timing;
i++;
diff --git a/include/linux/amlogic/media/vout/hdmitx_common/hdmitx_common.h b/include/linux/amlogic/media/vout/hdmitx_common/hdmitx_common.h
index 215327ed30..5d87d96eb8 100644
--- a/include/linux/amlogic/media/vout/hdmitx_common/hdmitx_common.h
+++ b/include/linux/amlogic/media/vout/hdmitx_common/hdmitx_common.h
@@ -396,6 +396,8 @@ struct hdmitx_common {
int clk_source_idx;
/*soc limitation config*/
u32 res_1080p;
+
+ u32 vesa_mode_en;
/* efuse ctrl state
* 1 disable the function
* 0 dont disable the function
--
2.43.2