Commit 8327af28 authored by Vandita Kulkarni's avatar Vandita Kulkarni Committed by Jani Nikula

drm/i915/icl: Add get config functionality for DSI

This patch implements the functionality for getting PIPE configuration
to which DSI encoder is connected. Use the same method to get port clock
like other DDI encoders. Used during the atomic modeset.

v2 by Jani:
- Squash Madhav's and Vandita's get config bits together
- Move cnl_calc_wrpll_link() to intel_drv.h
- Drop extra temp variables
- Use enc_to_intel_dsi() instead of open coding
Co-developed-by: default avatarMadhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: default avatarVandita Kulkarni <vandita.kulkarni@intel.com>
Signed-off-by: default avatarMadhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f21fa4258068d04582f2bf30735e5536a8043bdf.1543500286.git.jani.nikula@intel.com
parent c5f9c934
...@@ -1060,6 +1060,20 @@ static void gen11_dsi_disable(struct intel_encoder *encoder, ...@@ -1060,6 +1060,20 @@ static void gen11_dsi_disable(struct intel_encoder *encoder,
gen11_dsi_disable_io_power(encoder); gen11_dsi_disable_io_power(encoder);
} }
static void gen11_dsi_get_config(struct intel_encoder *encoder,
struct intel_crtc_state *pipe_config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
u32 pll_id;
/* FIXME: adapt icl_ddi_clock_get() for DSI and use that? */
pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll);
pipe_config->port_clock = cnl_calc_wrpll_link(dev_priv, pll_id);
pipe_config->base.adjusted_mode.crtc_clock = intel_dsi->pclk;
pipe_config->output_types |= BIT(INTEL_OUTPUT_DSI);
}
static void gen11_dsi_encoder_destroy(struct drm_encoder *encoder) static void gen11_dsi_encoder_destroy(struct drm_encoder *encoder)
{ {
intel_encoder_destroy(encoder); intel_encoder_destroy(encoder);
...@@ -1173,6 +1187,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) ...@@ -1173,6 +1187,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
encoder->pre_enable = gen11_dsi_pre_enable; encoder->pre_enable = gen11_dsi_pre_enable;
encoder->disable = gen11_dsi_disable; encoder->disable = gen11_dsi_disable;
encoder->port = port; encoder->port = port;
encoder->get_config = gen11_dsi_get_config;
encoder->type = INTEL_OUTPUT_DSI; encoder->type = INTEL_OUTPUT_DSI;
encoder->cloneable = 0; encoder->cloneable = 0;
encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C); encoder->crtc_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C);
......
...@@ -1364,7 +1364,7 @@ static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv, ...@@ -1364,7 +1364,7 @@ static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv,
return dco_freq / (p0 * p1 * p2 * 5); return dco_freq / (p0 * p1 * p2 * 5);
} }
static int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv, int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
enum intel_dpll_id pll_id) enum intel_dpll_id pll_id)
{ {
uint32_t cfgcr0, cfgcr1; uint32_t cfgcr0, cfgcr1;
......
...@@ -1535,6 +1535,8 @@ u8 intel_ddi_dp_pre_emphasis_max(struct intel_encoder *encoder, ...@@ -1535,6 +1535,8 @@ u8 intel_ddi_dp_pre_emphasis_max(struct intel_encoder *encoder,
int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
bool enable); bool enable);
void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder); void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
enum intel_dpll_id pll_id);
unsigned int intel_fb_align_height(const struct drm_framebuffer *fb, unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
int color_plane, unsigned int height); int color_plane, unsigned int height);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment