Blame view
include/drm/drm_mipi_dsi.h
10.1 KB
068a00233 drm: Add MIPI DSI... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
/* * MIPI DSI Bus * * Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd. * Andrzej Hajda <a.hajda@samsung.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __DRM_MIPI_DSI_H__ #define __DRM_MIPI_DSI_H__ #include <linux/device.h> struct mipi_dsi_host; struct mipi_dsi_device; |
1d96d4a67 drm/mipi_dsi: add... |
19 20 21 22 |
/* request ACK from peripheral */ #define MIPI_DSI_MSG_REQ_ACK BIT(0) /* use Low Power Mode to transmit message */ #define MIPI_DSI_MSG_USE_LPM BIT(1) |
068a00233 drm: Add MIPI DSI... |
23 24 25 26 |
/** * struct mipi_dsi_msg - read/write DSI buffer * @channel: virtual channel id * @type: payload data type |
009081e08 drm/dsi: Add to D... |
27 |
* @flags: flags controlling this message transmission |
068a00233 drm: Add MIPI DSI... |
28 29 30 31 32 33 34 35 |
* @tx_len: length of @tx_buf * @tx_buf: data to be written * @rx_len: length of @rx_buf * @rx_buf: data to be read, or NULL */ struct mipi_dsi_msg { u8 channel; u8 type; |
1d96d4a67 drm/mipi_dsi: add... |
36 |
u16 flags; |
068a00233 drm: Add MIPI DSI... |
37 38 39 40 41 42 43 |
size_t tx_len; const void *tx_buf; size_t rx_len; void *rx_buf; }; |
02acb76d7 drm/dsi: Introduc... |
44 45 |
bool mipi_dsi_packet_format_is_short(u8 type); bool mipi_dsi_packet_format_is_long(u8 type); |
068a00233 drm: Add MIPI DSI... |
46 |
/** |
a52879e8d drm/dsi: Add mess... |
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
* struct mipi_dsi_packet - represents a MIPI DSI packet in protocol format * @size: size (in bytes) of the packet * @header: the four bytes that make up the header (Data ID, Word Count or * Packet Data, and ECC) * @payload_length: number of bytes in the payload * @payload: a pointer to a buffer containing the payload, if any */ struct mipi_dsi_packet { size_t size; u8 header[4]; size_t payload_length; const u8 *payload; }; int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, const struct mipi_dsi_msg *msg); /** |
068a00233 drm: Add MIPI DSI... |
65 66 67 |
* struct mipi_dsi_host_ops - DSI bus operations * @attach: attach DSI device to DSI host * @detach: detach DSI device from DSI host |
009081e08 drm/dsi: Add to D... |
68 69 70 71 72 73 74 75 76 77 78 79 80 |
* @transfer: transmit a DSI packet * * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg * structures. This structure contains information about the type of packet * being transmitted as well as the transmit and receive buffers. When an * error is encountered during transmission, this function will return a * negative error code. On success it shall return the number of bytes * transmitted for write packets or the number of bytes received for read * packets. * * Note that typically DSI packet transmission is atomic, so the .transfer() * function will seldomly return anything other than the number of bytes * contained in the transmit buffer on success. |
068a00233 drm: Add MIPI DSI... |
81 82 83 84 85 86 87 |
*/ struct mipi_dsi_host_ops { int (*attach)(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi); int (*detach)(struct mipi_dsi_host *host, struct mipi_dsi_device *dsi); ssize_t (*transfer)(struct mipi_dsi_host *host, |
ed6ff40ee drm/dsi: Constify... |
88 |
const struct mipi_dsi_msg *msg); |
068a00233 drm: Add MIPI DSI... |
89 90 91 92 93 94 |
}; /** * struct mipi_dsi_host - DSI host device * @dev: driver model device node for this DSI host * @ops: DSI host operations |
97b6ae50e drm/dsi: Get DSI ... |
95 |
* @list: list management |
068a00233 drm: Add MIPI DSI... |
96 97 98 99 |
*/ struct mipi_dsi_host { struct device *dev; const struct mipi_dsi_host_ops *ops; |
97b6ae50e drm/dsi: Get DSI ... |
100 |
struct list_head list; |
068a00233 drm: Add MIPI DSI... |
101 102 103 104 |
}; int mipi_dsi_host_register(struct mipi_dsi_host *host); void mipi_dsi_host_unregister(struct mipi_dsi_host *host); |
97b6ae50e drm/dsi: Get DSI ... |
105 |
struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node); |
068a00233 drm: Add MIPI DSI... |
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
/* DSI mode flags */ /* video mode */ #define MIPI_DSI_MODE_VIDEO BIT(0) /* video burst mode */ #define MIPI_DSI_MODE_VIDEO_BURST BIT(1) /* video pulse mode */ #define MIPI_DSI_MODE_VIDEO_SYNC_PULSE BIT(2) /* enable auto vertical count mode */ #define MIPI_DSI_MODE_VIDEO_AUTO_VERT BIT(3) /* enable hsync-end packets in vsync-pulse and v-porch area */ #define MIPI_DSI_MODE_VIDEO_HSE BIT(4) /* disable hfront-porch area */ #define MIPI_DSI_MODE_VIDEO_HFP BIT(5) /* disable hback-porch area */ #define MIPI_DSI_MODE_VIDEO_HBP BIT(6) /* disable hsync-active area */ #define MIPI_DSI_MODE_VIDEO_HSA BIT(7) /* flush display FIFO on vsync pulse */ #define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8) /* disable EoT packets in HS mode */ #define MIPI_DSI_MODE_EOT_PACKET BIT(9) |
884d6a0b5 drm/dsi: Flag for... |
129 130 |
/* device supports non-continuous clock behavior (DSI spec 5.6.1) */ #define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10) |
d87f09abb drm/mipi-dsi: con... |
131 132 |
/* transmit data in low power */ #define MIPI_DSI_MODE_LPM BIT(11) |
068a00233 drm: Add MIPI DSI... |
133 134 135 136 137 138 139 |
enum mipi_dsi_pixel_format { MIPI_DSI_FMT_RGB888, MIPI_DSI_FMT_RGB666, MIPI_DSI_FMT_RGB666_PACKED, MIPI_DSI_FMT_RGB565, }; |
bf4363ce3 drm/dsi: Try to m... |
140 141 142 |
#define DSI_DEV_NAME_SIZE 20 /** |
c63ae8a96 drm/dsi: Use mipi... |
143 |
* struct mipi_dsi_device_info - template for creating a mipi_dsi_device |
bf4363ce3 drm/dsi: Try to m... |
144 |
* @type: DSI peripheral chip type |
c63ae8a96 drm/dsi: Use mipi... |
145 |
* @channel: DSI virtual channel assigned to peripheral |
bf4363ce3 drm/dsi: Try to m... |
146 |
* @node: pointer to OF device node or NULL |
c63ae8a96 drm/dsi: Use mipi... |
147 148 149 150 151 |
* * This is populated and passed to mipi_dsi_device_new to create a new * DSI device */ struct mipi_dsi_device_info { |
bf4363ce3 drm/dsi: Try to m... |
152 |
char type[DSI_DEV_NAME_SIZE]; |
c63ae8a96 drm/dsi: Use mipi... |
153 154 155 |
u32 channel; struct device_node *node; }; |
068a00233 drm: Add MIPI DSI... |
156 157 158 159 |
/** * struct mipi_dsi_device - DSI peripheral device * @host: DSI host for this peripheral * @dev: driver model device node for this peripheral |
bf4363ce3 drm/dsi: Try to m... |
160 |
* @name: DSI peripheral chip type |
068a00233 drm: Add MIPI DSI... |
161 162 163 164 165 166 167 168 |
* @channel: virtual channel assigned to the peripheral * @format: pixel format for video mode * @lanes: number of active data lanes * @mode_flags: DSI operation mode related flags */ struct mipi_dsi_device { struct mipi_dsi_host *host; struct device dev; |
bf4363ce3 drm/dsi: Try to m... |
169 |
char name[DSI_DEV_NAME_SIZE]; |
068a00233 drm: Add MIPI DSI... |
170 171 172 173 174 |
unsigned int channel; unsigned int lanes; enum mipi_dsi_pixel_format format; unsigned long mode_flags; }; |
babb24fec drm/dsi: Add ueve... |
175 |
#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:" |
77df01dcd drm/dsi: Replace ... |
176 177 178 179 |
static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) { return container_of(dev, struct mipi_dsi_device, dev); } |
068a00233 drm: Add MIPI DSI... |
180 |
|
ec26d9e93 drm/dsi: Add a he... |
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
/** * mipi_dsi_pixel_format_to_bpp - obtain the number of bits per pixel for any * given pixel format defined by the MIPI DSI * specification * @fmt: MIPI DSI pixel format * * Returns: The number of bits per pixel of the given pixel format. */ static inline int mipi_dsi_pixel_format_to_bpp(enum mipi_dsi_pixel_format fmt) { switch (fmt) { case MIPI_DSI_FMT_RGB888: case MIPI_DSI_FMT_RGB666: return 24; case MIPI_DSI_FMT_RGB666_PACKED: return 18; case MIPI_DSI_FMT_RGB565: return 16; } return -EINVAL; } |
c63ae8a96 drm/dsi: Use mipi... |
205 206 207 |
struct mipi_dsi_device * mipi_dsi_device_register_full(struct mipi_dsi_host *host, const struct mipi_dsi_device_info *info); |
509e42ce0 drm/dsi: Add rout... |
208 |
void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi); |
3ef059242 drm/dsi: Resolve ... |
209 |
struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); |
068a00233 drm: Add MIPI DSI... |
210 211 |
int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi); |
6e8c9e337 drm/dsi: Add Turn... |
212 213 |
int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi); int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi); |
dbf30b695 drm/dsi: Add mipi... |
214 215 |
int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, u16 value); |
550ab8483 drm/dsi: Implemen... |
216 217 218 219 220 |
ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, size_t size); ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, size_t num_params, void *data, size_t size); |
42fe1e755 drm/dsi: Implemen... |
221 222 223 224 225 226 227 228 229 230 231 |
/** * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking * information only * @MIPI_DSI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both * V-Blanking and H-Blanking information */ enum mipi_dsi_dcs_tear_mode { MIPI_DSI_DCS_TEAR_MODE_VBLANK, MIPI_DSI_DCS_TEAR_MODE_VHBLANK, }; |
3d9a8fcf1 drm/dsi: Implemen... |
232 233 234 235 236 |
#define MIPI_DSI_DCS_POWER_MODE_DISPLAY (1 << 2) #define MIPI_DSI_DCS_POWER_MODE_NORMAL (1 << 3) #define MIPI_DSI_DCS_POWER_MODE_SLEEP (1 << 4) #define MIPI_DSI_DCS_POWER_MODE_PARTIAL (1 << 5) #define MIPI_DSI_DCS_POWER_MODE_IDLE (1 << 6) |
960dd616f drm/dsi: Make mip... |
237 238 239 240 |
ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi, const void *data, size_t len); ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, const void *data, size_t len); |
3c523d7d3 drm/dsi: Use peri... |
241 242 |
ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, size_t len); |
083d573fd drm/dsi: Implemen... |
243 |
int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi); |
2f16b8973 drm/dsi: Implemen... |
244 |
int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi); |
3d9a8fcf1 drm/dsi: Implemen... |
245 |
int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode); |
5cc0af16f drm/dsi: Implemen... |
246 |
int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format); |
42fe1e755 drm/dsi: Implemen... |
247 248 249 250 |
int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi); |
3b46d4a0d drm/dsi: Implemen... |
251 252 253 254 |
int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start, u16 end); int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start, u16 end); |
42fe1e755 drm/dsi: Implemen... |
255 256 257 |
int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi); int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, enum mipi_dsi_dcs_tear_mode mode); |
5cc0af16f drm/dsi: Implemen... |
258 |
int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format); |
bbdcf516a drm/dsi: Order DC... |
259 |
int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline); |
1a9d75933 drm/dsi: Implemen... |
260 261 262 263 |
int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi, u16 brightness); int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi, u16 *brightness); |
068a00233 drm: Add MIPI DSI... |
264 265 266 267 268 269 |
/** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver * @probe: callback for device binding * @remove: callback for device unbinding |
d16218030 drm/dsi: Support ... |
270 |
* @shutdown: called at shutdown time to quiesce the device |
068a00233 drm: Add MIPI DSI... |
271 272 273 274 275 |
*/ struct mipi_dsi_driver { struct device_driver driver; int(*probe)(struct mipi_dsi_device *dsi); int(*remove)(struct mipi_dsi_device *dsi); |
d16218030 drm/dsi: Support ... |
276 |
void (*shutdown)(struct mipi_dsi_device *dsi); |
068a00233 drm: Add MIPI DSI... |
277 |
}; |
77df01dcd drm/dsi: Replace ... |
278 279 280 281 282 |
static inline struct mipi_dsi_driver * to_mipi_dsi_driver(struct device_driver *driver) { return container_of(driver, struct mipi_dsi_driver, driver); } |
068a00233 drm: Add MIPI DSI... |
283 284 285 286 287 288 289 290 291 292 |
static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi) { return dev_get_drvdata(&dsi->dev); } static inline void mipi_dsi_set_drvdata(struct mipi_dsi_device *dsi, void *data) { dev_set_drvdata(&dsi->dev, data); } |
99035e993 drm/dsi: Do not r... |
293 294 |
int mipi_dsi_driver_register_full(struct mipi_dsi_driver *driver, struct module *owner); |
068a00233 drm: Add MIPI DSI... |
295 |
void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver); |
99035e993 drm/dsi: Do not r... |
296 297 |
#define mipi_dsi_driver_register(driver) \ mipi_dsi_driver_register_full(driver, THIS_MODULE) |
068a00233 drm: Add MIPI DSI... |
298 299 300 301 302 |
#define module_mipi_dsi_driver(__mipi_dsi_driver) \ module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \ mipi_dsi_driver_unregister) #endif /* __DRM_MIPI_DSI__ */ |