xref: /linux/drivers/gpu/drm/msm/dp/dp_utils.h (revision 4b911a9690d72641879ea6d13cce1de31d346d79)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2024, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _DP_UTILS_H_
7 #define _DP_UTILS_H_
8 
9 #include <linux/bitfield.h>
10 #include <linux/bits.h>
11 #include <drm/display/drm_dp_helper.h>
12 
13 #define HEADER_BYTE_0_BIT	 0
14 #define PARITY_BYTE_0_BIT	 8
15 #define HEADER_BYTE_1_BIT	16
16 #define PARITY_BYTE_1_BIT	24
17 #define HEADER_BYTE_2_BIT	 0
18 #define PARITY_BYTE_2_BIT	 8
19 #define HEADER_BYTE_3_BIT	16
20 #define PARITY_BYTE_3_BIT	24
21 
22 #define HEADER_0_MASK	    GENMASK(7, 0)
23 #define PARITY_0_MASK	    GENMASK(15, 8)
24 #define HEADER_1_MASK	    GENMASK(23, 16)
25 #define PARITY_1_MASK	    GENMASK(31, 24)
26 #define HEADER_2_MASK	    GENMASK(7, 0)
27 #define PARITY_2_MASK	    GENMASK(15, 8)
28 #define HEADER_3_MASK	    GENMASK(23, 16)
29 #define PARITY_3_MASK	    GENMASK(31, 24)
30 
31 u8 dp_utils_get_g0_value(u8 data);
32 u8 dp_utils_get_g1_value(u8 data);
33 u8 dp_utils_calculate_parity(u32 data);
34 ssize_t dp_utils_pack_sdp_header(struct dp_sdp_header *sdp_header, u32 *header_buff);
35 
36 #endif /* _DP_UTILS_H_ */
37