[BXT,MIPI,v2,13/13] drm/i915: Added BXT DSI backlight support
diff mbox

Message ID 1437899840-32153-14-git-send-email-uma.shankar@intel.com
State New
Headers show

Commit Message

Shankar, Uma July 26, 2015, 8:37 a.m. UTC
DSI backlight support for bxt is added.

TODO: There is no support for backlight control in drm panel
      framework. This will be added as part of VBT version patches
      fixing the backlight sequence.

v2: Fixed Jani's review comments from previous patch. Added the
    BXT DSI backlight code in this patch. Backlight setup and
    enable/disable code for backlight is added in intel_dsi.c.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_dsi.c |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

Comments

Jani Nikula Aug. 17, 2015, 12:06 p.m. UTC | #1
On Sun, 26 Jul 2015, Uma Shankar <uma.shankar@intel.com> wrote:
> DSI backlight support for bxt is added.
>
> TODO: There is no support for backlight control in drm panel
>       framework. This will be added as part of VBT version patches
>       fixing the backlight sequence.
>
> v2: Fixed Jani's review comments from previous patch. Added the
>     BXT DSI backlight code in this patch. Backlight setup and
>     enable/disable code for backlight is added in intel_dsi.c.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dsi.c |   25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index d0b26c8..36fcb86 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -431,6 +431,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> +	struct intel_connector *intel_connector = intel_dsi->attached_connector;
>  	enum port port;
>  
>  	DRM_DEBUG_KMS("\n");
> @@ -451,6 +452,16 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>  
>  		intel_dsi_port_enable(encoder);
>  	}
> +
> +	if (IS_BROXTON(dev)) {
> +		if (intel_dsi->backlight_on_delay >= 20)
> +			msleep(intel_dsi->backlight_on_delay);
> +		else
> +			usleep_range(intel_dsi->backlight_on_delay * 1000,
> +					(intel_dsi->backlight_on_delay * 1000) + 500);

Please just use msleep, let's optimize (possibly with sensible wrappers)
later.

> +
> +		intel_panel_enable_backlight(intel_connector);
> +	}
>  }
>  
>  static void intel_dsi_pre_enable(struct intel_encoder *encoder)
> @@ -615,10 +626,20 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> +	struct intel_connector *intel_connector = intel_dsi->attached_connector;
>  	u32 val;
>  
>  	DRM_DEBUG_KMS("\n");
>  
> +	if (IS_BROXTON(dev)) {
> +		intel_panel_disable_backlight(intel_connector);
> +		if (intel_dsi->backlight_off_delay >= 20)
> +			msleep(intel_dsi->backlight_off_delay);
> +		else
> +			usleep_range(intel_dsi->backlight_off_delay * 1000,
> +				(intel_dsi->backlight_off_delay * 1000) + 500);
> +	}
> +
>  	intel_dsi_disable(encoder);
>  
>  	intel_dsi_clear_device_ready(encoder);
> @@ -1213,9 +1234,11 @@ void intel_dsi_init(struct drm_device *dev)
>  	}
>  
>  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
> +	if (IS_BROXTON(dev))
> +		intel_panel_setup_backlight(connector,
> +			intel_encoder->crtc_mask == (1 << PIPE_A) ? PIPE_A : PIPE_B);

The pipe parameter is not used for broxton, you can just pass
INVALID_PIPE.

>  
>  	return;
> -
>  err:
>  	drm_encoder_cleanup(&intel_encoder->base);
>  	kfree(intel_dsi);
> -- 
> 1.7.9.5
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index d0b26c8..36fcb86 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -431,6 +431,7 @@  static void intel_dsi_enable(struct intel_encoder *encoder)
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	struct intel_connector *intel_connector = intel_dsi->attached_connector;
 	enum port port;
 
 	DRM_DEBUG_KMS("\n");
@@ -451,6 +452,16 @@  static void intel_dsi_enable(struct intel_encoder *encoder)
 
 		intel_dsi_port_enable(encoder);
 	}
+
+	if (IS_BROXTON(dev)) {
+		if (intel_dsi->backlight_on_delay >= 20)
+			msleep(intel_dsi->backlight_on_delay);
+		else
+			usleep_range(intel_dsi->backlight_on_delay * 1000,
+					(intel_dsi->backlight_on_delay * 1000) + 500);
+
+		intel_panel_enable_backlight(intel_connector);
+	}
 }
 
 static void intel_dsi_pre_enable(struct intel_encoder *encoder)
@@ -615,10 +626,20 @@  static void intel_dsi_post_disable(struct intel_encoder *encoder)
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	struct intel_connector *intel_connector = intel_dsi->attached_connector;
 	u32 val;
 
 	DRM_DEBUG_KMS("\n");
 
+	if (IS_BROXTON(dev)) {
+		intel_panel_disable_backlight(intel_connector);
+		if (intel_dsi->backlight_off_delay >= 20)
+			msleep(intel_dsi->backlight_off_delay);
+		else
+			usleep_range(intel_dsi->backlight_off_delay * 1000,
+				(intel_dsi->backlight_off_delay * 1000) + 500);
+	}
+
 	intel_dsi_disable(encoder);
 
 	intel_dsi_clear_device_ready(encoder);
@@ -1213,9 +1234,11 @@  void intel_dsi_init(struct drm_device *dev)
 	}
 
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
+	if (IS_BROXTON(dev))
+		intel_panel_setup_backlight(connector,
+			intel_encoder->crtc_mask == (1 << PIPE_A) ? PIPE_A : PIPE_B);
 
 	return;
-
 err:
 	drm_encoder_cleanup(&intel_encoder->base);
 	kfree(intel_dsi);