aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-08-06 15:32:14 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-08 08:04:45 -0400
commit72b098964d3c3fb030dcac2d4c869c9851a0d17a (patch)
tree12a53e67bc5563db2d91f0d89c788b2daa9bfd78 /drivers/video
parent3c6b054de1c0243a0f708abf337f2a0e270ce247 (diff)
video/hdmi: Introduce a generic hdmi_infoframe union
And a way to pack hdmi_infoframe generically. Cc: Thierry Reding <thierry.reding@avionic-design.de> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Dave Airlie <airlied@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/hdmi.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index dbd882ffafbb..f7a85e5b7370 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/bug.h>
25#include <linux/errno.h> 26#include <linux/errno.h>
26#include <linux/export.h> 27#include <linux/export.h>
27#include <linux/hdmi.h> 28#include <linux/hdmi.h>
@@ -321,3 +322,45 @@ ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame,
321 return length; 322 return length;
322} 323}
323EXPORT_SYMBOL(hdmi_vendor_infoframe_pack); 324EXPORT_SYMBOL(hdmi_vendor_infoframe_pack);
325
326/**
327 * hdmi_infoframe_pack() - write a HDMI infoframe to binary buffer
328 * @frame: HDMI infoframe
329 * @buffer: destination buffer
330 * @size: size of buffer
331 *
332 * Packs the information contained in the @frame structure into a binary
333 * representation that can be written into the corresponding controller
334 * registers. Also computes the checksum as required by section 5.3.5 of
335 * the HDMI 1.4 specification.
336 *
337 * Returns the number of bytes packed into the binary buffer or a negative
338 * error code on failure.
339 */
340ssize_t
341hdmi_infoframe_pack(union hdmi_infoframe *frame, void *buffer, size_t size)
342{
343 ssize_t length;
344
345 switch (frame->any.type) {
346 case HDMI_INFOFRAME_TYPE_AVI:
347 length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size);
348 break;
349 case HDMI_INFOFRAME_TYPE_SPD:
350 length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size);
351 break;
352 case HDMI_INFOFRAME_TYPE_AUDIO:
353 length = hdmi_audio_infoframe_pack(&frame->audio, buffer, size);
354 break;
355 case HDMI_INFOFRAME_TYPE_VENDOR:
356 length = hdmi_vendor_infoframe_pack(&frame->vendor,
357 buffer, size);
358 break;
359 default:
360 WARN(1, "Bad infoframe type %d\n", frame->any.type);
361 length = -EINVAL;
362 }
363
364 return length;
365}
366EXPORT_SYMBOL(hdmi_infoframe_pack);