Skip to content

Commit 6074e90

Browse files
martinezjavierTzung-Bi Shih
authored andcommitted
firmware: sysfb: Add a sysfb_handles_screen_info() helper function
That can be used by drivers to check if the Generic System Framebuffers (sysfb) support can handle the data contained in the global screen_info. Drivers might need this information to know if have to setup the system framebuffer, or if they have to delegate this action to sysfb instead. Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/20240916110040.1688511-2-javierm@redhat.com Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
1 parent 9852d85 commit 6074e90

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

drivers/firmware/sysfb.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ void sysfb_disable(struct device *dev)
7777
}
7878
EXPORT_SYMBOL_GPL(sysfb_disable);
7979

80+
/**
81+
* sysfb_handles_screen_info() - reports if sysfb handles the global screen_info
82+
*
83+
* Callers can use sysfb_handles_screen_info() to determine whether the Generic
84+
* System Framebuffers (sysfb) can handle the global screen_info data structure
85+
* or not. Drivers might need this information to know if they have to setup the
86+
* system framebuffer, or if they have to delegate this action to sysfb instead.
87+
*
88+
* Returns:
89+
* True if sysfb handles the global screen_info data structure.
90+
*/
91+
bool sysfb_handles_screen_info(void)
92+
{
93+
const struct screen_info *si = &screen_info;
94+
95+
return !!screen_info_video_type(si);
96+
}
97+
EXPORT_SYMBOL_GPL(sysfb_handles_screen_info);
98+
8099
#if defined(CONFIG_PCI)
81100
static bool sysfb_pci_dev_is_enabled(struct pci_dev *pdev)
82101
{

include/linux/sysfb.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,19 @@ struct efifb_dmi_info {
6060

6161
void sysfb_disable(struct device *dev);
6262

63+
bool sysfb_handles_screen_info(void);
64+
6365
#else /* CONFIG_SYSFB */
6466

6567
static inline void sysfb_disable(struct device *dev)
6668
{
6769
}
6870

71+
static inline bool sysfb_handles_screen_info(void)
72+
{
73+
return false;
74+
}
75+
6976
#endif /* CONFIG_SYSFB */
7077

7178
#ifdef CONFIG_EFI

0 commit comments

Comments
 (0)