From d510a55f562ded6492d519659ba54dcb0b017839 Mon Sep 17 00:00:00 2001 From: "zhou.han" Date: Thu, 6 Aug 2026 13:42:49 +0800 Subject: [PATCH 2/2] 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: I2a2bae2c99ffa21e3b149d5d9f25496e1c9a2885 Signed-off-by: zhou.han --- arch/arm/dts/amlogic/meson-a9-by401.dtsi | 1 + arch/arm/dts/amlogic/meson-a9-by408.dtsi | 1 + arch/arm/dts/amlogic/meson-a9-by409.dtsi | 1 + arch/arm/dts/amlogic/meson-a9-skt.dtsi | 1 + .../amlogic/media/vout/hdmitx/hdmitx21/hdmi_param.c | 4 ++-- .../amlogic/media/vout/hdmitx/hdmitx21/hdmitx_drv.c | 10 ++++++++-- .../vout/hdmitx/hdmitx_common/hdmitx_check_valid.c | 10 ++++------ .../vout/hdmitx/hdmitx_common/hdmitx_edid_parse.c | 2 +- include/amlogic/media/vout/hdmitx21/hdmitx_module.h | 1 + 9 files changed, 20 insertions(+), 11 deletions(-) diff --git a/arch/arm/dts/amlogic/meson-a9-by401.dtsi b/arch/arm/dts/amlogic/meson-a9-by401.dtsi index 196958aaf12..63f19af3c66 100644 --- a/arch/arm/dts/amlogic/meson-a9-by401.dtsi +++ b/arch/arm/dts/amlogic/meson-a9-by401.dtsi @@ -107,6 +107,7 @@ amhdmitx { compatible = "amlogic, amhdmitx-a9"; max_refreshrate = <120>; /* the max freshrate of A9 is upto 120hz */ + vesa_mode_en = <1>; status = "okay"; }; }; diff --git a/arch/arm/dts/amlogic/meson-a9-by408.dtsi b/arch/arm/dts/amlogic/meson-a9-by408.dtsi index 196958aaf12..63f19af3c66 100644 --- a/arch/arm/dts/amlogic/meson-a9-by408.dtsi +++ b/arch/arm/dts/amlogic/meson-a9-by408.dtsi @@ -107,6 +107,7 @@ amhdmitx { compatible = "amlogic, amhdmitx-a9"; max_refreshrate = <120>; /* the max freshrate of A9 is upto 120hz */ + vesa_mode_en = <1>; status = "okay"; }; }; diff --git a/arch/arm/dts/amlogic/meson-a9-by409.dtsi b/arch/arm/dts/amlogic/meson-a9-by409.dtsi index 196958aaf12..63f19af3c66 100644 --- a/arch/arm/dts/amlogic/meson-a9-by409.dtsi +++ b/arch/arm/dts/amlogic/meson-a9-by409.dtsi @@ -107,6 +107,7 @@ amhdmitx { compatible = "amlogic, amhdmitx-a9"; max_refreshrate = <120>; /* the max freshrate of A9 is upto 120hz */ + vesa_mode_en = <1>; status = "okay"; }; }; diff --git a/arch/arm/dts/amlogic/meson-a9-skt.dtsi b/arch/arm/dts/amlogic/meson-a9-skt.dtsi index e6ef2dd1249..13bdc04cda3 100644 --- a/arch/arm/dts/amlogic/meson-a9-skt.dtsi +++ b/arch/arm/dts/amlogic/meson-a9-skt.dtsi @@ -107,6 +107,7 @@ amhdmitx { compatible = "amlogic, amhdmitx-a9"; max_refreshrate = <120>; /* the max freshrate of A9 is upto 120hz */ + vesa_mode_en = <1>; status = "okay"; }; }; diff --git a/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmi_param.c b/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmi_param.c index 86a0f970ae8..8ecec1c2337 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmi_param.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmi_param.c @@ -483,11 +483,11 @@ const struct hdmi_timing *hdmitx21_gettiming_from_name(const char *name) return NULL; /* check sname first */ - if (timing->sname && strstr(timing->sname, name)) + if (timing->sname && !strcmp(timing->sname, name)) goto next; /* check name second */ - if (strncmp(timing->name, name, strlen(timing->name)) == 0) + if (timing->name && !strcmp(timing->name, name)) goto next; i++; diff --git a/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmitx_drv.c b/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmitx_drv.c index 45fe5066faf..3e213d4a48d 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmitx_drv.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmitx21/hdmitx_drv.c @@ -429,6 +429,12 @@ static void hdmitx_load_dts_config(struct hdmitx_dev *hdev) hdev->tx_common.res_1080p = 1; } printf("res_1080p: %d\n", hdev->tx_common.res_1080p); + hdev->tx_common.vesa_mode_en = 0; + propdata = (char *)fdt_getprop(dt_blob, node, "vesa_mode_en", NULL); + if (propdata) + hdev->tx_common.vesa_mode_en = + !!be32_to_cpup((u32 *)propdata); + printf("vesa_mode_en: %d\n", hdev->tx_common.vesa_mode_en); /* * bq201-s905d5 viu2 only has 250M @@ -3422,8 +3428,8 @@ int hdmitx_hw_validate_mode(struct hdmitx_hw_common *tx_hw, u32 vic, u32 max_ref const struct hdmi_timing *timing; struct hdmitx_dev *hdev = get_hdmitx21_device(); - /* 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_common.vesa_mode_en)) return -EINVAL; timing = hdmitx_mode_vic_to_hdmi_timing(vic); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_check_valid.c b/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_check_valid.c index 0031b123be6..cae59e336ec 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_check_valid.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_check_valid.c @@ -44,15 +44,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/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_edid_parse.c b/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_edid_parse.c index c341357e37b..6e9d93acd16 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_edid_parse.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmitx_common/hdmitx_edid_parse.c @@ -679,7 +679,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/include/amlogic/media/vout/hdmitx21/hdmitx_module.h b/include/amlogic/media/vout/hdmitx21/hdmitx_module.h index 5b7cb61e812..bf4e62815df 100644 --- a/include/amlogic/media/vout/hdmitx21/hdmitx_module.h +++ b/include/amlogic/media/vout/hdmitx21/hdmitx_module.h @@ -43,6 +43,7 @@ struct hdmitx_common { struct hdmitx_hw_common *tx_hw; /*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