Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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
13struct backlight_device;
14struct drm_framebuffer;
15struct drm_rect;
16struct spi_transfer;
17struct spi_message;
18struct spi_device;
19struct device;
20
21/**
22 * tinydrm_machine_little_endian - Machine is little endian
23 *
24 * Returns:
25 * true if *defined(__LITTLE_ENDIAN)*, false otherwise
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
36void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
37 struct drm_rect *clip);
38void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
39 struct drm_rect *clip);
40void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
41 struct drm_framebuffer *fb,
42 struct drm_rect *clip, bool swap);
43void tinydrm_xrgb8888_to_gray8(u8 *dst, void *vaddr, struct drm_framebuffer *fb,
44 struct drm_rect *clip);
45
46size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
47bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
48int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
49 struct spi_transfer *header, u8 bpw, const void *buf,
50 size_t len);
51void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m);
52
53#ifdef DEBUG
54/**
55 * tinydrm_dbg_spi_message - Dump SPI message
56 * @spi: SPI device
57 * @m: SPI message
58 *
59 * Dumps info about the transfers in a SPI message including buffer content.
60 * DEBUG has to be defined for this function to be enabled alongside setting
61 * the DRM_UT_DRIVER bit of &drm_debug.
62 */
63static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
64 struct spi_message *m)
65{
66 if (drm_debug & DRM_UT_DRIVER)
67 _tinydrm_dbg_spi_message(spi, m);
68}
69#else
70static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
71 struct spi_message *m)
72{
73}
74#endif /* DEBUG */
75
76#endif /* __LINUX_TINYDRM_HELPERS_H */