Message ID | 20240122163220.110788-3-sui.jingfeng@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-33698-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2724060dyb; Mon, 22 Jan 2024 09:31:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHoacLHhy/QxWqVB9pEvpMq7U7/g6p0a8sxKYbohhcYZxljyYpcKOLtwcHvgtsqphvF0cb X-Received: by 2002:ac8:5bc7:0:b0:42a:3d4a:5ed5 with SMTP id b7-20020ac85bc7000000b0042a3d4a5ed5mr2239433qtb.44.1705944697511; Mon, 22 Jan 2024 09:31:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705944697; cv=pass; d=google.com; s=arc-20160816; b=qakNcAOneIo7SMe+lcZFbB4Nw6ELYQ7io1GIkbJMj2toGK8nUOqXfEVIvnzpKkGr6Z J/lpVK/kXXU0sA2MNG9blfahGpHzZWv63fZ8uwRm50YA9oIPaQWmG7NxQchQZ/hcvaqv apNUxT+2l5RDSI34VzEFvd+VCOg0kWj21hLBjUKhibmJrovGvA3J3C7HiXGUMKgJYkG0 VYbVAZ8BAvpkzkQXGYznG6vFry+UtLs1PxQT3SGXlSr7R+tAzr1NcDP5HZpNZblULdzf VCGe2PEKR8Z+Db/TnS93Q5ppQFE4zfPSBIP23JwfcEWw/JXIVxx5z534gSlVlq3zb1dj NDMQ== 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=zOQVFSKw3j/viuJ1r9uwPrf0VlEptyybu7p5hJGtU4I=; fh=cWC6IsLg7ATnMbCDrUvpyHjWPdsyZdwr+efYDPOTcPI=; b=is8409K7EjXeoGDehxaxdxrByc7hNLfuKu3paiGNgDpoa05S5CXWN+Em9+emANmVpg M2WyK069/+1tohESuL3XiHq0NyjkASIqbZDixVUVMyPcPdtHuPTzTWVcalHE/ESJGvPp h1vETn8aOTERgu5YPLdCMpiaNLU9IMRF920XarVqMHC57l7W0ziOKBuWSAqcQ1AjaIaK xYLd3uCLlXG0TcuDJzPmMYReAdrO+hG5mQ3XT6sZUl/MI9J99rBnwNuG6deKRp5VU1EI roOu4S5pK5nZe8TYs9u89X49S8tNEBX1sgigHeE+3PJE8qa3TaMbA2P4PNxUcnq9tk01 Kuog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="L7/FAapq"; 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-33698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33698-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f13-20020a05622a104d00b0042a4b719f28si153184qte.399.2024.01.22.09.31.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:31:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="L7/FAapq"; 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-33698-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33698-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C34AB1C27470 for <ouuuleilei@gmail.com>; Mon, 22 Jan 2024 17:31:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F2F67317B; Mon, 22 Jan 2024 16:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="L7/FAapq" Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 0EE826EB5D for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 16:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705941157; cv=none; b=mvHA7HKPHif+EHhWTeNXLUXv9PJ0n4YIihqQgvlMY89Xjo3dRdrO2NT59O6n5hlSABmMcZkWfoSfG6xlA6g8OB9m/YkzKfaIUwZjrRqxRU6gPbD0gphkmC0mt6WAHctMiR8GiPCntBhV/AzT0/JHR4xLTQNIQA1cbJfHEd4eNYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705941157; c=relaxed/simple; bh=JhvObS4GQ8Qdgb5wl3GUWBFziCFrID5vp3TWqC6dgJs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mXYNSaunkumPAR++wEf6nPstdAb6gqfpC1gtUfAWAvOAEk1mxRFYU+UHWntH7SCb63fSRM1/IBOhN5F+Urn639FREdXW4bf5qtLOamVzdiBMMfQ+L8ychtkRg7nT6WMT0fYy8kmDPdl7L18EpiyYPXR8EK40m4jlUUWp5VWNnmE= 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=L7/FAapq; arc=none smtp.client-ip=95.215.58.182 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-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=1705941154; 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=zOQVFSKw3j/viuJ1r9uwPrf0VlEptyybu7p5hJGtU4I=; b=L7/FAapq5/GA78moIR9tbDqaLl+KwawdazCvL79VK9uJYNJjZeHurgVE3jowYQvTiIOyFV GSBgDlmh2QUmpkYssS3+2mBzDVU7Ns2GYjvfvVs9cAaa+EBtpknfHqgWfkkT9sBJFoXNEz wcaIH5I6UVRBIFL9gZo/ycf5uHSXYKw= From: Sui Jingfeng <sui.jingfeng@linux.dev> To: David Airlie <airlied@gmail.com> Cc: Neil Armstrong <neil.armstrong@linaro.org>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter <daniel@ffwll.ch>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng <sui.jingfeng@linux.dev> Subject: [PATCH 2/5] drm/bridge: simple-bridge: Extend match support for non-DT based systems Date: Tue, 23 Jan 2024 00:32:17 +0800 Message-Id: <20240122163220.110788-3-sui.jingfeng@linux.dev> In-Reply-To: <20240122163220.110788-1-sui.jingfeng@linux.dev> References: <20240122163220.110788-1-sui.jingfeng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788812667455341478 X-GMAIL-MSGID: 1788812667455341478 |
Series |
drm/bridge: Allow using fwnode API to get the next bridge
|
|
Commit Message
Sui Jingfeng
Jan. 22, 2024, 4:32 p.m. UTC
Which is intended to be used on non-DT environment, where the simple-bridge
platform device is created by either the display controller driver side or
platform firmware subsystem. To avoid duplication and to keep consistent,
we choose to reuse the OF match tables. Because the potentional user may
not has a of_node attached, nor a ACPI match id. If this is the case,
a software node string property can be provide to fill the niche.
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
---
drivers/gpu/drm/bridge/simple-bridge.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
Comments
On Tue, Jan 23, 2024 at 12:32:17AM +0800, Sui Jingfeng wrote: > Which is intended to be used on non-DT environment, where the simple-bridge > platform device is created by either the display controller driver side or > platform firmware subsystem. Could you give an example of a platform where you intend to use this ? > To avoid duplication and to keep consistent, > we choose to reuse the OF match tables. Because the potentional user may > not has a of_node attached, nor a ACPI match id. If this is the case, > a software node string property can be provide to fill the niche. Shouldn't non-DT, non-ACPI platforms use swnodes ? > Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev> > --- > drivers/gpu/drm/bridge/simple-bridge.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c > index cbe8e778d7c7..595f672745b9 100644 > --- a/drivers/gpu/drm/bridge/simple-bridge.c > +++ b/drivers/gpu/drm/bridge/simple-bridge.c > @@ -166,6 +166,24 @@ static const struct drm_bridge_funcs simple_bridge_bridge_funcs = { > .disable = simple_bridge_disable, > }; > > +static const void *simple_bridge_get_match_data(const struct device *dev) > +{ > + const struct of_device_id *matches = dev->driver->of_match_table; > + > + /* Try to get the match data by software node */ > + while (matches) { > + if (!matches->compatible[0]) > + break; > + > + if (device_is_compatible(dev, matches->compatible)) > + return matches->data; > + > + matches++; > + } > + > + return NULL; > +} > + > static int simple_bridge_probe(struct platform_device *pdev) > { > struct simple_bridge *sbridge; > @@ -176,7 +194,10 @@ static int simple_bridge_probe(struct platform_device *pdev) > return -ENOMEM; > platform_set_drvdata(pdev, sbridge); > > - sbridge->info = of_device_get_match_data(&pdev->dev); > + if (pdev->dev.of_node) > + sbridge->info = of_device_get_match_data(&pdev->dev); > + else > + sbridge->info = simple_bridge_get_match_data(&pdev->dev); > > /* Get the next bridge in the pipeline. */ > remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); > @@ -309,3 +330,4 @@ module_platform_driver(simple_bridge_driver); > MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>"); > MODULE_DESCRIPTION("Simple DRM bridge driver"); > MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:simple-bridge"); This is an unrelated change.
Hi, On 2024/1/23 09:21, Laurent Pinchart wrote: > On Tue, Jan 23, 2024 at 12:32:17AM +0800, Sui Jingfeng wrote: >> Which is intended to be used on non-DT environment, where the simple-bridge >> platform device is created by either the display controller driver side or >> platform firmware subsystem. > Could you give an example of a platform where you intend to use this ? For example: 1) USB based display adapter, such as FL2000DX[1] which use the it66121 HDMI transmitter to convert the RGB888 to HDMI. 2) Simple 2D PCIe display controller, such as SM750(EMPV-1201) which using sii9022 HDMI transmitter to convert the RGB888 to HDMI. 3) Some FPGA PCIe Board (sil9136) 4) Be able to run unit test of drm bridges on X86. [1] https://github.com/FrescoLogic/FL2000
Hi, On 2024/1/23 09:21, Laurent Pinchart wrote: >> static int simple_bridge_probe(struct platform_device *pdev) >> { >> struct simple_bridge *sbridge; >> @@ -176,7 +194,10 @@ static int simple_bridge_probe(struct platform_device *pdev) >> return -ENOMEM; >> platform_set_drvdata(pdev, sbridge); >> >> - sbridge->info = of_device_get_match_data(&pdev->dev); >> + if (pdev->dev.of_node) >> + sbridge->info = of_device_get_match_data(&pdev->dev); >> + else >> + sbridge->info = simple_bridge_get_match_data(&pdev->dev); >> >> /* Get the next bridge in the pipeline. */ >> remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); >> @@ -309,3 +330,4 @@ module_platform_driver(simple_bridge_driver); >> MODULE_AUTHOR("Maxime Ripard<maxime.ripard@free-electrons.com>"); >> MODULE_DESCRIPTION("Simple DRM bridge driver"); >> MODULE_LICENSE("GPL"); >> +MODULE_ALIAS("platform:simple-bridge"); > This is an unrelated change. Otherwise, this driver will not be probed when compiled as module on non-DT environment.
On Tue, Jan 23, 2024 at 04:20:04PM +0800, Sui Jingfeng wrote: > On 2024/1/23 09:21, Laurent Pinchart wrote: > > On Tue, Jan 23, 2024 at 12:32:17AM +0800, Sui Jingfeng wrote: > >> Which is intended to be used on non-DT environment, where the simple-bridge > >> platform device is created by either the display controller driver side or > >> platform firmware subsystem. > > > > Could you give an example of a platform where you intend to use this ? > > For example: > > 1) USB based display adapter, such as FL2000DX[1] which use > the it66121 HDMI transmitter to convert the RGB888 to HDMI. > > 2) Simple 2D PCIe display controller, such as SM750(EMPV-1201) > which using sii9022 HDMI transmitter to convert the RGB888 > to HDMI. > > 3) Some FPGA PCIe Board (sil9136) > > 4) Be able to run unit test of drm bridges on X86. Thank you, those are useful examples. It would be nice to capture at least some of them (first instance the first two) to the commit message. > [1] https://github.com/FrescoLogic/FL2000
diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c index cbe8e778d7c7..595f672745b9 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -166,6 +166,24 @@ static const struct drm_bridge_funcs simple_bridge_bridge_funcs = { .disable = simple_bridge_disable, }; +static const void *simple_bridge_get_match_data(const struct device *dev) +{ + const struct of_device_id *matches = dev->driver->of_match_table; + + /* Try to get the match data by software node */ + while (matches) { + if (!matches->compatible[0]) + break; + + if (device_is_compatible(dev, matches->compatible)) + return matches->data; + + matches++; + } + + return NULL; +} + static int simple_bridge_probe(struct platform_device *pdev) { struct simple_bridge *sbridge; @@ -176,7 +194,10 @@ static int simple_bridge_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, sbridge); - sbridge->info = of_device_get_match_data(&pdev->dev); + if (pdev->dev.of_node) + sbridge->info = of_device_get_match_data(&pdev->dev); + else + sbridge->info = simple_bridge_get_match_data(&pdev->dev); /* Get the next bridge in the pipeline. */ remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); @@ -309,3 +330,4 @@ module_platform_driver(simple_bridge_driver); MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>"); MODULE_DESCRIPTION("Simple DRM bridge driver"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:simple-bridge");