Message ID | 87a9l95u8m.fsf@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, On Fri, Jul 26, 2013 at 8:24 AM, Jani Nikula <jani.nikula@linux.intel.com> wrote: > 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! :) I did try this patch and I still see the same issue: when I go to the lowest level (xbacklight -set 0), the backlight is completely off. It seems in -rc2 the intel backlight driver works better, and can be controlled from the keys just fine, but it's still not as good as the acpi one minus win8. I don't notice any difference with your patch. Cheers.
On Mon, 29 Jul 2013, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> I don't notice any difference with your patch.
Ok, thanks for trying it out.
BR,
Jani.
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;