aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-11-04 08:59:14 -0500
committerThierry Reding <treding@nvidia.com>2014-11-13 07:55:24 -0500
commit02acb76d72b3672330b6a20d2773048658b2d176 (patch)
tree3b94b9085c953ed129df66529f8355eb7f7bc8b4 /drivers/gpu/drm
parentd85a1609e62c22730aa4e3ef09884f04606b086e (diff)
drm/dsi: Introduce packet format helpers
Add two helpers, mipi_dsi_packet_format_is_{short,long}(), that help in determining the format of a packet. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/drm_mipi_dsi.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index eb6dfe52cab2..adf056677498 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -199,6 +199,73 @@ int mipi_dsi_detach(struct mipi_dsi_device *dsi)
199EXPORT_SYMBOL(mipi_dsi_detach); 199EXPORT_SYMBOL(mipi_dsi_detach);
200 200
201/** 201/**
202 * mipi_dsi_packet_format_is_short - check if a packet is of the short format
203 * @type: MIPI DSI data type of the packet
204 *
205 * Return: true if the packet for the given data type is a short packet, false
206 * otherwise.
207 */
208bool mipi_dsi_packet_format_is_short(u8 type)
209{
210 switch (type) {
211 case MIPI_DSI_V_SYNC_START:
212 case MIPI_DSI_V_SYNC_END:
213 case MIPI_DSI_H_SYNC_START:
214 case MIPI_DSI_H_SYNC_END:
215 case MIPI_DSI_END_OF_TRANSMISSION:
216 case MIPI_DSI_COLOR_MODE_OFF:
217 case MIPI_DSI_COLOR_MODE_ON:
218 case MIPI_DSI_SHUTDOWN_PERIPHERAL:
219 case MIPI_DSI_TURN_ON_PERIPHERAL:
220 case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
221 case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
222 case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
223 case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
224 case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
225 case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
226 case MIPI_DSI_DCS_SHORT_WRITE:
227 case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
228 case MIPI_DSI_DCS_READ:
229 case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
230 return true;
231 }
232
233 return false;
234}
235EXPORT_SYMBOL(mipi_dsi_packet_format_is_short);
236
237/**
238 * mipi_dsi_packet_format_is_long - check if a packet is of the long format
239 * @type: MIPI DSI data type of the packet
240 *
241 * Return: true if the packet for the given data type is a long packet, false
242 * otherwise.
243 */
244bool mipi_dsi_packet_format_is_long(u8 type)
245{
246 switch (type) {
247 case MIPI_DSI_NULL_PACKET:
248 case MIPI_DSI_BLANKING_PACKET:
249 case MIPI_DSI_GENERIC_LONG_WRITE:
250 case MIPI_DSI_DCS_LONG_WRITE:
251 case MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20:
252 case MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24:
253 case MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16:
254 case MIPI_DSI_PACKED_PIXEL_STREAM_30:
255 case MIPI_DSI_PACKED_PIXEL_STREAM_36:
256 case MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12:
257 case MIPI_DSI_PACKED_PIXEL_STREAM_16:
258 case MIPI_DSI_PACKED_PIXEL_STREAM_18:
259 case MIPI_DSI_PIXEL_STREAM_3BYTE_18:
260 case MIPI_DSI_PACKED_PIXEL_STREAM_24:
261 return true;
262 }
263
264 return false;
265}
266EXPORT_SYMBOL(mipi_dsi_packet_format_is_long);
267
268/**
202 * mipi_dsi_dcs_write - send DCS write command 269 * mipi_dsi_dcs_write - send DCS write command
203 * @dsi: DSI device 270 * @dsi: DSI device
204 * @data: pointer to the command followed by parameters 271 * @data: pointer to the command followed by parameters