xref: /linux/drivers/video/fbdev/core/fb_internal.h (revision 470ea955a18c76eeb10ca11ffcb2fe923bfc5515)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef _FB_INTERNAL_H
4 #define _FB_INTERNAL_H
5 
6 #include <linux/device.h>
7 #include <linux/fb.h>
8 #include <linux/mutex.h>
9 
10 /* fb_devfs.c */
11 #if defined(CONFIG_FB_DEVICE)
12 int fb_register_chrdev(void);
13 void fb_unregister_chrdev(void);
14 #else
15 static inline int fb_register_chrdev(void)
16 {
17 	return 0;
18 }
19 static inline void fb_unregister_chrdev(void)
20 { }
21 #endif
22 
23 /* fb_logo.c */
24 #if defined(CONFIG_LOGO)
25 extern bool fb_center_logo;
26 extern int fb_logo_count;
27 int fb_prepare_logo(struct fb_info *fb_info, int rotate);
28 int fb_show_logo(struct fb_info *fb_info, int rotate);
29 #else
30 static inline int fb_prepare_logo(struct fb_info *info, int rotate)
31 {
32 	return 0;
33 }
34 static inline int fb_show_logo(struct fb_info *info, int rotate)
35 {
36 	return 0;
37 }
38 #endif /* CONFIG_LOGO */
39 
40 /* fbmem.c */
41 extern struct class *fb_class;
42 extern struct mutex registration_lock;
43 extern struct fb_info *registered_fb[FB_MAX];
44 extern int num_registered_fb;
45 struct fb_info *get_fb_info(unsigned int idx);
46 void put_fb_info(struct fb_info *fb_info);
47 int fb_blank_from_user(struct fb_info *info, int blank);
48 
49 /* fb_procfs.c */
50 #if defined(CONFIG_FB_DEVICE)
51 int fb_init_procfs(void);
52 void fb_cleanup_procfs(void);
53 #else
54 static inline int fb_init_procfs(void)
55 {
56 	return 0;
57 }
58 static inline void fb_cleanup_procfs(void)
59 { }
60 #endif
61 
62 /* fbsysfs.c */
63 #if defined(CONFIG_FB_DEVICE)
64 int fb_device_create(struct fb_info *fb_info);
65 void fb_device_destroy(struct fb_info *fb_info);
66 #else
67 static inline int fb_device_create(struct fb_info *fb_info)
68 {
69 	/*
70 	 * Acquire a reference on the parent device to avoid
71 	 * unplug operations behind our back. With the fbdev
72 	 * device enabled, this is performed within register_device().
73 	 */
74 	get_device(fb_info->device);
75 
76 	return 0;
77 }
78 static inline void fb_device_destroy(struct fb_info *fb_info)
79 {
80 	/* Undo the get_device() from fb_device_create() */
81 	put_device(fb_info->device);
82 }
83 #endif
84 
85 #endif
86