From: Thomas Zimmermann <tzimmermann@suse.de>
To: javierm@redhat.com, pjones@redhat.com, deller@gmx.de, ardb@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v2 3/8] firmware/sysfb: Set firmware-framebuffer parent device
Date: Fri, 2 Feb 2024 12:58:44 +0100 [thread overview]
Message-ID: <20240202120140.3517-4-tzimmermann@suse.de> (raw)
In-Reply-To: <20240202120140.3517-1-tzimmermann@suse.de>
Set the firmware framebuffer's parent device, which usually is the
graphics hardware's physical device. Integrates the framebuffer in
the Linux device hierarchy and lets Linux handle dependencies among
devices. For example, the graphics hardware won't be suspended while
the firmware device is still active.
v2:
* detect parent device in sysfb_parent_dev()
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/firmware/sysfb.c | 19 ++++++++++++++++++-
drivers/firmware/sysfb_simplefb.c | 5 ++++-
include/linux/sysfb.h | 3 ++-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
index 3c197db42c9d9..d02945b0d8ea1 100644
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -29,6 +29,7 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mm.h>
+#include <linux/pci.h>
#include <linux/platform_data/simplefb.h>
#include <linux/platform_device.h>
#include <linux/screen_info.h>
@@ -69,9 +70,21 @@ void sysfb_disable(void)
}
EXPORT_SYMBOL_GPL(sysfb_disable);
+static __init struct device *sysfb_parent_dev(const struct screen_info *si)
+{
+ struct pci_dev *pdev;
+
+ pdev = screen_info_pci_dev(si);
+ if (pdev)
+ return &pdev->dev;
+
+ return NULL;
+}
+
static __init int sysfb_init(void)
{
struct screen_info *si = &screen_info;
+ struct device *parent;
struct simplefb_platform_data mode;
const char *name;
bool compatible;
@@ -83,10 +96,12 @@ static __init int sysfb_init(void)
sysfb_apply_efi_quirks();
+ parent = sysfb_parent_dev(si);
+
/* try to create a simple-framebuffer device */
compatible = sysfb_parse_mode(si, &mode);
if (compatible) {
- pd = sysfb_create_simplefb(si, &mode);
+ pd = sysfb_create_simplefb(si, &mode, parent);
if (!IS_ERR(pd))
goto unlock_mutex;
}
@@ -109,6 +124,8 @@ static __init int sysfb_init(void)
goto unlock_mutex;
}
+ pd->dev.parent = parent;
+
sysfb_set_efifb_fwnode(pd);
ret = platform_device_add_data(pd, si, sizeof(*si));
diff --git a/drivers/firmware/sysfb_simplefb.c b/drivers/firmware/sysfb_simplefb.c
index 74363ed7501f6..75a186bf8f8ec 100644
--- a/drivers/firmware/sysfb_simplefb.c
+++ b/drivers/firmware/sysfb_simplefb.c
@@ -91,7 +91,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
}
__init struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
- const struct simplefb_platform_data *mode)
+ const struct simplefb_platform_data *mode,
+ struct device *parent)
{
struct platform_device *pd;
struct resource res;
@@ -143,6 +144,8 @@ __init struct platform_device *sysfb_create_simplefb(const struct screen_info *s
if (!pd)
return ERR_PTR(-ENOMEM);
+ pd->dev.parent = parent;
+
sysfb_set_efifb_fwnode(pd);
ret = platform_device_add_resources(pd, &res, 1);
diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
index 19cb803dd5ecd..6ee3ade3f8b06 100644
--- a/include/linux/sysfb.h
+++ b/include/linux/sysfb.h
@@ -91,7 +91,8 @@ static inline void sysfb_set_efifb_fwnode(struct platform_device *pd)
bool sysfb_parse_mode(const struct screen_info *si,
struct simplefb_platform_data *mode);
struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
- const struct simplefb_platform_data *mode);
+ const struct simplefb_platform_data *mode,
+ struct device *parent);
#else /* CONFIG_SYSFB_SIMPLE */
--
2.43.0
next prev parent reply other threads:[~2024-02-02 12:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 11:58 [PATCH v2 0/8] firmware/sysfb: Track parent device for screen_info Thomas Zimmermann
2024-02-02 11:58 ` [PATCH v2 1/8] video: Add helpers for decoding screen_info Thomas Zimmermann
2024-02-02 11:58 ` [PATCH v2 2/8] video: Provide screen_info_get_pci_dev() to find screen_info's PCI device Thomas Zimmermann
2024-02-02 16:31 ` [v2,2/8] " Sui Jingfeng
2024-02-05 8:14 ` Thomas Zimmermann
2024-02-02 17:03 ` Sui Jingfeng
2024-02-05 8:17 ` Thomas Zimmermann
2024-02-05 10:05 ` Sui Jingfeng
2024-02-05 12:32 ` Thomas Zimmermann
2024-02-04 1:53 ` [PATCH v2 2/8] " kernel test robot
2024-02-02 11:58 ` Thomas Zimmermann [this message]
2024-02-02 14:40 ` [v2,3/8] firmware/sysfb: Set firmware-framebuffer parent device Sui Jingfeng
2024-02-02 15:23 ` Sui Jingfeng
2024-02-05 8:24 ` Thomas Zimmermann
2024-02-07 15:34 ` Sui Jingfeng
2024-02-03 19:12 ` [PATCH v2 3/8] " kernel test robot
2024-02-04 2:13 ` kernel test robot
2024-02-02 11:58 ` [PATCH v2 4/8] fbdev/efifb: Remove PM for " Thomas Zimmermann
2024-02-02 11:58 ` [PATCH v2 5/8] firmware/sysfb: Create firmware device only for enabled PCI devices Thomas Zimmermann
2024-02-02 17:50 ` [v2, " Sui Jingfeng
2024-02-05 8:25 ` Thomas Zimmermann
2024-02-02 11:58 ` [PATCH v2 6/8] fbdev/efifb: Do not track parent device status Thomas Zimmermann
2024-02-02 11:58 ` [PATCH v2 7/8] firmware/sysfb: Update screen_info for relocated EFI framebuffers Thomas Zimmermann
2024-02-02 17:54 ` [v2,7/8] " Sui Jingfeng
2024-02-05 10:11 ` Thomas Zimmermann
2024-02-02 18:00 ` Sui Jingfeng
2024-02-06 16:45 ` Thomas Zimmermann
2024-02-02 11:58 ` [PATCH v2 8/8] fbdev/efifb: Remove framebuffer relocation tracking Thomas Zimmermann
2024-02-02 18:07 ` [v2,8/8] " Sui Jingfeng
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=20240202120140.3517-4-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=ardb@kernel.org \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=pjones@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).