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/kernel.h>
11 #include <linux/platform_data/simplefb.h>
12 #include <linux/screen_info.h>
13 
14 enum {
15 	M_I17,		/* 17-Inch iMac */
16 	M_I20,		/* 20-Inch iMac */
17 	M_I20_SR,	/* 20-Inch iMac (Santa Rosa) */
18 	M_I24,		/* 24-Inch iMac */
19 	M_I24_8_1,	/* 24-Inch iMac, 8,1th gen */
20 	M_I24_10_1,	/* 24-Inch iMac, 10,1th gen */
21 	M_I27_11_1,	/* 27-Inch iMac, 11,1th gen */
22 	M_MINI,		/* Mac Mini */
23 	M_MINI_3_1,	/* Mac Mini, 3,1th gen */
24 	M_MINI_4_1,	/* Mac Mini, 4,1th gen */
25 	M_MB,		/* MacBook */
26 	M_MB_2,		/* MacBook, 2nd rev. */
27 	M_MB_3,		/* MacBook, 3rd rev. */
28 	M_MB_5_1,	/* MacBook, 5th rev. */
29 	M_MB_6_1,	/* MacBook, 6th rev. */
30 	M_MB_7_1,	/* MacBook, 7th rev. */
31 	M_MB_SR,	/* MacBook, 2nd gen, (Santa Rosa) */
32 	M_MBA,		/* MacBook Air */
33 	M_MBA_3,	/* Macbook Air, 3rd rev */
34 	M_MBP,		/* MacBook Pro */
35 	M_MBP_2,	/* MacBook Pro 2nd gen */
36 	M_MBP_2_2,	/* MacBook Pro 2,2nd gen */
37 	M_MBP_SR,	/* MacBook Pro (Santa Rosa) */
38 	M_MBP_4,	/* MacBook Pro, 4th gen */
39 	M_MBP_5_1,	/* MacBook Pro, 5,1th gen */
40 	M_MBP_5_2,	/* MacBook Pro, 5,2th gen */
41 	M_MBP_5_3,	/* MacBook Pro, 5,3rd gen */
42 	M_MBP_6_1,	/* MacBook Pro, 6,1th gen */
43 	M_MBP_6_2,	/* MacBook Pro, 6,2th gen */
44 	M_MBP_7_1,	/* MacBook Pro, 7,1th gen */
45 	M_MBP_8_2,	/* MacBook Pro, 8,2nd gen */
46 	M_UNKNOWN	/* placeholder */
47 };
48 
49 struct efifb_dmi_info {
50 	char *optname;
51 	unsigned long base;
52 	int stride;
53 	int width;
54 	int height;
55 	int flags;
56 };
57 
58 #ifdef CONFIG_SYSFB
59 
60 void sysfb_disable(void);
61 
62 #else /* CONFIG_SYSFB */
63 
sysfb_disable(void)64 static inline void sysfb_disable(void)
65 {
66 }
67 
68 #endif /* CONFIG_SYSFB */
69 
70 #ifdef CONFIG_EFI
71 
72 extern struct efifb_dmi_info efifb_dmi_list[];
73 void sysfb_apply_efi_quirks(struct platform_device *pd);
74 
75 #else /* CONFIG_EFI */
76 
sysfb_apply_efi_quirks(struct platform_device * pd)77 static inline void sysfb_apply_efi_quirks(struct platform_device *pd)
78 {
79 }
80 
81 #endif /* CONFIG_EFI */
82 
83 #ifdef CONFIG_SYSFB_SIMPLEFB
84 
85 bool sysfb_parse_mode(const struct screen_info *si,
86 		      struct simplefb_platform_data *mode);
87 struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
88 					      const struct simplefb_platform_data *mode);
89 
90 #else /* CONFIG_SYSFB_SIMPLE */
91 
sysfb_parse_mode(const struct screen_info * si,struct simplefb_platform_data * mode)92 static inline bool sysfb_parse_mode(const struct screen_info *si,
93 				    struct simplefb_platform_data *mode)
94 {
95 	return false;
96 }
97 
sysfb_create_simplefb(const struct screen_info * si,const struct simplefb_platform_data * mode)98 static inline struct platform_device *sysfb_create_simplefb(const struct screen_info *si,
99 							    const struct simplefb_platform_data *mode)
100 {
101 	return ERR_PTR(-EINVAL);
102 }
103 
104 #endif /* CONFIG_SYSFB_SIMPLE */
105 
106 #endif /* _LINUX_SYSFB_H */
107