1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 4 */ 5 6 #ifndef _DP_CATALOG_H_ 7 #define _DP_CATALOG_H_ 8 9 #include <drm/drm_modes.h> 10 11 #include "dp_utils.h" 12 #include "disp/msm_disp_snapshot.h" 13 14 /* interrupts */ 15 #define DP_INTR_HPD BIT(0) 16 #define DP_INTR_AUX_XFER_DONE BIT(3) 17 #define DP_INTR_WRONG_ADDR BIT(6) 18 #define DP_INTR_TIMEOUT BIT(9) 19 #define DP_INTR_NACK_DEFER BIT(12) 20 #define DP_INTR_WRONG_DATA_CNT BIT(15) 21 #define DP_INTR_I2C_NACK BIT(18) 22 #define DP_INTR_I2C_DEFER BIT(21) 23 #define DP_INTR_PLL_UNLOCKED BIT(24) 24 #define DP_INTR_AUX_ERROR BIT(27) 25 26 #define DP_INTR_READY_FOR_VIDEO BIT(0) 27 #define DP_INTR_IDLE_PATTERN_SENT BIT(3) 28 #define DP_INTR_FRAME_END BIT(6) 29 #define DP_INTR_CRC_UPDATED BIT(9) 30 31 #define DP_HW_VERSION_1_0 0x10000000 32 #define DP_HW_VERSION_1_2 0x10020000 33 34 struct msm_dp_catalog { 35 bool wide_bus_en; 36 }; 37 38 /* Debug module */ 39 void msm_dp_catalog_snapshot(struct msm_dp_catalog *msm_dp_catalog, struct msm_disp_state *disp_state); 40 41 /* AUX APIs */ 42 u32 msm_dp_catalog_aux_read_data(struct msm_dp_catalog *msm_dp_catalog); 43 int msm_dp_catalog_aux_write_data(struct msm_dp_catalog *msm_dp_catalog, u32 data); 44 int msm_dp_catalog_aux_write_trans(struct msm_dp_catalog *msm_dp_catalog, u32 data); 45 int msm_dp_catalog_aux_clear_trans(struct msm_dp_catalog *msm_dp_catalog, bool read); 46 int msm_dp_catalog_aux_clear_hw_interrupts(struct msm_dp_catalog *msm_dp_catalog); 47 void msm_dp_catalog_aux_reset(struct msm_dp_catalog *msm_dp_catalog); 48 void msm_dp_catalog_aux_enable(struct msm_dp_catalog *msm_dp_catalog, bool enable); 49 int msm_dp_catalog_aux_wait_for_hpd_connect_state(struct msm_dp_catalog *msm_dp_catalog, 50 unsigned long wait_us); 51 u32 msm_dp_catalog_aux_get_irq(struct msm_dp_catalog *msm_dp_catalog); 52 53 /* DP Controller APIs */ 54 void msm_dp_catalog_ctrl_state_ctrl(struct msm_dp_catalog *msm_dp_catalog, u32 state); 55 void msm_dp_catalog_ctrl_config_ctrl(struct msm_dp_catalog *msm_dp_catalog, u32 config); 56 void msm_dp_catalog_ctrl_lane_mapping(struct msm_dp_catalog *msm_dp_catalog); 57 void msm_dp_catalog_ctrl_mainlink_ctrl(struct msm_dp_catalog *msm_dp_catalog, bool enable); 58 void msm_dp_catalog_ctrl_psr_mainlink_enable(struct msm_dp_catalog *msm_dp_catalog, bool enable); 59 void msm_dp_catalog_setup_peripheral_flush(struct msm_dp_catalog *msm_dp_catalog); 60 void msm_dp_catalog_ctrl_config_misc(struct msm_dp_catalog *msm_dp_catalog, u32 cc, u32 tb); 61 void msm_dp_catalog_ctrl_config_msa(struct msm_dp_catalog *msm_dp_catalog, u32 rate, 62 u32 stream_rate_khz, bool is_ycbcr_420); 63 int msm_dp_catalog_ctrl_set_pattern_state_bit(struct msm_dp_catalog *msm_dp_catalog, u32 pattern); 64 u32 msm_dp_catalog_hw_revision(const struct msm_dp_catalog *msm_dp_catalog); 65 void msm_dp_catalog_ctrl_reset(struct msm_dp_catalog *msm_dp_catalog); 66 bool msm_dp_catalog_ctrl_mainlink_ready(struct msm_dp_catalog *msm_dp_catalog); 67 void msm_dp_catalog_ctrl_enable_irq(struct msm_dp_catalog *msm_dp_catalog, bool enable); 68 void msm_dp_catalog_hpd_config_intr(struct msm_dp_catalog *msm_dp_catalog, 69 u32 intr_mask, bool en); 70 void msm_dp_catalog_ctrl_hpd_enable(struct msm_dp_catalog *msm_dp_catalog); 71 void msm_dp_catalog_ctrl_hpd_disable(struct msm_dp_catalog *msm_dp_catalog); 72 void msm_dp_catalog_ctrl_config_psr(struct msm_dp_catalog *msm_dp_catalog); 73 void msm_dp_catalog_ctrl_set_psr(struct msm_dp_catalog *msm_dp_catalog, bool enter); 74 u32 msm_dp_catalog_link_is_connected(struct msm_dp_catalog *msm_dp_catalog); 75 u32 msm_dp_catalog_hpd_get_intr_status(struct msm_dp_catalog *msm_dp_catalog); 76 void msm_dp_catalog_ctrl_phy_reset(struct msm_dp_catalog *msm_dp_catalog); 77 int msm_dp_catalog_ctrl_get_interrupt(struct msm_dp_catalog *msm_dp_catalog); 78 u32 msm_dp_catalog_ctrl_read_psr_interrupt_status(struct msm_dp_catalog *msm_dp_catalog); 79 void msm_dp_catalog_ctrl_update_transfer_unit(struct msm_dp_catalog *msm_dp_catalog, 80 u32 msm_dp_tu, u32 valid_boundary, 81 u32 valid_boundary2); 82 void msm_dp_catalog_ctrl_send_phy_pattern(struct msm_dp_catalog *msm_dp_catalog, 83 u32 pattern); 84 u32 msm_dp_catalog_ctrl_read_phy_pattern(struct msm_dp_catalog *msm_dp_catalog); 85 86 /* DP Panel APIs */ 87 int msm_dp_catalog_panel_timing_cfg(struct msm_dp_catalog *msm_dp_catalog, u32 total, 88 u32 sync_start, u32 width_blanking, u32 msm_dp_active); 89 void msm_dp_catalog_panel_enable_vsc_sdp(struct msm_dp_catalog *msm_dp_catalog, struct dp_sdp *vsc_sdp); 90 void msm_dp_catalog_panel_disable_vsc_sdp(struct msm_dp_catalog *msm_dp_catalog); 91 void msm_dp_catalog_panel_tpg_enable(struct msm_dp_catalog *msm_dp_catalog, 92 struct drm_display_mode *drm_mode); 93 void msm_dp_catalog_panel_tpg_disable(struct msm_dp_catalog *msm_dp_catalog); 94 95 struct msm_dp_catalog *msm_dp_catalog_get(struct device *dev); 96 97 /* DP Audio APIs */ 98 void msm_dp_catalog_write_audio_stream(struct msm_dp_catalog *msm_dp_catalog, 99 struct dp_sdp_header *sdp_hdr); 100 void msm_dp_catalog_write_audio_timestamp(struct msm_dp_catalog *msm_dp_catalog, 101 struct dp_sdp_header *sdp_hdr); 102 void msm_dp_catalog_write_audio_infoframe(struct msm_dp_catalog *msm_dp_catalog, 103 struct dp_sdp_header *sdp_hdr); 104 void msm_dp_catalog_write_audio_copy_mgmt(struct msm_dp_catalog *msm_dp_catalog, 105 struct dp_sdp_header *sdp_hdr); 106 void msm_dp_catalog_write_audio_isrc(struct msm_dp_catalog *msm_dp_catalog, 107 struct dp_sdp_header *sdp_hdr); 108 void msm_dp_catalog_audio_config_acr(struct msm_dp_catalog *catalog, u32 select); 109 void msm_dp_catalog_audio_enable(struct msm_dp_catalog *catalog, bool enable); 110 void msm_dp_catalog_audio_config_sdp(struct msm_dp_catalog *catalog); 111 void msm_dp_catalog_audio_sfe_level(struct msm_dp_catalog *catalog, u32 safe_to_exit_level); 112 113 #endif /* _DP_CATALOG_H_ */ 114