[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0fe707761a3a5a432a191f5afb07df7831e03c22.camel@mediatek.com>
Date: Mon, 2 Dec 2024 02:52:09 +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: "linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"tzimmermann@...e.de" <tzimmermann@...e.de>, "simona@...ll.ch"
<simona@...ll.ch>, "mripard@...nel.org" <mripard@...nel.org>,
"kernel@...labora.com" <kernel@...labora.com>, "p.zabel@...gutronix.de"
<p.zabel@...gutronix.de>, "maarten.lankhorst@...ux.intel.com"
<maarten.lankhorst@...ux.intel.com>, "conor+dt@...nel.org"
<conor+dt@...nel.org>, "robh@...nel.org" <robh@...nel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"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>, "krzk+dt@...nel.org" <krzk+dt@...nel.org>
Subject: Re: [PATCH v1 6/7] drm/mediatek: mtk_hdmi: Split driver and add
common probe function
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@...labora.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");
You change the error message here. If this is necessary, separate this to a refinement patch.
> +
> + 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;
> +
> + ret = devm_drm_bridge_add(dev, &hdmi->bridge);
You change drm_bridge_add() to devm_drm_bridge_add(). If this is necessary, separate this to a refinement patch.
Regards,
CK
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to add bridge\n");
> +
> + return 0;
> +}
> +
Powered by blists - more mailing lists