All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org
Subject: Re: [Update][PATCH 0/3] Fix backlight issues on some Windows 8 systems
Date: Fri, 26 Jul 2013 16:24:57 +0300	[thread overview]
Message-ID: <87a9l95u8m.fsf@intel.com> (raw)
In-Reply-To: <CAMP44s2fT8C=wfF-uadxTOSzqLLfjFTJMQ767qy6teJZh_SS6w@mail.gmail.com>


[distribution massively reduced]

On Sat, 20 Jul 2013, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> I tried this patch series and it's as I expected, it's the same as
> acpi_backlight=vendor, and the intel backlight driver doesn't work
> correctly in this machine. If you are actually serious about the
> mantra of "no user-space regressions", then for this machine at least,
> you need to use the ACPI backlight with Windows8 OSI disabled, until
> the intel backlight driver is fixed. My patch does that:
>
> http://article.gmane.org/gmane.linux.acpi.devel/60969

Hi Felipe, would you mind trying the following patch on top of -rc2,
without your quirk patch? Up front, I'm not sure what all your failure
modes are, I'm not claiming this fixes them, and frankly, it didn't do
anything on a machine I tried... I just have this hunch it might help
with the ACPI hotkeys on some BIOSes. Maybe you're the lucky one! :)

BR,
Jani.


>From eb1493a7551dafb4bac3d65e4ed3ecd2e46f7f67 Mon Sep 17 00:00:00 2001
From: Jani Nikula <jani.nikula@intel.com>
Date: Fri, 7 Dec 2012 15:32:45 +0200
Subject: [PATCH] drm/i915: set the BIOS current backlight reference level
Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
Cc: Jani Nikula <jani.nikula@intel.com>

This should keep BIOS brightness keys and i915 backlight device better in
sync.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |    3 +++
 drivers/gpu/drm/i915/intel_opregion.c |   20 +++++++++++++++++++-
 drivers/gpu/drm/i915/intel_panel.c    |    3 +++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 82ea281..5a1cfa3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2059,10 +2059,13 @@ extern int intel_opregion_setup(struct drm_device *dev);
 extern void intel_opregion_init(struct drm_device *dev);
 extern void intel_opregion_fini(struct drm_device *dev);
 extern void intel_opregion_asle_intr(struct drm_device *dev);
+extern void intel_opregion_asle_set_cblv(struct drm_device *dev, u32 level, u32 max);
 #else
 static inline void intel_opregion_init(struct drm_device *dev) { return; }
 static inline void intel_opregion_fini(struct drm_device *dev) { return; }
 static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
+}
+static inline void intel_opregion_asle_set_cblv(struct drm_device *dev, u32 level, u32 max) { return; }
 #endif
 
 /* intel_acpi.c */
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index cfb8fb6..00fce49 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -158,6 +158,25 @@ struct opregion_asle {
 #define ACPI_LVDS_OUTPUT (4<<8)
 
 #ifdef CONFIG_ACPI
+
+/* set backlight brightness reference to level in range [0..max] */
+void intel_opregion_asle_set_cblv(struct drm_device *dev, u32 level, u32 max)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
+
+	if (!asle)
+		return;
+
+	if (level > max)
+		level = max;
+
+	/* scale to 0...100 per opregion spec */
+	level = level * 100 / max;
+
+	iowrite32(level | ASLE_CBLV_VALID, &asle->cblv);
+}
+
 static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -173,7 +192,6 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 		return ASLE_BACKLIGHT_FAILED;
 
 	intel_panel_set_backlight(dev, bclp, 255);
-	iowrite32((bclp*0x64)/0xff | ASLE_CBLV_VALID, &asle->cblv);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 67e2c1f..a497e20 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -497,6 +497,9 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max)
 		goto out;
 	}
 
+	/* set brightness reference value for bios hotkeys */
+	intel_opregion_asle_set_cblv(dev, level, max);
+
 	/* scale to hardware */
 	level = level * freq / max;
 
