From nobody Mon Apr 27 08:43:10 2026 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 8DB48C433EF for ; Wed, 15 Jun 2022 04:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239455AbiFOEzy (ORCPT ); Wed, 15 Jun 2022 00:55:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232754AbiFOEzv (ORCPT ); Wed, 15 Jun 2022 00:55:51 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1967C286C0 for ; Tue, 14 Jun 2022 21:55:51 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id A298F320096D; Wed, 15 Jun 2022 00:55:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 15 Jun 2022 00:55:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655268949; x=1655355349; bh=vx 67vaRjPe5jJUHZJSR0JmsWvIkH3E5HlZjLsIE7qUI=; b=mBJUMoKhx3q8L9kmP1 N+ixlvzimsWkMpYIr5Ah79Vky+oKr0bSv7gK6T5ZSf32bPUvLif7BLQAIrN4kpgr GKkfUN2fVoe3D/vW8WOO4PbuPA/SEOM09QJ3QE/405drHabFXl+qXHKYq3UOW4uf LQ9RwutZVVKjUIsdiFgd2Bm71iFQeTT4bPUiDLfRgH1NlskgqRRUdF9/2qplQq8p clI2AjMrD32MNmUaGW1M09lP8QeimQroy6umi1af+2Udm2n1JBcynlb090A19f8C s14P0lEc/hm5XMxjB4EjGMwHVMtxa46xmmxImfjWziGQv+iQCd7L7Y4BAAeckygo z1tA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655268949; x=1655355349; bh=vx67vaRjPe5jJ UHZJSR0JmsWvIkH3E5HlZjLsIE7qUI=; b=IVS/1kP7+yPMDeVPBETxpANATY/7a 13Zby4MNbOmh8Wrmh2cB7fmUDnN2zI8seTYt/xECgOBll6rlMsZ1oZO9Lb0RsRB2 C9rqV7xytf2iqKnkGTuGJ57+pO6nb86eUPFrBDZQTE//wbjVGOIY1lmnUqZshmkC zY+j/xFj1BDChk9fELch/Oictiu1h2eToib18SijOa9JCx8B3uRD4fc32p9vRPck e0knZOp0QTOuV3sxTjF2xsuWIMAkb799WmCCgZIuxFTbgBZYpQRD8zGL/QmNQJtH 4wCsyeIaGbitrhfHwf/IOlISz1H5w1JIiTKuHNcQluo2QbFVvJWKDH1ww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvtddgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 00:55:48 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Maxime Ripard Cc: Samuel Holland , Daniel Vetter , David Airlie , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 1/6] drm/sun4i: sun8i-hdmi-phy: Use of_device_get_match_data Date: Tue, 14 Jun 2022 23:55:38 -0500 Message-Id: <20220615045543.62813-2-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615045543.62813-1-samuel@sholland.org> References: <20220615045543.62813-1-samuel@sholland.org> 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" Now that the HDMI PHY is using a platform driver, we can use the usual helper function for getting the variant structure. Signed-off-by: Samuel Holland --- (no changes since v1) drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/= sun8i_dw_hdmi.h index bffe1b9cd3dc..0adbfac6eb31 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -173,7 +173,7 @@ struct sun8i_hdmi_phy { unsigned int rcal; struct regmap *regs; struct reset_control *rst_phy; - struct sun8i_hdmi_phy_variant *variant; + const struct sun8i_hdmi_phy_variant *variant; }; =20 struct sun8i_dw_hdmi_quirks { diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index 2860e6bff8b7..4553e04144fe 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -565,7 +565,7 @@ void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy) void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy, struct dw_hdmi_plat_data *plat_data) { - struct sun8i_hdmi_phy_variant *variant =3D phy->variant; + const struct sun8i_hdmi_phy_variant *variant =3D phy->variant; =20 if (variant->is_custom_phy) { plat_data->phy_ops =3D &sun8i_hdmi_phy_ops; @@ -672,7 +672,6 @@ int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, stru= ct device_node *node) =20 static int sun8i_hdmi_phy_probe(struct platform_device *pdev) { - const struct of_device_id *match; struct device *dev =3D &pdev->dev; struct device_node *node =3D dev->of_node; struct sun8i_hdmi_phy *phy; @@ -680,17 +679,11 @@ static int sun8i_hdmi_phy_probe(struct platform_devic= e *pdev) void __iomem *regs; int ret; =20 - match =3D of_match_node(sun8i_hdmi_phy_of_table, node); - if (!match) { - dev_err(dev, "Incompatible HDMI PHY\n"); - return -EINVAL; - } - phy =3D devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); if (!phy) return -ENOMEM; =20 - phy->variant =3D (struct sun8i_hdmi_phy_variant *)match->data; + phy->variant =3D of_device_get_match_data(dev); phy->dev =3D dev; =20 ret =3D of_address_to_resource(node, 0, &res); --=20 2.35.1 From nobody Mon Apr 27 08:43:10 2026 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 E911DC43334 for ; Wed, 15 Jun 2022 04:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240673AbiFOEz5 (ORCPT ); Wed, 15 Jun 2022 00:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239557AbiFOEzy (ORCPT ); Wed, 15 Jun 2022 00:55:54 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEDBA27CE5 for ; Tue, 14 Jun 2022 21:55:53 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 539B3320091D; Wed, 15 Jun 2022 00:55:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 15 Jun 2022 00:55:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655268951; x=1655355351; bh=me B3o4RHIjnH4+7Q/C/69u/oZ6dMRlLCXzf5bgQ4WC4=; b=LTBiMCzL2FhF6pdlV1 Tbw6xLQsd9/7Xwope6Ey+tJO/uEis5iOG0mdYfgV7zw0PY2M1bRmFVWgJb+FsdPH E142niuNLUxzmhpn7d3XdGSehXIrZj1rthRpCUvAHABvoRG8PpuxiKWU4AJfCasP nkWAup39gMjS4Am3Yn1USxtxz3n/LvQcQvPilVeyk9WRarP6a2hH1lVfqBsuhQbN fLoJbIayBImhfzT+R0A0/tXoGq6s2HI6mnKNpaazRvneHbKc2I7P6zquHjd2Bi5Z 4+3QtYz9Qf7NM08MSWL5EdX/jye6N+Pm0fAgGEzM3htWT/DScY+5iagpOJT4RRfk gK2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655268951; x=1655355351; bh=meB3o4RHIjnH4 +7Q/C/69u/oZ6dMRlLCXzf5bgQ4WC4=; b=kq6o7i78UHBy7o0QqsIg1dd/CgBcw H0ntZ+97IyM5OZ7ElvaBN07ETY+CM9dEz2MLiycuiuzj/uPZhakCay510A1U4FU1 jem+o9j0dQqSwxz4sstXtuGxc5JMa+IY7UBqCtgb9YqQaa12RuqbBh5S54b38QQB MtWocRz4ipAMagckd4pcFir0Ksoj2BIty8fnN/S7cbE3XRdv1fdyzLJzfgtpA3OP M9pZWty1XpAGg0VCjZpwwKt3ZKec/pEwEhWsg9QN9GWhH2+tJw1wVUwsCfoWxUaN uOXl9NTjobqWKTJd9Ac90sKmRdTeWebT7+AHTKAEWwk1W0dTDqtjaY+Fg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvtddgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 00:55:51 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Maxime Ripard Cc: Samuel Holland , Daniel Vetter , David Airlie , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 2/6] drm/sun4i: sun8i-hdmi-phy: Use devm_platform_ioremap_resource Date: Tue, 14 Jun 2022 23:55:39 -0500 Message-Id: <20220615045543.62813-3-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615045543.62813-1-samuel@sholland.org> References: <20220615045543.62813-1-samuel@sholland.org> 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" The struct resource is not used for anything else, so we can simplify the code a bit by using the helper function. Signed-off-by: Samuel Holland --- (no changes since v1) drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index 4553e04144fe..10504c2de132 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -675,7 +675,6 @@ static int sun8i_hdmi_phy_probe(struct platform_device = *pdev) struct device *dev =3D &pdev->dev; struct device_node *node =3D dev->of_node; struct sun8i_hdmi_phy *phy; - struct resource res; void __iomem *regs; int ret; =20 @@ -686,13 +685,7 @@ static int sun8i_hdmi_phy_probe(struct platform_device= *pdev) phy->variant =3D of_device_get_match_data(dev); phy->dev =3D dev; =20 - ret =3D of_address_to_resource(node, 0, &res); - if (ret) { - dev_err(dev, "phy: Couldn't get our resources\n"); - return ret; - } - - regs =3D devm_ioremap_resource(dev, &res); + regs =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(regs)) { dev_err(dev, "Couldn't map the HDMI PHY registers\n"); return PTR_ERR(regs); --=20 2.35.1 From nobody Mon Apr 27 08:43:10 2026 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 8C41BC43334 for ; Wed, 15 Jun 2022 04:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241400AbiFOE4B (ORCPT ); Wed, 15 Jun 2022 00:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240620AbiFOEz5 (ORCPT ); Wed, 15 Jun 2022 00:55:57 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CD762EA01 for ; Tue, 14 Jun 2022 21:55:56 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id F1375320096C; Wed, 15 Jun 2022 00:55:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 15 Jun 2022 00:55:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655268954; x=1655355354; bh=4R SAB9WD1dJBoGy/ykZA0xO819bE9MGyQmRwgpMsiv0=; b=kAZ3mbFOJcYWLlVOna eE7pMGbk9QVC9aGpjMA4MR0OrYtrYh2pumu6fMUe9jGjRjPAxwk6PnXBLyw95/0D xr5CCJ//ZOQyvy4MNWQXetk88UDXRrepGks9iaUT6AgptsL0OxZdVcwD1UAjF1we 4YgfTeupmsWSciAbUH1FYQS7i9AjMp5bEnJ/6pwDePCnIkXUEvFJw3BRzIfoMI98 frtjkaNE7+yxIXnCEVzH072QAykkBr9CO6V06AME586vnZ4AbreUgu1y5Q3P1iYQ rafv1LIyJIIA5HkjfkczCApFPdP+dNAKdFsXe5/NsYgKhMBrZiU2gQ9pw2dZg2K+ Htcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655268954; x=1655355354; bh=4RSAB9WD1dJBo Gy/ykZA0xO819bE9MGyQmRwgpMsiv0=; b=bnnkKio8GO/xCIs/cI7nSn1eCsriM PhO8XWj//4vVwBP/9V2VMn3F4jWRT/1lp4SNeaisJXpSSEjIhx4BcDT8J14+TALY cO/t4AiZVCYRcfc87twxwtVKIg1kcnR5IKgqvdv9ebpL06t6wKZYBCQG7FlIhq/w djZpPo5HplTUts/oOOqj3HuLpbckgs0h4ShO8ASTlQDpTaz1jGD2ctrgDppdD+Fo os4iHyVQjblzE9NGZ6ccsqGNsgW1SLyQV062sNYvfXgimjvWST1frgOGlHv48Htl kni80rg1RT1fJ6K4lKbpYtguMnJvhvYUlvs8btsdyLP0vi3PiV2iU5hUA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvtddgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 00:55:53 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Maxime Ripard Cc: Samuel Holland , Daniel Vetter , David Airlie , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 3/6] drm/sun4i: sun8i-hdmi-phy: Used device-managed clocks/resets Date: Tue, 14 Jun 2022 23:55:40 -0500 Message-Id: <20220615045543.62813-4-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615045543.62813-1-samuel@sholland.org> References: <20220615045543.62813-1-samuel@sholland.org> 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" Now that the HDMI PHY is using a platform driver, it can use device- managed resources. Use these, as well as the dev_err_probe helper, to simplify the probe function and get rid of the remove function. Signed-off-by: Samuel Holland --- Changes in v2: - Move error handling inside variant checks in probe function drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 90 ++++++++------------------ 1 file changed, 26 insertions(+), 64 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index 10504c2de132..9086ce547fad 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -673,10 +673,8 @@ int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, str= uct device_node *node) static int sun8i_hdmi_phy_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - struct device_node *node =3D dev->of_node; struct sun8i_hdmi_phy *phy; void __iomem *regs; - int ret; =20 phy =3D devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); if (!phy) @@ -686,88 +684,52 @@ static int sun8i_hdmi_phy_probe(struct platform_devic= e *pdev) phy->dev =3D dev; =20 regs =3D devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(regs)) { - dev_err(dev, "Couldn't map the HDMI PHY registers\n"); - return PTR_ERR(regs); - } + if (IS_ERR(regs)) + return dev_err_probe(dev, PTR_ERR(regs), + "Couldn't map the HDMI PHY registers\n"); =20 phy->regs =3D devm_regmap_init_mmio(dev, regs, &sun8i_hdmi_phy_regmap_config); - if (IS_ERR(phy->regs)) { - dev_err(dev, "Couldn't create the HDMI PHY regmap\n"); - return PTR_ERR(phy->regs); - } + if (IS_ERR(phy->regs)) + return dev_err_probe(dev, PTR_ERR(phy->regs), + "Couldn't create the HDMI PHY regmap\n"); =20 - phy->clk_bus =3D of_clk_get_by_name(node, "bus"); - if (IS_ERR(phy->clk_bus)) { - dev_err(dev, "Could not get bus clock\n"); - return PTR_ERR(phy->clk_bus); - } + phy->clk_bus =3D devm_clk_get(dev, "bus"); + if (IS_ERR(phy->clk_bus)) + return dev_err_probe(dev, PTR_ERR(phy->clk_bus), + "Could not get bus clock\n"); =20 - phy->clk_mod =3D of_clk_get_by_name(node, "mod"); - if (IS_ERR(phy->clk_mod)) { - dev_err(dev, "Could not get mod clock\n"); - ret =3D PTR_ERR(phy->clk_mod); - goto err_put_clk_bus; - } + phy->clk_mod =3D devm_clk_get(dev, "mod"); + if (IS_ERR(phy->clk_mod)) + return dev_err_probe(dev, PTR_ERR(phy->clk_mod), + "Could not get mod clock\n"); =20 if (phy->variant->has_phy_clk) { - phy->clk_pll0 =3D of_clk_get_by_name(node, "pll-0"); - if (IS_ERR(phy->clk_pll0)) { - dev_err(dev, "Could not get pll-0 clock\n"); - ret =3D PTR_ERR(phy->clk_pll0); - goto err_put_clk_mod; - } + phy->clk_pll0 =3D devm_clk_get(dev, "pll-0"); + if (IS_ERR(phy->clk_pll0)) + return dev_err_probe(dev, PTR_ERR(phy->clk_pll0), + "Could not get pll-0 clock\n"); =20 if (phy->variant->has_second_pll) { - phy->clk_pll1 =3D of_clk_get_by_name(node, "pll-1"); - if (IS_ERR(phy->clk_pll1)) { - dev_err(dev, "Could not get pll-1 clock\n"); - ret =3D PTR_ERR(phy->clk_pll1); - goto err_put_clk_pll0; - } + phy->clk_pll1 =3D devm_clk_get(dev, "pll-1"); + if (IS_ERR(phy->clk_pll1)) + return dev_err_probe(dev, PTR_ERR(phy->clk_pll1), + "Could not get pll-1 clock\n"); } } =20 - phy->rst_phy =3D of_reset_control_get_shared(node, "phy"); - if (IS_ERR(phy->rst_phy)) { - dev_err(dev, "Could not get phy reset control\n"); - ret =3D PTR_ERR(phy->rst_phy); - goto err_put_clk_pll1; - } + phy->rst_phy =3D devm_reset_control_get_shared(dev, "phy"); + if (IS_ERR(phy->rst_phy)) + return dev_err_probe(dev, PTR_ERR(phy->rst_phy), + "Could not get phy reset control\n"); =20 platform_set_drvdata(pdev, phy); =20 return 0; - -err_put_clk_pll1: - clk_put(phy->clk_pll1); -err_put_clk_pll0: - clk_put(phy->clk_pll0); -err_put_clk_mod: - clk_put(phy->clk_mod); -err_put_clk_bus: - clk_put(phy->clk_bus); - - return ret; -} - -static int sun8i_hdmi_phy_remove(struct platform_device *pdev) -{ - struct sun8i_hdmi_phy *phy =3D platform_get_drvdata(pdev); - - reset_control_put(phy->rst_phy); - - clk_put(phy->clk_pll0); - clk_put(phy->clk_pll1); - clk_put(phy->clk_mod); - clk_put(phy->clk_bus); - return 0; } =20 struct platform_driver sun8i_hdmi_phy_driver =3D { .probe =3D sun8i_hdmi_phy_probe, - .remove =3D sun8i_hdmi_phy_remove, .driver =3D { .name =3D "sun8i-hdmi-phy", .of_match_table =3D sun8i_hdmi_phy_of_table, --=20 2.35.1 From nobody Mon Apr 27 08:43:10 2026 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 AA690CCA473 for ; Wed, 15 Jun 2022 04:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242162AbiFOE4G (ORCPT ); Wed, 15 Jun 2022 00:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239557AbiFOEz7 (ORCPT ); Wed, 15 Jun 2022 00:55:59 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F89231344 for ; Tue, 14 Jun 2022 21:55:59 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 992F632002D8; Wed, 15 Jun 2022 00:55:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 15 Jun 2022 00:55:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655268957; x=1655355357; bh=dC BZtoBVILfECus7qg2DlxiYpAC2GWJbCJsguToVhOk=; b=elluduuYcLPXejHCGK G5buTngPVkEDpO5e4o0+xspJIUlDhzNphtJGwuR0xX87rma81mB62cbz6/y4sqVX lm2Q0vAUh6HokDEWBseuYzWkrW71gpfVAVsZ72NUrWm00yD1MCOaFpjiWhHG262j JVsJja6Qt/leHqDei117zWof1Fu2At92OmhuqQ7P111PPOL0C8MmSQhHjRzG2CKh ghD25lqu3S70JwDarw1a8RoLkRR6mqzMZA+Mrdfrdjhcv8ZsUndmz7bGZkQUceB8 NsUPYUqvcDbXa0E9BTVCH/0nIBEwH0ExgMw3hoWNluEf1xnSc3KzAs9uL5vdtb6l EtCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655268957; x=1655355357; bh=dCBZtoBVILfEC us7qg2DlxiYpAC2GWJbCJsguToVhOk=; b=mPfnY6KuBDJepHeoCODh/H5Hn15dd RGgyvx1NQYXFrN8swknzQqsHF1QF0juug7EIGNk1dTxiqmV11WCLhwQBzzaf6b+2 7DMHJXkXUk4nQyf7idfBPycmJgKtnsgT1+LApqKYkO6605wSLHLNUpPtSKDZo1FS UgEyHBfinMGhGdnQe8tPuKCAxzllWcwjXvUC83vSGDgMQNdHq/3mvQlbMjedMRE9 31QFHLfP7Pub/1tTEurM/kzFVujrBbT6IWRDeMwlSdgp/xdKcyMYN4CmY29YrJWd UZ4S/nBykJUEvXh0osDyfa8kWbkCh7hvLtXBLRYzKLOTYQzIKzZaJt/6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvtddgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 00:55:56 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Maxime Ripard Cc: Samuel Holland , Daniel Vetter , David Airlie , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 4/6] drm/sun4i: sun8i-hdmi-phy: Support multiple custom PHY ops Date: Tue, 14 Jun 2022 23:55:41 -0500 Message-Id: <20220615045543.62813-5-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615045543.62813-1-samuel@sholland.org> References: <20220615045543.62813-1-samuel@sholland.org> 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" The D1 SoC comes with a new custom HDMI PHY, which does not share any registers with the existing custom PHY. So it needs a new set of ops. Instead of providing a flag in the variant structure, provide the ops themselves. Signed-off-by: Samuel Holland --- (no changes since v1) drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/= sun8i_dw_hdmi.h index 0adbfac6eb31..f0b1aaad27d9 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -151,10 +151,10 @@ struct sun8i_hdmi_phy; struct sun8i_hdmi_phy_variant { bool has_phy_clk; bool has_second_pll; - unsigned int is_custom_phy : 1; const struct dw_hdmi_curr_ctrl *cur_ctr; const struct dw_hdmi_mpll_config *mpll_cfg; const struct dw_hdmi_phy_config *phy_cfg; + const struct dw_hdmi_phy_ops *phy_ops; void (*phy_init)(struct sun8i_hdmi_phy *phy); void (*phy_disable)(struct dw_hdmi *hdmi, struct sun8i_hdmi_phy *phy); diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index 9086ce547fad..e6d25bbe3d2f 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -567,8 +567,8 @@ void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy, { const struct sun8i_hdmi_phy_variant *variant =3D phy->variant; =20 - if (variant->is_custom_phy) { - plat_data->phy_ops =3D &sun8i_hdmi_phy_ops; + if (variant->phy_ops) { + plat_data->phy_ops =3D variant->phy_ops; plat_data->phy_name =3D "sun8i_dw_hdmi_phy"; plat_data->phy_data =3D phy; } else { @@ -587,7 +587,7 @@ static const struct regmap_config sun8i_hdmi_phy_regmap= _config =3D { }; =20 static const struct sun8i_hdmi_phy_variant sun8i_a83t_hdmi_phy =3D { - .is_custom_phy =3D true, + .phy_ops =3D &sun8i_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_a83t, .phy_disable =3D &sun8i_hdmi_phy_disable_a83t, .phy_config =3D &sun8i_hdmi_phy_config_a83t, @@ -595,7 +595,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_a83t_h= dmi_phy =3D { =20 static const struct sun8i_hdmi_phy_variant sun8i_h3_hdmi_phy =3D { .has_phy_clk =3D true, - .is_custom_phy =3D true, + .phy_ops =3D &sun8i_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_h3, .phy_disable =3D &sun8i_hdmi_phy_disable_h3, .phy_config =3D &sun8i_hdmi_phy_config_h3, @@ -604,7 +604,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_h3_hdm= i_phy =3D { static const struct sun8i_hdmi_phy_variant sun8i_r40_hdmi_phy =3D { .has_phy_clk =3D true, .has_second_pll =3D true, - .is_custom_phy =3D true, + .phy_ops =3D &sun8i_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_h3, .phy_disable =3D &sun8i_hdmi_phy_disable_h3, .phy_config =3D &sun8i_hdmi_phy_config_h3, @@ -612,7 +612,7 @@ static const struct sun8i_hdmi_phy_variant sun8i_r40_hd= mi_phy =3D { =20 static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy =3D { .has_phy_clk =3D true, - .is_custom_phy =3D true, + .phy_ops =3D &sun8i_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_h3, .phy_disable =3D &sun8i_hdmi_phy_disable_h3, .phy_config =3D &sun8i_hdmi_phy_config_h3, --=20 2.35.1 From nobody Mon Apr 27 08:43:10 2026 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 B6EC7C433EF for ; Wed, 15 Jun 2022 04:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242266AbiFOE4J (ORCPT ); Wed, 15 Jun 2022 00:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240620AbiFOE4D (ORCPT ); Wed, 15 Jun 2022 00:56:03 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B710E27CE5 for ; Tue, 14 Jun 2022 21:56:01 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 42ABF3200929; Wed, 15 Jun 2022 00:56:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 15 Jun 2022 00:56:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655268959; x=1655355359; bh=4f hmPRCR/z2ZYZI3PkonKC6pcED+Dt3lsyKP/K9frn0=; b=OcUu0q9/i56Icdnjne Pc4fAcTFf/LmRVujJwq8utAKX15IL1CLcpCtAcvbMf0ye87eF+LhCtGQBnkIrqGJ Tmm0zopRyr8aRYlCLLcWv7m7q8g7kKyqTnBiGBIib+zqUXwHDJwXxF8U+tLSyPHC iGiZieMPbBP7a0Ol0ypp6wpX6dMTu5/8NPHc9+QV18s4i4nXNQSViiP5fOuyXjfc yMaCQCkb7RovIu0vJoeIENh96XC9pIi0OkP+r9zvFY5qyRiTj6or04tdr0f9trm9 UkLFChb+hy1VidppOD2Z2A3i4ckSuQy51Wf2IUgxOqkSaZFE+ctRgRXckDTExW0g BG6w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655268959; x=1655355359; bh=4fhmPRCR/z2ZY ZI3PkonKC6pcED+Dt3lsyKP/K9frn0=; b=At+ARN8Y90WnPyRbz/ER4oRzGXM4H ZXv4EhYH4BYWyFmd1RokVg49QkXrINXFmEI+BKS2JmKVYBMLbD3PiYYRwCOcj8LC rEtzdx7p4mf2YmFyj7B8tsyArPJfpq5CrshQuQsOd3H9u4WqN6VKWuAeHwpZKg7g ZXqYhc0aicab5bxwk28tlz4YoTOpAwydX5lPXRlyTjdfJKKRZ2M6ReaFYWQZlm3V c9hMsb002uxzWz5LScR8Vb0J9qEWdq3MDx2cb+GVvRVeMU4wKpv53j+afsIwPfSs PCCnYup9p2F0BDXvojJw6VYb6YnaBrPwMN3m17TTirc/S3PfIfcQzPJbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvtddgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 00:55:59 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Maxime Ripard Cc: Samuel Holland , Daniel Vetter , David Airlie , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 5/6] drm/sun4i: sun8i-hdmi-phy: Separate A83T and H3 PHY ops Date: Tue, 14 Jun 2022 23:55:42 -0500 Message-Id: <20220615045543.62813-6-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615045543.62813-1-samuel@sholland.org> References: <20220615045543.62813-1-samuel@sholland.org> 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" Since the driver already needs to support multiple sets of ops, we can drop the mid-layer used by the A83T and H3 PHYs. They share only a small amount of code; factor this out as sun8i_hdmi_phy_set_polarity. For clarity, this commit keeps the existing function order. Signed-off-by: Samuel Holland --- (no changes since v1) drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 5 -- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 89 +++++++++++++------------- 2 files changed, 46 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/= sun8i_dw_hdmi.h index f0b1aaad27d9..f082b8ecfe2c 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -156,11 +156,6 @@ struct sun8i_hdmi_phy_variant { const struct dw_hdmi_phy_config *phy_cfg; const struct dw_hdmi_phy_ops *phy_ops; void (*phy_init)(struct sun8i_hdmi_phy *phy); - void (*phy_disable)(struct dw_hdmi *hdmi, - struct sun8i_hdmi_phy *phy); - int (*phy_config)(struct dw_hdmi *hdmi, - struct sun8i_hdmi_phy *phy, - unsigned int clk_rate); }; =20 struct sun8i_hdmi_phy { diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index e6d25bbe3d2f..f94c1ddddbad 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -123,10 +123,18 @@ static const struct dw_hdmi_phy_config sun50i_h6_phy_= config[] =3D { { ~0UL, 0x0000, 0x0000, 0x0000} }; =20 -static int sun8i_hdmi_phy_config_a83t(struct dw_hdmi *hdmi, - struct sun8i_hdmi_phy *phy, - unsigned int clk_rate) +static void sun8i_hdmi_phy_set_polarity(struct sun8i_hdmi_phy *phy, + const struct drm_display_mode *mode); + +static int sun8i_a83t_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, + const struct drm_display_info *display, + const struct drm_display_mode *mode) { + unsigned int clk_rate =3D mode->crtc_clock * 1000; + struct sun8i_hdmi_phy *phy =3D data; + + sun8i_hdmi_phy_set_polarity(phy, mode); + regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_REXT_CTRL_REG, SUN8I_HDMI_PHY_REXT_CTRL_REXT_EN, SUN8I_HDMI_PHY_REXT_CTRL_REXT_EN); @@ -185,10 +193,12 @@ static int sun8i_hdmi_phy_config_a83t(struct dw_hdmi = *hdmi, return 0; } =20 -static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi, - struct sun8i_hdmi_phy *phy, - unsigned int clk_rate) +static int sun8i_h3_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, + const struct drm_display_info *display, + const struct drm_display_mode *mode) { + unsigned int clk_rate =3D mode->crtc_clock * 1000; + struct sun8i_hdmi_phy *phy =3D data; u32 pll_cfg1_init; u32 pll_cfg2_init; u32 ana_cfg1_end; @@ -197,6 +207,11 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hd= mi, u32 b_offset =3D 0; u32 val; =20 + if (phy->variant->has_phy_clk) + clk_set_rate(phy->clk_phy, clk_rate); + + sun8i_hdmi_phy_set_polarity(phy, mode); + /* bandwidth / frequency independent settings */ =20 pll_cfg1_init =3D SUN8I_HDMI_PHY_PLL_CFG1_LDO2_EN | @@ -333,11 +348,9 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hd= mi, return 0; } =20 -static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, - const struct drm_display_info *display, - const struct drm_display_mode *mode) +static void sun8i_hdmi_phy_set_polarity(struct sun8i_hdmi_phy *phy, + const struct drm_display_mode *mode) { - struct sun8i_hdmi_phy *phy =3D (struct sun8i_hdmi_phy *)data; u32 val =3D 0; =20 if (mode->flags & DRM_MODE_FLAG_NHSYNC) @@ -348,16 +361,12 @@ static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi= , void *data, =20 regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG, SUN8I_HDMI_PHY_DBG_CTRL_POL_MASK, val); - - if (phy->variant->has_phy_clk) - clk_set_rate(phy->clk_phy, mode->crtc_clock * 1000); - - return phy->variant->phy_config(hdmi, phy, mode->crtc_clock * 1000); }; =20 -static void sun8i_hdmi_phy_disable_a83t(struct dw_hdmi *hdmi, - struct sun8i_hdmi_phy *phy) +static void sun8i_a83t_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) { + struct sun8i_hdmi_phy *phy =3D data; + dw_hdmi_phy_gen2_txpwron(hdmi, 0); dw_hdmi_phy_gen2_pddq(hdmi, 1); =20 @@ -365,9 +374,10 @@ static void sun8i_hdmi_phy_disable_a83t(struct dw_hdmi= *hdmi, SUN8I_HDMI_PHY_REXT_CTRL_REXT_EN, 0); } =20 -static void sun8i_hdmi_phy_disable_h3(struct dw_hdmi *hdmi, - struct sun8i_hdmi_phy *phy) +static void sun8i_h3_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) { + struct sun8i_hdmi_phy *phy =3D data; + regmap_write(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, SUN8I_HDMI_PHY_ANA_CFG1_LDOEN | SUN8I_HDMI_PHY_ANA_CFG1_ENVBS | @@ -375,19 +385,20 @@ static void sun8i_hdmi_phy_disable_h3(struct dw_hdmi = *hdmi, regmap_write(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG, 0); } =20 -static void sun8i_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) -{ - struct sun8i_hdmi_phy *phy =3D (struct sun8i_hdmi_phy *)data; - - phy->variant->phy_disable(hdmi, phy); -} +static const struct dw_hdmi_phy_ops sun8i_a83t_hdmi_phy_ops =3D { + .init =3D sun8i_a83t_hdmi_phy_config, + .disable =3D sun8i_a83t_hdmi_phy_disable, + .read_hpd =3D dw_hdmi_phy_read_hpd, + .update_hpd =3D dw_hdmi_phy_update_hpd, + .setup_hpd =3D dw_hdmi_phy_setup_hpd, +}; =20 -static const struct dw_hdmi_phy_ops sun8i_hdmi_phy_ops =3D { - .init =3D &sun8i_hdmi_phy_config, - .disable =3D &sun8i_hdmi_phy_disable, - .read_hpd =3D &dw_hdmi_phy_read_hpd, - .update_hpd =3D &dw_hdmi_phy_update_hpd, - .setup_hpd =3D &dw_hdmi_phy_setup_hpd, +static const struct dw_hdmi_phy_ops sun8i_h3_hdmi_phy_ops =3D { + .init =3D sun8i_h3_hdmi_phy_config, + .disable =3D sun8i_h3_hdmi_phy_disable, + .read_hpd =3D dw_hdmi_phy_read_hpd, + .update_hpd =3D dw_hdmi_phy_update_hpd, + .setup_hpd =3D dw_hdmi_phy_setup_hpd, }; =20 static void sun8i_hdmi_phy_unlock(struct sun8i_hdmi_phy *phy) @@ -587,35 +598,27 @@ static const struct regmap_config sun8i_hdmi_phy_regm= ap_config =3D { }; =20 static const struct sun8i_hdmi_phy_variant sun8i_a83t_hdmi_phy =3D { - .phy_ops =3D &sun8i_hdmi_phy_ops, + .phy_ops =3D &sun8i_a83t_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_a83t, - .phy_disable =3D &sun8i_hdmi_phy_disable_a83t, - .phy_config =3D &sun8i_hdmi_phy_config_a83t, }; =20 static const struct sun8i_hdmi_phy_variant sun8i_h3_hdmi_phy =3D { .has_phy_clk =3D true, - .phy_ops =3D &sun8i_hdmi_phy_ops, + .phy_ops =3D &sun8i_h3_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_h3, - .phy_disable =3D &sun8i_hdmi_phy_disable_h3, - .phy_config =3D &sun8i_hdmi_phy_config_h3, }; =20 static const struct sun8i_hdmi_phy_variant sun8i_r40_hdmi_phy =3D { .has_phy_clk =3D true, .has_second_pll =3D true, - .phy_ops =3D &sun8i_hdmi_phy_ops, + .phy_ops =3D &sun8i_h3_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_h3, - .phy_disable =3D &sun8i_hdmi_phy_disable_h3, - .phy_config =3D &sun8i_hdmi_phy_config_h3, }; =20 static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy =3D { .has_phy_clk =3D true, - .phy_ops =3D &sun8i_hdmi_phy_ops, + .phy_ops =3D &sun8i_h3_hdmi_phy_ops, .phy_init =3D &sun8i_hdmi_phy_init_h3, - .phy_disable =3D &sun8i_hdmi_phy_disable_h3, - .phy_config =3D &sun8i_hdmi_phy_config_h3, }; =20 static const struct sun8i_hdmi_phy_variant sun50i_h6_hdmi_phy =3D { --=20 2.35.1 From nobody Mon Apr 27 08:43:10 2026 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 9FB0CC433EF for ; Wed, 15 Jun 2022 04:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242498AbiFOE4O (ORCPT ); Wed, 15 Jun 2022 00:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242130AbiFOE4F (ORCPT ); Wed, 15 Jun 2022 00:56:05 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 551C836692 for ; Tue, 14 Jun 2022 21:56:04 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id DC95132002D8; Wed, 15 Jun 2022 00:56:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 15 Jun 2022 00:56:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1655268962; x=1655355362; bh=ei fZR+rkb7Pl0q/tlESZNdAQghMG8hJv8oUZqbBJ87E=; b=lpYhE3imjXxM9qpcvv GfEKzM1NTLSHHUt9X/UJ4jm6+tfyGg1+kPGtsqGxiYbpdNwFolCYV0ajPaALUl9b 0+YshqjpPbpZC7HGxpVrCA6J/eebx4KHh22mImGdQKonAWOsE6JGnDuqa0C0L2EB TsHhivo2OxxaOK5d1Jox9rG+ST4td5c5x49vo6JwNhZGMsF6ozc2c60WGeeg0mU2 BpIM2UkHNDCAHP49fQT31qfDozqJUaVGUllLMMk4+xN9mtpzGL6Lo6maF1Eo+6vy QS57tAk9N8+n42D7Lc96IgQ/9++iG29LVrC4/FtZ07OoWHkNyRgceXKRboR/osZD kiCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1655268962; x=1655355362; bh=eifZR+rkb7Pl0 q/tlESZNdAQghMG8hJv8oUZqbBJ87E=; b=JYyxK58vtzSheCX2MFZUAvDd4PTLL VotbJ0/5RWF1kqhVoAlqWe0FJIUk9YNCrYEC3T+AXaTinD3paF8awjsrbupi34gS qPbpHB6cDDxsUVYeBStfdeFOIbKfR71ntPXXBNfX77qO/QWPHwSt/qAROorzgf70 cz3lsAI1tpx0CpAAUxdPFI8syF7LzWP2QK1QmUzui9VxixMRa+OuzovSD73Y6Nsm VsSUclPEHRHSI0tMyWI4akzddgiytFJwPsEP1plw83Tm+MtI6QbLa5TPoZyRcJBH +71iKnfO+AUebTBpsV4yiUA9l76IwWhwRjcJK0E+t7j4ZyFiEsZOtoyXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvtddgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 00:56:01 -0400 (EDT) From: Samuel Holland To: Chen-Yu Tsai , Jernej Skrabec , Maxime Ripard Cc: Samuel Holland , Daniel Vetter , David Airlie , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 6/6] drm/sun4i: sun8i-hdmi-phy: Group PHY ops functions by generation Date: Tue, 14 Jun 2022 23:55:43 -0500 Message-Id: <20220615045543.62813-7-samuel@sholland.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615045543.62813-1-samuel@sholland.org> References: <20220615045543.62813-1-samuel@sholland.org> 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" Now that the PHY ops are separated, sort them topologically, with the common sun8i_hdmi_phy_set_polarity helper at the top. No function contents are changed in this commit. Signed-off-by: Samuel Holland --- (no changes since v1) drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 67 ++++++++++++-------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i= /sun8i_hdmi_phy.c index f94c1ddddbad..ca53b5e9fffc 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -124,7 +124,19 @@ static const struct dw_hdmi_phy_config sun50i_h6_phy_c= onfig[] =3D { }; =20 static void sun8i_hdmi_phy_set_polarity(struct sun8i_hdmi_phy *phy, - const struct drm_display_mode *mode); + const struct drm_display_mode *mode) +{ + u32 val =3D 0; + + if (mode->flags & DRM_MODE_FLAG_NHSYNC) + val |=3D SUN8I_HDMI_PHY_DBG_CTRL_POL_NHSYNC; + + if (mode->flags & DRM_MODE_FLAG_NVSYNC) + val |=3D SUN8I_HDMI_PHY_DBG_CTRL_POL_NVSYNC; + + regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG, + SUN8I_HDMI_PHY_DBG_CTRL_POL_MASK, val); +}; =20 static int sun8i_a83t_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, const struct drm_display_info *display, @@ -193,6 +205,25 @@ static int sun8i_a83t_hdmi_phy_config(struct dw_hdmi *= hdmi, void *data, return 0; } =20 +static void sun8i_a83t_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) +{ + struct sun8i_hdmi_phy *phy =3D data; + + dw_hdmi_phy_gen2_txpwron(hdmi, 0); + dw_hdmi_phy_gen2_pddq(hdmi, 1); + + regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_REXT_CTRL_REG, + SUN8I_HDMI_PHY_REXT_CTRL_REXT_EN, 0); +} + +static const struct dw_hdmi_phy_ops sun8i_a83t_hdmi_phy_ops =3D { + .init =3D sun8i_a83t_hdmi_phy_config, + .disable =3D sun8i_a83t_hdmi_phy_disable, + .read_hpd =3D dw_hdmi_phy_read_hpd, + .update_hpd =3D dw_hdmi_phy_update_hpd, + .setup_hpd =3D dw_hdmi_phy_setup_hpd, +}; + static int sun8i_h3_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, const struct drm_display_info *display, const struct drm_display_mode *mode) @@ -348,32 +379,6 @@ static int sun8i_h3_hdmi_phy_config(struct dw_hdmi *hd= mi, void *data, return 0; } =20 -static void sun8i_hdmi_phy_set_polarity(struct sun8i_hdmi_phy *phy, - const struct drm_display_mode *mode) -{ - u32 val =3D 0; - - if (mode->flags & DRM_MODE_FLAG_NHSYNC) - val |=3D SUN8I_HDMI_PHY_DBG_CTRL_POL_NHSYNC; - - if (mode->flags & DRM_MODE_FLAG_NVSYNC) - val |=3D SUN8I_HDMI_PHY_DBG_CTRL_POL_NVSYNC; - - regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG, - SUN8I_HDMI_PHY_DBG_CTRL_POL_MASK, val); -}; - -static void sun8i_a83t_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) -{ - struct sun8i_hdmi_phy *phy =3D data; - - dw_hdmi_phy_gen2_txpwron(hdmi, 0); - dw_hdmi_phy_gen2_pddq(hdmi, 1); - - regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_REXT_CTRL_REG, - SUN8I_HDMI_PHY_REXT_CTRL_REXT_EN, 0); -} - static void sun8i_h3_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) { struct sun8i_hdmi_phy *phy =3D data; @@ -385,14 +390,6 @@ static void sun8i_h3_hdmi_phy_disable(struct dw_hdmi *= hdmi, void *data) regmap_write(phy->regs, SUN8I_HDMI_PHY_PLL_CFG1_REG, 0); } =20 -static const struct dw_hdmi_phy_ops sun8i_a83t_hdmi_phy_ops =3D { - .init =3D sun8i_a83t_hdmi_phy_config, - .disable =3D sun8i_a83t_hdmi_phy_disable, - .read_hpd =3D dw_hdmi_phy_read_hpd, - .update_hpd =3D dw_hdmi_phy_update_hpd, - .setup_hpd =3D dw_hdmi_phy_setup_hpd, -}; - static const struct dw_hdmi_phy_ops sun8i_h3_hdmi_phy_ops =3D { .init =3D sun8i_h3_hdmi_phy_config, .disable =3D sun8i_h3_hdmi_phy_disable, --=20 2.35.1