Zephyr API 3.6.99
Loading...
Searching...
No Matches
mipi_dsi.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Teslabs Engineering S.L.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_DRIVERS_MIPI_DSI_H_
13#define ZEPHYR_INCLUDE_DRIVERS_MIPI_DSI_H_
14
23#include <errno.h>
24#include <sys/types.h>
25#include <zephyr/device.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
52
59#define MIPI_DSI_MODE_VIDEO BIT(0)
61#define MIPI_DSI_MODE_VIDEO_BURST BIT(1)
63#define MIPI_DSI_MODE_VIDEO_SYNC_PULSE BIT(2)
65#define MIPI_DSI_MODE_VIDEO_AUTO_VERT BIT(3)
67#define MIPI_DSI_MODE_VIDEO_HSE BIT(4)
69#define MIPI_DSI_MODE_VIDEO_HFP BIT(5)
71#define MIPI_DSI_MODE_VIDEO_HBP BIT(6)
73#define MIPI_DSI_MODE_VIDEO_HSA BIT(7)
75#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
77#define MIPI_DSI_MODE_EOT_PACKET BIT(9)
79#define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10)
81#define MIPI_DSI_MODE_LPM BIT(11)
82
96
97/*
98 * Per message flag to indicate the message must be sent
99 * using Low Power Mode instead of controller default.
100 */
101#define MIPI_DSI_MSG_USE_LPM BIT(0x0)
102
120
122__subsystem struct mipi_dsi_driver_api {
123 int (*attach)(const struct device *dev, uint8_t channel,
124 const struct mipi_dsi_device *mdev);
125 ssize_t (*transfer)(const struct device *dev, uint8_t channel,
126 struct mipi_dsi_msg *msg);
127 int (*detach)(const struct device *dev, uint8_t channel,
128 const struct mipi_dsi_device *mdev);
129};
130
140static inline int mipi_dsi_attach(const struct device *dev,
141 uint8_t channel,
142 const struct mipi_dsi_device *mdev)
143{
144 const struct mipi_dsi_driver_api *api = (const struct mipi_dsi_driver_api *)dev->api;
145
146 return api->attach(dev, channel, mdev);
147}
148
158static inline ssize_t mipi_dsi_transfer(const struct device *dev,
159 uint8_t channel,
160 struct mipi_dsi_msg *msg)
161{
162 const struct mipi_dsi_driver_api *api = (const struct mipi_dsi_driver_api *)dev->api;
163
164 return api->transfer(dev, channel, msg);
165}
166
179ssize_t mipi_dsi_generic_read(const struct device *dev, uint8_t channel,
180 const void *params, size_t nparams,
181 void *buf, size_t len);
182
193ssize_t mipi_dsi_generic_write(const struct device *dev, uint8_t channel,
194 const void *buf, size_t len);
195
207ssize_t mipi_dsi_dcs_read(const struct device *dev, uint8_t channel,
208 uint8_t cmd, void *buf, size_t len);
209
221ssize_t mipi_dsi_dcs_write(const struct device *dev, uint8_t channel,
222 uint8_t cmd, const void *buf, size_t len);
223
224
234static inline int mipi_dsi_detach(const struct device *dev,
235 uint8_t channel,
236 const struct mipi_dsi_device *mdev)
237{
238 const struct mipi_dsi_driver_api *api = (const struct mipi_dsi_driver_api *)dev->api;
239
240 if (api->detach == NULL) {
241 return -ENOSYS;
242 }
243
244 return api->detach(dev, channel, mdev);
245}
246
247#ifdef __cplusplus
248}
249#endif
250
255#endif /* ZEPHYR_INCLUDE_DRIVERS_MIPI_DSI_H_ */
System error numbers.
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
ssize_t mipi_dsi_generic_read(const struct device *dev, uint8_t channel, const void *params, size_t nparams, void *buf, size_t len)
MIPI-DSI generic read.
static int mipi_dsi_attach(const struct device *dev, uint8_t channel, const struct mipi_dsi_device *mdev)
Attach a new device to the MIPI-DSI bus.
Definition mipi_dsi.h:140
ssize_t mipi_dsi_generic_write(const struct device *dev, uint8_t channel, const void *buf, size_t len)
MIPI-DSI generic write.
ssize_t mipi_dsi_dcs_read(const struct device *dev, uint8_t channel, uint8_t cmd, void *buf, size_t len)
MIPI-DSI DCS read.
static ssize_t mipi_dsi_transfer(const struct device *dev, uint8_t channel, struct mipi_dsi_msg *msg)
Transfer data to/from a device attached to the MIPI-DSI bus.
Definition mipi_dsi.h:158
static int mipi_dsi_detach(const struct device *dev, uint8_t channel, const struct mipi_dsi_device *mdev)
Detach a device from the MIPI-DSI bus.
Definition mipi_dsi.h:234
ssize_t mipi_dsi_dcs_write(const struct device *dev, uint8_t channel, uint8_t cmd, const void *buf, size_t len)
MIPI-DSI DCS write.
#define ENOSYS
Function not implemented.
Definition errno.h:82
__SIZE_TYPE__ ssize_t
Definition types.h:28
Display definitions for MIPI devices.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:409
MIPI-DSI device.
Definition mipi_dsi.h:86
uint32_t pixfmt
Pixel format.
Definition mipi_dsi.h:92
uint8_t data_lanes
Number of data lanes.
Definition mipi_dsi.h:88
uint32_t mode_flags
Mode flags.
Definition mipi_dsi.h:94
struct mipi_dsi_timings timings
Display timings.
Definition mipi_dsi.h:90
MIPI-DSI host driver API.
Definition mipi_dsi.h:122
int(* attach)(const struct device *dev, uint8_t channel, const struct mipi_dsi_device *mdev)
Definition mipi_dsi.h:123
int(* detach)(const struct device *dev, uint8_t channel, const struct mipi_dsi_device *mdev)
Definition mipi_dsi.h:127
ssize_t(* transfer)(const struct device *dev, uint8_t channel, struct mipi_dsi_msg *msg)
Definition mipi_dsi.h:125
MIPI-DSI read/write message.
Definition mipi_dsi.h:104
uint8_t cmd
Command (only for DCS)
Definition mipi_dsi.h:110
size_t tx_len
Transmission buffer length.
Definition mipi_dsi.h:112
const void * tx_buf
Transmission buffer.
Definition mipi_dsi.h:114
uint8_t type
Payload data type.
Definition mipi_dsi.h:106
void * rx_buf
Reception buffer.
Definition mipi_dsi.h:118
size_t rx_len
Reception buffer length.
Definition mipi_dsi.h:116
uint16_t flags
Flags controlling message transmission.
Definition mipi_dsi.h:108
MIPI-DSI display timings.
Definition mipi_dsi.h:34
uint32_t hactive
Horizontal active video.
Definition mipi_dsi.h:36
uint32_t vsync
Vertical sync length.
Definition mipi_dsi.h:50
uint32_t hsync
Horizontal sync length.
Definition mipi_dsi.h:42
uint32_t vfp
Vertical front porch.
Definition mipi_dsi.h:46
uint32_t vactive
Vertical active video.
Definition mipi_dsi.h:44
uint32_t hfp
Horizontal front porch.
Definition mipi_dsi.h:38
uint32_t hbp
Horizontal back porch.
Definition mipi_dsi.h:40
uint32_t vbp
Vertical back porch.
Definition mipi_dsi.h:48