diff options
author | Dave Airlie <airlied@redhat.com> | 2014-11-14 18:36:13 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-11-14 18:36:13 -0500 |
commit | 8aa3dc3c17f886c14ef6bcb62720832409ded0a6 (patch) | |
tree | 23d14adf55a6522107c8492507cd2acfcf172c99 /include/drm | |
parent | fd172d0c47fddff801d998e38c3efdd236ed082f (diff) | |
parent | 1976dbca047ed73888f9e7a533df899e961e1dc0 (diff) |
Merge tag 'drm/panel/for-3.19-rc1' of git://people.freedesktop.org/~tagr/linux into drm-next
drm/panel: Changes for v3.19-rc1
This contains support for a couple of new panels, updates for some GPIO
API changes and a bunch of updates to the MIPI DSI support that should
make it easier to write panel drivers in the future.
* tag 'drm/panel/for-3.19-rc1' of git://people.freedesktop.org/~tagr/linux: (31 commits)
drm/panel: Add Sharp LQ101R1SX01 support
drm/dsi: Do not require .owner field to be set
drm/dsi: Resolve MIPI DSI device from phandle
drm/dsi: Implement DCS set_{column,page}_address commands
drm/dsi: Implement DCS {get,set}_pixel_format commands
drm/dsi: Implement DCS get_power_mode command
drm/dsi: Implement DCS soft_reset command
drm/dsi: Implement DCS nop command
drm/dsi: Add to DocBook documentation
drm/dsi: Implement some standard DCS commands
drm/dsi: Implement generic read and write commands
drm/panel: s6e8aa0: Use standard MIPI DSI function
drm/dsi: Add mipi_dsi_set_maximum_return_packet_size() helper
drm/dsi: Constify mipi_dsi_msg
drm/dsi: Make mipi_dsi_dcs_{read,write}() symmetrical
drm/dsi: Add DSI transfer helper
drm/dsi: Add message to packet translator
drm/dsi: Introduce packet format helpers
drm/panel: s6e8aa0: Fix build warnings on 64-bit
drm/panel: ld9040: Fix build warnings on 64-bit
...
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/drm_mipi_dsi.h | 94 |
1 files changed, 88 insertions, 6 deletions
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 8569dc5a1026..f1d8d0dbb4f1 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h | |||
@@ -26,6 +26,7 @@ struct mipi_dsi_device; | |||
26 | * struct mipi_dsi_msg - read/write DSI buffer | 26 | * struct mipi_dsi_msg - read/write DSI buffer |
27 | * @channel: virtual channel id | 27 | * @channel: virtual channel id |
28 | * @type: payload data type | 28 | * @type: payload data type |
29 | * @flags: flags controlling this message transmission | ||
29 | * @tx_len: length of @tx_buf | 30 | * @tx_len: length of @tx_buf |
30 | * @tx_buf: data to be written | 31 | * @tx_buf: data to be written |
31 | * @rx_len: length of @rx_buf | 32 | * @rx_len: length of @rx_buf |
@@ -43,12 +44,44 @@ struct mipi_dsi_msg { | |||
43 | void *rx_buf; | 44 | void *rx_buf; |
44 | }; | 45 | }; |
45 | 46 | ||
47 | bool mipi_dsi_packet_format_is_short(u8 type); | ||
48 | bool mipi_dsi_packet_format_is_long(u8 type); | ||
49 | |||
50 | /** | ||
51 | * struct mipi_dsi_packet - represents a MIPI DSI packet in protocol format | ||
52 | * @size: size (in bytes) of the packet | ||
53 | * @header: the four bytes that make up the header (Data ID, Word Count or | ||
54 | * Packet Data, and ECC) | ||
55 | * @payload_length: number of bytes in the payload | ||
56 | * @payload: a pointer to a buffer containing the payload, if any | ||
57 | */ | ||
58 | struct mipi_dsi_packet { | ||
59 | size_t size; | ||
60 | u8 header[4]; | ||
61 | size_t payload_length; | ||
62 | const u8 *payload; | ||
63 | }; | ||
64 | |||
65 | int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, | ||
66 | const struct mipi_dsi_msg *msg); | ||
67 | |||
46 | /** | 68 | /** |
47 | * struct mipi_dsi_host_ops - DSI bus operations | 69 | * struct mipi_dsi_host_ops - DSI bus operations |
48 | * @attach: attach DSI device to DSI host | 70 | * @attach: attach DSI device to DSI host |
49 | * @detach: detach DSI device from DSI host | 71 | * @detach: detach DSI device from DSI host |
50 | * @transfer: send and/or receive DSI packet, return number of received bytes, | 72 | * @transfer: transmit a DSI packet |
51 | * or error | 73 | * |
74 | * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg | ||
75 | * structures. This structure contains information about the type of packet | ||
76 | * being transmitted as well as the transmit and receive buffers. When an | ||
77 | * error is encountered during transmission, this function will return a | ||
78 | * negative error code. On success it shall return the number of bytes | ||
79 | * transmitted for write packets or the number of bytes received for read | ||
80 | * packets. | ||
81 | * | ||
82 | * Note that typically DSI packet transmission is atomic, so the .transfer() | ||
83 | * function will seldomly return anything other than the number of bytes | ||
84 | * contained in the transmit buffer on success. | ||
52 | */ | 85 | */ |
53 | struct mipi_dsi_host_ops { | 86 | struct mipi_dsi_host_ops { |
54 | int (*attach)(struct mipi_dsi_host *host, | 87 | int (*attach)(struct mipi_dsi_host *host, |
@@ -56,7 +89,7 @@ struct mipi_dsi_host_ops { | |||
56 | int (*detach)(struct mipi_dsi_host *host, | 89 | int (*detach)(struct mipi_dsi_host *host, |
57 | struct mipi_dsi_device *dsi); | 90 | struct mipi_dsi_device *dsi); |
58 | ssize_t (*transfer)(struct mipi_dsi_host *host, | 91 | ssize_t (*transfer)(struct mipi_dsi_host *host, |
59 | struct mipi_dsi_msg *msg); | 92 | const struct mipi_dsi_msg *msg); |
60 | }; | 93 | }; |
61 | 94 | ||
62 | /** | 95 | /** |
@@ -130,12 +163,57 @@ static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) | |||
130 | return container_of(dev, struct mipi_dsi_device, dev); | 163 | return container_of(dev, struct mipi_dsi_device, dev); |
131 | } | 164 | } |
132 | 165 | ||
166 | struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); | ||
133 | int mipi_dsi_attach(struct mipi_dsi_device *dsi); | 167 | int mipi_dsi_attach(struct mipi_dsi_device *dsi); |
134 | int mipi_dsi_detach(struct mipi_dsi_device *dsi); | 168 | int mipi_dsi_detach(struct mipi_dsi_device *dsi); |
135 | ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data, | 169 | int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, |
136 | size_t len); | 170 | u16 value); |
171 | |||
172 | ssize_t mipi_dsi_generic_write(struct mipi_dsi_device *dsi, const void *payload, | ||
173 | size_t size); | ||
174 | ssize_t mipi_dsi_generic_read(struct mipi_dsi_device *dsi, const void *params, | ||
175 | size_t num_params, void *data, size_t size); | ||
176 | |||
177 | /** | ||
178 | * enum mipi_dsi_dcs_tear_mode - Tearing Effect Output Line mode | ||
179 | * @MIPI_DSI_DCS_TEAR_MODE_VBLANK: the TE output line consists of V-Blanking | ||
180 | * information only | ||
181 | * @MIPI_DSI_DCS_TEAR_MODE_VHBLANK : the TE output line consists of both | ||
182 | * V-Blanking and H-Blanking information | ||
183 | */ | ||
184 | enum mipi_dsi_dcs_tear_mode { | ||
185 | MIPI_DSI_DCS_TEAR_MODE_VBLANK, | ||
186 | MIPI_DSI_DCS_TEAR_MODE_VHBLANK, | ||
187 | }; | ||
188 | |||
189 | #define MIPI_DSI_DCS_POWER_MODE_DISPLAY (1 << 2) | ||
190 | #define MIPI_DSI_DCS_POWER_MODE_NORMAL (1 << 3) | ||
191 | #define MIPI_DSI_DCS_POWER_MODE_SLEEP (1 << 4) | ||
192 | #define MIPI_DSI_DCS_POWER_MODE_PARTIAL (1 << 5) | ||
193 | #define MIPI_DSI_DCS_POWER_MODE_IDLE (1 << 6) | ||
194 | |||
195 | ssize_t mipi_dsi_dcs_write_buffer(struct mipi_dsi_device *dsi, | ||
196 | const void *data, size_t len); | ||
197 | ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, u8 cmd, | ||
198 | const void *data, size_t len); | ||
137 | ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, | 199 | ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data, |
138 | size_t len); | 200 | size_t len); |
201 | int mipi_dsi_dcs_nop(struct mipi_dsi_device *dsi); | ||
202 | int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi); | ||
203 | int mipi_dsi_dcs_get_power_mode(struct mipi_dsi_device *dsi, u8 *mode); | ||
204 | int mipi_dsi_dcs_get_pixel_format(struct mipi_dsi_device *dsi, u8 *format); | ||
205 | int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi); | ||
206 | int mipi_dsi_dcs_exit_sleep_mode(struct mipi_dsi_device *dsi); | ||
207 | int mipi_dsi_dcs_set_display_off(struct mipi_dsi_device *dsi); | ||
208 | int mipi_dsi_dcs_set_display_on(struct mipi_dsi_device *dsi); | ||
209 | int mipi_dsi_dcs_set_column_address(struct mipi_dsi_device *dsi, u16 start, | ||
210 | u16 end); | ||
211 | int mipi_dsi_dcs_set_page_address(struct mipi_dsi_device *dsi, u16 start, | ||
212 | u16 end); | ||
213 | int mipi_dsi_dcs_set_tear_off(struct mipi_dsi_device *dsi); | ||
214 | int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, | ||
215 | enum mipi_dsi_dcs_tear_mode mode); | ||
216 | int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format); | ||
139 | 217 | ||
140 | /** | 218 | /** |
141 | * struct mipi_dsi_driver - DSI driver | 219 | * struct mipi_dsi_driver - DSI driver |
@@ -167,9 +245,13 @@ static inline void mipi_dsi_set_drvdata(struct mipi_dsi_device *dsi, void *data) | |||
167 | dev_set_drvdata(&dsi->dev, data); | 245 | dev_set_drvdata(&dsi->dev, data); |
168 | } | 246 | } |
169 | 247 | ||
170 | int mipi_dsi_driver_register(struct mipi_dsi_driver *driver); | 248 | int mipi_dsi_driver_register_full(struct mipi_dsi_driver *driver, |
249 | struct module *owner); | ||
171 | void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver); | 250 | void mipi_dsi_driver_unregister(struct mipi_dsi_driver *driver); |
172 | 251 | ||
252 | #define mipi_dsi_driver_register(driver) \ | ||
253 | mipi_dsi_driver_register_full(driver, THIS_MODULE) | ||
254 | |||
173 | #define module_mipi_dsi_driver(__mipi_dsi_driver) \ | 255 | #define module_mipi_dsi_driver(__mipi_dsi_driver) \ |
174 | module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \ | 256 | module_driver(__mipi_dsi_driver, mipi_dsi_driver_register, \ |
175 | mipi_dsi_driver_unregister) | 257 | mipi_dsi_driver_unregister) |