From: Jani Nikula <jani.nikula@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915/backlight: handle enabled but zero duty cycle at module load
Date: Thu, 25 Aug 2016 14:27:04 +0300 [thread overview]
Message-ID: <87a8g1t7g7.fsf@intel.com> (raw)
In-Reply-To: <1471939811-9817-1-git-send-email-maarten.lankhorst@linux.intel.com>
On Tue, 23 Aug 2016, Maarten Lankhorst <maarten.lankhorst@linux.intel.com> wrote:
> From: Jani Nikula <jani.nikula@intel.com>
>
> Don't consider enabled but zero duty cycle backlight disabled. Clamp
> level between min and max for sanity.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
I think this is the right thing to do.
In the future, perhaps we'll want to check for !enabled, and actually
enable the backlight too if backlight is present and the crtc is active.
Please just push this, and we'll see what happens.
BR,
Jani.
> ---
> drivers/gpu/drm/i915/intel_panel.c | 40 +++++++++++++++++++++++---------------
> 1 file changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 96c65d77e886..c10e9b0405e8 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -1430,10 +1430,11 @@ static int lpt_setup_backlight(struct intel_connector *connector, enum pipe unus
> panel->backlight.min = get_backlight_min_vbt(connector);
>
> val = lpt_get_backlight(connector);
> - panel->backlight.level = intel_panel_compute_brightness(connector, val);
> + val = intel_panel_compute_brightness(connector, val);
> + panel->backlight.level = clamp(val, panel->backlight.min,
> + panel->backlight.max);
>
> - panel->backlight.enabled = (pch_ctl1 & BLM_PCH_PWM_ENABLE) &&
> - panel->backlight.level != 0;
> + panel->backlight.enabled = pch_ctl1 & BLM_PCH_PWM_ENABLE;
>
> return 0;
> }
> @@ -1459,11 +1460,13 @@ static int pch_setup_backlight(struct intel_connector *connector, enum pipe unus
> panel->backlight.min = get_backlight_min_vbt(connector);
>
> val = pch_get_backlight(connector);
> - panel->backlight.level = intel_panel_compute_brightness(connector, val);
> + val = intel_panel_compute_brightness(connector, val);
> + panel->backlight.level = clamp(val, panel->backlight.min,
> + panel->backlight.max);
>
> cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2);
> panel->backlight.enabled = (cpu_ctl2 & BLM_PWM_ENABLE) &&
> - (pch_ctl1 & BLM_PCH_PWM_ENABLE) && panel->backlight.level != 0;
> + (pch_ctl1 & BLM_PCH_PWM_ENABLE);
>
> return 0;
> }
> @@ -1498,9 +1501,11 @@ static int i9xx_setup_backlight(struct intel_connector *connector, enum pipe unu
> panel->backlight.min = get_backlight_min_vbt(connector);
>
> val = i9xx_get_backlight(connector);
> - panel->backlight.level = intel_panel_compute_brightness(connector, val);
> + val = intel_panel_compute_brightness(connector, val);
> + panel->backlight.level = clamp(val, panel->backlight.min,
> + panel->backlight.max);
>
> - panel->backlight.enabled = panel->backlight.level != 0;
> + panel->backlight.enabled = val != 0;
>
> return 0;
> }
> @@ -1530,10 +1535,11 @@ static int i965_setup_backlight(struct intel_connector *connector, enum pipe unu
> panel->backlight.min = get_backlight_min_vbt(connector);
>
> val = i9xx_get_backlight(connector);
> - panel->backlight.level = intel_panel_compute_brightness(connector, val);
> + val = intel_panel_compute_brightness(connector, val);
> + panel->backlight.level = clamp(val, panel->backlight.min,
> + panel->backlight.max);
>
> - panel->backlight.enabled = (ctl2 & BLM_PWM_ENABLE) &&
> - panel->backlight.level != 0;
> + panel->backlight.enabled = ctl2 & BLM_PWM_ENABLE;
>
> return 0;
> }
> @@ -1562,10 +1568,11 @@ static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe
> panel->backlight.min = get_backlight_min_vbt(connector);
>
> val = _vlv_get_backlight(dev_priv, pipe);
> - panel->backlight.level = intel_panel_compute_brightness(connector, val);
> + val = intel_panel_compute_brightness(connector, val);
> + panel->backlight.level = clamp(val, panel->backlight.min,
> + panel->backlight.max);
>
> - panel->backlight.enabled = (ctl2 & BLM_PWM_ENABLE) &&
> - panel->backlight.level != 0;
> + panel->backlight.enabled = ctl2 & BLM_PWM_ENABLE;
>
> return 0;
> }
> @@ -1607,10 +1614,11 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
> return -ENODEV;
>
> val = bxt_get_backlight(connector);
> - panel->backlight.level = intel_panel_compute_brightness(connector, val);
> + val = intel_panel_compute_brightness(connector, val);
> + panel->backlight.level = clamp(val, panel->backlight.min,
> + panel->backlight.max);
>
> - panel->backlight.enabled = (pwm_ctl & BXT_BLC_PWM_ENABLE) &&
> - panel->backlight.level != 0;
> + panel->backlight.enabled = pwm_ctl & BXT_BLC_PWM_ENABLE;
>
> return 0;
> }
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2016-08-25 11:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 8:10 [PATCH 1/2] drm/i915/backlight: handle enabled but zero duty cycle at module load Maarten Lankhorst
2016-08-23 8:10 ` [PATCH] drm/i915: Fix botched merge that downgrades CSR versions Maarten Lankhorst
2016-08-25 11:29 ` Jani Nikula
2016-08-23 8:10 ` [PATCH] locking/mutex: Add waiter parameter to mutex_optimistic_spin() Maarten Lankhorst
2016-08-23 8:10 ` [PATCH 2/2] drm/i915: Enable fast modesetting again Maarten Lankhorst
2016-08-23 8:10 ` [PATCH] locking/mutex: Enable optimistic spinning of woken task in wait queue Maarten Lankhorst
2016-08-23 8:10 ` [PATCH] locking/mutex: Ensure forward progress of waiter-spinner Maarten Lankhorst
2016-08-23 8:10 ` [PATCH] Avoid mutex starvation when optimistic spinning is disabled Maarten Lankhorst
2016-08-23 8:40 ` kbuild test robot
2016-08-25 11:27 ` Jani Nikula [this message]
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=87a8g1t7g7.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
/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