From nobody Sun Feb 8 05:27:04 2026 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF61521115 for ; Mon, 11 Mar 2024 08:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710147511; cv=none; b=WELiWew3jZ7n1pLa447z5kPzxKm/DBExsvYtpP7Jf0VHiYhgMe7R86u4zYwmHVmt2cUjYEQJjoKrswoAj26QU4K2/lEgpQFgr/mMeVDVCjq0ODuNhWZsU5cdV/kacD2Fwq/xHyAatijUYtKcunfmy394lWSxiiFJ/aQyHyy4wGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710147511; c=relaxed/simple; bh=vq9XBTBjoQZnocYnQAqv25NSvH4VWo7Rsys2n+nDlxE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SXsdyPPN2N4lYX6bx8jkiStBtydpY0L35gVj9Qz/M0Ti7L/W1NcrOajRzQMN8fP7Ju2mdmw7H/4AdS7jHlpGULiMrM6Z+KieiJ30mwz5XJmt0W0m0ZxzPMuknV7+JoZtbhQAuBt79Y21aiKgLIo7jCgPG+TjOGIJZ2UlvJEOJsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=o7SpAZM2; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="o7SpAZM2" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710147507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Aep+0Bx5dDl+omojFo37hiW07MeWApSc10wBdc6QHoM=; b=o7SpAZM20vIWA1feEu6Qmid7aZHNi34FMD0eBo819WVjEfZDH/7z2Ki4n50utYq2lw4Bw4 JV0JLLp48M/TehOzS2WavoDaWfiba0/hR8DhKnL/D4fBdHWbr3sggprk2UWWBapGe1UanY 6moYpT4qpUqeOh6JOqSTAh//Ko7PJSk= From: Sui Jingfeng To: Andrzej Hajda Cc: Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Phong LE , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v3 3/5] drm-bridge: display-connector: Use fwnode API to acquire device properties Date: Mon, 11 Mar 2024 16:56:57 +0800 Message-Id: <20240311085659.244043-4-sui.jingfeng@linux.dev> In-Reply-To: <20240311085659.244043-1-sui.jingfeng@linux.dev> References: <20240311085659.244043-1-sui.jingfeng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Make this driver less DT-dependent by using the fwnode helper function, should be no functional changes for DT based systems. Do the necessary works before it can be truely subsystem independent, even though there is no user yet, this still do no harms. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/display-connector.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/b= ridge/display-connector.c index ab8e00baf3f1..d80cb7bc59e6 100644 --- a/drivers/gpu/drm/bridge/display-connector.c +++ b/drivers/gpu/drm/bridge/display-connector.c @@ -204,6 +204,7 @@ static int display_connector_get_supply(struct platform= _device *pdev, =20 static int display_connector_probe(struct platform_device *pdev) { + struct fwnode_handle *fwnode =3D dev_fwnode(&pdev->dev); struct display_connector *conn; unsigned int type; const char *label =3D NULL; @@ -215,15 +216,15 @@ static int display_connector_probe(struct platform_de= vice *pdev) =20 platform_set_drvdata(pdev, conn); =20 - type =3D (uintptr_t)of_device_get_match_data(&pdev->dev); + type =3D (uintptr_t)device_get_match_data(&pdev->dev); =20 /* Get the exact connector type. */ switch (type) { case DRM_MODE_CONNECTOR_DVII: { bool analog, digital; =20 - analog =3D of_property_read_bool(pdev->dev.of_node, "analog"); - digital =3D of_property_read_bool(pdev->dev.of_node, "digital"); + analog =3D fwnode_property_present(fwnode, "analog"); + digital =3D fwnode_property_present(fwnode, "digital"); if (analog && !digital) { conn->bridge.type =3D DRM_MODE_CONNECTOR_DVIA; } else if (!analog && digital) { @@ -240,8 +241,7 @@ static int display_connector_probe(struct platform_devi= ce *pdev) case DRM_MODE_CONNECTOR_HDMIA: { const char *hdmi_type; =20 - ret =3D of_property_read_string(pdev->dev.of_node, "type", - &hdmi_type); + ret =3D fwnode_property_read_string(fwnode, "type", &hdmi_type); if (ret < 0) { dev_err(&pdev->dev, "HDMI connector with no type\n"); return -EINVAL; @@ -271,7 +271,7 @@ static int display_connector_probe(struct platform_devi= ce *pdev) conn->bridge.interlace_allowed =3D true; =20 /* Get the optional connector label. */ - of_property_read_string(pdev->dev.of_node, "label", &label); + fwnode_property_read_string(fwnode, "label", &label); =20 /* * Get the HPD GPIO for DVI, HDMI and DP connectors. If the GPIO can prov= ide @@ -309,12 +309,12 @@ static int display_connector_probe(struct platform_de= vice *pdev) if (type =3D=3D DRM_MODE_CONNECTOR_DVII || type =3D=3D DRM_MODE_CONNECTOR_HDMIA || type =3D=3D DRM_MODE_CONNECTOR_VGA) { - struct device_node *phandle; + struct fwnode_handle *phandle; =20 - phandle =3D of_parse_phandle(pdev->dev.of_node, "ddc-i2c-bus", 0); - if (phandle) { - conn->bridge.ddc =3D of_get_i2c_adapter_by_node(phandle); - of_node_put(phandle); + phandle =3D fwnode_find_reference(fwnode, "ddc-i2c-bus", 0); + if (!IS_ERR_OR_NULL(phandle)) { + conn->bridge.ddc =3D i2c_get_adapter_by_fwnode(phandle); + fwnode_handle_put(phandle); if (!conn->bridge.ddc) return -EPROBE_DEFER; } else { @@ -358,7 +358,7 @@ static int display_connector_probe(struct platform_devi= ce *pdev) } =20 conn->bridge.funcs =3D &display_connector_bridge_funcs; - conn->bridge.of_node =3D pdev->dev.of_node; + drm_bridge_set_node(&conn->bridge, fwnode); =20 if (conn->bridge.ddc) conn->bridge.ops |=3D DRM_BRIDGE_OP_EDID --=20 2.34.1