lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7b320c063bc5ddeadb2d8672516a382874c4b1be.camel@mediatek.com>
Date: Thu, 13 Feb 2025 08:03:19 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>
CC: "robh@...nel.org" <robh@...nel.org>, "jie.qiu@...iatek.com"
	<jie.qiu@...iatek.com>, "tzimmermann@...e.de" <tzimmermann@...e.de>,
	"simona@...ll.ch" <simona@...ll.ch>, "mripard@...nel.org"
	<mripard@...nel.org>, Jitao Shi (石记涛)
	<jitao.shi@...iatek.com>, "linux-mediatek@...ts.infradead.org"
	<linux-mediatek@...ts.infradead.org>, "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>, "maarten.lankhorst@...ux.intel.com"
	<maarten.lankhorst@...ux.intel.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "devicetree@...r.kernel.org"
	<devicetree@...r.kernel.org>, "kernel@...labora.com" <kernel@...labora.com>,
	"dmitry.baryshkov@...aro.org" <dmitry.baryshkov@...aro.org>,
	"krzk+dt@...nel.org" <krzk+dt@...nel.org>,
	Lewis Liao (廖柏鈞) <Lewis.Liao@...iatek.com>,
	"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>, "conor+dt@...nel.org"
	<conor+dt@...nel.org>, TommyYL Chen (陳彥良)
	<TommyYL.Chen@...iatek.com>, Ives Chenjh (陳俊弘)
	<Ives.Chenjh@...iatek.com>, "airlied@...il.com" <airlied@...il.com>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "matthias.bgg@...il.com"
	<matthias.bgg@...il.com>, Jason-JH Lin (林睿祥)
	<Jason-JH.Lin@...iatek.com>, "junzhi.zhao@...iatek.com"
	<junzhi.zhao@...iatek.com>
Subject: Re: [PATCH v6 34/42] drm/mediatek: mtk_hdmi: Add HDMI IP version
 configuration to pdata

On Tue, 2025-02-11 at 12:34 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> In preparation for adding a driver for the HDMIv2 IP and before
> moving the common bits out of this driver, add a new structure
> `mtk_hdmi_ver_conf`, holding pointers to HDMI IP version specific
> drm_bridge_funcs, hdmi_codec_ops and clock array used for probe,
> and nest it into the mtk_hdmi_conf platform data structure.
> 
> While at it, also convert all of the direct users of
> mtk_hdmi_bridge_funcs, mtk_hdmi_audio_codec_ops, mtk_hdmi_clk_names
> to use pointers from the ver_conf platform data.
> 
> In order to do so, it was also necessary to fill a new version 1
> specific const `mtk_hdmi_v1_ver_conf` and assign it to all of the
> currently supported compatibles for this driver.
> 
> This commit brings no functional change.

Reviewed-by: CK Hu <ck.hu@...iatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 36 ++++++++++++++++++++++++-----
>  1 file changed, 30 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index d3bfae2f1842..332567f18c9a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -144,7 +144,15 @@ struct hdmi_audio_param {
>         struct hdmi_codec_params codec_params;
>  };
> 
> +struct mtk_hdmi_ver_conf {
> +       const struct drm_bridge_funcs *bridge_funcs;
> +       const struct hdmi_codec_ops *codec_ops;
> +       const char * const *mtk_hdmi_clock_names;
> +       int num_clocks;
> +};
> +
>  struct mtk_hdmi_conf {
> +       const struct mtk_hdmi_ver_conf *ver_conf;
>         bool tz_disabled;
>         bool cea_modes_only;
>         unsigned long max_mode_clock;
> @@ -1605,7 +1613,7 @@ static int mtk_hdmi_register_audio_driver(struct device *dev)
>         struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
>         struct hdmi_audio_param *aud_param = &hdmi->aud_param;
>         struct hdmi_codec_pdata codec_data = {
> -               .ops = &mtk_hdmi_audio_codec_ops,
> +               .ops = hdmi->conf->ver_conf->codec_ops,
>                 .max_i2s_channels = 2,
>                 .i2s = 1,
>                 .data = hdmi,
> @@ -1638,6 +1646,7 @@ static int mtk_hdmi_register_audio_driver(struct device *dev)
> 
>  static int mtk_hdmi_probe(struct platform_device *pdev)
>  {
> +       const struct mtk_hdmi_ver_conf *ver_conf;
>         struct mtk_hdmi *hdmi;
>         struct device *dev = &pdev->dev;
>         const int num_clocks = MTK_HDMI_CLK_COUNT;
> @@ -1649,12 +1658,14 @@ static int mtk_hdmi_probe(struct platform_device *pdev)
> 
>         hdmi->dev = dev;
>         hdmi->conf = of_device_get_match_data(dev);
> +       ver_conf = hdmi->conf->ver_conf;
> 
> -       hdmi->clk = devm_kcalloc(dev, num_clocks, sizeof(*hdmi->clk), GFP_KERNEL);
> +       hdmi->clk = devm_kcalloc(dev, ver_conf->num_clocks, sizeof(*hdmi->clk), GFP_KERNEL);
>         if (!hdmi->clk)
>                 return -ENOMEM;
> 
> -       ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev, mtk_hdmi_clk_names, num_clocks);
> +       ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev, ver_conf->mtk_hdmi_clock_names,
> +                                     ver_conf->num_clocks);
>         if (ret)
>                 return ret;
> 
> @@ -1671,7 +1682,7 @@ static int mtk_hdmi_probe(struct platform_device *pdev)
>                 return dev_err_probe(dev, ret,
>                                      "Failed to register audio driver\n");
> 
> -       hdmi->bridge.funcs = &mtk_hdmi_bridge_funcs;
> +       hdmi->bridge.funcs = ver_conf->bridge_funcs;
>         hdmi->bridge.of_node = pdev->dev.of_node;
>         hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
>                          | DRM_BRIDGE_OP_HPD;
> @@ -1716,19 +1727,32 @@ static __maybe_unused int mtk_hdmi_resume(struct device *dev)
> 
>  static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops, mtk_hdmi_suspend, mtk_hdmi_resume);
> 
> +static const struct mtk_hdmi_ver_conf mtk_hdmi_v1_ver_conf = {
> +       .bridge_funcs = &mtk_hdmi_bridge_funcs,
> +       .codec_ops = &mtk_hdmi_audio_codec_ops,
> +       .mtk_hdmi_clock_names = mtk_hdmi_clk_names,
> +       .num_clocks = ARRAY_SIZE(mtk_hdmi_clk_names)
> +};
> +
>  static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = {
>         .tz_disabled = true,
> +       .ver_conf = &mtk_hdmi_v1_ver_conf
>  };
> 
>  static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8167 = {
> -       .max_mode_clock = 148500,
>         .cea_modes_only = true,
> +       .max_mode_clock = 148500,
> +       .ver_conf = &mtk_hdmi_v1_ver_conf
> +};
> +
> +static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8173 = {
> +       .ver_conf = &mtk_hdmi_v1_ver_conf
>  };
> 
>  static const struct of_device_id mtk_hdmi_of_ids[] = {
>         { .compatible = "mediatek,mt2701-hdmi", .data = &mtk_hdmi_conf_mt2701 },
>         { .compatible = "mediatek,mt8167-hdmi", .data = &mtk_hdmi_conf_mt8167 },
> -       { .compatible = "mediatek,mt8173-hdmi" },
> +       { .compatible = "mediatek,mt8173-hdmi", .data = &mtk_hdmi_conf_mt8173 },
>         { /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, mtk_hdmi_of_ids);
> --
> 2.48.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