]>
Commit | Line | Data |
---|---|---|
9f69eb5c NT |
1 | /* |
2 | * Copyright (C) 2016 Noralf Trønnes | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | */ | |
9 | ||
10 | #ifndef __LINUX_TINYDRM_HELPERS_H | |
11 | #define __LINUX_TINYDRM_HELPERS_H | |
12 | ||
13 | struct backlight_device; | |
96f2a9ae NT |
14 | struct drm_device; |
15 | struct drm_display_mode; | |
af741381 | 16 | struct drm_framebuffer; |
b051b345 | 17 | struct drm_rect; |
96f2a9ae NT |
18 | struct drm_simple_display_pipe; |
19 | struct drm_simple_display_pipe_funcs; | |
9f69eb5c NT |
20 | struct spi_transfer; |
21 | struct spi_message; | |
22 | struct spi_device; | |
23 | struct device; | |
24 | ||
25 | /** | |
26 | * tinydrm_machine_little_endian - Machine is little endian | |
27 | * | |
28 | * Returns: | |
29 | * true if *defined(__LITTLE_ENDIAN)*, false otherwise | |
30 | */ | |
31 | static inline bool tinydrm_machine_little_endian(void) | |
32 | { | |
33 | #if defined(__LITTLE_ENDIAN) | |
34 | return true; | |
35 | #else | |
36 | return false; | |
37 | #endif | |
38 | } | |
39 | ||
96f2a9ae NT |
40 | int tinydrm_display_pipe_init(struct drm_device *drm, |
41 | struct drm_simple_display_pipe *pipe, | |
42 | const struct drm_simple_display_pipe_funcs *funcs, | |
43 | int connector_type, | |
44 | const uint32_t *formats, | |
45 | unsigned int format_count, | |
46 | const struct drm_display_mode *mode, | |
47 | unsigned int rotation); | |
48 | ||
9f69eb5c NT |
49 | size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len); |
50 | bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw); | |
51 | int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz, | |
52 | struct spi_transfer *header, u8 bpw, const void *buf, | |
53 | size_t len); | |
54 | void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m); | |
55 | ||
56 | #ifdef DEBUG | |
57 | /** | |
58 | * tinydrm_dbg_spi_message - Dump SPI message | |
59 | * @spi: SPI device | |
60 | * @m: SPI message | |
61 | * | |
62 | * Dumps info about the transfers in a SPI message including buffer content. | |
63 | * DEBUG has to be defined for this function to be enabled alongside setting | |
64 | * the DRM_UT_DRIVER bit of &drm_debug. | |
65 | */ | |
66 | static inline void tinydrm_dbg_spi_message(struct spi_device *spi, | |
67 | struct spi_message *m) | |
68 | { | |
69 | if (drm_debug & DRM_UT_DRIVER) | |
70 | _tinydrm_dbg_spi_message(spi, m); | |
71 | } | |
72 | #else | |
73 | static inline void tinydrm_dbg_spi_message(struct spi_device *spi, | |
74 | struct spi_message *m) | |
75 | { | |
76 | } | |
77 | #endif /* DEBUG */ | |
78 | ||
79 | #endif /* __LINUX_TINYDRM_HELPERS_H */ |