aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorLespiau, Damien <damien.lespiau@intel.com>2013-08-19 11:59:01 -0400
committerDave Airlie <airlied@gmail.com>2013-08-29 18:41:30 -0400
commitaf3e95b40720cdf301eb85387c0a3dc4067cc551 (patch)
tree22590128866c81d879ff51ffb2d9b4d8d7d1b205 /drivers/video
parentc782d2e73d1e69c863d03945907bc7fbc879a778 (diff)
video/hdmi: Hook the HDMI vendor infoframe with the generic _pack()
With this last bit, hdmi_infoframe_pack() is now able to pack any infoframe we support. At the same time, because it's impractical to make two commits out of this, we get rid of the version that encourages the open coding of the vendor infoframe packing. We can do so because the only user of this API has been ported in: Author: Damien Lespiau <damien.lespiau@intel.com> Date: Mon Aug 12 18:08:37 2013 +0100 gpu: host1x: Port the HDMI vendor infoframe code the common helpers v2: Change oui to be an unsigned int (Ville Syrjälä) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dave Airlie <airlied@gmail.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/hdmi.c46
1 files changed, 10 insertions, 36 deletions
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 4c42bcb86535..fbccb88c2620 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -300,6 +300,8 @@ int hdmi_hdmi_infoframe_init(struct hdmi_hdmi_infoframe *frame)
300 frame->type = HDMI_INFOFRAME_TYPE_VENDOR; 300 frame->type = HDMI_INFOFRAME_TYPE_VENDOR;
301 frame->version = 1; 301 frame->version = 1;
302 302
303 frame->oui = HDMI_IDENTIFIER;
304
303 /* 305 /*
304 * 0 is a valid value for s3d_struct, so we use a special "not set" 306 * 0 is a valid value for s3d_struct, so we use a special "not set"
305 * value 307 * value
@@ -377,46 +379,18 @@ ssize_t hdmi_hdmi_infoframe_pack(struct hdmi_hdmi_infoframe *frame,
377} 379}
378EXPORT_SYMBOL(hdmi_hdmi_infoframe_pack); 380EXPORT_SYMBOL(hdmi_hdmi_infoframe_pack);
379 381
380/** 382/*
381 * hdmi_vendor_infoframe_pack() - write a HDMI vendor infoframe to binary 383 * hdmi_vendor_infoframe_pack() - write a vendor infoframe to binary buffer
382 * buffer
383 * @frame: HDMI vendor infoframe
384 * @buffer: destination buffer
385 * @size: size of buffer
386 *
387 * Packs the information contained in the @frame structure into a binary
388 * representation that can be written into the corresponding controller
389 * registers. Also computes the checksum as required by section 5.3.5 of
390 * the HDMI 1.4 specification.
391 *
392 * Returns the number of bytes packed into the binary buffer or a negative
393 * error code on failure.
394 */ 384 */
395ssize_t hdmi_vendor_infoframe_pack(struct hdmi_vendor_infoframe *frame, 385static ssize_t hdmi_vendor_infoframe_pack(union hdmi_vendor_infoframe *frame,
396 void *buffer, size_t size) 386 void *buffer, size_t size)
397{ 387{
398 u8 *ptr = buffer; 388 /* we only know about HDMI vendor infoframes */
399 size_t length; 389 if (frame->any.oui != HDMI_IDENTIFIER)
400 390 return -EINVAL;
401 length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
402
403 if (size < length)
404 return -ENOSPC;
405
406 memset(buffer, 0, size);
407
408 ptr[0] = frame->type;
409 ptr[1] = frame->version;
410 ptr[2] = frame->length;
411 ptr[3] = 0; /* checksum */
412
413 memcpy(&ptr[HDMI_INFOFRAME_HEADER_SIZE], frame->data, frame->length);
414
415 hdmi_infoframe_checksum(buffer, length);
416 391
417 return length; 392 return hdmi_hdmi_infoframe_pack(&frame->hdmi, buffer, size);
418} 393}
419EXPORT_SYMBOL(hdmi_vendor_infoframe_pack);
420 394
421/** 395/**
422 * hdmi_infoframe_pack() - write a HDMI infoframe to binary buffer 396 * hdmi_infoframe_pack() - write a HDMI infoframe to binary buffer