1
2
3
4
5
6
7
8
9
10#ifndef __LINUX_TINYDRM_HELPERS_H
11#define __LINUX_TINYDRM_HELPERS_H
12
13struct backlight_device;
14struct tinydrm_device;
15struct drm_clip_rect;
16struct spi_transfer;
17struct spi_message;
18struct spi_device;
19struct device;
20
21
22
23
24
25
26
27static inline bool tinydrm_machine_little_endian(void)
28{
29#if defined(__LITTLE_ENDIAN)
30 return true;
31#else
32 return false;
33#endif
34}
35
36bool tinydrm_merge_clips(struct drm_clip_rect *dst,
37 struct drm_clip_rect *src, unsigned int num_clips,
38 unsigned int flags, u32 max_width, u32 max_height);
39void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
40 struct drm_clip_rect *clip);
41void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
42 struct drm_clip_rect *clip);
43void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
44 struct drm_framebuffer *fb,
45 struct drm_clip_rect *clip, bool swap);
46void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
47 struct drm_clip_rect *clip);
48
49struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
50int tinydrm_enable_backlight(struct backlight_device *backlight);
51int tinydrm_disable_backlight(struct backlight_device *backlight);
52
53size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
54bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
55int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
56 struct spi_transfer *header, u8 bpw, const void *buf,
57 size_t len);
58void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m);
59
60#ifdef DEBUG
61
62
63
64
65
66
67
68
69
70static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
71 struct spi_message *m)
72{
73 if (drm_debug & DRM_UT_DRIVER)
74 _tinydrm_dbg_spi_message(spi, m);
75}
76#else
77static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
78 struct spi_message *m)
79{
80}
81#endif
82
83#endif
84