Loading...
Note: File does not exist in v3.1.
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
4 */
5
6#ifndef _DP_LINK_H_
7#define _DP_LINK_H_
8
9#include "dp_aux.h"
10
11#define DS_PORT_STATUS_CHANGED 0x200
12#define DP_TEST_BIT_DEPTH_UNKNOWN 0xFFFFFFFF
13#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
14
15struct msm_dp_link_info {
16 unsigned char revision;
17 unsigned int rate;
18 unsigned int num_lanes;
19 unsigned long capabilities;
20};
21
22#define DP_TRAIN_LEVEL_MAX 3
23
24struct msm_dp_link_test_video {
25 u32 test_video_pattern;
26 u32 test_bit_depth;
27 u32 test_dyn_range;
28 u32 test_h_total;
29 u32 test_v_total;
30 u32 test_h_start;
31 u32 test_v_start;
32 u32 test_hsync_pol;
33 u32 test_hsync_width;
34 u32 test_vsync_pol;
35 u32 test_vsync_width;
36 u32 test_h_width;
37 u32 test_v_height;
38 u32 test_rr_d;
39 u32 test_rr_n;
40};
41
42struct msm_dp_link_test_audio {
43 u32 test_audio_sampling_rate;
44 u32 test_audio_channel_count;
45 u32 test_audio_pattern_type;
46 u32 test_audio_period_ch_1;
47 u32 test_audio_period_ch_2;
48 u32 test_audio_period_ch_3;
49 u32 test_audio_period_ch_4;
50 u32 test_audio_period_ch_5;
51 u32 test_audio_period_ch_6;
52 u32 test_audio_period_ch_7;
53 u32 test_audio_period_ch_8;
54};
55
56struct msm_dp_link_phy_params {
57 u32 phy_test_pattern_sel;
58 u8 v_level;
59 u8 p_level;
60};
61
62struct msm_dp_link {
63 u32 sink_request;
64 u32 test_response;
65
66 u8 sink_count;
67 struct msm_dp_link_test_video test_video;
68 struct msm_dp_link_test_audio test_audio;
69 struct msm_dp_link_phy_params phy_params;
70 struct msm_dp_link_info link_params;
71};
72
73/**
74 * mdss_dp_test_bit_depth_to_bpp() - convert test bit depth to bpp
75 * @tbd: test bit depth
76 *
77 * Returns the bits per pixel (bpp) to be used corresponding to the
78 * git bit depth value. This function assumes that bit depth has
79 * already been validated.
80 */
81static inline u32 msm_dp_link_bit_depth_to_bpp(u32 tbd)
82{
83 /*
84 * Few simplistic rules and assumptions made here:
85 * 1. Bit depth is per color component
86 * 2. If bit depth is unknown return 0
87 * 3. Assume 3 color components
88 */
89 switch (tbd) {
90 case DP_TEST_BIT_DEPTH_6:
91 return 18;
92 case DP_TEST_BIT_DEPTH_8:
93 return 24;
94 case DP_TEST_BIT_DEPTH_10:
95 return 30;
96 case DP_TEST_BIT_DEPTH_UNKNOWN:
97 default:
98 return 0;
99 }
100}
101
102void msm_dp_link_reset_phy_params_vx_px(struct msm_dp_link *msm_dp_link);
103u32 msm_dp_link_get_test_bits_depth(struct msm_dp_link *msm_dp_link, u32 bpp);
104int msm_dp_link_process_request(struct msm_dp_link *msm_dp_link);
105int msm_dp_link_get_colorimetry_config(struct msm_dp_link *msm_dp_link);
106int msm_dp_link_adjust_levels(struct msm_dp_link *msm_dp_link, u8 *link_status);
107bool msm_dp_link_send_test_response(struct msm_dp_link *msm_dp_link);
108int msm_dp_link_psm_config(struct msm_dp_link *msm_dp_link,
109 struct msm_dp_link_info *link_info, bool enable);
110bool msm_dp_link_send_edid_checksum(struct msm_dp_link *msm_dp_link, u8 checksum);
111
112/**
113 * msm_dp_link_get() - get the functionalities of dp test module
114 *
115 *
116 * return: a pointer to msm_dp_link struct
117 */
118struct msm_dp_link *msm_dp_link_get(struct device *dev, struct drm_dp_aux *aux);
119
120#endif /* _DP_LINK_H_ */