2 * Copyright (C) 2016 Noralf Trønnes
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.
10 #ifndef __LINUX_TINYDRM_HELPERS_H
11 #define __LINUX_TINYDRM_HELPERS_H
13 struct backlight_device
;
14 struct tinydrm_device
;
22 * tinydrm_machine_little_endian - Machine is little endian
25 * true if *defined(__LITTLE_ENDIAN)*, false otherwise
27 static inline bool tinydrm_machine_little_endian(void)
29 #if defined(__LITTLE_ENDIAN)
36 bool 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
);
39 void tinydrm_memcpy(void *dst
, void *vaddr
, struct drm_framebuffer
*fb
,
40 struct drm_clip_rect
*clip
);
41 void tinydrm_swab16(u16
*dst
, void *vaddr
, struct drm_framebuffer
*fb
,
42 struct drm_clip_rect
*clip
);
43 void tinydrm_xrgb8888_to_rgb565(u16
*dst
, void *vaddr
,
44 struct drm_framebuffer
*fb
,
45 struct drm_clip_rect
*clip
, bool swap
);
46 void tinydrm_xrgb8888_to_gray8(u8
*dst
, void *vaddr
, struct drm_framebuffer
*fb
,
47 struct drm_clip_rect
*clip
);
49 struct backlight_device
*tinydrm_of_find_backlight(struct device
*dev
);
50 int tinydrm_enable_backlight(struct backlight_device
*backlight
);
51 int tinydrm_disable_backlight(struct backlight_device
*backlight
);
53 size_t tinydrm_spi_max_transfer_size(struct spi_device
*spi
, size_t max_len
);
54 bool tinydrm_spi_bpw_supported(struct spi_device
*spi
, u8 bpw
);
55 int tinydrm_spi_transfer(struct spi_device
*spi
, u32 speed_hz
,
56 struct spi_transfer
*header
, u8 bpw
, const void *buf
,
58 void _tinydrm_dbg_spi_message(struct spi_device
*spi
, struct spi_message
*m
);
62 * tinydrm_dbg_spi_message - Dump SPI message
66 * Dumps info about the transfers in a SPI message including buffer content.
67 * DEBUG has to be defined for this function to be enabled alongside setting
68 * the DRM_UT_DRIVER bit of &drm_debug.
70 static inline void tinydrm_dbg_spi_message(struct spi_device
*spi
,
71 struct spi_message
*m
)
73 if (drm_debug
& DRM_UT_DRIVER
)
74 _tinydrm_dbg_spi_message(spi
, m
);
77 static inline void tinydrm_dbg_spi_message(struct spi_device
*spi
,
78 struct spi_message
*m
)
83 #endif /* __LINUX_TINYDRM_HELPERS_H */