xref: /linux/include/linux/sysfb.h (revision 8d2b0853add1d7534dc0794e3c8e0b9e8c4ec640)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _LINUX_SYSFB_H
3 #define _LINUX_SYSFB_H
4 
5 /*
6  * Generic System Framebuffers on x86
7  * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
8  */
9 
10 #include <linux/err.h>
11 #include <linux/types.h>
12 
13 #include <linux/platform_data/simplefb.h>
14 
15 struct device;
16 struct platform_device;
17 struct screen_info;
18 
19 enum {
20 	M_I17,		/* 17-Inch iMac */
21 	M_I20,		/* 20-Inch iMac */
22 	M_I20_SR,	/* 20-Inch iMac (Santa Rosa) */
23 	M_I24,		/* 24-Inch iMac */
24 	M_I24_8_1,	/* 24-Inch iMac, 8,1th gen */
25 	M_I24_10_1,	/* 24-Inch iMac, 10,1th gen */
26 	M_I27_11_1,	/* 27-Inch iMac, 11,1th gen */
27 	M_MINI,		/* Mac Mini */
28 	M_MINI_3_1,	/* Mac Mini, 3,1th gen */
29 	M_MINI_4_1,	/* Mac Mini, 4,1th gen */
30 	M_MB,		/* MacBook */
31 	M_MB_2,		/* MacBook, 2nd rev. */
32 	M_MB_3,		/* MacBook, 3rd rev. */
33 	M_MB_5_1,	/* MacBook, 5th rev. */
34 	M_MB_6_1,	/* MacBook, 6th rev. */
35 	M_MB_7_1,	/* MacBook, 7th rev. */
36 	M_MB_SR,	/* MacBook, 2nd gen, (Santa Rosa) */
37 	M_MBA,		/* MacBook Air */
38 	M_MBA_3,	/* Macbook Air, 3rd rev */
39 	M_MBP,		/* MacBook Pro */
40 	M_MBP_2,	/* MacBook Pro 2nd gen */
41 	M_MBP_2_2,	/* MacBook Pro 2,2nd gen */
42 	M_MBP_SR,	/* MacBook Pro (Santa Rosa) */
43 	M_MBP_4,	/* MacBook Pro, 4th gen */
44 	M_MBP_5_1,	/* MacBook Pro, 5,1th gen */
45 	M_MBP_5_2,	/* MacBook Pro, 5,2th gen */
46 	M_MBP_5_3,	/* MacBook Pro, 5,3rd gen */
47 	M_MBP_6_1,	/* MacBook Pro, 6,1th gen */
48 	M_MBP_6_2,	/* MacBook Pro, 6,2th gen */
49 	M_MBP_7_1,	/* MacBook Pro, 7,1th gen */
50 	M_MBP_8_2,	/* MacBook Pro, 8,2nd gen */
51 	M_UNKNOWN	/* placeholder */
52 };
53 
54 struct efifb_dmi_info {
55 	char *optname;
56 	unsigned long base;
57 	int stride;
58 	int width;
59 	int height;
60 	int flags;
61 };
62 
63 #ifdef CONFIG_SYSFB
64 
65 void sysfb_disable(struct device *dev);
66 
67 bool sysfb_handles_screen_info(void);
68 
69 #else /* CONFIG_SYSFB */
70 
71 static inline void sysfb_disable(struct device *dev)
72 {
73 }
74 
75 static inline bool sysfb_handles_screen_info(void)
76 {
77 	return false;
78 }
79 
80 #endif /* CONFIG_SYSFB */
81 
82 #ifdef CONFIG_EFI
83 
84 extern struct efifb_dmi_info efifb_dmi_list[];
85 void sysfb_apply_efi_quirks(void);
86 void sysfb_set_efifb_fwnode(struct platform_device *pd);
87 
88 #else /* CONFIG_EFI */
89 
90 static inline void sysfb_apply_efi_quirks(void)
91 {
92 }
93 
94 static inline void sysfb_set_efifb_fwnode(struct platform_device *pd)
95 {
96 }
97 
98 #endif /* CONFIG_EFI */
99 
100 #ifdef CONFIG_SYSFB_SIMPLEFB
101 
102 bool sysfb_parse_mode(const struct screen_info *si,
103 		      struct simplefb_platform_data *mode);
104 struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
105 					      const struct simplefb_platform_data *mode,
106 					      struct device *parent);
107 
108 #else /* CONFIG_SYSFB_SIMPLE */
109 
110 static inline bool sysfb_parse_mode(const struct screen_info *si,
111 				    struct simplefb_platform_data *mode)
112 {
113 	return false;
114 }
115 
116 static inline struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
117 							    const struct simplefb_platform_data *mode,
118 							    struct device *parent)
119 {
120 	return ERR_PTR(-EINVAL);
121 }
122 
123 #endif /* CONFIG_SYSFB_SIMPLE */
124 
125 #endif /* _LINUX_SYSFB_H */
126