1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef __ASM_GENERIC_VIDEO_H_
4 #define __ASM_GENERIC_VIDEO_H_
7 * Only include this header file from your architecture's <asm/fb.h>.
11 #include <linux/mm_types.h>
12 #include <linux/pgtable.h>
13 #include <linux/types.h>
17 #ifndef pgprot_framebuffer
18 #define pgprot_framebuffer pgprot_framebuffer
19 static inline pgprot_t
pgprot_framebuffer(pgprot_t prot
,
20 unsigned long vm_start
, unsigned long vm_end
,
23 return pgprot_writecombine(prot
);
27 #ifndef video_is_primary_device
28 #define video_is_primary_device video_is_primary_device
29 static inline bool video_is_primary_device(struct device
*dev
)
36 * I/O helpers for the framebuffer. Prefer these functions over their
37 * regular counterparts. The regular I/O functions provide in-order
38 * access and swap bytes to/from little-endian ordering. Neither is
39 * required for framebuffers. Instead, the helpers read and write
40 * raw framebuffer data. Independent operations can be reordered for
41 * improved performance.
45 static inline u8
fb_readb(const volatile void __iomem
*addr
)
47 return __raw_readb(addr
);
49 #define fb_readb fb_readb
53 static inline u16
fb_readw(const volatile void __iomem
*addr
)
55 return __raw_readw(addr
);
57 #define fb_readw fb_readw
61 static inline u32
fb_readl(const volatile void __iomem
*addr
)
63 return __raw_readl(addr
);
65 #define fb_readl fb_readl
69 #if defined(__raw_readq)
70 static inline u64
fb_readq(const volatile void __iomem
*addr
)
72 return __raw_readq(addr
);
74 #define fb_readq fb_readq
79 static inline void fb_writeb(u8 b
, volatile void __iomem
*addr
)
81 __raw_writeb(b
, addr
);
83 #define fb_writeb fb_writeb
87 static inline void fb_writew(u16 b
, volatile void __iomem
*addr
)
89 __raw_writew(b
, addr
);
91 #define fb_writew fb_writew
95 static inline void fb_writel(u32 b
, volatile void __iomem
*addr
)
97 __raw_writel(b
, addr
);
99 #define fb_writel fb_writel
103 #if defined(__raw_writeq)
104 static inline void fb_writeq(u64 b
, volatile void __iomem
*addr
)
106 __raw_writeq(b
, addr
);
108 #define fb_writeq fb_writeq
112 #ifndef fb_memcpy_fromio
113 static inline void fb_memcpy_fromio(void *to
, const volatile void __iomem
*from
, size_t n
)
115 memcpy_fromio(to
, from
, n
);
117 #define fb_memcpy_fromio fb_memcpy_fromio
120 #ifndef fb_memcpy_toio
121 static inline void fb_memcpy_toio(volatile void __iomem
*to
, const void *from
, size_t n
)
123 memcpy_toio(to
, from
, n
);
125 #define fb_memcpy_toio fb_memcpy_toio
129 static inline void fb_memset_io(volatile void __iomem
*addr
, int c
, size_t n
)
131 memset_io(addr
, c
, n
);
133 #define fb_memset fb_memset_io
136 #endif /* __ASM_GENERIC_VIDEO_H_ */