Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1706480lqb; Sun, 26 May 2024 13:22:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXQ022uL6tk7DaoyHlOX76ApyiEGf81NlY1JTLg9N075kT4kXaeftwxKjuswOxFANA0B+CODfh0B/YCIskeODcYOigj7O9tsXr7xLttA== X-Google-Smtp-Source: AGHT+IGx8IlF8ATiCYcWZje+Ws6/jNkrLOA0neUOmrBO7ikwkd9RKO55y4dX0rT13ZBPyk5ni/Xg X-Received: by 2002:a50:ab13:0:b0:578:5aef:23e3 with SMTP id 4fb4d7f45d1cf-5785aef24bamr4532849a12.21.1716754974095; Sun, 26 May 2024 13:22:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716754974; cv=pass; d=google.com; s=arc-20160816; b=B4AEncGD8PxpDMhLzHJBE68e8DGcGXk52EpASZFnk+YfqZ7szEwkCKbDr7uipVmqFL nVh+kDb70/ANWyUkwvM4Dn9NSfZDqEMGnA9mAxuNELOPNIiDkejgAXJpQNts1ZVtbcaC MJB2W8FhRLyBFzl8273ckMWcdXntmQKRUxUsvfsJn92ryNhbz8ad2PRLTTHScilFn60U jIegBaNwMBgB9zAvW5QVLXfDhITTxd09n5Jb9OEjIjlhPhGbuC7pFLiXefgQixA/HpJK acsNUBHJyw8SX5Rlirr3Sjhaf+kxPTt2tPlgKpEjVx6H+5Bk74hGrsZCtQJRbl2EBFbh Zurw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BDwi2AKZAI/4eaSYZxKdRQj29huk3ZJbAA3zVO8rY3o=; fh=+9pjvWy/sQxAY6MxG8mZV2fAo+vnxCF8rB7oqMHgJRU=; b=y02EZroNqzcblDi/9nx2uCaHt1386ZfRBTC74jaR6xhR6G6CGdewlVsiS3cgEgmEr7 z8JHIVDqt7WKDJWk+9EHmJtXPRrw34BI9NfO7UiigITW/PAtWd4IFCvVVyvsE69M9/VW Mg21+MkLe5A5So9tKReSSSl4YUNIFzSP3ktbKs7+M3CqmuV5mXHrPrI6XyoqbDguLuIB 6j45FnR1rgfM378ca/b81h5CVR//D2t/iJ1O/D9DCdJJwBPOC12sBJyB+qmieFVtkBmu xsHgMh6pwIsJjcm/lSJMu0x9pha/ZvXUFNsdR3VB5YFISZOJn1C10+rGnUbDmLCYmfue 7A3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=rP4X33l+; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-189860-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189860-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-579035cb509si1801903a12.64.2024.05.26.13.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 13:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189860-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=rP4X33l+; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-189860-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189860-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CE87B1F20938 for ; Sun, 26 May 2024 20:22:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD7D813A3FE; Sun, 26 May 2024 20:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="rP4X33l+" Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 4159F13A3E2 for ; Sun, 26 May 2024 20:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716754922; cv=none; b=K4l9ERVxm/WCWtjaBKeVla40ljPr8nEddmS8NmxjncwTJOQgGCZVvN+E/KoT4INv3AR9xBWyGUfcWjnLeCZEBkFY6iqdmjQXlilQ1pZj8OyarquRl2NNezheJvEOglPQNayJdLt+N7Pf0fWizuwreeAGfUUxExzkovP7pX+FulE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716754922; c=relaxed/simple; bh=FYtpw8ESyd5jaOOSr7QC8OXX2cBY/owg7fDQm/F6Ywk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HVrWBPg3dVPpY00AT+Py+YosF9Q5qrTAWg8iErjURy6q8D09pHwk+mxfQerNYIYBYiRbAvfMnxeSwGD6GSxlM3sPrrzHpzwxieveb5QT3exuCDNBlntk7/ZwtHrLeDkgQO6js0NTN/c9+EOxXA0JPGOs9CTtgoeOUehQ9dOXoZI= 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=rP4X33l+; arc=none smtp.client-ip=95.215.58.180 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 X-Envelope-To: rfoss@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716754918; 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=BDwi2AKZAI/4eaSYZxKdRQj29huk3ZJbAA3zVO8rY3o=; b=rP4X33l+PCCFXLLpwmHy0ioEKwJ39KTdMuR0AjX4Mtgdv70or10PdEaJAeziIFjlarkUbV ZfYdrb9PUNLIB3s7hZQoK2wV124//Tl1HIj5JEEyhu8NKBP6RXKQtXUnM++e2VuiG0gXWX xRux/vR7fHKEwbt3tLP0Br72CfmFeNM= X-Envelope-To: laurent.pinchart@ideasonboard.com X-Envelope-To: dri-devel@lists.freedesktop.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: sui.jingfeng@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng To: Robert Foss , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v6 05/10] drm/bridge: display-connector: Use fwnode APIs to acquire device properties Date: Mon, 27 May 2024 04:21:10 +0800 Message-Id: <20240526202115.129049-6-sui.jingfeng@linux.dev> In-Reply-To: <20240526202115.129049-1-sui.jingfeng@linux.dev> References: <20240526202115.129049-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: 8bit X-Migadu-Flow: FLOW_OUT 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 | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c index fb1e97d385fe..7436e7cd53fc 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 @@ -204,6 +203,7 @@ static int display_connector_get_supply(struct platform_device *pdev, static int display_connector_probe(struct platform_device *pdev) { + struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev); struct display_connector *conn; unsigned int type; const char *label = NULL; @@ -215,15 +215,15 @@ static int display_connector_probe(struct platform_device *pdev) platform_set_drvdata(pdev, conn); - type = (uintptr_t)of_device_get_match_data(&pdev->dev); + type = (uintptr_t)device_get_match_data(&pdev->dev); /* Get the exact connector type. */ switch (type) { case DRM_MODE_CONNECTOR_DVII: { bool analog, digital; - analog = of_property_read_bool(pdev->dev.of_node, "analog"); - digital = of_property_read_bool(pdev->dev.of_node, "digital"); + analog = fwnode_property_present(fwnode, "analog"); + digital = fwnode_property_present(fwnode, "digital"); if (analog && !digital) { conn->bridge.type = DRM_MODE_CONNECTOR_DVIA; } else if (!analog && digital) { @@ -240,8 +240,7 @@ static int display_connector_probe(struct platform_device *pdev) case DRM_MODE_CONNECTOR_HDMIA: { const char *hdmi_type; - ret = of_property_read_string(pdev->dev.of_node, "type", - &hdmi_type); + ret = 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_device *pdev) conn->bridge.interlace_allowed = true; /* Get the optional connector label. */ - of_property_read_string(pdev->dev.of_node, "label", &label); + fwnode_property_read_string(fwnode, "label", &label); /* * Get the HPD GPIO for DVI, HDMI and DP connectors. If the GPIO can provide @@ -309,12 +308,12 @@ static int display_connector_probe(struct platform_device *pdev) if (type == DRM_MODE_CONNECTOR_DVII || type == DRM_MODE_CONNECTOR_HDMIA || type == DRM_MODE_CONNECTOR_VGA) { - struct device_node *phandle; + struct fwnode_handle *phandle; - phandle = of_parse_phandle(pdev->dev.of_node, "ddc-i2c-bus", 0); - if (phandle) { - conn->bridge.ddc = of_get_i2c_adapter_by_node(phandle); - of_node_put(phandle); + phandle = fwnode_find_reference(fwnode, "ddc-i2c-bus", 0); + if (!IS_ERR(phandle)) { + conn->bridge.ddc = i2c_get_adapter_by_fwnode(phandle); + fwnode_handle_put(phandle); if (!conn->bridge.ddc) return -EPROBE_DEFER; } else { -- 2.34.1