xref: /dragonfly/sys/dev/drm/include/drm/drm_mipi_dsi.h (revision a85cb24f)
12c9916cdSFrançois Tigeot /*
22c9916cdSFrançois Tigeot  * MIPI DSI Bus
32c9916cdSFrançois Tigeot  *
42c9916cdSFrançois Tigeot  * Copyright (C) 2012-2013, Samsung Electronics, Co., Ltd.
52c9916cdSFrançois Tigeot  * Andrzej Hajda <a.hajda@samsung.com>
62c9916cdSFrançois Tigeot  *
72c9916cdSFrançois Tigeot  * This program is free software; you can redistribute it and/or modify
82c9916cdSFrançois Tigeot  * it under the terms of the GNU General Public License version 2 as
92c9916cdSFrançois Tigeot  * published by the Free Software Foundation.
102c9916cdSFrançois Tigeot  */
112c9916cdSFrançois Tigeot 
122c9916cdSFrançois Tigeot #ifndef __DRM_MIPI_DSI_H__
132c9916cdSFrançois Tigeot #define __DRM_MIPI_DSI_H__
142c9916cdSFrançois Tigeot 
152c9916cdSFrançois Tigeot #include <linux/device.h>
162c9916cdSFrançois Tigeot 
172c9916cdSFrançois Tigeot struct mipi_dsi_host;
182c9916cdSFrançois Tigeot struct mipi_dsi_device;
192c9916cdSFrançois Tigeot 
202c9916cdSFrançois Tigeot /* request ACK from peripheral */
212c9916cdSFrançois Tigeot #define MIPI_DSI_MSG_REQ_ACK	BIT(0)
222c9916cdSFrançois Tigeot /* use Low Power Mode to transmit message */
232c9916cdSFrançois Tigeot #define MIPI_DSI_MSG_USE_LPM	BIT(1)
242c9916cdSFrançois Tigeot 
252c9916cdSFrançois Tigeot /**
262c9916cdSFrançois Tigeot  * struct mipi_dsi_msg - read/write DSI buffer
272c9916cdSFrançois Tigeot  * @channel: virtual channel id
282c9916cdSFrançois Tigeot  * @type: payload data type
292c9916cdSFrançois Tigeot  * @flags: flags controlling this message transmission
302c9916cdSFrançois Tigeot  * @tx_len: length of @tx_buf
312c9916cdSFrançois Tigeot  * @tx_buf: data to be written
322c9916cdSFrançois Tigeot  * @rx_len: length of @rx_buf
332c9916cdSFrançois Tigeot  * @rx_buf: data to be read, or NULL
342c9916cdSFrançois Tigeot  */
352c9916cdSFrançois Tigeot struct mipi_dsi_msg {
362c9916cdSFrançois Tigeot 	u8 channel;
372c9916cdSFrançois Tigeot 	u8 type;
382c9916cdSFrançois Tigeot 	u16 flags;
392c9916cdSFrançois Tigeot 
402c9916cdSFrançois Tigeot 	size_t tx_len;
412c9916cdSFrançois Tigeot 	const void *tx_buf;
422c9916cdSFrançois Tigeot 
432c9916cdSFrançois Tigeot 	size_t rx_len;
442c9916cdSFrançois Tigeot 	void *rx_buf;
452c9916cdSFrançois Tigeot };
462c9916cdSFrançois Tigeot 
472c9916cdSFrançois Tigeot bool mipi_dsi_packet_format_is_short(u8 type);
482c9916cdSFrançois Tigeot bool mipi_dsi_packet_format_is_long(u8 type);
492c9916cdSFrançois Tigeot 
502c9916cdSFrançois Tigeot /**
512c9916cdSFrançois Tigeot  * struct mipi_dsi_packet - represents a MIPI DSI packet in protocol format
522c9916cdSFrançois Tigeot  * @size: size (in bytes) of the packet
532c9916cdSFrançois Tigeot  * @header: the four bytes that make up the header (Data ID, Word Count or
542c9916cdSFrançois Tigeot  *     Packet Data, and ECC)
552c9916cdSFrançois Tigeot  * @payload_length: number of bytes in the payload
562c9916cdSFrançois Tigeot  * @payload: a pointer to a buffer containing the payload, if any
572c9916cdSFrançois Tigeot  */
582c9916cdSFrançois Tigeot struct mipi_dsi_packet {
592c9916cdSFrançois Tigeot 	size_t size;
602c9916cdSFrançois Tigeot 	u8 header[4];
612c9916cdSFrançois Tigeot 	size_t payload_length;
622c9916cdSFrançois Tigeot 	const u8 *payload;
632c9916cdSFrançois Tigeot };
642c9916cdSFrançois Tigeot 
652c9916cdSFrançois Tigeot int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
662c9916cdSFrançois Tigeot 			   const struct mipi_dsi_msg *msg);
672c9916cdSFrançois Tigeot 
682c9916cdSFrançois Tigeot /**
692c9916cdSFrançois Tigeot  * struct mipi_dsi_host_ops - DSI bus operations
702c9916cdSFrançois Tigeot  * @attach: attach DSI device to DSI host
712c9916cdSFrançois Tigeot  * @detach: detach DSI device from DSI host
722c9916cdSFrançois Tigeot  * @transfer: transmit a DSI packet
732c9916cdSFrançois Tigeot  *
742c9916cdSFrançois Tigeot  * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg
752c9916cdSFrançois Tigeot  * structures. This structure contains information about the type of packet
762c9916cdSFrançois Tigeot  * being transmitted as well as the transmit and receive buffers. When an
772c9916cdSFrançois Tigeot  * error is encountered during transmission, this function will return a
782c9916cdSFrançois Tigeot  * negative error code. On success it shall return the number of bytes
792c9916cdSFrançois Tigeot  * transmitted for write packets or the number of bytes received for read
802c9916cdSFrançois Tigeot  * packets.
812c9916cdSFrançois Tigeot  *
822c9916cdSFrançois Tigeot  * Note that typically DSI packet transmission is atomic, so the .transfer()
832c9916cdSFrançois Tigeot  * function will seldomly return anything other than the number of bytes
842c9916cdSFrançois Tigeot  * contained in the transmit buffer on success.
852c9916cdSFrançois Tigeot  */
862c9916cdSFrançois Tigeot struct mipi_dsi_host_ops {
872c9916cdSFrançois Tigeot 	int (*attach)(struct mipi_dsi_host *host,
882c9916cdSFrançois Tigeot 		      struct mipi_dsi_device *dsi);
892c9916cdSFrançois Tigeot 	int (*detach)(struct mipi_dsi_host *host,
902c9916cdSFrançois Tigeot 		      struct mipi_dsi_device *dsi);
912c9916cdSFrançois Tigeot 	ssize_t (*transfer)(struct mipi_dsi_host *host,
922c9916cdSFrançois Tigeot 			    const struct mipi_dsi_msg *msg);
932c9916cdSFrançois Tigeot };
942c9916cdSFrançois Tigeot 
952c9916cdSFrançois Tigeot /**
962c9916cdSFrançois Tigeot  * struct mipi_dsi_host - DSI host device
972c9916cdSFrançois Tigeot  * @dev: driver model device node for this DSI host
982c9916cdSFrançois Tigeot  * @ops: DSI host operations
99c0e85e96SFrançois Tigeot  * @list: list management
1002c9916cdSFrançois Tigeot  */
1012c9916cdSFrançois Tigeot struct mipi_dsi_host {
1022c9916cdSFrançois Tigeot 	struct device *dev;
1032c9916cdSFrançois Tigeot 	const struct mipi_dsi_host_ops *ops;
104c0e85e96SFrançois Tigeot 	struct list_head list;
1052c9916cdSFrançois Tigeot };
1062c9916cdSFrançois Tigeot 
1072c9916cdSFrançois Tigeot int mipi_dsi_host_register(struct mipi_dsi_host *host);
1082c9916cdSFrançois Tigeot void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
109c0e85e96SFrançois Tigeot struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
1102c9916cdSFrançois Tigeot 
1112c9916cdSFrançois Tigeot /* DSI mode flags */
1122c9916cdSFrançois Tigeot 
1132c9916cdSFrançois Tigeot /* video mode */
1142c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO		BIT(0)
1152c9916cdSFrançois Tigeot /* video burst mode */
1162c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_BURST	BIT(1)
1172c9916cdSFrançois Tigeot /* video pulse mode */
1182c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_SYNC_PULSE	BIT(2)
1192c9916cdSFrançois Tigeot /* enable auto vertical count mode */
1202c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_AUTO_VERT	BIT(3)
1212c9916cdSFrançois Tigeot /* enable hsync-end packets in vsync-pulse and v-porch area */
1222c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_HSE		BIT(4)
1232c9916cdSFrançois Tigeot /* disable hfront-porch area */
1242c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_HFP		BIT(5)
1252c9916cdSFrançois Tigeot /* disable hback-porch area */
1262c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_HBP		BIT(6)
1272c9916cdSFrançois Tigeot /* disable hsync-active area */
1282c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VIDEO_HSA		BIT(7)
1292c9916cdSFrançois Tigeot /* flush display FIFO on vsync pulse */
1302c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_VSYNC_FLUSH	BIT(8)
1312c9916cdSFrançois Tigeot /* disable EoT packets in HS mode */
1322c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_EOT_PACKET	BIT(9)
1332c9916cdSFrançois Tigeot /* device supports non-continuous clock behavior (DSI spec 5.6.1) */
1342c9916cdSFrançois Tigeot #define MIPI_DSI_CLOCK_NON_CONTINUOUS	BIT(10)
1352c9916cdSFrançois Tigeot /* transmit data in low power */
1362c9916cdSFrançois Tigeot #define MIPI_DSI_MODE_LPM		BIT(11)
1372c9916cdSFrançois Tigeot 
1382c9916cdSFrançois Tigeot enum mipi_dsi_pixel_format {
1392c9916cdSFrançois Tigeot 	MIPI_DSI_FMT_RGB888,
1402c9916cdSFrançois Tigeot 	MIPI_DSI_FMT_RGB666,
1412c9916cdSFrançois Tigeot 	MIPI_DSI_FMT_RGB666_PACKED,
1422c9916cdSFrançois Tigeot 	MIPI_DSI_FMT_RGB565,
1432c9916cdSFrançois Tigeot };
1442c9916cdSFrançois Tigeot 
145c0e85e96SFrançois Tigeot #define DSI_DEV_NAME_SIZE		20
146c0e85e96SFrançois Tigeot 
147c0e85e96SFrançois Tigeot /**
148c0e85e96SFrançois Tigeot  * struct mipi_dsi_device_info - template for creating a mipi_dsi_device
149c0e85e96SFrançois Tigeot  * @type: DSI peripheral chip type
150c0e85e96SFrançois Tigeot  * @channel: DSI virtual channel assigned to peripheral
151c0e85e96SFrançois Tigeot  * @node: pointer to OF device node or NULL
152c0e85e96SFrançois Tigeot  *
153c0e85e96SFrançois Tigeot  * This is populated and passed to mipi_dsi_device_new to create a new
154c0e85e96SFrançois Tigeot  * DSI device
155c0e85e96SFrançois Tigeot  */
156c0e85e96SFrançois Tigeot struct mipi_dsi_device_info {
157c0e85e96SFrançois Tigeot 	char type[DSI_DEV_NAME_SIZE];
158c0e85e96SFrançois Tigeot 	u32 channel;
159c0e85e96SFrançois Tigeot 	struct device_node *node;
160c0e85e96SFrançois Tigeot };
161c0e85e96SFrançois Tigeot 
1622c9916cdSFrançois Tigeot /**
1632c9916cdSFrançois Tigeot  * struct mipi_dsi_device - DSI peripheral device
1642c9916cdSFrançois Tigeot  * @host: DSI host for this peripheral
1652c9916cdSFrançois Tigeot  * @dev: driver model device node for this peripheral
166c0e85e96SFrançois Tigeot  * @name: DSI peripheral chip type
1672c9916cdSFrançois Tigeot  * @channel: virtual channel assigned to the peripheral
1682c9916cdSFrançois Tigeot  * @format: pixel format for video mode
1692c9916cdSFrançois Tigeot  * @lanes: number of active data lanes
1702c9916cdSFrançois Tigeot  * @mode_flags: DSI operation mode related flags
1712c9916cdSFrançois Tigeot  */
1722c9916cdSFrançois Tigeot struct mipi_dsi_device {
1732c9916cdSFrançois Tigeot 	struct mipi_dsi_host *host;
1742c9916cdSFrançois Tigeot 	struct device dev;
1752c9916cdSFrançois Tigeot 
176c0e85e96SFrançois Tigeot 	char name[DSI_DEV_NAME_SIZE];
1772c9916cdSFrançois Tigeot 	unsigned int channel;
1782c9916cdSFrançois Tigeot 	unsigned int lanes;
1792c9916cdSFrançois Tigeot 	enum mipi_dsi_pixel_format format;
1802c9916cdSFrançois Tigeot 	unsigned long mode_flags;
1812c9916cdSFrançois Tigeot };
1822c9916cdSFrançois Tigeot 
183*1dedbd3bSFrançois Tigeot #define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"
184*1dedbd3bSFrançois Tigeot 
to_mipi_dsi_device(struct device * dev)1852c9916cdSFrançois Tigeot static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
1862c9916cdSFrançois Tigeot {
1872c9916cdSFrançois Tigeot 	return container_of(dev, struct mipi_dsi_device, dev);
1882c9916cdSFrançois Tigeot }
1892c9916cdSFrançois Tigeot 
190aee94f86SFrançois Tigeot /**
191aee94f86SFrançois Tigeot  * mipi_dsi_pixel_format_to_bpp - obtain the number of bits per pixel for any
192aee94f86SFrançois Tigeot  *                                given pixel format defined by the MIPI DSI
193aee94f86SFrançois Tigeot  *                                specification
194aee94f86SFrançois Tigeot  * @fmt: MIPI DSI pixel format
195aee94f86SFrançois Tigeot  *
196aee94f86SFrançois Tigeot  * Returns: The number of bits per pixel of the given pixel format.
197aee94f86SFrançois Tigeot  */
mipi_dsi_pixel_format_to_bpp(enum mipi_dsi_pixel_format fmt)198aee94f86SFrançois Tigeot static inline int mipi_dsi_pixel_format_to_bpp(enum mipi_dsi_pixel_format fmt)
199aee94f86SFrançois Tigeot {
200aee94f86SFrançois Tigeot 	switch (fmt) {
201aee94f86SFrançois Tigeot 	case MIPI_DSI_FMT_RGB888:
202aee94f86SFrançois Tigeot 	case MIPI_DSI_FMT_RGB666:
203aee94f86SFrançois Tigeot 		return 24;
204aee94f86SFrançois Tigeot 
205aee94f86SFrançois Tigeot 	case MIPI_DSI_FMT_RGB666_PACKED:
206aee94f86SFrançois Tigeot 		return 18;
207aee94f86SFrançois Tigeot 
208aee94f86SFrançois Tigeot 	case MIPI_DSI_FMT_RGB565:
209aee94f86SFrançois Tigeot 		return 16;
210aee94f86SFrançois Tigeot 	}
211aee94f86SFrançois Tigeot 
212aee94f86SFrançois Tigeot 	return -EINVAL;
213aee94f86SFrançois Tigeot }
214aee94f86SFrançois Tigeot 
215c0e85e96SFrançois Tigeot struct mipi_dsi_device *
216c0e85e96SFrançois Tigeot mipi_dsi_device_register_full(struct mipi_dsi_host *host,
217c0e85e96SFrançois Tigeot 			      const struct mipi_dsi_device_info *info);
218c0e85e96SFrançois Tigeot void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi);
2192c9916cdSFrançois Tigeot struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
2202c9916cdSFrançois Tigeot int mipi_dsi_attach(struct mipi_dsi_device *dsi);
2212c9916cdSFrançois Tigeot int mipi_dsi_detach(struct mipi_dsi_device *dsi);
222aee94f86SFrançois Tigeot int mipi_dsi_shutdown_peripheral(struct mipi_dsi_device *dsi);
223aee94f86SFrançois Tigeot int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device *dsi);
2242c9916cdSFrançois Tigeot int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,
2252c9916cdSFrançois Tigeot 					    u16 value);
2262c9916cdSFrançois Tigeot 
2272c9916cdSFrançois Tigeot ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload,
2282c9916cdSFrançois Tigeot 			       size_t size);
2292c9916cdSFrançois Tigeot ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params,
2302c9916cdSFrançois Tigeot 			      size_t num_params, void *data, size_t size);
2312c9916cdSFrançois Tigeot 
2322c9916cdSFrançois Tigeot /**
2332c9916cdSFrançois Tigeot  * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode
2342c9916cdSFrançois Tigeot  * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking
2352c9916cdSFrançois Tigeot  *    information only
2362c9916cdSFrançois Tigeot  * @MIPI_DSI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both
2372c9916cdSFrançois Tigeot  *    V-Blanking and H-Blanking information
2382c9916cdSFrançois Tigeot  */
2392c9916cdSFrançois Tigeot enum mipi_dsi_dcs_tear_mode {
2402c9916cdSFrançois Tigeot 	MIPI_DSI_DCS_TEAR_MODE_VBLANK,
2412c9916cdSFrançois Tigeot 	MIPI_DSI_DCS_TEAR_MODE_VHBLANK,
2422c9916cdSFrançois Tigeot };
2432c9916cdSFrançois Tigeot 
2442c9916cdSFrançois Tigeot #define MIPI_DSI_DCS_POWER_MODE_DISPLAY (1 << 2)
2452c9916cdSFrançois Tigeot #define MIPI_DSI_DCS_POWER_MODE_NORMAL  (1 << 3)
2462c9916cdSFrançois Tigeot #define MIPI_DSI_DCS_POWER_MODE_SLEEP   (1 << 4)
2472c9916cdSFrançois Tigeot #define MIPI_DSI_DCS_POWER_MODE_PARTIAL (1 << 5)
2482c9916cdSFrançois Tigeot #define MIPI_DSI_DCS_POWER_MODE_IDLE    (1 << 6)
2492c9916cdSFrançois Tigeot 
2502c9916cdSFrançois Tigeot ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi,
2512c9916cdSFrançois Tigeot 				  const void *data, size_t len);
2522c9916cdSFrançois Tigeot ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd,
2532c9916cdSFrançois Tigeot 			   const void *data, size_t len);
2542c9916cdSFrançois Tigeot ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
2552c9916cdSFrançois Tigeot 			  size_t len);
2562c9916cdSFrançois Tigeot int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi);
2572c9916cdSFrançois Tigeot int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi);
2582c9916cdSFrançois Tigeot int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode);
2592c9916cdSFrançois Tigeot int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format);
2602c9916cdSFrançois Tigeot int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi);
2612c9916cdSFrançois Tigeot int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi);
2622c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi);
2632c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi);
2642c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start,
2652c9916cdSFrançois Tigeot 				    u16 end);
2662c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start,
2672c9916cdSFrançois Tigeot 				  u16 end);
2682c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi);
2692c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi,
2702c9916cdSFrançois Tigeot 			     enum mipi_dsi_dcs_tear_mode mode);
2712c9916cdSFrançois Tigeot int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format);
272*1dedbd3bSFrançois Tigeot int mipi_dsi_dcs_set_tear_scanline(struct mipi_dsi_device *dsi, u16 scanline);
273*1dedbd3bSFrançois Tigeot int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi,
274*1dedbd3bSFrançois Tigeot 					u16 brightness);
275*1dedbd3bSFrançois Tigeot int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi,
276*1dedbd3bSFrançois Tigeot 					u16 *brightness);
2772c9916cdSFrançois Tigeot 
2782c9916cdSFrançois Tigeot /**
2792c9916cdSFrançois Tigeot  * struct mipi_dsi_driver - DSI driver
2802c9916cdSFrançois Tigeot  * @driver: device driver model driver
2812c9916cdSFrançois Tigeot  * @probe: callback for device binding
2822c9916cdSFrançois Tigeot  * @remove: callback for device unbinding
2832c9916cdSFrançois Tigeot  * @shutdown: called at shutdown time to quiesce the device
2842c9916cdSFrançois Tigeot  */
2852c9916cdSFrançois Tigeot struct mipi_dsi_driver {
2862c9916cdSFrançois Tigeot 	struct device_driver driver;
2872c9916cdSFrançois Tigeot 	int(*probe)(struct mipi_dsi_device *dsi);
2882c9916cdSFrançois Tigeot 	int(*remove)(struct mipi_dsi_device *dsi);
2892c9916cdSFrançois Tigeot 	void (*shutdown)(struct mipi_dsi_device *dsi);
2902c9916cdSFrançois Tigeot };
2912c9916cdSFrançois Tigeot 
2922c9916cdSFrançois Tigeot static inline struct mipi_dsi_driver *
to_mipi_dsi_driver(struct device_driver * driver)2932c9916cdSFrançois Tigeot to_mipi_dsi_driver(struct device_driver *driver)
2942c9916cdSFrançois Tigeot {
2952c9916cdSFrançois Tigeot 	return container_of(driver, struct mipi_dsi_driver, driver);
2962c9916cdSFrançois Tigeot }
2972c9916cdSFrançois Tigeot 
mipi_dsi_get_drvdata(const struct mipi_dsi_device * dsi)2982c9916cdSFrançois Tigeot static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi)
2992c9916cdSFrançois Tigeot {
3002c9916cdSFrançois Tigeot 	return dev_get_drvdata(&dsi->dev);
3012c9916cdSFrançois Tigeot }
3022c9916cdSFrançois Tigeot 
mipi_dsi_set_drvdata(struct mipi_dsi_device * dsi,void * data)3032c9916cdSFrançois Tigeot static inline void mipi_dsi_set_drvdata(struct mipi_dsi_device *dsi, void *data)
3042c9916cdSFrançois Tigeot {
3052c9916cdSFrançois Tigeot 	dev_set_drvdata(&dsi->dev, data);
3062c9916cdSFrançois Tigeot }
3072c9916cdSFrançois Tigeot 
3082c9916cdSFrançois Tigeot int mipi_dsi_driver_register_full(struct mipi_dsi_driver *driver,
3092c9916cdSFrançois Tigeot 				  struct module *owner);
3102c9916cdSFrançois Tigeot void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver);
3112c9916cdSFrançois Tigeot 
3122c9916cdSFrançois Tigeot #define mipi_dsi_driver_register(driver) \
3132c9916cdSFrançois Tigeot 	mipi_dsi_driver_register_full(driver, THIS_MODULE)
3142c9916cdSFrançois Tigeot 
3152c9916cdSFrançois Tigeot #define module_mipi_dsi_driver(__mipi_dsi_driver) \
3162c9916cdSFrançois Tigeot 	module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \
3172c9916cdSFrançois Tigeot 			mipi_dsi_driver_unregister)
3182c9916cdSFrançois Tigeot 
3192c9916cdSFrançois Tigeot #endif /* __DRM_MIPI_DSI__ */
320