From nobody Thu Nov 14 05:56:13 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CFCDEB64DC for ; Mon, 17 Jul 2023 14:15:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232237AbjGQOPS (ORCPT ); Mon, 17 Jul 2023 10:15:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232144AbjGQOOz (ORCPT ); Mon, 17 Jul 2023 10:14:55 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E64A19A for ; Mon, 17 Jul 2023 07:14:51 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id A74AA660706F; Mon, 17 Jul 2023 15:14:49 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1689603290; bh=MTYqTiXP+9VBPluWnDbRM5Aq8M+c0b3eKDaIxQE6YVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dCT0de41LveyRkV8kQF7wB58+3bsMLnhgZTbfJJMh8+st92dT/EX6fAaz2ifNhi/A vp5xffRe0vxRDJAgmmFwkRCddVC0gYz7L5PudUeozMQmxnxZ+oZWC5F2kRejclH6Hu +7w38gRXU3aZAsAOspKlFSPkRoNZ43QL3zAvJn0cNrww6c2uLAemAehf40VMixwCDJ nErJeZERhU0uW0PIM7OC5xLLNf6a86DCFYcXSomvEKcyLYinb1IvW3hY5QZ738NsEB FCQPvCqEV/WNBwXByaD3crhe04KlSshSPjiVnTzgf5igl/d2jTpA8WzQ22Jo4PQ0tJ EYMFQuFiUK0Yw== From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, wenst@chromium.org, nfraprado@collabora.com Subject: [PATCH v6 08/11] drm/mediatek: dp: Move PHY registration to new function Date: Mon, 17 Jul 2023 16:14:35 +0200 Message-Id: <20230717141438.274419-9-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230717141438.274419-1-angelogioacchino.delregno@collabora.com> References: <20230717141438.274419-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat --- 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/m= tk_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 devic= e *dev) return PTR_ERR_OR_ZERO(mtk_dp->audio_pdev); } =20 +static int mtk_dp_register_phy(struct mtk_dp *mtk_dp) +{ + struct device *dev =3D mtk_dp->dev; + + mtk_dp->phy_dev =3D 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 =3D 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) } } =20 - mtk_dp->phy_dev =3D 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 =3D 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 =3D mtk_dp_register_phy(mtk_dp); + if (ret) + return ret; =20 mtk_dp->bridge.funcs =3D &mtk_dp_bridge_funcs; mtk_dp->bridge.of_node =3D dev->of_node; --=20 2.40.1