Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Puthikorn Voravootivat <puthik@chromium.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH RESEND v4 2/6] drm/i915: Correctly enable blacklight adjustment via DPCD
Date: Tue, 2 May 2017 19:00:25 -0700	[thread overview]
Message-ID: <20170503020024.GB3176@intel.com> (raw)
In-Reply-To: <20170418234824.157355-3-puthik@chromium.org>

On Tue, Apr 18, 2017 at 04:48:20PM -0700, Puthikorn Voravootivat wrote:
> intel_dp_aux_enable_backlight() assumed that the register
> BACKLIGHT_BRIGHTNESS_CONTROL_MODE can only has value 01
> (DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET) when initialize.
> 
> This patch fixed that by handling all cases of that register.
> 
> Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
> ---
>  drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 29 +++++++++++++++++++++------
>  1 file changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> index 42f73d9a3ccf..f06c8381c74e 100644
> --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> @@ -101,15 +101,32 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base);
>  	uint8_t dpcd_buf = 0;
> +	uint8_t edp_backlight_mode = 0;
>  
>  	set_aux_backlight_enable(intel_dp, true);
>  
> -	if ((drm_dp_dpcd_readb(&intel_dp->aux,
> -			       DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf) == 1) &&
> -	    ((dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK) ==
> -	     DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET))
> -		drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER,
> -				   (dpcd_buf | DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD));
> +	if (!drm_dp_dpcd_readb(&intel_dp->aux,
> +			       DP_EDP_BACKLIGHT_MODE_SET_REGISTER, &dpcd_buf)) {
> +		return;
> +	}
> +
> +	edp_backlight_mode = dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK;
> +
> +	switch (edp_backlight_mode) {
> +	case DP_EDP_BACKLIGHT_CONTROL_MODE_PWM:
> +	case DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET:
> +	case DP_EDP_BACKLIGHT_CONTROL_MODE_PRODUCT:
> +		dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK;
> +		dpcd_buf |= DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD;
> +		drm_dp_dpcd_writeb(&intel_dp->aux,
> +			DP_EDP_BACKLIGHT_MODE_SET_REGISTER, dpcd_buf);
> +		break;
> +
> +	/* Do nothing when it is already DPCD mode */
> +	case DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD:
> +	default:
> +		break;

Do you really need a break; here?

Manasi
> +	}
>  }
>  
>  static void intel_dp_aux_disable_backlight(struct intel_connector *connector)
> -- 
> 2.12.2.816.g2cccc81164-goog
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-05-03  1:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 23:48 [PATCH RESEND v4 0/6] Enhancement to intel_dp_aux_backlight driver Puthikorn Voravootivat
2017-04-18 23:48 ` [PATCH RESEND v4 1/6] drm/i915: Add DPCD preferred mode for backlight control Puthikorn Voravootivat
2017-05-03  0:54   ` Pandiyan, Dhinakaran
2017-05-03  1:19     ` Pandiyan, Dhinakaran
2017-05-03  9:11   ` Jani Nikula
2017-05-03 23:47     ` Puthikorn Voravootivat
2017-04-18 23:48 ` [PATCH RESEND v4 2/6] drm/i915: Correctly enable blacklight adjustment via DPCD Puthikorn Voravootivat
2017-05-03  0:56   ` Pandiyan, Dhinakaran
2017-05-03  1:17   ` Pandiyan, Dhinakaran
2017-05-03  2:00   ` Manasi Navare [this message]
2017-05-03  9:19   ` Jani Nikula
2017-04-18 23:48 ` [PATCH RESEND v4 3/6] drm/i915: Support dynamic backlight via DPCD register Puthikorn Voravootivat
2017-05-03  3:00   ` Pandiyan, Dhinakaran
2017-05-03 22:16     ` Puthikorn Voravootivat
2017-04-18 23:48 ` [PATCH RESEND v4 4/6] drm/i915: Store brightness level in aux backlight driver Puthikorn Voravootivat
2017-05-03 11:32   ` Jani Nikula
2017-04-18 23:48 ` [PATCH RESEND v4 5/6] drm: Add definition for eDP backlight frequency Puthikorn Voravootivat
2017-05-03  1:27   ` Manasi Navare
2017-05-03 12:49     ` Jani Nikula
2017-05-03 16:28       ` Manasi Navare
2017-04-18 23:48 ` [PATCH RESEND v4 6/6] drm/i915: Set PWM divider to match desired frequency in vbt Puthikorn Voravootivat
2017-05-03  2:15   ` Pandiyan, Dhinakaran
2017-05-03  3:12     ` Manasi Navare
2017-05-03 14:12   ` Jani Nikula
2017-05-03 23:14     ` Puthikorn Voravootivat
2017-04-19  0:08 ` ✗ Fi.CI.BAT: warning for Enhancement to intel_dp_aux_backlight driver (rev3) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170503020024.GB3176@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=puthik@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox