[Intel-gfx] drivers: i915: Default max backlight brightness value
Simon Que
sque at chromium.org
Wed Nov 2 03:20:06 CET 2011
Sorry, this is the wrong patch, please disregard.
On Tue, Nov 1, 2011 at 6:58 PM, Simon Que <sque at chromium.org> wrote:
> Use 0x1000 as the default backlight PWM max value and period. This is
> passed in as a module parameter to i915_drv and is used to program the
> PWM registers. It can be set to other values based on the needs of each
> system.
>
> Signed-off-by: Simon Que <sque at chromium.org>
> ---
> drivers/gpu/drm/i915/i915_reg.h | 1 +
> drivers/gpu/drm/i915/intel_panel.c | 29 +++++++++++++++++------------
> 2 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h
> b/drivers/gpu/drm/i915/i915_reg.h
> index 5d5def7..a832028 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -3275,6 +3275,7 @@
> #define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
>
> #define BLC_PWM_PCH_CTL2 0xc8254
> +#define BLC_PWM_PCH_FREQ_SHIFT 16
>
> #define PCH_PP_STATUS 0xc7200
> #define PCH_PP_CONTROL 0xc7204
> diff --git a/drivers/gpu/drm/i915/intel_panel.c
> b/drivers/gpu/drm/i915/intel_panel.c
> index 05f500c..b5d2244 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -133,27 +133,32 @@ static u32 i915_read_blc_pwm_ctl(struct
> drm_i915_private *dev_priv)
> {
> u32 val;
>
> - /* Restore the CTL value if it lost, e.g. GPU reset */
> -
> + /* Restore the CTL value if it was lost, e.g. GPU reset */
> + /* Use the default PWM max if none is available. */
> if (HAS_PCH_SPLIT(dev_priv->dev)) {
> val = I915_READ(BLC_PWM_PCH_CTL2);
> - if (dev_priv->saveBLC_PWM_CTL2 == 0) {
> + if (dev_priv->saveBLC_PWM_CTL2 == 0 && val == 0)
> + dev_priv->saveBLC_PWM_CTL2 =
> + i915_max_backlight <<
> BLC_PWM_PCH_FREQ_SHIFT;
> + else if (dev_priv->saveBLC_PWM_CTL2 == 0)
> dev_priv->saveBLC_PWM_CTL2 = val;
> - } else if (val == 0) {
> + if (val == 0) {
> I915_WRITE(BLC_PWM_PCH_CTL2,
> - dev_priv->saveBLC_PWM_CTL);
> - val = dev_priv->saveBLC_PWM_CTL;
> + dev_priv->saveBLC_PWM_CTL2);
> + val = dev_priv->saveBLC_PWM_CTL2;
> }
> } else {
> val = I915_READ(BLC_PWM_CTL);
> - if (dev_priv->saveBLC_PWM_CTL == 0) {
> + if (dev_priv->saveBLC_PWM_CTL == 0 && val == 0) {
> + dev_priv->saveBLC_PWM_CTL = i915_max_backlight
> + << BACKLIGHT_MODULATION_FREQ_SHIFT;
> + } else if (dev_priv->saveBLC_PWM_CTL == 0) {
> dev_priv->saveBLC_PWM_CTL = val;
> dev_priv->saveBLC_PWM_CTL2 =
> I915_READ(BLC_PWM_CTL2);
> - } else if (val == 0) {
> - I915_WRITE(BLC_PWM_CTL,
> - dev_priv->saveBLC_PWM_CTL);
> - I915_WRITE(BLC_PWM_CTL2,
> - dev_priv->saveBLC_PWM_CTL2);
> + }
> + if (val == 0) {
> + I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL);
> + I915_WRITE(BLC_PWM_CTL2,
> dev_priv->saveBLC_PWM_CTL2);
> val = dev_priv->saveBLC_PWM_CTL;
> }
> }
> --
> 1.7.2.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20111101/7574e869/attachment.html>
More information about the Intel-gfx
mailing list