[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1533c98764b34896fc959bb03b748830f97437d0.camel@mediatek.com>
Date: Thu, 27 Jul 2023 03:27:03 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"wenst@...omium.org" <wenst@...omium.org>,
"kernel@...labora.com" <kernel@...labora.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"amergnat@...libre.com" <amergnat@...libre.com>,
"ehristev@...labora.com" <ehristev@...labora.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"nfraprado@...labora.com" <nfraprado@...labora.com>
Subject: Re: [PATCH v7 08/11] drm/mediatek: dp: Move PHY registration to new
function
Hi, Angelo:
On Tue, 2023-07-25 at 09:32 +0200, AngeloGioacchino Del Regno wrote:
> In preparation for adding support for eDP, move the PHY registration
> code to a new mtk_dp_register_phy() function for better readability.
>
> This commit brings no functional changes.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>
> Tested-by: Chen-Yu Tsai <wenst@...omium.org>
> Reviewed-by: Alexandre Mergnat <amergnat@...libre.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dp.c | 43 +++++++++++++++++++--------
> ----
> 1 file changed, 26 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> b/drivers/gpu/drm/mediatek/mtk_dp.c
> index c1d1a882f1db..1b4219e6a00b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -2478,6 +2478,29 @@ static int mtk_dp_register_audio_driver(struct
> device *dev)
> return PTR_ERR_OR_ZERO(mtk_dp->audio_pdev);
> }
>
> +static int mtk_dp_register_phy(struct mtk_dp *mtk_dp)
> +{
> + struct device *dev = mtk_dp->dev;
> +
> + mtk_dp->phy_dev = platform_device_register_data(dev, "mediatek-
> dp-phy",
> + PLATFORM_DEVID_
> AUTO,
> + &mtk_dp->regs,
> + sizeof(struct
> regmap *));
> + if (IS_ERR(mtk_dp->phy_dev))
> + return dev_err_probe(dev, PTR_ERR(mtk_dp->phy_dev),
> + "Failed to create device mediatek-
> dp-phy\n");
> +
> + mtk_dp_get_calibration_data(mtk_dp);
> +
> + mtk_dp->phy = devm_phy_get(&mtk_dp->phy_dev->dev, "dp");
> + if (IS_ERR(mtk_dp->phy)) {
> + platform_device_unregister(mtk_dp->phy_dev);
> + return dev_err_probe(dev, PTR_ERR(mtk_dp->phy), "Failed
> to get phy\n");
> + }
> +
> + return 0;
> +}
> +
> static int mtk_dp_probe(struct platform_device *pdev)
> {
> struct mtk_dp *mtk_dp;
> @@ -2536,23 +2559,9 @@ static int mtk_dp_probe(struct platform_device
> *pdev)
> }
> }
>
> - mtk_dp->phy_dev = platform_device_register_data(dev, "mediatek-
> dp-phy",
> - PLATFORM_DEVID_
> AUTO,
> - &mtk_dp->regs,
> - sizeof(struct
> regmap *));
> - if (IS_ERR(mtk_dp->phy_dev))
> - return dev_err_probe(dev, PTR_ERR(mtk_dp->phy_dev),
> - "Failed to create device mediatek-
> dp-phy\n");
> -
> - mtk_dp_get_calibration_data(mtk_dp);
> -
> - mtk_dp->phy = devm_phy_get(&mtk_dp->phy_dev->dev, "dp");
> -
> - if (IS_ERR(mtk_dp->phy)) {
> - platform_device_unregister(mtk_dp->phy_dev);
> - return dev_err_probe(dev, PTR_ERR(mtk_dp->phy),
> - "Failed to get phy\n");
> - }
> + ret = mtk_dp_register_phy(mtk_dp);
> + if (ret)
> + return ret;
>
> mtk_dp->bridge.funcs = &mtk_dp_bridge_funcs;
> mtk_dp->bridge.of_node = dev->of_node;
Powered by blists - more mailing lists