From nobody Sun Feb 8 12:37:04 2026 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (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 7AC45156C65 for ; Fri, 3 May 2024 16:41:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714754501; cv=none; b=p/oRIXPgDymLoljnh9gWo3A0EyTZR5kexnh170jtmrNo7Bu2CXxgxxfBovC737gBOew+rIl/IL1W69zIHo9aDPLfGhxKgpNtdMT/J8uhl79/fLtu1Srv0Ox79tTEM/XQVnDA6vwrtzH4EylDERkJZzoIVQGwurVsIGQnMa1IJlo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714754501; c=relaxed/simple; bh=BrI+V4j4yEmG0niUITWX6blr1exPXxg2RDL7xUdiT/s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IiZVMCGpFMFosbQZ99SwrtBfh4Oi+vgMG1QDCC1xUKH+mZr/8pyQ+33b65NrcOEzQfxfN0YbLVsvJP7I+VWlmJ1LfaGR+sXb6sfIkHSKJHBo2Z14mI+nh7ImqI1vB+fEvicRtbrnzMs5i8Ald32wQ54hHRJj4UyQIEC3br7ZL40= 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=bvYUeIrF; arc=none smtp.client-ip=95.215.58.188 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="bvYUeIrF" 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=1714754497; 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=nlgmWXnBZEqYq/ZquiJSlQpBRN3TEKI4GE5FtczWsBM=; b=bvYUeIrFwjsJQ/IraA0iZ+FZJvL+dHzKhYld5uyfEKHdjhpMlZpyRf19V6NQXkPKtGHo2L 79oi/4+4NPGFN9/Zyn2DLaG27963rMHCpAHbZqdMC906FyuKipkgRjeHZqHNGRR+lqb0ke 9zAhiszQJTyFOfKInTtHprY2Kx6MeSk= From: Sui Jingfeng To: Andrzej Hajda Cc: Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v5 04/10] drm/bridge: display-connector: Use fwnode APIs to acquire device properties Date: Sat, 4 May 2024 00:41:00 +0800 Message-Id: <20240503164106.1172650-5-sui.jingfeng@linux.dev> In-Reply-To: <20240503164106.1172650-1-sui.jingfeng@linux.dev> References: <20240503164106.1172650-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" Switch to use the fwnode APIs, which is a fundamental step to make this driver OF-independent possible. No functional changes for DT-based systems. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/display-connector.c | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/b= ridge/display-connector.c index ab8e00baf3f1..ac680c6e9bd6 100644 --- a/drivers/gpu/drm/bridge/display-connector.c +++ b/drivers/gpu/drm/bridge/display-connector.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include =20 @@ -204,6 +203,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 +215,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 +240,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 +270,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 +308,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(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 +357,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