diff mbox series

[v8,27/38] drm/i915/icl: Add DSI encoder remaining functions

Message ID bb5e0e0d6060a293d7507d50053054bca3c586df.1540900289.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/icl: dsi enabling | expand

Commit Message

Jani Nikula Oct. 30, 2018, 11:56 a.m. UTC
From: Madhav Chauhan <madhav.chauhan@intel.com>

This patch implements compute config and enable function
for Gen11 DSI encoder which is required at the time of
modeset. Enable function is empty as functionality is
implemented inside pre-enable function but still needed
otherwise null pointer dereference during modeset.

v2 by Jani:
 - drop the enable nop hook
 - fixed_mode is always true
 - HAS_GMCH_DISPLAY() is always false

Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/icl_dsi.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Chauhan, Madhav Nov. 1, 2018, 2:08 p.m. UTC | #1
On 10/30/2018 5:26 PM, Jani Nikula wrote:
> From: Madhav Chauhan <madhav.chauhan@intel.com>
>
> This patch implements compute config and enable function
> for Gen11 DSI encoder which is required at the time of
> modeset. Enable function is empty as functionality is
> implemented inside pre-enable function but still needed
> otherwise null pointer dereference during modeset.
>
> v2 by Jani:
>   - drop the enable nop hook
>   - fixed_mode is always true
>   - HAS_GMCH_DISPLAY() is always false

Changes looks fine.

Regards,
Madhav

>
> Signed-off-by: Madhav Chauhan <madhav.chauhan@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>   drivers/gpu/drm/i915/icl_dsi.c | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
> index c12c7d53bcff..7a000a660c12 100644
> --- a/drivers/gpu/drm/i915/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/icl_dsi.c
> @@ -1068,6 +1068,37 @@ static void gen11_dsi_get_config(struct intel_encoder *encoder,
>   	pipe_config->port_clock = pixel_clk;
>   }
>   
> +static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
> +				     struct intel_crtc_state *pipe_config,
> +				     struct drm_connector_state *conn_state)
> +{
> +	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
> +						   base);
> +	struct intel_connector *intel_connector = intel_dsi->attached_connector;
> +	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
> +	const struct drm_display_mode *fixed_mode =
> +					intel_connector->panel.fixed_mode;
> +	struct drm_display_mode *adjusted_mode =
> +					&pipe_config->base.adjusted_mode;
> +
> +	intel_fixed_panel_mode(fixed_mode, adjusted_mode);
> +	intel_pch_panel_fitting(crtc, pipe_config, conn_state->scaling_mode);
> +
> +	adjusted_mode->flags = 0;
> +
> +	/* Dual link goes to trancoder DSI'0' */
> +	if (intel_dsi->ports == BIT(PORT_B))
> +		pipe_config->cpu_transcoder = TRANSCODER_DSI_1;
> +	else
> +		pipe_config->cpu_transcoder = TRANSCODER_DSI_0;
> +
> +	pipe_config->clock_set = true;
> +
> +	//TODO: Add check if DSI PLL calculation is done
> +
> +	return true;
> +}
> +
>   static bool gen11_dsi_get_hw_state(struct intel_encoder *encoder,
>   				   enum pipe *pipe)
>   {
> @@ -1221,6 +1252,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
>   	encoder->disable = gen11_dsi_disable;
>   	encoder->port = port;
>   	encoder->get_config = gen11_dsi_get_config;
> +	encoder->compute_config = gen11_dsi_compute_config;
>   	encoder->get_hw_state = gen11_dsi_get_hw_state;
>   	encoder->type = INTEL_OUTPUT_DSI;
>   	encoder->cloneable = 0;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
index c12c7d53bcff..7a000a660c12 100644
--- a/drivers/gpu/drm/i915/icl_dsi.c
+++ b/drivers/gpu/drm/i915/icl_dsi.c
@@ -1068,6 +1068,37 @@  static void gen11_dsi_get_config(struct intel_encoder *encoder,
 	pipe_config->port_clock = pixel_clk;
 }
 
+static bool gen11_dsi_compute_config(struct intel_encoder *encoder,
+				     struct intel_crtc_state *pipe_config,
+				     struct drm_connector_state *conn_state)
+{
+	struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi,
+						   base);
+	struct intel_connector *intel_connector = intel_dsi->attached_connector;
+	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
+	const struct drm_display_mode *fixed_mode =
+					intel_connector->panel.fixed_mode;
+	struct drm_display_mode *adjusted_mode =
+					&pipe_config->base.adjusted_mode;
+
+	intel_fixed_panel_mode(fixed_mode, adjusted_mode);
+	intel_pch_panel_fitting(crtc, pipe_config, conn_state->scaling_mode);
+
+	adjusted_mode->flags = 0;
+
+	/* Dual link goes to trancoder DSI'0' */
+	if (intel_dsi->ports == BIT(PORT_B))
+		pipe_config->cpu_transcoder = TRANSCODER_DSI_1;
+	else
+		pipe_config->cpu_transcoder = TRANSCODER_DSI_0;
+
+	pipe_config->clock_set = true;
+
+	//TODO: Add check if DSI PLL calculation is done
+
+	return true;
+}
+
 static bool gen11_dsi_get_hw_state(struct intel_encoder *encoder,
 				   enum pipe *pipe)
 {
@@ -1221,6 +1252,7 @@  void icl_dsi_init(struct drm_i915_private *dev_priv)
 	encoder->disable = gen11_dsi_disable;
 	encoder->port = port;
 	encoder->get_config = gen11_dsi_get_config;
+	encoder->compute_config = gen11_dsi_compute_config;
 	encoder->get_hw_state = gen11_dsi_get_hw_state;
 	encoder->type = INTEL_OUTPUT_DSI;
 	encoder->cloneable = 0;