All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [PATCH] drm/i915/bxt: fix incorrect BIOS backlight PWM frequency setting
Date: Thu, 10 Dec 2015 15:52:17 +0200	[thread overview]
Message-ID: <1449755537-8697-1-git-send-email-imre.deak@intel.com> (raw)

There seem to be BIOSes with that set an invalid PWM frequency, assuming the
wrong base frequency. This base frequency is 19.2MHz on BXT except for A
stepping where it's the current CD clock frequency. The BIOSes in question
don't take this difference into account and program the frequency
assuming it's based on the CD clock frequency even on B stepping.

Since we don't care about A stepping any more, simply assume the 19.2MHz
everywhere and require a minimum of 100Hz PWM frequency, regard anything
below this as incorrect. In case we correct the frequency we also have to
disable fastboot, that being the simplest way to reprogram the backlight
settings.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 5 +++++
 drivers/gpu/drm/i915/intel_drv.h     | 1 +
 drivers/gpu/drm/i915/intel_panel.c   | 7 +++++++
 3 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e9bb860..bdd8506 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13271,6 +13271,11 @@ static void calc_watermark_data(struct drm_atomic_state *state)
 	}
 }
 
+void intel_disable_fastboot(void)
+{
+	i915.fastboot = 0;
+}
+
 /**
  * intel_atomic_check - validate state object
  * @dev: drm device
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 76dfa28..e957494 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1057,6 +1057,7 @@ int intel_pch_rawclk(struct drm_device *dev);
 int intel_hrawclk(struct drm_device *dev);
 void intel_mark_busy(struct drm_device *dev);
 void intel_mark_idle(struct drm_device *dev);
+void intel_disable_fastboot(void);
 void intel_crtc_restore_mode(struct drm_crtc *crtc);
 int intel_display_suspend(struct drm_device *dev);
 void intel_encoder_destroy(struct drm_encoder *encoder);
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 72183a0..c598b6b 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -1647,6 +1647,13 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
 	panel->backlight.active_low_pwm = pwm_ctl & BXT_BLC_PWM_POLARITY;
 	panel->backlight.max =
 		I915_READ(BXT_BLC_PWM_FREQ(panel->backlight.controller));
+	if (panel->backlight.hz_to_pwm &&
+	    panel->backlight.max > panel->backlight.hz_to_pwm(connector, 100)) {
+		DRM_INFO("Correcting innvalid BIOS backlight PWM frequency (%d), disabling fastboot\n",
+			 panel->backlight.max);
+		intel_disable_fastboot();
+		panel->backlight.max = 0;
+	}
 
 	if (!panel->backlight.max)
 		panel->backlight.max = get_backlight_max_vbt(connector);
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2015-12-10 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 13:52 Imre Deak [this message]
2015-12-10 15:00 ` [PATCH] drm/i915/bxt: fix incorrect BIOS backlight PWM frequency setting Jani Nikula
2015-12-10 15:08   ` Imre Deak

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=1449755537-8697-1-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.