diff mbox

drm/i915/backlight: setup backlight pwm alternate increment on backlight enable

Message ID 1474273390-31621-1-git-send-email-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Sept. 19, 2016, 8:23 a.m. UTC
From: Shawn Lee <shawn.c.lee@intel.com>

Backlight enable is supposed to do a full setup of the backlight. We
were missing the PWM alternate increment bit in the south chicken
registers on lpt+ pch. This potentially caused a PWM frequency change
when the chicken register value was lost e.g. on suspend.

v2 by Jani, rebase on the patch caching alt increment

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97486
Cc: Cooper Chiou <cooper.chiou@intel.com>
Cc: Wei Shun Chen <wei.shun.chang@intel.com>
Cc: Gary C Wang <gary.c.wang@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Shawn Lee <shawn.c.lee@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_panel.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Jani Nikula Sept. 19, 2016, 8:25 a.m. UTC | #1
On Mon, 19 Sep 2016, Jani Nikula <jani.nikula@intel.com> wrote:
> From: Shawn Lee <shawn.c.lee@intel.com>
>
> Backlight enable is supposed to do a full setup of the backlight. We
> were missing the PWM alternate increment bit in the south chicken
> registers on lpt+ pch. This potentially caused a PWM frequency change
> when the chicken register value was lost e.g. on suspend.
>
> v2 by Jani, rebase on the patch caching alt increment

Fat fingered this one, please ignore, and look at the two patches in
reply to this one. Sorry.

BR,
Jani.
kernel test robot Sept. 19, 2016, 10:48 a.m. UTC | #2
Hi Shawn,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.8-rc7 next-20160916]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Jani-Nikula/drm-i915-backlight-setup-backlight-pwm-alternate-increment-on-backlight-enable/20160919-181342
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x008-201638 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_panel.c: In function 'lpt_enable_backlight':
>> drivers/gpu/drm/i915/intel_panel.c:855:23: error: 'struct <anonymous>' has no member named 'alternate_pwm_increment'
      if (panel->backlight.alternate_pwm_increment)
                          ^
   drivers/gpu/drm/i915/intel_panel.c:862:23: error: 'struct <anonymous>' has no member named 'alternate_pwm_increment'
      if (panel->backlight.alternate_pwm_increment)
                          ^

vim +855 drivers/gpu/drm/i915/intel_panel.c

   849			pch_ctl1 &= ~BLM_PCH_PWM_ENABLE;
   850			I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1);
   851		}
   852	
   853		if (HAS_PCH_LPT(dev_priv)) {
   854			schicken = I915_READ(SOUTH_CHICKEN2);
 > 855			if (panel->backlight.alternate_pwm_increment)
   856				schicken |= LPT_PWM_GRANULARITY;
   857			else
   858				schicken &= ~LPT_PWM_GRANULARITY;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 8bc43205d6a0..be4b4d546fd9 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -841,7 +841,7 @@  static void lpt_enable_backlight(struct intel_connector *connector)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct intel_panel *panel = &connector->panel;
-	u32 pch_ctl1, pch_ctl2;
+	u32 pch_ctl1, pch_ctl2, schicken;
 
 	pch_ctl1 = I915_READ(BLC_PWM_PCH_CTL1);
 	if (pch_ctl1 & BLM_PCH_PWM_ENABLE) {
@@ -850,6 +850,22 @@  static void lpt_enable_backlight(struct intel_connector *connector)
 		I915_WRITE(BLC_PWM_PCH_CTL1, pch_ctl1);
 	}
 
+	if (HAS_PCH_LPT(dev_priv)) {
+		schicken = I915_READ(SOUTH_CHICKEN2);
+		if (panel->backlight.alternate_pwm_increment)
+			schicken |= LPT_PWM_GRANULARITY;
+		else
+			schicken &= ~LPT_PWM_GRANULARITY;
+		I915_WRITE(SOUTH_CHICKEN2, schicken);
+	} else {
+		schicken = I915_READ(SOUTH_CHICKEN1);
+		if (panel->backlight.alternate_pwm_increment)
+			schicken |= SPT_PWM_GRANULARITY;
+		else
+			schicken &= ~SPT_PWM_GRANULARITY;
+		I915_WRITE(SOUTH_CHICKEN1, schicken);
+	}
+
 	pch_ctl2 = panel->backlight.max << 16;
 	I915_WRITE(BLC_PWM_PCH_CTL2, pch_ctl2);