Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
0004  */
0005 
0006 #ifndef _DP_CATALOG_H_
0007 #define _DP_CATALOG_H_
0008 
0009 #include <drm/drm_modes.h>
0010 
0011 #include "dp_parser.h"
0012 #include "disp/msm_disp_snapshot.h"
0013 
0014 /* interrupts */
0015 #define DP_INTR_HPD     BIT(0)
0016 #define DP_INTR_AUX_I2C_DONE    BIT(3)
0017 #define DP_INTR_WRONG_ADDR  BIT(6)
0018 #define DP_INTR_TIMEOUT     BIT(9)
0019 #define DP_INTR_NACK_DEFER  BIT(12)
0020 #define DP_INTR_WRONG_DATA_CNT  BIT(15)
0021 #define DP_INTR_I2C_NACK    BIT(18)
0022 #define DP_INTR_I2C_DEFER   BIT(21)
0023 #define DP_INTR_PLL_UNLOCKED    BIT(24)
0024 #define DP_INTR_AUX_ERROR   BIT(27)
0025 
0026 #define DP_INTR_READY_FOR_VIDEO     BIT(0)
0027 #define DP_INTR_IDLE_PATTERN_SENT   BIT(3)
0028 #define DP_INTR_FRAME_END       BIT(6)
0029 #define DP_INTR_CRC_UPDATED     BIT(9)
0030 
0031 #define DP_AUX_CFG_MAX_VALUE_CNT 3
0032 
0033 /* PHY AUX config registers */
0034 enum dp_phy_aux_config_type {
0035     PHY_AUX_CFG0,
0036     PHY_AUX_CFG1,
0037     PHY_AUX_CFG2,
0038     PHY_AUX_CFG3,
0039     PHY_AUX_CFG4,
0040     PHY_AUX_CFG5,
0041     PHY_AUX_CFG6,
0042     PHY_AUX_CFG7,
0043     PHY_AUX_CFG8,
0044     PHY_AUX_CFG9,
0045     PHY_AUX_CFG_MAX,
0046 };
0047 
0048 enum dp_catalog_audio_sdp_type {
0049     DP_AUDIO_SDP_STREAM,
0050     DP_AUDIO_SDP_TIMESTAMP,
0051     DP_AUDIO_SDP_INFOFRAME,
0052     DP_AUDIO_SDP_COPYMANAGEMENT,
0053     DP_AUDIO_SDP_ISRC,
0054     DP_AUDIO_SDP_MAX,
0055 };
0056 
0057 enum dp_catalog_audio_header_type {
0058     DP_AUDIO_SDP_HEADER_1,
0059     DP_AUDIO_SDP_HEADER_2,
0060     DP_AUDIO_SDP_HEADER_3,
0061     DP_AUDIO_SDP_HEADER_MAX,
0062 };
0063 
0064 struct dp_catalog {
0065     u32 aux_data;
0066     u32 total;
0067     u32 sync_start;
0068     u32 width_blanking;
0069     u32 dp_active;
0070     enum dp_catalog_audio_sdp_type sdp_type;
0071     enum dp_catalog_audio_header_type sdp_header;
0072     u32 audio_data;
0073     bool wide_bus_en;
0074 };
0075 
0076 /* Debug module */
0077 void dp_catalog_snapshot(struct dp_catalog *dp_catalog, struct msm_disp_state *disp_state);
0078 
0079 /* AUX APIs */
0080 u32 dp_catalog_aux_read_data(struct dp_catalog *dp_catalog);
0081 int dp_catalog_aux_write_data(struct dp_catalog *dp_catalog);
0082 int dp_catalog_aux_write_trans(struct dp_catalog *dp_catalog);
0083 int dp_catalog_aux_clear_trans(struct dp_catalog *dp_catalog, bool read);
0084 int dp_catalog_aux_clear_hw_interrupts(struct dp_catalog *dp_catalog);
0085 void dp_catalog_aux_reset(struct dp_catalog *dp_catalog);
0086 void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable);
0087 void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog);
0088 int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog);
0089 u32 dp_catalog_aux_get_irq(struct dp_catalog *dp_catalog);
0090 
0091 /* DP Controller APIs */
0092 void dp_catalog_ctrl_state_ctrl(struct dp_catalog *dp_catalog, u32 state);
0093 void dp_catalog_ctrl_config_ctrl(struct dp_catalog *dp_catalog, u32 config);
0094 void dp_catalog_ctrl_lane_mapping(struct dp_catalog *dp_catalog);
0095 void dp_catalog_ctrl_mainlink_ctrl(struct dp_catalog *dp_catalog, bool enable);
0096 void dp_catalog_ctrl_config_misc(struct dp_catalog *dp_catalog, u32 cc, u32 tb);
0097 void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, u32 rate,
0098                 u32 stream_rate_khz, bool fixed_nvid);
0099 int dp_catalog_ctrl_set_pattern_state_bit(struct dp_catalog *dp_catalog, u32 pattern);
0100 u32 dp_catalog_hw_revision(const struct dp_catalog *dp_catalog);
0101 void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog);
0102 bool dp_catalog_ctrl_mainlink_ready(struct dp_catalog *dp_catalog);
0103 void dp_catalog_ctrl_enable_irq(struct dp_catalog *dp_catalog, bool enable);
0104 void dp_catalog_hpd_config_intr(struct dp_catalog *dp_catalog,
0105             u32 intr_mask, bool en);
0106 void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog);
0107 u32 dp_catalog_link_is_connected(struct dp_catalog *dp_catalog);
0108 u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog);
0109 void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog);
0110 int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, u8 v_level,
0111                 u8 p_level);
0112 int dp_catalog_ctrl_get_interrupt(struct dp_catalog *dp_catalog);
0113 void dp_catalog_ctrl_update_transfer_unit(struct dp_catalog *dp_catalog,
0114                 u32 dp_tu, u32 valid_boundary,
0115                 u32 valid_boundary2);
0116 void dp_catalog_ctrl_send_phy_pattern(struct dp_catalog *dp_catalog,
0117                 u32 pattern);
0118 u32 dp_catalog_ctrl_read_phy_pattern(struct dp_catalog *dp_catalog);
0119 
0120 /* DP Panel APIs */
0121 int dp_catalog_panel_timing_cfg(struct dp_catalog *dp_catalog);
0122 void dp_catalog_dump_regs(struct dp_catalog *dp_catalog);
0123 void dp_catalog_panel_tpg_enable(struct dp_catalog *dp_catalog,
0124                 struct drm_display_mode *drm_mode);
0125 void dp_catalog_panel_tpg_disable(struct dp_catalog *dp_catalog);
0126 
0127 struct dp_catalog *dp_catalog_get(struct device *dev, struct dp_io *io);
0128 
0129 /* DP Audio APIs */
0130 void dp_catalog_audio_get_header(struct dp_catalog *catalog);
0131 void dp_catalog_audio_set_header(struct dp_catalog *catalog);
0132 void dp_catalog_audio_config_acr(struct dp_catalog *catalog);
0133 void dp_catalog_audio_enable(struct dp_catalog *catalog);
0134 void dp_catalog_audio_config_sdp(struct dp_catalog *catalog);
0135 void dp_catalog_audio_init(struct dp_catalog *catalog);
0136 void dp_catalog_audio_sfe_level(struct dp_catalog *catalog);
0137 
0138 #endif /* _DP_CATALOG_H_ */