]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - include/drm/tinydrm/tinydrm-helpers.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
[mirror_ubuntu-eoan-kernel.git] / include / drm / tinydrm / tinydrm-helpers.h
CommitLineData
2874c5fd 1/* SPDX-License-Identifier: GPL-2.0-or-later */
9f69eb5c
NT
2/*
3 * Copyright (C) 2016 Noralf Trønnes
9f69eb5c
NT
4 */
5
6#ifndef __LINUX_TINYDRM_HELPERS_H
7#define __LINUX_TINYDRM_HELPERS_H
8
9struct backlight_device;
96f2a9ae
NT
10struct drm_device;
11struct drm_display_mode;
af741381 12struct drm_framebuffer;
b051b345 13struct drm_rect;
96f2a9ae
NT
14struct drm_simple_display_pipe;
15struct drm_simple_display_pipe_funcs;
9f69eb5c
NT
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
96f2a9ae
NT
36int tinydrm_display_pipe_init(struct drm_device *drm,
37 struct drm_simple_display_pipe *pipe,
38 const struct drm_simple_display_pipe_funcs *funcs,
39 int connector_type,
40 const uint32_t *formats,
41 unsigned int format_count,
42 const struct drm_display_mode *mode,
43 unsigned int rotation);
44
9f69eb5c
NT
45size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
46bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
47int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
48 struct spi_transfer *header, u8 bpw, const void *buf,
49 size_t len);
50void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m);
51
52#ifdef DEBUG
53/**
54 * tinydrm_dbg_spi_message - Dump SPI message
55 * @spi: SPI device
56 * @m: SPI message
57 *
58 * Dumps info about the transfers in a SPI message including buffer content.
59 * DEBUG has to be defined for this function to be enabled alongside setting
60 * the DRM_UT_DRIVER bit of &drm_debug.
61 */
62static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
63 struct spi_message *m)
64{
65 if (drm_debug & DRM_UT_DRIVER)
66 _tinydrm_dbg_spi_message(spi, m);
67}
68#else
69static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
70 struct spi_message *m)
71{
72}
73#endif /* DEBUG */
74
75#endif /* __LINUX_TINYDRM_HELPERS_H */