Lines Matching +full:4 +full:- +full:switch

17  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
44 return 256 - csum; in hdmi_infoframe_checksum()
55 * hdmi_avi_infoframe_init() - initialize an HDMI AVI infoframe
64 frame->type = HDMI_INFOFRAME_TYPE_AVI; in hdmi_avi_infoframe_init()
65 frame->version = 2; in hdmi_avi_infoframe_init()
66 frame->length = HDMI_AVI_INFOFRAME_SIZE; in hdmi_avi_infoframe_init()
73 * hdmi_avi_infoframe_pack() - write HDMI AVI infoframe to binary buffer
92 length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; in hdmi_avi_infoframe_pack()
95 return -ENOSPC; in hdmi_avi_infoframe_pack()
99 ptr[0] = frame->type; in hdmi_avi_infoframe_pack()
100 ptr[1] = frame->version; in hdmi_avi_infoframe_pack()
101 ptr[2] = frame->length; in hdmi_avi_infoframe_pack()
107 ptr[0] = ((frame->colorspace & 0x3) << 5) | (frame->scan_mode & 0x3); in hdmi_avi_infoframe_pack()
110 * Data byte 1, bit 4 has to be set if we provide the active format in hdmi_avi_infoframe_pack()
113 if (frame->active_aspect & 0xf) in hdmi_avi_infoframe_pack()
114 ptr[0] |= BIT(4); in hdmi_avi_infoframe_pack()
117 if (frame->top_bar || frame->bottom_bar) in hdmi_avi_infoframe_pack()
120 if (frame->left_bar || frame->right_bar) in hdmi_avi_infoframe_pack()
123 ptr[1] = ((frame->colorimetry & 0x3) << 6) | in hdmi_avi_infoframe_pack()
124 ((frame->picture_aspect & 0x3) << 4) | in hdmi_avi_infoframe_pack()
125 (frame->active_aspect & 0xf); in hdmi_avi_infoframe_pack()
127 ptr[2] = ((frame->extended_colorimetry & 0x7) << 4) | in hdmi_avi_infoframe_pack()
128 ((frame->quantization_range & 0x3) << 2) | in hdmi_avi_infoframe_pack()
129 (frame->nups & 0x3); in hdmi_avi_infoframe_pack()
131 if (frame->itc) in hdmi_avi_infoframe_pack()
134 ptr[3] = frame->video_code & 0x7f; in hdmi_avi_infoframe_pack()
136 ptr[4] = ((frame->ycc_quantization_range & 0x3) << 6) | in hdmi_avi_infoframe_pack()
137 ((frame->content_type & 0x3) << 4) | in hdmi_avi_infoframe_pack()
138 (frame->pixel_repeat & 0xf); in hdmi_avi_infoframe_pack()
140 ptr[5] = frame->top_bar & 0xff; in hdmi_avi_infoframe_pack()
141 ptr[6] = (frame->top_bar >> 8) & 0xff; in hdmi_avi_infoframe_pack()
142 ptr[7] = frame->bottom_bar & 0xff; in hdmi_avi_infoframe_pack()
143 ptr[8] = (frame->bottom_bar >> 8) & 0xff; in hdmi_avi_infoframe_pack()
144 ptr[9] = frame->left_bar & 0xff; in hdmi_avi_infoframe_pack()
145 ptr[10] = (frame->left_bar >> 8) & 0xff; in hdmi_avi_infoframe_pack()
146 ptr[11] = frame->right_bar & 0xff; in hdmi_avi_infoframe_pack()
147 ptr[12] = (frame->right_bar >> 8) & 0xff; in hdmi_avi_infoframe_pack()
156 * hdmi_spd_infoframe_init() - initialize an HDMI SPD infoframe
168 frame->type = HDMI_INFOFRAME_TYPE_SPD; in hdmi_spd_infoframe_init()
169 frame->version = 1; in hdmi_spd_infoframe_init()
170 frame->length = HDMI_SPD_INFOFRAME_SIZE; in hdmi_spd_infoframe_init()
172 strncpy(frame->vendor, vendor, sizeof(frame->vendor)); in hdmi_spd_infoframe_init()
173 strncpy(frame->product, product, sizeof(frame->product)); in hdmi_spd_infoframe_init()
180 * hdmi_spd_infoframe_pack() - write HDMI SPD infoframe to binary buffer
199 length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; in hdmi_spd_infoframe_pack()
202 return -ENOSPC; in hdmi_spd_infoframe_pack()
206 ptr[0] = frame->type; in hdmi_spd_infoframe_pack()
207 ptr[1] = frame->version; in hdmi_spd_infoframe_pack()
208 ptr[2] = frame->length; in hdmi_spd_infoframe_pack()
214 memcpy(ptr, frame->vendor, sizeof(frame->vendor)); in hdmi_spd_infoframe_pack()
215 memcpy(ptr + 8, frame->product, sizeof(frame->product)); in hdmi_spd_infoframe_pack()
217 ptr[24] = frame->sdi; in hdmi_spd_infoframe_pack()
226 * hdmi_audio_infoframe_init() - initialize an HDMI audio infoframe
235 frame->type = HDMI_INFOFRAME_TYPE_AUDIO; in hdmi_audio_infoframe_init()
236 frame->version = 1; in hdmi_audio_infoframe_init()
237 frame->length = HDMI_AUDIO_INFOFRAME_SIZE; in hdmi_audio_infoframe_init()
244 * hdmi_audio_infoframe_pack() - write HDMI audio infoframe to binary buffer
264 length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; in hdmi_audio_infoframe_pack()
267 return -ENOSPC; in hdmi_audio_infoframe_pack()
271 if (frame->channels >= 2) in hdmi_audio_infoframe_pack()
272 channels = frame->channels - 1; in hdmi_audio_infoframe_pack()
276 ptr[0] = frame->type; in hdmi_audio_infoframe_pack()
277 ptr[1] = frame->version; in hdmi_audio_infoframe_pack()
278 ptr[2] = frame->length; in hdmi_audio_infoframe_pack()
284 ptr[0] = ((frame->coding_type & 0xf) << 4) | (channels & 0x7); in hdmi_audio_infoframe_pack()
285 ptr[1] = ((frame->sample_frequency & 0x7) << 2) | in hdmi_audio_infoframe_pack()
286 (frame->sample_size & 0x3); in hdmi_audio_infoframe_pack()
287 ptr[2] = frame->coding_type_ext & 0x1f; in hdmi_audio_infoframe_pack()
288 ptr[3] = frame->channel_allocation; in hdmi_audio_infoframe_pack()
289 ptr[4] = (frame->level_shift_value & 0xf) << 3; in hdmi_audio_infoframe_pack()
291 if (frame->downmix_inhibit) in hdmi_audio_infoframe_pack()
292 ptr[4] |= BIT(7); in hdmi_audio_infoframe_pack()
301 * hdmi_vendor_infoframe_init() - initialize an HDMI vendor infoframe
310 frame->type = HDMI_INFOFRAME_TYPE_VENDOR; in hdmi_vendor_infoframe_init()
311 frame->version = 1; in hdmi_vendor_infoframe_init()
313 frame->oui = HDMI_IEEE_OUI; in hdmi_vendor_infoframe_init()
319 frame->s3d_struct = HDMI_3D_STRUCTURE_INVALID; in hdmi_vendor_infoframe_init()
326 * hdmi_vendor_infoframe_pack() - write a HDMI vendor infoframe to binary buffer
346 if (frame->vic == 0 && frame->s3d_struct == HDMI_3D_STRUCTURE_INVALID) in hdmi_vendor_infoframe_pack()
347 return -EINVAL; in hdmi_vendor_infoframe_pack()
350 if (frame->vic != 0 && frame->s3d_struct != HDMI_3D_STRUCTURE_INVALID) in hdmi_vendor_infoframe_pack()
351 return -EINVAL; in hdmi_vendor_infoframe_pack()
354 if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) in hdmi_vendor_infoframe_pack()
355 frame->length = 6; in hdmi_vendor_infoframe_pack()
357 frame->length = 5; in hdmi_vendor_infoframe_pack()
359 length = HDMI_INFOFRAME_HEADER_SIZE + frame->length; in hdmi_vendor_infoframe_pack()
362 return -ENOSPC; in hdmi_vendor_infoframe_pack()
366 ptr[0] = frame->type; in hdmi_vendor_infoframe_pack()
367 ptr[1] = frame->version; in hdmi_vendor_infoframe_pack()
368 ptr[2] = frame->length; in hdmi_vendor_infoframe_pack()
372 ptr[4] = 0x03; in hdmi_vendor_infoframe_pack()
376 if (frame->vic) { in hdmi_vendor_infoframe_pack()
378 ptr[8] = frame->vic; in hdmi_vendor_infoframe_pack()
381 ptr[8] = (frame->s3d_struct & 0xf) << 4; in hdmi_vendor_infoframe_pack()
382 if (frame->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) in hdmi_vendor_infoframe_pack()
383 ptr[9] = (frame->s3d_ext_data & 0xf) << 4; in hdmi_vendor_infoframe_pack()
393 * hdmi_vendor_any_infoframe_pack() - write a vendor infoframe to binary buffer
400 if (frame->any.oui != HDMI_IEEE_OUI) in hdmi_vendor_any_infoframe_pack()
401 return -EINVAL; in hdmi_vendor_any_infoframe_pack()
403 return hdmi_vendor_infoframe_pack(&frame->hdmi, buffer, size); in hdmi_vendor_any_infoframe_pack()
407 * hdmi_infoframe_pack() - write a HDMI infoframe to binary buffer
425 switch (frame->any.type) { in hdmi_infoframe_pack()
427 length = hdmi_avi_infoframe_pack(&frame->avi, buffer, size); in hdmi_infoframe_pack()
430 length = hdmi_spd_infoframe_pack(&frame->spd, buffer, size); in hdmi_infoframe_pack()
433 length = hdmi_audio_infoframe_pack(&frame->audio, buffer, size); in hdmi_infoframe_pack()
436 length = hdmi_vendor_any_infoframe_pack(&frame->vendor, in hdmi_infoframe_pack()
440 printf("Bad infoframe type %d\n", frame->any.type); in hdmi_infoframe_pack()
441 length = -EINVAL; in hdmi_infoframe_pack()
452 switch (type) { in hdmi_infoframe_type_get_name()
468 hdmi_infoframe_type_get_name(frame->type), in hdmi_infoframe_log_header()
469 frame->version, frame->length); in hdmi_infoframe_log_header()
474 switch (colorspace) { in hdmi_colorspace_get_name()
478 return "YCbCr 4:2:2"; in hdmi_colorspace_get_name()
480 return "YCbCr 4:4:4"; in hdmi_colorspace_get_name()
482 return "YCbCr 4:2:0"; in hdmi_colorspace_get_name()
484 return "Reserved (4)"; in hdmi_colorspace_get_name()
497 switch (scan_mode) { in hdmi_scan_mode_get_name()
512 switch (colorimetry) { in hdmi_colorimetry_get_name()
528 switch (picture_aspect) { in hdmi_picture_aspect_get_name()
532 return "4:3"; in hdmi_picture_aspect_get_name()
547 switch (active_aspect) { in hdmi_active_aspect_get_name()
557 return "4:3"; in hdmi_active_aspect_get_name()
563 return "4:3 SP 14:9"; in hdmi_active_aspect_get_name()
567 return "16:9 SP 4:3"; in hdmi_active_aspect_get_name()
575 switch (ext_col) { in hdmi_extended_colorimetry_get_name()
599 switch (qrange) { in hdmi_quantization_range_get_name()
614 switch (nups) { in hdmi_nups_get_name()
616 return "Unknown Non-uniform Scaling"; in hdmi_nups_get_name()
630 switch (qrange) { in hdmi_ycc_quantization_range_get_name()
642 switch (content_type) { in hdmi_content_type_get_name()
656 * hdmi_avi_infoframe_log() - log info of HDMI AVI infoframe
666 hdmi_colorspace_get_name(frame->colorspace)); in hdmi_avi_infoframe_log()
668 hdmi_scan_mode_get_name(frame->scan_mode)); in hdmi_avi_infoframe_log()
670 hdmi_colorimetry_get_name(frame->colorimetry)); in hdmi_avi_infoframe_log()
672 hdmi_picture_aspect_get_name(frame->picture_aspect)); in hdmi_avi_infoframe_log()
674 hdmi_active_aspect_get_name(frame->active_aspect)); in hdmi_avi_infoframe_log()
675 hdmi_log(" itc: %s\n", frame->itc ? "IT Content" : "No Data"); in hdmi_avi_infoframe_log()
677 hdmi_extended_colorimetry_get_name(frame->extended_colorimetry)); in hdmi_avi_infoframe_log()
679 hdmi_quantization_range_get_name(frame->quantization_range)); in hdmi_avi_infoframe_log()
680 hdmi_log(" nups: %s\n", hdmi_nups_get_name(frame->nups)); in hdmi_avi_infoframe_log()
681 hdmi_log(" video code: %u\n", frame->video_code); in hdmi_avi_infoframe_log()
683 hdmi_ycc_quantization_range_get_name(frame->ycc_quantization_range)); in hdmi_avi_infoframe_log()
685 hdmi_content_type_get_name(frame->content_type)); in hdmi_avi_infoframe_log()
686 hdmi_log(" pixel repeat: %u\n", frame->pixel_repeat); in hdmi_avi_infoframe_log()
688 frame->top_bar, frame->bottom_bar, in hdmi_avi_infoframe_log()
689 frame->left_bar, frame->right_bar); in hdmi_avi_infoframe_log()
695 switch (sdi) { in hdmi_spd_sdi_get_name()
703 return "D-VHS"; in hdmi_spd_sdi_get_name()
717 return "Blu-Ray Disc (BD)"; in hdmi_spd_sdi_get_name()
729 * hdmi_spd_infoframe_log() - log info of HDMI SPD infoframe
742 strncpy(buf, frame->vendor, 8); in hdmi_spd_infoframe_log()
744 strncpy(buf, frame->product, 16); in hdmi_spd_infoframe_log()
747 hdmi_spd_sdi_get_name(frame->sdi), frame->sdi); in hdmi_spd_infoframe_log()
753 switch (coding_type) { in hdmi_audio_coding_type_get_name()
759 return "AC-3"; in hdmi_audio_coding_type_get_name()
777 return "DTS-HD"; in hdmi_audio_coding_type_get_name()
793 switch (sample_size) { in hdmi_audio_sample_size_get_name()
809 switch (freq) { in hdmi_audio_sample_frequency_get_name()
834 switch (ctx) { in hdmi_audio_coding_type_ext_get_name()
844 return "MPEG-4 HE AAC"; in hdmi_audio_coding_type_ext_get_name()
846 return "MPEG-4 HE AAC v2"; in hdmi_audio_coding_type_ext_get_name()
848 return "MPEG-4 AAC LC"; in hdmi_audio_coding_type_ext_get_name()
852 return "MPEG-4 HE AAC + MPEG Surround"; in hdmi_audio_coding_type_ext_get_name()
854 return "MPEG-4 AAC LC + MPEG Surround"; in hdmi_audio_coding_type_ext_get_name()
860 * hdmi_audio_infoframe_log() - log info of HDMI AUDIO infoframe
869 if (frame->channels) in hdmi_audio_infoframe_log()
870 hdmi_log(" channels: %u\n", frame->channels - 1); in hdmi_audio_infoframe_log()
874 hdmi_audio_coding_type_get_name(frame->coding_type)); in hdmi_audio_infoframe_log()
876 hdmi_audio_sample_size_get_name(frame->sample_size)); in hdmi_audio_infoframe_log()
878 hdmi_audio_sample_frequency_get_name(frame->sample_frequency)); in hdmi_audio_infoframe_log()
880 hdmi_audio_coding_type_ext_get_name(frame->coding_type_ext)); in hdmi_audio_infoframe_log()
882 frame->channel_allocation); in hdmi_audio_infoframe_log()
884 frame->level_shift_value); in hdmi_audio_infoframe_log()
886 frame->downmix_inhibit ? "Yes" : "No"); in hdmi_audio_infoframe_log()
895 switch (s3d_struct) { in hdmi_3d_structure_get_name()
903 return "Side-by-side (Full)"; in hdmi_3d_structure_get_name()
907 return "L + Depth + Graphics + Graphics-depth"; in hdmi_3d_structure_get_name()
909 return "Top-and-Bottom"; in hdmi_3d_structure_get_name()
911 return "Side-by-side (Half)"; in hdmi_3d_structure_get_name()
919 * hdmi_vendor_infoframe_log() - log info of HDMI VENDOR infoframe
927 struct hdmi_vendor_infoframe *hvf = &frame->hdmi; in hdmi_vendor_any_infoframe_log()
931 if (frame->any.oui != HDMI_IEEE_OUI) { in hdmi_vendor_any_infoframe_log()
935 if (hvf->vic == 0 && hvf->s3d_struct == HDMI_3D_STRUCTURE_INVALID) { in hdmi_vendor_any_infoframe_log()
940 if (hvf->vic) in hdmi_vendor_any_infoframe_log()
941 hdmi_log(" HDMI VIC: %u\n", hvf->vic); in hdmi_vendor_any_infoframe_log()
942 if (hvf->s3d_struct != HDMI_3D_STRUCTURE_INVALID) { in hdmi_vendor_any_infoframe_log()
944 hdmi_3d_structure_get_name(hvf->s3d_struct)); in hdmi_vendor_any_infoframe_log()
945 if (hvf->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) in hdmi_vendor_any_infoframe_log()
947 hvf->s3d_ext_data); in hdmi_vendor_any_infoframe_log()
952 * hdmi_infoframe_log() - log info of HDMI infoframe
959 switch (frame->any.type) { in hdmi_infoframe_log()
961 hdmi_avi_infoframe_log(&frame->avi); in hdmi_infoframe_log()
964 hdmi_spd_infoframe_log(&frame->spd); in hdmi_infoframe_log()
967 hdmi_audio_infoframe_log(&frame->audio); in hdmi_infoframe_log()
970 hdmi_vendor_any_infoframe_log(&frame->vendor); in hdmi_infoframe_log()
977 * hdmi_avi_infoframe_unpack() - unpack binary buffer to a HDMI AVI infoframe
997 return -EINVAL; in hdmi_avi_infoframe_unpack()
1000 return -EINVAL; in hdmi_avi_infoframe_unpack()
1008 frame->colorspace = (ptr[0] >> 5) & 0x3; in hdmi_avi_infoframe_unpack()
1010 frame->active_aspect = ptr[1] & 0xf; in hdmi_avi_infoframe_unpack()
1012 frame->top_bar = (ptr[5] << 8) + ptr[6]; in hdmi_avi_infoframe_unpack()
1013 frame->bottom_bar = (ptr[7] << 8) + ptr[8]; in hdmi_avi_infoframe_unpack()
1016 frame->left_bar = (ptr[9] << 8) + ptr[10]; in hdmi_avi_infoframe_unpack()
1017 frame->right_bar = (ptr[11] << 8) + ptr[12]; in hdmi_avi_infoframe_unpack()
1019 frame->scan_mode = ptr[0] & 0x3; in hdmi_avi_infoframe_unpack()
1021 frame->colorimetry = (ptr[1] >> 6) & 0x3; in hdmi_avi_infoframe_unpack()
1022 frame->picture_aspect = (ptr[1] >> 4) & 0x3; in hdmi_avi_infoframe_unpack()
1023 frame->active_aspect = ptr[1] & 0xf; in hdmi_avi_infoframe_unpack()
1025 frame->itc = ptr[2] & 0x80 ? true : false; in hdmi_avi_infoframe_unpack()
1026 frame->extended_colorimetry = (ptr[2] >> 4) & 0x7; in hdmi_avi_infoframe_unpack()
1027 frame->quantization_range = (ptr[2] >> 2) & 0x3; in hdmi_avi_infoframe_unpack()
1028 frame->nups = ptr[2] & 0x3; in hdmi_avi_infoframe_unpack()
1030 frame->video_code = ptr[3] & 0x7f; in hdmi_avi_infoframe_unpack()
1031 frame->ycc_quantization_range = (ptr[4] >> 6) & 0x3; in hdmi_avi_infoframe_unpack()
1032 frame->content_type = (ptr[4] >> 4) & 0x3; in hdmi_avi_infoframe_unpack()
1034 frame->pixel_repeat = ptr[4] & 0xf; in hdmi_avi_infoframe_unpack()
1040 * hdmi_spd_infoframe_unpack() - unpack binary buffer to a HDMI SPD infoframe
1060 return -EINVAL; in hdmi_spd_infoframe_unpack()
1064 return -EINVAL; in hdmi_spd_infoframe_unpack()
1072 frame->sdi = ptr[24]; in hdmi_spd_infoframe_unpack()
1078 * hdmi_audio_infoframe_unpack() - unpack binary buffer to a HDMI AUDIO infoframe
1098 return -EINVAL; in hdmi_audio_infoframe_unpack()
1102 return -EINVAL; in hdmi_audio_infoframe_unpack()
1110 frame->channels = ptr[0] & 0x7; in hdmi_audio_infoframe_unpack()
1111 frame->coding_type = (ptr[0] >> 4) & 0xf; in hdmi_audio_infoframe_unpack()
1112 frame->sample_size = ptr[1] & 0x3; in hdmi_audio_infoframe_unpack()
1113 frame->sample_frequency = (ptr[1] >> 2) & 0x7; in hdmi_audio_infoframe_unpack()
1114 frame->coding_type_ext = ptr[2] & 0x1f; in hdmi_audio_infoframe_unpack()
1115 frame->channel_allocation = ptr[3]; in hdmi_audio_infoframe_unpack()
1116 frame->level_shift_value = (ptr[4] >> 3) & 0xf; in hdmi_audio_infoframe_unpack()
1117 frame->downmix_inhibit = ptr[4] & 0x80 ? true : false; in hdmi_audio_infoframe_unpack()
1123 * hdmi_vendor_infoframe_unpack() - unpack binary buffer to a HDMI vendor infoframe
1142 struct hdmi_vendor_infoframe *hvf = &frame->hdmi; in hdmi_vendor_any_infoframe_unpack()
1147 return -EINVAL; in hdmi_vendor_any_infoframe_unpack()
1153 return -EINVAL; in hdmi_vendor_any_infoframe_unpack()
1161 return -EINVAL; in hdmi_vendor_any_infoframe_unpack()
1166 return -EINVAL; in hdmi_vendor_any_infoframe_unpack()
1172 hvf->length = length; in hdmi_vendor_any_infoframe_unpack()
1175 hvf->vic = ptr[4]; in hdmi_vendor_any_infoframe_unpack()
1177 hvf->s3d_struct = ptr[4] >> 4; in hdmi_vendor_any_infoframe_unpack()
1178 if (hvf->s3d_struct >= HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF) { in hdmi_vendor_any_infoframe_unpack()
1180 hvf->s3d_ext_data = ptr[5] >> 4; in hdmi_vendor_any_infoframe_unpack()
1182 return -EINVAL; in hdmi_vendor_any_infoframe_unpack()
1190 * hdmi_infoframe_unpack() - unpack binary buffer to a HDMI infoframe
1206 switch (ptr[0]) { in hdmi_infoframe_unpack()
1208 ret = hdmi_avi_infoframe_unpack(&frame->avi, buffer); in hdmi_infoframe_unpack()
1211 ret = hdmi_spd_infoframe_unpack(&frame->spd, buffer); in hdmi_infoframe_unpack()
1214 ret = hdmi_audio_infoframe_unpack(&frame->audio, buffer); in hdmi_infoframe_unpack()
1217 ret = hdmi_vendor_any_infoframe_unpack(&frame->vendor, buffer); in hdmi_infoframe_unpack()
1220 ret = -EINVAL; in hdmi_infoframe_unpack()