// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #define pr_fmt(fmt) … #include <drm/drm_print.h> #include "dp_reg.h" #include "dp_link.h" #include "dp_panel.h" #define DP_TEST_REQUEST_MASK … enum audio_sample_rate { … }; enum audio_pattern_type { … }; struct dp_link_request { … }; struct dp_link_private { … }; static int dp_aux_link_power_up(struct drm_dp_aux *aux, struct dp_link_info *link) { … } static int dp_aux_link_power_down(struct drm_dp_aux *aux, struct dp_link_info *link) { … } static int dp_link_get_period(struct dp_link_private *link, int const addr) { … } static int dp_link_parse_audio_channel_period(struct dp_link_private *link) { … } static int dp_link_parse_audio_pattern_type(struct dp_link_private *link) { … } static int dp_link_parse_audio_mode(struct dp_link_private *link) { … } static int dp_link_parse_audio_pattern_params(struct dp_link_private *link) { … } static bool dp_link_is_video_pattern_valid(u32 pattern) { … } /** * dp_link_is_bit_depth_valid() - validates the bit depth requested * @tbd: bit depth requested by the sink * * Returns true if the requested bit depth is supported. */ static bool dp_link_is_bit_depth_valid(u32 tbd) { … } static int dp_link_parse_timing_params1(struct dp_link_private *link, int addr, int len, u32 *val) { … } static int dp_link_parse_timing_params2(struct dp_link_private *link, int addr, int len, u32 *val1, u32 *val2) { … } static int dp_link_parse_timing_params3(struct dp_link_private *link, int addr, u32 *val) { … } /** * dp_link_parse_video_pattern_params() - parses video pattern parameters from DPCD * @link: Display Port Driver data * * Returns 0 if it successfully parses the video link pattern and the link * bit depth requested by the sink and, and if the values parsed are valid. */ static int dp_link_parse_video_pattern_params(struct dp_link_private *link) { … } /** * dp_link_parse_link_training_params() - parses link training parameters from * DPCD * @link: Display Port Driver data * * Returns 0 if it successfully parses the link rate (Byte 0x219) and lane * count (Byte 0x220), and if these values parse are valid. */ static int dp_link_parse_link_training_params(struct dp_link_private *link) { … } /** * dp_link_parse_phy_test_params() - parses the phy link parameters * @link: Display Port Driver data * * Parses the DPCD (Byte 0x248) for the DP PHY link pattern that is being * requested. */ static int dp_link_parse_phy_test_params(struct dp_link_private *link) { … } /** * dp_link_is_video_audio_test_requested() - checks for audio/video link request * @link: link requested by the sink * * Returns true if the requested link is a permitted audio/video link. */ static bool dp_link_is_video_audio_test_requested(u32 link) { … } /** * dp_link_parse_request() - parses link request parameters from sink * @link: Display Port Driver data * * Parses the DPCD to check if an automated link is requested (Byte 0x201), * and what type of link automation is being requested (Byte 0x218). */ static int dp_link_parse_request(struct dp_link_private *link) { … } static int dp_link_parse_sink_status_field(struct dp_link_private *link) { … } /** * dp_link_process_link_training_request() - processes new training requests * @link: Display Port link data * * This function will handle new link training requests that are initiated by * the sink. In particular, it will update the requested lane count and link * rate, and then trigger the link retraining procedure. * * The function will return 0 if a link training request has been processed, * otherwise it will return -EINVAL. */ static int dp_link_process_link_training_request(struct dp_link_private *link) { … } bool dp_link_send_test_response(struct dp_link *dp_link) { … } int dp_link_psm_config(struct dp_link *dp_link, struct dp_link_info *link_info, bool enable) { … } bool dp_link_send_edid_checksum(struct dp_link *dp_link, u8 checksum) { … } static void dp_link_parse_vx_px(struct dp_link_private *link) { … } /** * dp_link_process_phy_test_pattern_request() - process new phy link requests * @link: Display Port Driver data * * This function will handle new phy link pattern requests that are initiated * by the sink. The function will return 0 if a phy link pattern has been * processed, otherwise it will return -EINVAL. */ static int dp_link_process_phy_test_pattern_request( struct dp_link_private *link) { … } static bool dp_link_read_psr_error_status(struct dp_link_private *link) { … } static bool dp_link_psr_capability_changed(struct dp_link_private *link) { … } static u8 get_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r) { … } /** * dp_link_process_link_status_update() - processes link status updates * @link: Display Port link module data * * This function will check for changes in the link status, e.g. clock * recovery done on all lanes, and trigger link training if there is a * failure/error on the link. * * The function will return 0 if the a link status update has been processed, * otherwise it will return -EINVAL. */ static int dp_link_process_link_status_update(struct dp_link_private *link) { … } /** * dp_link_process_ds_port_status_change() - process port status changes * @link: Display Port Driver data * * This function will handle downstream port updates that are initiated by * the sink. If the downstream port status has changed, the EDID is read via * AUX. * * The function will return 0 if a downstream port update has been * processed, otherwise it will return -EINVAL. */ static int dp_link_process_ds_port_status_change(struct dp_link_private *link) { … } static bool dp_link_is_video_pattern_requested(struct dp_link_private *link) { … } static bool dp_link_is_audio_pattern_requested(struct dp_link_private *link) { … } static void dp_link_reset_data(struct dp_link_private *link) { … } /** * dp_link_process_request() - handle HPD IRQ transition to HIGH * @dp_link: pointer to link module data * * This function will handle the HPD IRQ state transitions from LOW to HIGH * (including cases when there are back to back HPD IRQ HIGH) indicating * the start of a new link training request or sink status update. */ int dp_link_process_request(struct dp_link *dp_link) { … } int dp_link_get_colorimetry_config(struct dp_link *dp_link) { … } int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status) { … } void dp_link_reset_phy_params_vx_px(struct dp_link *dp_link) { … } u32 dp_link_get_test_bits_depth(struct dp_link *dp_link, u32 bpp) { … } struct dp_link *dp_link_get(struct device *dev, struct drm_dp_aux *aux) { … }