brintos

brintos / linux-shallow public Read only

0
0
Text · 2.9 KiB · 5846337 Raw
121 lines · c
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 0x20012#define DP_TEST_BIT_DEPTH_UNKNOWN 0xFFFFFFFF13#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)14 15struct 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	323 24struct 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 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 dp_link_phy_params {57	u32 phy_test_pattern_sel;58	u8 v_level;59	u8 p_level;60};61 62struct dp_link {63	u32 sink_request;64	u32 test_response;65 66	u8 sink_count;67	struct dp_link_test_video test_video;68	struct dp_link_test_audio test_audio;69	struct dp_link_phy_params phy_params;70	struct dp_link_info link_params;71};72 73/**74 * mdss_dp_test_bit_depth_to_bpp() - convert test bit depth to bpp75 * @tbd: test bit depth76 *77 * Returns the bits per pixel (bpp) to be used corresponding to the78 * git bit depth value. This function assumes that bit depth has79 * already been validated.80 */81static inline u32 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 component86	 *    2. If bit depth is unknown return 087	 *    3. Assume 3 color components88	 */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 dp_link_reset_phy_params_vx_px(struct dp_link *dp_link);103u32 dp_link_get_test_bits_depth(struct dp_link *dp_link, u32 bpp);104int dp_link_process_request(struct dp_link *dp_link);105int dp_link_get_colorimetry_config(struct dp_link *dp_link);106int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status);107bool dp_link_send_test_response(struct dp_link *dp_link);108int dp_link_psm_config(struct dp_link *dp_link,109		struct dp_link_info *link_info, bool enable);110bool dp_link_send_edid_checksum(struct dp_link *dp_link, u8 checksum);111 112/**113 * dp_link_get() - get the functionalities of dp test module114 *115 *116 * return: a pointer to dp_link struct117 */118struct dp_link *dp_link_get(struct device *dev, struct drm_dp_aux *aux);119 120#endif /* _DP_LINK_H_ */121