0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef _INTEL_DSI_H
0025 #define _INTEL_DSI_H
0026
0027 #include <drm/drm_crtc.h>
0028 #include <drm/drm_mipi_dsi.h>
0029
0030 #include "intel_display_types.h"
0031
0032 #define INTEL_DSI_VIDEO_MODE 0
0033 #define INTEL_DSI_COMMAND_MODE 1
0034
0035
0036 #define DSI_DUAL_LINK_NONE 0
0037 #define DSI_DUAL_LINK_FRONT_BACK 1
0038 #define DSI_DUAL_LINK_PIXEL_ALT 2
0039
0040 struct intel_dsi_host;
0041
0042 struct intel_dsi {
0043 struct intel_encoder base;
0044
0045 struct intel_dsi_host *dsi_hosts[I915_MAX_PORTS];
0046 intel_wakeref_t io_wakeref[I915_MAX_PORTS];
0047
0048
0049 struct gpio_desc *gpio_panel;
0050 struct gpio_desc *gpio_backlight;
0051
0052 struct intel_connector *attached_connector;
0053
0054
0055 union {
0056 u16 ports;
0057 u16 phys;
0058 };
0059
0060
0061 bool hs;
0062
0063
0064 int channel;
0065
0066
0067 u16 operation_mode;
0068
0069
0070 unsigned int lane_count;
0071
0072
0073 int i2c_bus_num;
0074
0075
0076
0077
0078
0079
0080 enum mipi_dsi_pixel_format pixel_format;
0081
0082
0083 int video_mode;
0084
0085
0086 u8 eotp_pkt;
0087 u8 clock_stop;
0088
0089 u8 escape_clk_div;
0090 u8 dual_link;
0091
0092 u16 dcs_backlight_ports;
0093 u16 dcs_cabc_ports;
0094
0095
0096 bool bgr_enabled;
0097
0098 u8 pixel_overlap;
0099 u32 port_bits;
0100 u32 bw_timer;
0101 u32 dphy_reg;
0102
0103
0104 u32 dphy_data_lane_reg;
0105 u32 video_frmt_cfg_bits;
0106 u16 lp_byte_clk;
0107
0108
0109 u16 hs_tx_timeout;
0110 u16 lp_rx_timeout;
0111 u16 turn_arnd_val;
0112 u16 rst_timer_val;
0113 u16 hs_to_lp_count;
0114 u16 clk_lp_to_hs_count;
0115 u16 clk_hs_to_lp_count;
0116
0117 u16 init_count;
0118 u32 pclk;
0119 u16 burst_mode_ratio;
0120
0121
0122 u16 backlight_off_delay;
0123 u16 backlight_on_delay;
0124 u16 panel_on_delay;
0125 u16 panel_off_delay;
0126 u16 panel_pwr_cycle_delay;
0127 ktime_t panel_power_off_time;
0128 };
0129
0130 struct intel_dsi_host {
0131 struct mipi_dsi_host base;
0132 struct intel_dsi *intel_dsi;
0133 enum port port;
0134
0135
0136 struct mipi_dsi_device *device;
0137 };
0138
0139 static inline struct intel_dsi_host *to_intel_dsi_host(struct mipi_dsi_host *h)
0140 {
0141 return container_of(h, struct intel_dsi_host, base);
0142 }
0143
0144 #define for_each_dsi_port(__port, __ports_mask) \
0145 for_each_port_masked(__port, __ports_mask)
0146 #define for_each_dsi_phy(__phy, __phys_mask) \
0147 for_each_phy_masked(__phy, __phys_mask)
0148
0149 static inline struct intel_dsi *enc_to_intel_dsi(struct intel_encoder *encoder)
0150 {
0151 return container_of(&encoder->base, struct intel_dsi, base.base);
0152 }
0153
0154 static inline bool is_vid_mode(struct intel_dsi *intel_dsi)
0155 {
0156 return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE;
0157 }
0158
0159 static inline bool is_cmd_mode(struct intel_dsi *intel_dsi)
0160 {
0161 return intel_dsi->operation_mode == INTEL_DSI_COMMAND_MODE;
0162 }
0163
0164 static inline u16 intel_dsi_encoder_ports(struct intel_encoder *encoder)
0165 {
0166 return enc_to_intel_dsi(encoder)->ports;
0167 }
0168
0169 int intel_dsi_bitrate(const struct intel_dsi *intel_dsi);
0170 int intel_dsi_tlpx_ns(const struct intel_dsi *intel_dsi);
0171 enum drm_panel_orientation
0172 intel_dsi_get_panel_orientation(struct intel_connector *connector);
0173 int intel_dsi_get_modes(struct drm_connector *connector);
0174 enum drm_mode_status intel_dsi_mode_valid(struct drm_connector *connector,
0175 struct drm_display_mode *mode);
0176 struct intel_dsi_host *intel_dsi_host_init(struct intel_dsi *intel_dsi,
0177 const struct mipi_dsi_host_ops *funcs,
0178 enum port port);
0179
0180 #endif