1 // SPDX-License-Identifier: GPL-2.0
4 void pack_hdmi_infoframe(struct packed_hdmi_infoframe
*packed_frame
,
5 u8
*raw_frame
, ssize_t len
)
11 u32 subpack1_high
= 0;
15 * "When in doubt, use brute force."
20 * We presume that no valid frame is longer than 17
21 * octets, including header... And truncate to that
25 subpack1_high
= (raw_frame
[16] << 16);
27 subpack1_high
|= (raw_frame
[15] << 8);
29 subpack1_high
|= raw_frame
[14];
31 subpack1_low
= (raw_frame
[13] << 24);
33 subpack1_low
|= (raw_frame
[12] << 16);
35 subpack1_low
|= (raw_frame
[11] << 8);
37 subpack1_low
|= raw_frame
[10];
39 subpack0_high
= (raw_frame
[9] << 16);
41 subpack0_high
|= (raw_frame
[8] << 8);
43 subpack0_high
|= raw_frame
[7];
45 subpack0_low
= (raw_frame
[6] << 24);
47 subpack0_low
|= (raw_frame
[5] << 16);
49 subpack0_low
|= (raw_frame
[4] << 8);
51 subpack0_low
|= raw_frame
[3];
53 header
= (raw_frame
[2] << 16);
55 header
|= (raw_frame
[1] << 8);
57 header
|= raw_frame
[0];
62 packed_frame
->header
= header
;
63 packed_frame
->subpack0_low
= subpack0_low
;
64 packed_frame
->subpack0_high
= subpack0_high
;
65 packed_frame
->subpack1_low
= subpack1_low
;
66 packed_frame
->subpack1_high
= subpack1_high
;