-- 
1.7.9.5

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2013-07-26 13:23 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-09 23:01 [PATCH 0/3] Fix backlight issues on some Windows 8 systems Matthew Garrett
2013-06-09 23:01 ` [PATCH 1/3] acpi: video: add function to support unregister backlight interface Matthew Garrett
2013-06-09 23:01 ` [PATCH 2/3] ACPICA: Add interface for getting latest OS version requested via _OSI Matthew Garrett
2013-06-17 22:31   ` Rafael J. Wysocki
2013-06-17 22:37     ` Matthew Garrett
2013-06-17 22:37       ` Matthew Garrett
2013-06-18  0:42       ` Rafael J. Wysocki
2013-06-25 23:23         ` Rafael J. Wysocki
2013-07-02 13:56           ` [PATCH 0/2] Expose OSI version Aaron Lu
2013-07-02 13:59             ` [PATCH 1/2] ACPICA: expose " Aaron Lu
2013-07-02 14:01             ` [PATCH 2/2] ACPI / OSL: add a wrapper function to return " Aaron Lu
2013-07-03 21:57               ` Rafael J. Wysocki
2013-07-04  1:24                 ` Aaron Lu
2013-07-05 19:52                   ` Rafael J. Wysocki
2013-06-09 23:01 ` [PATCH 3/3] i915: Don't provide ACPI backlight interface if firmware expects Windows 8 Matthew Garrett
2013-06-10  7:40   ` Daniel Vetter
2013-06-10  9:22   ` joeyli
2013-06-10 14:09   ` Alex Deucher
2013-06-14  6:47   ` Aaron Lu
2013-06-14 17:29     ` Matthew Garrett
2013-06-14 17:29       ` Matthew Garrett
2013-06-15  1:26       ` Aaron Lu
2013-06-15  1:38         ` Matthew Garrett
2013-06-15  1:38           ` Matthew Garrett
2013-06-15  4:14           ` Aaron Lu
2013-06-15  4:14             ` Aaron Lu
2013-06-15  4:19             ` Matthew Garrett
2013-06-15 12:29               ` Aaron Lu
2013-06-15 12:29                 ` Aaron Lu
2013-06-15 15:16                 ` Matthew Garrett
2013-06-15 18:29                   ` Daniel Vetter
2013-06-15 18:44                     ` Matthew Garrett
2013-06-15 20:27                     ` Rafael J. Wysocki
2013-06-15 20:35                       ` Daniel Vetter
2013-07-05 12:20   ` Rafael J. Wysocki
2013-07-05 20:00     ` Rafael J. Wysocki
2013-07-05 21:40       ` Rafael J. Wysocki
2013-07-05 22:23         ` Rafael J. Wysocki
2013-07-06  5:45           ` Aaron Lu
2013-07-06 13:33             ` Rafael J. Wysocki
2013-07-07 13:19               ` Rafael J. Wysocki
2013-07-07 13:19                 ` Rafael J. Wysocki
2013-07-08  8:00                 ` Aaron Lu
2013-07-13  0:46                   ` [Update][PATCH] ACPI / video / i915: Remove ACPI backlight " Rafael J. Wysocki
2013-07-15  2:36                     ` Aaron Lu
2013-07-15 11:42                       ` Rafael J. Wysocki
2013-07-16  3:24                         ` Aaron Lu
2013-07-16 11:54                           ` Rafael J. Wysocki
2013-07-15 13:06                     ` Igor Gnatenko
2013-07-15 13:06                       ` Igor Gnatenko
2013-07-15 23:53                       ` Rafael J. Wysocki
2013-07-16  7:45                         ` Igor Gnatenko
2013-07-16  7:45                           ` Igor Gnatenko
2013-07-16 13:32                     ` Igor Gnatenko
2013-07-16 13:32                       ` Igor Gnatenko
2013-07-16 17:08                       ` Matthew Garrett
2013-07-16 17:08                         ` Matthew Garrett
2013-07-16 22:01                         ` Rafael J. Wysocki
2013-07-17  5:16                           ` Igor Gnatenko
2013-07-17  5:16                             ` Igor Gnatenko
2013-07-17 11:38                             ` Rafael J. Wysocki
2013-07-17 12:03                               ` Igor Gnatenko
2013-07-17 12:03                                 ` Igor Gnatenko
2013-06-10 11:59 ` [PATCH 0/3] Fix backlight issues on some Windows 8 systems Rafael J. Wysocki
2013-06-10 13:48   ` Matthew Garrett
2013-06-10 13:48     ` Matthew Garrett
2013-06-11 13:08 ` Seth Forshee
2013-06-22 21:46 ` Yves-Alexis Perez
2013-06-25 16:08   ` Matthew Garrett
2013-06-25 16:10     ` Daniel Vetter
2013-06-25 16:13       ` Matthew Garrett
2013-06-25 20:43     ` Yves-Alexis Perez
2013-06-25 20:43       ` Yves-Alexis Perez
2013-06-25 20:54       ` Matthew Garrett
2013-06-25 21:10         ` Yves-Alexis Perez
2013-06-25 21:14           ` Matthew Garrett
2013-06-25 21:30             ` Yves-Alexis Perez
2013-06-25 21:33               ` Matthew Garrett
2013-06-25 21:33                 ` Matthew Garrett
2013-06-25 21:46                 ` Yves-Alexis Perez
2013-06-25 21:49                   ` Matthew Garrett
2013-06-25 21:49                     ` Matthew Garrett
2013-07-17 15:51   ` Felipe Contreras
2013-07-17 19:57     ` Yves-Alexis Perez
2013-07-18  0:16 ` [Update][PATCH " Rafael J. Wysocki
2013-07-18  0:20   ` [PATCH 1/3] ACPICA: expose OSI version Rafael J. Wysocki
2013-07-18  5:38     ` Igor Gnatenko
2013-07-18  5:38       ` Igor Gnatenko
2013-07-18  0:21   ` [PATCH 2/3] ACPI / video: Always call acpi_video_init_brightness() on init Rafael J. Wysocki
2013-07-18  5:40     ` Igor Gnatenko
2013-07-18  5:40       ` Igor Gnatenko
2013-07-18  0:22   ` [PATCH 3/3] ACPI / video / i915: No ACPI backlight if firmware expects Windows 8 Rafael J. Wysocki
2013-07-20 13:16   ` [Update][PATCH 0/3] Fix backlight issues on some Windows 8 systems Felipe Contreras
2013-07-26 13:24     ` Jani Nikula [this message]
2013-07-29 18:01       ` Felipe Contreras
2013-07-30  5:03         ` Jani Nikula
2013-07-31  0:01   ` Rafael J. Wysocki
2013-07-31  0:01     ` Matthew Garrett
2013-07-31  0:01       ` Matthew Garrett
2013-07-31  6:48     ` Igor Gnatenko
2013-07-31  6:48       ` Igor Gnatenko
2013-07-31  9:08     ` Aaron Lu
2013-08-07  7:44 ` Backlight control only in the kernel? Borislav Petkov
2013-08-07  9:03   ` Aaron Lu
2013-08-07 10:34     ` Borislav Petkov
2013-08-07 10:36   ` Matthew Garrett
2013-08-07 10:36     ` Matthew Garrett
2013-08-07 11:04     ` Borislav Petkov

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=87a9l95u8m.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=felipe.contreras@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rjw@sisk.pl \
    /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.