<html><body><p>
<pre>
Hi, Angelo:

On Wed, 2024-11-20 at 13:45 +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 new driver for the HDMI TX v2 IP,
> split out the functions that will be common between the already
> present mtk_hdmi (v1) driver and the new one.
>
> Since the probe flow for both drivers is 90% similar, add a common
> probe function that will be called from each driver's .probe()
> callback, avoiding lots of code duplication.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---

[snip]

> +int mtk_hdmi_common_probe(struct platform_device *pdev, struct mtk_hdmi *hdmi)
> +{
> + const struct mtk_hdmi_ver_conf *ver_conf;
> + struct device *dev = &pdev->dev;
> + int ret;
> +
> + hdmi->dev = dev;
> + hdmi->conf = of_device_get_match_data(dev);
> + ver_conf = hdmi->conf->ver_conf;
> +
> + hdmi->clk = devm_kcalloc(dev, ver_conf->num_clocks, sizeof(*hdmi->clk), GFP_KERNEL);
> + if (!hdmi->clk)
> + return -ENOMEM;
> +
> + hdmi->phy = devm_phy_get(dev, "hdmi");
> + if (IS_ERR(hdmi->phy))
> + return dev_err_probe(dev, PTR_ERR(hdmi->phy), "Failed to get HDMI PHY\n");
> +
> + ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev, ver_conf->mtk_hdmi_clock_names,
> + ver_conf->num_clocks);
> + if (ret)
> + return ret;
> +
> + platform_set_drvdata(pdev, hdmi);
> +
> + ret = mtk_hdmi_register_audio_driver(dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "Cannot register HDMI Audio driver\n");
> +
> + hdmi->bridge.funcs = ver_conf->bridge_funcs;
> + hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD;
> + hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
> + hdmi->bridge.of_node = pdev->dev.of_node;
> + hdmi->bridge.ddc = hdmi->ddc_adpt;

I think this patch is just to move common part out of v1 driver.
In original v1 driver, it does not set hdmi->bridge.ddc.
So this patch let v1 driver to set hdmi->bridge.ddc and this change the behavior of v1.
I don't know it's necessary or not.
If it's necessary, separate this to a v1 refinement patch in front of this patch.
Let this patch not change behavior of v1.

Regards,
CK

> +
> + ret = devm_drm_bridge_add(dev, &hdmi->bridge);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to add bridge\n");
> +
> + return 0;
> +}
> +

</pre>
</p></body></html><!--type:text--><!--{--><pre>************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
</pre><!--}-->