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 4/5] drm/bridge: display-connector: Extend match support for non-DT based systems
Date: Tue, 23 Jan 2024 00:32:19 +0800 [thread overview]
Message-ID: <20240122163220.110788-5-sui.jingfeng@linux.dev> (raw)
In-Reply-To: <20240122163220.110788-1-sui.jingfeng@linux.dev>
On which case the driver is not probed by OF, Instead, a fwnode is
associated to the platform device before this driver is probed. The newly
added code is intended to be used on non-DT environment. It is assumed
that there is a string fwnode property associated with the platform device,
the name of the string property is compatible, the value of the string
property is used to get platform match data.
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
---
drivers/gpu/drm/bridge/display-connector.c | 24 +++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c
index 08bd5695ddae..eb7e194e7735 100644
--- a/drivers/gpu/drm/bridge/display-connector.c
+++ b/drivers/gpu/drm/bridge/display-connector.c
@@ -202,6 +202,24 @@ static int display_connector_get_supply(struct platform_device *pdev,
return PTR_ERR_OR_ZERO(conn->supply);
}
+static const void *display_connector_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 display_connector_probe(struct platform_device *pdev)
{
struct display_connector *conn;
@@ -215,7 +233,10 @@ static int display_connector_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, conn);
- type = (uintptr_t)of_device_get_match_data(&pdev->dev);
+ if (pdev->dev.of_node)
+ type = (uintptr_t)of_device_get_match_data(&pdev->dev);
+ else
+ type = (uintptr_t)display_connector_get_match_data(&pdev->dev);
/* Get the exact connector type. */
switch (type) {
@@ -434,3 +455,4 @@ module_platform_driver(display_connector_driver);
MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
MODULE_DESCRIPTION("Display connector driver");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:display-connector");
--
2.25.1
next prev parent reply other threads:[~2024-01-22 16:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 16:32 [PATCH 0/5] drm/bridge: Allow using fwnode API to get the next bridge Sui Jingfeng
2024-01-22 16:32 ` [PATCH 1/5] drm/bridge: Add drm_bridge_find_by_fwnode() helper Sui Jingfeng
2024-01-23 1:17 ` Laurent Pinchart
2024-01-23 8:01 ` Sui Jingfeng
2024-01-23 15:15 ` Laurent Pinchart
2024-01-22 16:32 ` [PATCH 2/5] drm/bridge: simple-bridge: Extend match support for non-DT based systems Sui Jingfeng
2024-01-23 1:21 ` Laurent Pinchart
2024-01-23 8:20 ` Sui Jingfeng
2024-01-23 15:16 ` Laurent Pinchart
2024-01-23 12:31 ` Sui Jingfeng
2024-03-20 20:34 ` Andy Shevchenko
2024-01-22 16:32 ` [PATCH 3/5] drm/bridge: simple-bridge: Allow acquiring the next bridge with fwnode API Sui Jingfeng
2024-01-23 1:18 ` Laurent Pinchart
2024-01-23 12:18 ` Sui Jingfeng
2024-01-23 15:18 ` Laurent Pinchart
2024-01-24 15:00 ` Maxime Ripard
2024-01-22 16:32 ` Sui Jingfeng [this message]
2024-01-22 16:32 ` [PATCH 5/5] drm-bridge: display-connector: Switch to use " Sui Jingfeng
2024-01-23 1:20 ` Laurent Pinchart
2024-01-23 12:35 ` Sui Jingfeng
2024-03-20 20:32 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240122163220.110788-5-sui.jingfeng@linux.dev \
--to=sui.jingfeng@linux.dev \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox