[PATCH 1/2] UBUNTU: SAUCE: i915_bpo: drm/i915/backlight: setup and cache pwm alternate increment value
AceLan Kao
acelan.kao at canonical.com
Wed Sep 21 06:37:33 UTC 2016
From: Jani Nikula <jani.nikula at intel.com>
BugLink: http://bugs.launchpad.net/bugs/1625932
This will also be needed later on when setting up the alternate
increment in backlight enable.
Cc: Shawn Lee <shawn.c.lee at intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/9984b20bc59aee90b83caf59ce91f3fb122c9627.1474281249.git.jani.nikula@intel.com
(cherry-picked from drm-intel-next-queued commit 32b421e79e6b546)
Signed-off-by: AceLan Kao <acelan.kao at canonical.com>
---
ubuntu/i915/intel_drv.h | 1 +
ubuntu/i915/intel_panel.c | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ubuntu/i915/intel_drv.h b/ubuntu/i915/intel_drv.h
index d97b8e1..8c5a158 100644
--- a/ubuntu/i915/intel_drv.h
+++ b/ubuntu/i915/intel_drv.h
@@ -211,6 +211,7 @@ struct intel_panel {
bool enabled;
bool combination_mode; /* gen 2/4 only */
bool active_low_pwm;
+ bool alternate_pwm_increment; /* lpt+ */
/* PWM chip */
bool util_pin_active_low; /* bxt+ */
diff --git a/ubuntu/i915/intel_panel.c b/ubuntu/i915/intel_panel.c
index 56b64a0..d676ff6 100644
--- a/ubuntu/i915/intel_panel.c
+++ b/ubuntu/i915/intel_panel.c
@@ -1250,10 +1250,10 @@ static u32 bxt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
*/
static u32 spt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
{
- struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+ struct intel_panel *panel = &connector->panel;
u32 mul;
- if (I915_READ(SOUTH_CHICKEN1) & SPT_PWM_GRANULARITY)
+ if (panel->backlight.alternate_pwm_increment)
mul = 128;
else
mul = 16;
@@ -1269,9 +1269,10 @@ static u32 spt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
static u32 lpt_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
{
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+ struct intel_panel *panel = &connector->panel;
u32 mul, clock;
- if (I915_READ(SOUTH_CHICKEN2) & LPT_PWM_GRANULARITY)
+ if (panel->backlight.alternate_pwm_increment)
mul = 16;
else
mul = 128;
@@ -1422,6 +1423,13 @@ static int lpt_setup_backlight(struct intel_connector *connector, enum pipe unus
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
struct intel_panel *panel = &connector->panel;
u32 pch_ctl1, pch_ctl2, val;
+ bool alt;
+
+ if (HAS_PCH_LPT(dev_priv))
+ alt = I915_READ(SOUTH_CHICKEN2) & LPT_PWM_GRANULARITY;
+ else
+ alt = I915_READ(SOUTH_CHICKEN1) & SPT_PWM_GRANULARITY;
+ panel->backlight.alternate_pwm_increment = alt;
pch_ctl1 = I915_READ(BLC_PWM_PCH_CTL1);
panel->backlight.active_low_pwm = pch_ctl1 & BLM_PCH_POLARITY;
--
2.7.4
More information about the kernel-team
mailing list