Skip to contentSkip to conversation

Need help debugging Sony Vaio VPCY2 backlight control problem

DISCUSSION Michel Alexandre Salim 4 participants 11 messages Jul 1, 2011 – Jul 13, 2011

Subsystems (6)
DRM drivers DRM misc Intel i915 ACPI +2 more subsystems
lore
Share & tools
lore
#0 lore raw

Dear all,

(cc:ing Mattia and Marco since they seem to be actively working on sony-laptop.ko)

I have a Sony Vaio VPCY2 with a backlight control problem -- both with acpi_backlight=video and acpi_backlight=vendor.

With the former, setting the backlight (with Fn-F5/6) gave the appearance, as far as /sys/class/backlight/acpi_video0/{actual_,}brightness is concerned, that the change took place, however, the screen brightness remained unchanged. Even setpci-ing the hardware register does not make a difference.

Kernel bug report here: https://bugzilla.kernel.org/show_bug.cgi?id=38342

Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=689962

Is the Vaio Y's backlight supposed to be controlled by sony-laptop instead of by video.ko? Right now with sony-laptop, actual_brightness always reads -1 no matter what value is written to brightness.

If there's any information not currently attached to those bug reports that is needed, please let me know.

Thanks in advance,

Signature · 5 lines
Michel Alexandre Salim
GPG key ID: 78884778

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
#1 lore raw

Il 01/07/2011 21:34, Michel Alexandre Salim ha scritto:

Quoted 1 line

Dear all,

Hello Michel,

I'm not neither experienced nor the maintainer but I'll give my two cents.

Quoted 8 lines

I have a Sony Vaio VPCY2 with a backlight control problem -- both with acpi_backlight=video and acpi_backlight=vendor.

With the former, setting the backlight (with Fn-F5/6) gave the appearance, as far as /sys/class/backlight/acpi_video0/{actual_,}brightness is concerned, that the change took place, however, the screen brightness remained unchanged.

Here there is something I don't understand, since the _BCM method stores the brightness level into an EC register (apparently which one depends whether the notebook is on battery or not, if BNCM is enabled), but no GFX related methods are then called. The fact that _BQC returns an updated value proves that it works, but looking at your DSDT I'd say that no change is indeed applied. Are you experiencing the same issue under Windows?

Quoted 6 lines

Kernel bug report here: https://bugzilla.kernel.org/show_bug.cgi?id=38342

Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=689962

Is the Vaio Y's backlight supposed to be controlled by sony-laptop instead of by video.ko?

Not necessarily.

Quoted 2 lines

Right now with sony-laptop, actual_brightness
always reads -1 no matter what value is written to brightness.

In your laptop SBRT/GBRT methods use zero based values, so -1 is a reasonable value. But why are you always getting -1 (especially if the LCD brightness is maximized)? Maybe the if statement "If (^^EC0.BNEN)" is false, but why?

Quoted 2 lines

If there's any information not currently attached to those bug reports that is needed, please let me know.

Using the sony-laptop provided backlight device, try to dump the EC registers before and after changing the brightness value. You can use "ectool" or sysfs (depending on your kernel configuration).

Regards

#2 lore raw

Hi Marco,

Quoted 9 lines · Marco Chiappero

Il 01/07/2011 21:34, Michel Alexandre Salim ha scritto:
Here there is something I don't understand, since the _BCM method stores the brightness level into an EC register (apparently which one depends whether the notebook is on battery or not, if BNCM is enabled), but no GFX related methods are then called. The fact that _BQC returns an updated value proves that it works, but looking at your DSDT I'd say that no change is indeed applied. Are you experiencing the same issue under Windows?

Brightness control works perfectly under Windows, or I probably would have returned the laptop for repairs :)

Quoted 12 lines
Quoted 6 lines

Kernel bug report here: https://bugzilla.kernel.org/show_bug.cgi?id=38342

Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=689962

Is the Vaio Y's backlight supposed to be controlled by sony-laptop instead of by video.ko?

Not necessarily.

Quoted 2 lines

Right now with sony-laptop, actual_brightness
always reads -1 no matter what value is written to brightness.

In 3.0-rc5, sony-laptop.ko actually behaves like video.ko -- sysfs's brightness file can be set, but actual_brightness does not budge. Previously (as late as 2.6.38.8, and maybe 3.0-rc4 but I'm not 100% sure about the latter), using sony-laptop.ko the brightness file also reads -1 all the time, and Fn-F5/F6 shows it stuck to zero, whereas now it concurs with the brightness file, pretending that brightness values are changing.

Only diff now is that video.ko defaults to full brightness whereas according to sony-laptop.ko, at boot up the brightness is 0. But that's probably because video.ko's actual_brightness reads 8 (max) whereas sony-laptop.ko reads actual_brightness of -1 (so defaulting brightness to zero is sensible).

Quoted 5 lines

In your laptop SBRT/GBRT methods use zero based values, so -1 is a reasonable value. But why are you always getting -1 (especially if the LCD brightness is maximized)? Maybe the if statement "If (^^EC0.BNEN)" is false, but why?

Quoted 7 lines
Quoted 2 lines

If there's any information not currently attached to those bug reports that is needed, please let me know.

Using the sony-laptop provided backlight device, try to dump the EC registers before and after changing the brightness value. You can use "ectool" or sysfs (depending on your kernel configuration).

Here are the ectool dumps, before setting any brightness (backlight=0), after setting it to 5, and after setting it to 3, plus the typescript log of the commands issued and the sysfs readings.

I then set brightness back to 0 (ec-after3.txt) -- didn't log the keyboard interactions because it's the same (value for brightness concurs with what is set, but actual_brightness is still -1)

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Thanks,

Signature · 4 lines
Michel Alexandre Salim

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

EC RAM:

00: 00 20 00 00 00 00 00 00 00 00 00 50 00 00 00 30 10: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40: 00 00 00 00 00 00 00 00 00 00 00 f4 00 00 00 00 50: c1 07 03 07 03 c4 00 00 00 01 00 00 07 00 00 00 60: 80 80 00 00 00 00 00 0b d7 95 07 8f 65 55 39 f5 70: 62 03 04 00 88 61 00 00 01 01 00 00 00 00 00 00 80: 04 08 08 08 ff 00 00 ff 0b 00 00 06 00 00 00 00 90: 00 00 00 04 9a 97 00 00 00 a1 00 00 00 00 03 0a
a0: 82 80 80 80 80 80 80 80 2d 25 27 00 32 3b 12 00
b0: 80 80 00 00 00 00 00 00 1a 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 64 67 57 5a 00 00 00 7e 00 00 00 00 1d 00 00 00
e0: 1a 14 a2 14 61 00 0c 01 9a 30 01 80 02 01 b2 0b
f0: 30 57 2e 30 32 53 4e 2e 4b 30 2e 31 34 20 00 00

Not dumping EC IDX RAM.

EC RAM:

00: 00 20 00 00 00 00 00 00 00 00 00 50 00 00 00 30 10: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40: 00 00 00 00 00 00 00 00 00 00 00 f4 00 00 00 00 50: c1 07 03 07 03 c4 00 00 00 01 00 00 07 00 00 00 60: 80 80 00 00 00 00 00 0b d7 95 07 8f 65 55 39 f5 70: 62 03 04 00 88 61 00 00 01 01 00 00 00 00 00 00 80: 04 08 08 08 ff 00 00 ff 0b 00 00 06 00 00 00 00 90: 00 00 00 04 9a 97 00 00 00 a1 00 00 00 00 03 0a
a0: 82 80 80 80 80 80 80 80 2e 26 27 00 31 3b 12 00
b0: 80 80 00 00 00 00 00 00 1a 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 64 67 57 5a 00 00 00 7e 00 00 00 00 1d 00 00 00
e0: 20 14 a2 14 62 00 fc 00 9c 30 01 80 f8 00 b4 0b
f0: 30 57 2e 30 32 53 4e 2e 4b 30 2e 31 34 20 00 00

Not dumping EC IDX RAM.

EC RAM:

00: 00 20 00 00 00 00 00 00 00 00 00 50 00 00 00 30 10: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40: 00 00 00 00 00 00 00 00 00 00 00 f4 00 00 00 00 50: c1 07 03 07 03 c4 00 00 00 01 00 00 07 00 00 00 60: 80 80 00 00 00 00 00 0b d7 95 07 8f 65 55 39 f5 70: 62 03 04 00 88 61 00 00 01 01 00 00 00 00 00 00 80: 04 08 08 08 ff 00 00 ff 0b 00 00 06 00 00 00 00 90: 00 00 00 04 9a 97 00 00 00 a1 00 00 00 00 03 0a
a0: 82 80 80 80 80 80 80 80 2e 26 28 00 31 3b 13 00
b0: 80 80 00 00 00 00 00 00 1b 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 64 67 57 5a 00 00 00 7e 00 00 00 00 1d 00 00 00
e0: 2b 14 a2 14 62 00 d5 00 9c 30 01 80 d0 00 b8 0b
f0: 30 57 2e 30 32 53 4e 2e 4b 30 2e 31 34 20 00 00

Not dumping EC IDX RAM.

#3 lore raw
Quoted 8 lines · Michel Alexandre Salim

Here are the ectool dumps, before setting any brightness (backlight=0), after setting it to 5, and after setting it to 3, plus the typescript log of the commands issued and the sysfs readings.

I then set brightness back to 0 (ec-after3.txt) -- didn't log the keyboard interactions because it's the same (value for brightness concurs with what is set, but actual_brightness is still -1)

Quoted 6 lines

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Thanks,

And here's the last dump file, forgot to attach it earlier.

Thanks,

Signature · 4 lines
Michel Alexandre Salim

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

EC RAM:

00: 00 20 00 00 00 00 00 00 00 00 00 50 00 00 00 30 10: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40: 00 00 00 00 00 00 00 00 00 00 00 f4 00 00 00 00 50: c1 07 03 07 03 c4 00 00 00 01 00 00 07 00 00 00 60: 80 80 00 00 00 00 00 0b d7 95 07 8f 65 55 39 f5 70: 62 03 04 00 88 61 00 00 01 01 00 00 00 00 00 00 80: 04 08 08 08 ff 00 00 ff 0b 00 00 06 00 00 00 00 90: 00 00 00 04 7e 7c 00 00 00 a1 00 00 00 00 03 0a
a0: 83 80 80 80 80 80 80 80 2d 27 28 00 32 3b 11 00
b0: 80 80 00 00 00 00 00 00 1b 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 64 67 57 5a 00 00 00 7e 00 00 00 00 1d 00 00 00
e0: 3c 14 a2 14 62 00 a6 00 9e 30 01 80 a0 00 bf 0b
f0: 30 57 2e 30 32 53 4e 2e 4b 30 2e 31 34 20 00 00

Not dumping EC IDX RAM.

Acked-by Jesse Barnes
#4 lore raw

Hi, Michael,

please check if the two patches attached help.

thanks,
rui

Quoted 13 lines · Michel Alexandre Salim
Quoted 12 lines · Michel Alexandre Salim

Here are the ectool dumps, before setting any brightness (backlight=0), after setting it to 5, and after setting it to 3, plus the typescript log of the commands issued and the sysfs readings.

I then set brightness back to 0 (ec-after3.txt) -- didn't log the keyboard interactions because it's the same (value for brightness concurs with what is set, but actual_brightness is still -1)

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Quoted 6 lines
Quoted 2 lines

Thanks,

And here's the last dump file, forgot to attach it earlier.

Thanks,

From b788969e3ee7ba2311e4c7c968895c5a3ca0cf7c Mon Sep 17 00:00:00 2001
From: Matthew Garrett <[email protected]>
Date: Wed, 18 May 2011 17:12:05 -0400
Subject: [PATCH 1/2] ACPI/Intel: Rework Opregion support

The Integrated Graphics Device opregion specification defines a mechanism for the OS and system firmware to collaborate on various graphics-related functionality. This is currently implemented in the i915 driver but isn't strictly limited to these devices. Move it to a more generic location and remove the i915 dependency, while simultaneously reworking i915 to make use of the new driver.

[ickle: rebase onto drm-core-next]
---
 drivers/acpi/Kconfig                  |    8 +
 drivers/acpi/Makefile                 |    1 +
 drivers/acpi/acpi_igd_opregion.c      |  411 ++++++++++++++++++++++++++
 drivers/gpu/drm/Kconfig               |    1 +
 drivers/gpu/drm/i915/Makefile         |    1 -
 drivers/gpu/drm/i915/i915_debugfs.c   |    2 +-
 drivers/gpu/drm/i915/i915_dma.c       |   13 +-
 drivers/gpu/drm/i915/i915_drv.c       |    6 +-
 drivers/gpu/drm/i915/i915_drv.h       |   34 +--
 drivers/gpu/drm/i915/i915_irq.c       |    7 +-
 drivers/gpu/drm/i915/intel_bios.c     |    8 +-
 drivers/gpu/drm/i915/intel_lvds.c     |    2 +-
 drivers/gpu/drm/i915/intel_opregion.c |  516 ---------------------------------
 drivers/gpu/drm/i915/intel_panel.c    |    4 +-
 include/acpi/acpi_igd_opregion.h      |  105 +++++++
 15 files changed, 552 insertions(+), 567 deletions(-)
 create mode 100644 drivers/acpi/acpi_igd_opregion.c
 delete mode 100644 drivers/gpu/drm/i915/intel_opregion.c
 create mode 100644 include/acpi/acpi_igd_opregion.h
drivers/acpi/Kconfig +8 -0
index bc2218d..3824361 100644
@@ -371,4 +371,12 @@ config ACPI_HED
 
 source "drivers/acpi/apei/Kconfig"
 
+config ACPI_IGD_OPREGION
+       tristate "ACPI Integrated Graphics Device OpRegion support"
+       help
+         This driver adds support for the Intel ACPI Integrated Graphics
+	 Device OpRegion specification, allowing communication between
+	 the firmware and graphics driver on mobile systems with Intel
+	 graphics
+
 endif	# ACPI
drivers/acpi/Makefile +1 -0
index b66fbb2..0e641a8 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_ACPI_SBS)		+= sbshc.o
 obj-$(CONFIG_ACPI_SBS)		+= sbs.o
 obj-$(CONFIG_ACPI_HED)		+= hed.o
 obj-$(CONFIG_ACPI_EC_DEBUGFS)	+= ec_sys.o
+obj-$(CONFIG_ACPI_IGD_OPREGION)	+= acpi_igd_opregion.o
 
 # processor has its own "processor." module_param namespace
 processor-y			:= processor_driver.o processor_throttling.o
drivers/acpi/acpi_igd_opregion.c new file +411 -0

411 lines not on this page · raw message

drivers/gpu/drm/Kconfig +1 -0
index b493663..fd6f79e 100644
@@ -101,6 +101,7 @@ config DRM_I915
 	select INPUT if ACPI
 	select ACPI_VIDEO if ACPI
 	select ACPI_BUTTON if ACPI
+	select ACPI_IGD_OPREGION if ACPI
 	help
 	  Choose this option if you have a system that has "Intel Graphics
 	  Media Accelerator" or "HD Graphics" integrated graphics,
drivers/gpu/drm/i915/Makefile +0 -1
index 0ae6a7c..776c362 100644
@@ -28,7 +28,6 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
 	  intel_dvo.o \
 	  intel_ringbuffer.o \
 	  intel_overlay.o \
-	  intel_opregion.o \
 	  dvo_ch7xxx.o \
 	  dvo_ch7017.o \
 	  dvo_ivch.o \
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 183eaac..74e48bb 100644
@@ -1136,7 +1136,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
 	struct drm_device *dev = node->minor->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
-	struct intel_opregion *opregion = &dev_priv->opregion;
+	struct igd_opregion *opregion = &dev_priv->opregion_dev.opregion;
 	int ret;
 
 	ret = mutex_lock_interruptible(&dev->struct_mutex);
drivers/gpu/drm/i915/i915_dma.c +10 -3
index 0239e99..8e68a1b 100644
@@ -2027,7 +2027,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	/* Try to make sure MCHBAR is enabled before poking at it */
 	intel_setup_mchbar(dev);
 	intel_setup_gmbus(dev);
-	intel_opregion_setup(dev);
+
+	if (IS_MOBILE(dev)) {
+		dev_priv->opregion_dev.max_backlight = intel_panel_get_max_backlight(dev);
+		dev_priv->opregion_dev.set_backlight = intel_panel_set_backlight;
+	}
+	dev_priv->opregion_dev.enable_asle = intel_enable_asle;
+	dev_priv->opregion_dev.drm_dev = dev;
+	igd_opregion_setup(&dev_priv->opregion_dev);
 
 	/* Make sure the bios did its job and set up vital registers */
 	intel_setup_bios(dev);
@@ -2087,7 +2094,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	}
 
 	/* Must be done after probing outputs */
-	intel_opregion_init(dev);
+	igd_opregion_init(&dev_priv->opregion_dev);
 	acpi_video_register();
 
 	setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed,
@@ -2176,7 +2183,7 @@ int i915_driver_unload(struct drm_device *dev)
 	if (dev->pdev->msi_enabled)
 		pci_disable_msi(dev->pdev);
 
-	intel_opregion_fini(dev);
+	igd_opregion_fini(&dev_priv->opregion_dev);
 
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		/* Flush any outstanding unpin_work. */
drivers/gpu/drm/i915/i915_drv.c +3 -3
index c041869..0656106 100644
@@ -371,7 +371,7 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	i915_save_state(dev);
 
-	intel_opregion_fini(dev);
+	igd_opregion_fini(&dev_priv->opregion_dev);
 
 	/* Modeset on resume, not lid events */
 	dev_priv->modeset_on_lid = 0;
@@ -421,7 +421,7 @@ static int i915_drm_thaw(struct drm_device *dev)
 	}
 
 	i915_restore_state(dev);
-	intel_opregion_setup(dev);
+	igd_opregion_setup(&dev_priv->opregion_dev);
 
 	/* KMS EnterVT equivalent */
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
@@ -441,7 +441,7 @@ static int i915_drm_thaw(struct drm_device *dev)
 			ironlake_enable_rc6(dev);
 	}
 
-	intel_opregion_init(dev);
+	igd_opregion_init(&dev_priv->opregion_dev);
 
 	dev_priv->modeset_on_lid = 0;
 
drivers/gpu/drm/i915/i915_drv.h +2 -32
index 3a1c277..9b2b94a 100644
@@ -36,6 +36,7 @@
 #include <linux/io-mapping.h>
 #include <linux/i2c.h>
 #include <drm/intel-gtt.h>
+#include <acpi/acpi_igd_opregion.h>
 
 /* General customization:
  */
@@ -102,21 +103,6 @@ struct mem_block {
 	struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
 };
 
-struct opregion_header;
-struct opregion_acpi;
-struct opregion_swsci;
-struct opregion_asle;
-
-struct intel_opregion {
-	struct opregion_header *header;
-	struct opregion_acpi *acpi;
-	struct opregion_swsci *swsci;
-	struct opregion_asle *asle;
-	void *vbt;
-	u32 __iomem *lid_state;
-};
-#define OPREGION_SIZE            (8*1024)
-
 struct intel_overlay;
 struct intel_overlay_error_state;
 
@@ -330,7 +316,7 @@ typedef struct drm_i915_private {
 	int cfb_plane;
 	int cfb_y;
 
-	struct intel_opregion opregion;
+	struct opregion_dev opregion_dev;
 
 	/* overlay */
 	struct intel_overlay *overlay;
@@ -1281,22 +1267,6 @@ extern inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
 }
 extern void intel_i2c_reset(struct drm_device *dev);
 
-/* intel_opregion.c */
-extern int intel_opregion_setup(struct drm_device *dev);
-#ifdef CONFIG_ACPI
-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_gse_intr(struct drm_device *dev);
-extern void intel_opregion_enable_asle(struct drm_device *dev);
-#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_gse_intr(struct drm_device *dev) { return; }
-static inline void intel_opregion_enable_asle(struct drm_device *dev) { return; }
-#endif
-
 /* intel_acpi.c */
 #ifdef CONFIG_ACPI
 extern void intel_register_dsm_handler(void);
drivers/gpu/drm/i915/i915_irq.c +3 -4
index 349a03e..f6eeeac 100644
@@ -601,7 +601,7 @@ irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
 		notify_ring(dev, &dev_priv->ring[BCS]);
 
 	if (de_iir & DE_GSE)
-		intel_opregion_gse_intr(dev);
+		igd_opregion_intr(&dev_priv->opregion_dev);
 
 	if (de_iir & DE_PLANEA_FLIP_DONE) {
 		intel_prepare_page_flip(dev, 0);
@@ -1322,9 +1322,8 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
 				blc_event = true;
 		}
 
-
 		if (blc_event || (iir & I915_ASLE_INTERRUPT))
-			intel_opregion_asle_intr(dev);
+			igd_opregion_intr(&dev_priv->opregion_dev);
 
 		/* With MSI, interrupts are only generated when iir
 		 * transitions from zero to nonzero.  If another bit got
@@ -1977,7 +1976,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
 		I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
 	}
 
-	intel_opregion_enable_asle(dev);
+	igd_opregion_enable_asle(&dev_priv->opregion_dev);
 
 	return 0;
 }
drivers/gpu/drm/i915/intel_bios.c +4 -4
index 927442a..f606735 100644
@@ -611,15 +611,15 @@ intel_parse_bios(struct drm_device *dev)
 
 	init_vbt_defaults(dev_priv);
 
-	/* XXX Should this validation be moved to intel_opregion.c? */
-	if (dev_priv->opregion.vbt) {
-		struct vbt_header *vbt = dev_priv->opregion.vbt;
+	/* XXX Should this validation be moved to acpi_igd_opregion.c? */
+	if (dev_priv->opregion_dev.opregion.vbt) {
+		struct vbt_header *vbt = dev_priv->opregion_dev.opregion.vbt;
 		if (memcmp(vbt->signature, "$VBT", 4) == 0) {
 			DRM_DEBUG_DRIVER("Using VBT from OpRegion: %20s\n",
 					 vbt->signature);
 			bdb = (struct bdb_header *)((char *)vbt + vbt->bdb_offset);
 		} else
-			dev_priv->opregion.vbt = NULL;
+			dev_priv->opregion_dev.opregion.vbt = NULL;
 	}
 
 	if (bdb == NULL) {
drivers/gpu/drm/i915/intel_lvds.c +1 -1
index 67cb076..3b90e68 100644
@@ -825,7 +825,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
 		 * additional data.  Trust that if the VBT was written into
 		 * the OpRegion then they have validated the LVDS's existence.
 		 */
-		if (dev_priv->opregion.vbt)
+		if (dev_priv->opregion_dev.opregion.vbt)
 			return true;
 	}
 
drivers/gpu/drm/i915/intel_opregion.c deleted +0 -516

516 lines not on this page · raw message

drivers/gpu/drm/i915/intel_panel.c +2 -2
index a06ff07..f893ff0 100644
@@ -297,8 +297,8 @@ intel_panel_detect(struct drm_device *dev)
 	 * appears to be either the BIOS or Linux ACPI fault */
 #if 0
 	/* Assume that the BIOS does not lie through the OpRegion... */
-	if (dev_priv->opregion.lid_state)
-		return ioread32(dev_priv->opregion.lid_state) & 0x1 ?
+	if (dev_priv->opregion_dev.opregion.acpi)
+		return ioread32(&dev_priv->opregion_dev.opregion.acpi->clid) & 0x1 ?
 			connector_status_connected :
 			connector_status_disconnected;
 #endif
include/acpi/acpi_igd_opregion.h new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
1.7.5

From d957b0a6ca265797cce4296dfc3cfda625dfd96f Mon Sep 17 00:00:00 2001
From: Matthew Garrett <[email protected]>
Date: Wed, 18 May 2011 17:15:48 -0400
Subject: [PATCH 2/2] i915: Add GPU backlight interface

Not all systems provide a firmware or platform interface to backlight control. We should expose a gpu-level backlight interface to handle that case.

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 +
 drivers/gpu/drm/i915/intel_display.c |    2 -
 drivers/gpu/drm/i915/intel_dp.c      |    6 +++
 drivers/gpu/drm/i915/intel_drv.h     |    3 +-
 drivers/gpu/drm/i915/intel_lvds.c    |    6 +++
 drivers/gpu/drm/i915/intel_panel.c   |   78 ++++++++++++++++++++++++++++++----
 6 files changed, 86 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 9b2b94a..68e8869 100644
@@ -33,6 +33,7 @@
 #include "i915_reg.h"
 #include "intel_bios.h"
 #include "intel_ringbuffer.h"
+#include <linux/backlight.h>
 #include <linux/io-mapping.h>
 #include <linux/i2c.h>
 #include <drm/intel-gtt.h>
@@ -667,6 +668,7 @@ typedef struct drm_i915_private {
 	int child_dev_num;
 	struct child_device_config *child_dev;
 	struct drm_connector *int_lvds_connector;
+	struct backlight_device *backlight;
 
 	bool mchbar_need_disable;
 
drivers/gpu/drm/i915/intel_display.c +0 -2
index 03726a5..7ffb851 100644
@@ -6752,8 +6752,6 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_encoder_clones(dev, encoder->clone_mask);
 	}
 
-	intel_panel_setup_backlight(dev);
-
 	/* disable all the possible outputs/crtcs before entering KMS mode */
 	drm_helper_disable_unused_functions(dev);
 }
drivers/gpu/drm/i915/intel_dp.c +6 -0
index a4d8031..c262378 100644
@@ -1747,6 +1747,11 @@ done:
 static void
 intel_dp_destroy (struct drm_connector *connector)
 {
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
+
+	if (is_edp(intel_dp))
+		intel_panel_destroy_backlight(connector);
+
 	drm_sysfs_connector_remove(connector);
 	drm_connector_cleanup(connector);
 	kfree(connector);
@@ -1989,6 +1994,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 					DRM_MODE_TYPE_PREFERRED;
 			}
 		}
+		intel_panel_setup_backlight(connector);
 	}
 
 	intel_dp_add_properties(intel_dp, connector);
drivers/gpu/drm/i915/intel_drv.h +2 -1
index 831d7a4..c2b5c11 100644
@@ -265,7 +265,8 @@ extern void intel_pch_panel_fitting(struct drm_device *dev,
 extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
 extern u32 intel_panel_get_backlight(struct drm_device *dev);
 extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
-extern void intel_panel_setup_backlight(struct drm_device *dev);
+extern int intel_panel_setup_backlight(struct drm_connector *dev);
+extern void intel_panel_destroy_backlight(struct drm_connector *dev);
 extern void intel_panel_enable_backlight(struct drm_device *dev);
 extern void intel_panel_disable_backlight(struct drm_device *dev);
 extern enum drm_connector_status intel_panel_detect(struct drm_device *dev);
drivers/gpu/drm/i915/intel_lvds.c +6 -0
index 3b90e68..38047b6 100644
@@ -584,6 +584,9 @@ static void intel_lvds_destroy(struct drm_connector *connector)
 
 	if (dev_priv->lid_notifier.notifier_call)
 		acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
+
+	intel_panel_destroy_backlight(connector);
+
 	drm_sysfs_connector_remove(connector);
 	drm_connector_cleanup(connector);
 	kfree(connector);
@@ -1033,6 +1036,9 @@ out:
 	/* keep the LVDS connector */
 	dev_priv->int_lvds_connector = connector;
 	drm_sysfs_connector_add(connector);
+
+	intel_panel_setup_backlight(connector);
+
 	return true;
 
 failed:
drivers/gpu/drm/i915/intel_panel.c +70 -8

90 lines not on this page · raw message

Signature · 1 line
1.7.5
#8 lore raw
In reply to Michel Alexandre Salim

Il 04/07/2011 10:46, Michel Alexandre Salim ha scritto:

Quoted 1 line

Hi Marco,

Hi Michel,

Quoted 3 lines

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Both this behavior and the ASL is confusing, so it's not easy to say where is the problem exactly, but BNEN, BNCM, BNDM, BNVE are set to 0. This affects for sure the SBRT/GBRT methods used by sony-laptop (that's why they do not work), I can't say about _BCM/_BQC methods used by the acpi video driver (which is preferable). However, since _BCM calls no GFX methods and only acts on the EC, it might start to work after setting those bits to 1. The real question is why those bits are low, is there any issue during the EC initialization? That said, the issue doesn't seem to belong to sony-laptop and video drivers. You can try to temporarily fix the problem setting to 1 those bits (but it is not a solution), just compile and run the attached program. Please report back if it works, and if it works for both backlight controls.

#5 lore raw
In reply to Zhang Rui

Hi Rui,

They apply cleanly on top of 3.0-rc5, but I'm getting a warning-treated-as-failure. Which kernel tree am I supposed to be applying this to -- linus' 3.0-rc5, a post-rc5 commit, drm-intel-fixes or drm-intel-next?

Thanks -- Michel

  CC [M]  drivers/gpu/drm/i915/i915_drv.o
  CC [M]  drivers/gpu/drm/i915/i915_dma.o
  CC [M]  drivers/gpu/drm/i915/i915_irq.o

drivers/gpu/drm/i915/i915_irq.c: In function ‘ivybridge_irq_handler’:
drivers/gpu/drm/i915/i915_irq.c:505:3: error: implicit declaration of function ‘intel_opregion_gse_intr’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

make[4]: *** [drivers/gpu/drm/i915/i915_irq.o] Error 1 make[3]: *** [drivers/gpu/drm/i915] Error 2 make[2]: *** [drivers/gpu/drm] Error 2 make[1]: *** [drivers/gpu] Error 2
make: *** [drivers] Error 2

Quoted 27 lines · Zhang Rui

Hi, Michael,

please check if the two patches attached help.

thanks,
rui

Quoted 19 lines · Michel Alexandre Salim
Quoted 8 lines · Michel Alexandre Salim

Here are the ectool dumps, before setting any brightness (backlight=0), after setting it to 5, and after setting it to 3, plus the typescript log of the commands issued and the sysfs readings.

I then set brightness back to 0 (ec-after3.txt) -- didn't log the keyboard interactions because it's the same (value for brightness concurs with what is set, but actual_brightness is still -1)

Quoted 6 lines

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Thanks,

And here's the last dump file, forgot to attach it earlier.

Thanks,

Signature · 4 lines
Michel Alexandre Salim

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
#6 lore raw
Quoted 17 lines · Michel Alexandre Salim

Hi Rui,

They apply cleanly on top of 3.0-rc5, but I'm getting a warning-treated-as-failure. Which kernel tree am I supposed to be applying this to -- linus' 3.0-rc5, a post-rc5 commit, drm-intel-fixes or drm-intel-next?

Thanks -- Michel

  CC [M]  drivers/gpu/drm/i915/i915_drv.o
  CC [M]  drivers/gpu/drm/i915/i915_dma.o
  CC [M]  drivers/gpu/drm/i915/i915_irq.o

drivers/gpu/drm/i915/i915_irq.c: In function ‘ivybridge_irq_handler’:
drivers/gpu/drm/i915/i915_irq.c:505:3: error: implicit declaration of function ‘intel_opregion_gse_intr’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

Quoted 6 lines

make[4]: *** [drivers/gpu/drm/i915/i915_irq.o] Error 1 make[3]: *** [drivers/gpu/drm/i915] Error 2 make[2]: *** [drivers/gpu/drm] Error 2 make[1]: *** [drivers/gpu] Error 2
make: *** [drivers] Error 2

And if I comment out those two lines, compile finishes but fails because of undefined references -- seems like there's an Ivybridge-specific references from another patch that I don't have.

Kernel: arch/x86/boot/bzImage is ready (#3)
Building modules, stage 2.
MODPOST 2369 modules
ERROR: "igd_opregion_init" [drivers/gpu/drm/i915/i915.ko] undefined!
ERROR: "igd_opregion_intr" [drivers/gpu/drm/i915/i915.ko] undefined!
ERROR: "igd_opregion_enable_asle" [drivers/gpu/drm/i915/i915.ko] undefined!
ERROR: "igd_opregion_setup" [drivers/gpu/drm/i915/i915.ko] undefined!
ERROR: "igd_opregion_fini" [drivers/gpu/drm/i915/i915.ko] undefined!
WARNING: modpost: Found 3 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

Quoted 30 lines · Zhang Rui
Quoted 27 lines

Hi, Michael,

please check if the two patches attached help.

thanks,
rui

Quoted 19 lines · Michel Alexandre Salim
Quoted 8 lines · Michel Alexandre Salim

Here are the ectool dumps, before setting any brightness (backlight=0), after setting it to 5, and after setting it to 3, plus the typescript log of the commands issued and the sysfs readings.

I then set brightness back to 0 (ec-after3.txt) -- didn't log the keyboard interactions because it's the same (value for brightness concurs with what is set, but actual_brightness is still -1)

Quoted 6 lines

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Thanks,

And here's the last dump file, forgot to attach it earlier.

Thanks,

Signature · 8 lines
Michel Alexandre Salim

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw
In reply to Marco Chiappero

Hi Marco,

Quoted 7 lines · Marco Chiappero

Il 04/07/2011 10:46, Michel Alexandre Salim ha scritto:
Hi Michel,

Quoted 3 lines

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Quoted 13 lines

Both this behavior and the ASL is confusing, so it's not easy to say where is the problem exactly, but BNEN, BNCM, BNDM, BNVE are set to 0. This affects for sure the SBRT/GBRT methods used by sony-laptop (that's why they do not work), I can't say about _BCM/_BQC methods used by the acpi video driver (which is preferable). However, since _BCM calls no GFX methods and only acts on the EC, it might start to work after setting those bits to 1. The real question is why those bits are low, is there any issue during the EC initialization? That said, the issue doesn't seem to belong to sony-laptop and video drivers. You can try to temporarily fix the problem setting to 1 those bits (but it is not a solution), just compile and run the attached program. Please report back if it works, and if it works for both backlight controls.

Unfortunately, the results are, again, rather confusing. With sony-laptop.ko, after running backlight_fix once, actual_brightness has a nonsensical value -- 55. I tried setting it to 5, and something actually happens this time - actual_brightness now reads 5 rather than -1, and the screen brightness actually changes -- but, alas, too much (if the brightness range is from 0 to 7, 5 should be rather bright, instead it looked more like a 2 to me).

Further attempts to adjust brightness produced no result -- actual_brightness now tallies with brightness, like the video.ko's behavior, but the screen remained dim. Repeatedly running backlight_fix does not resolve matter either.

With the video.ko driver, backlight_fix appears to have no effect.

Anything else I can try? I've not tried Rui's solution yet, as I haven't found a kernel tree where the patches would apply *and* build cleanly yet.

Thanks,

Signature · 4 lines
Michel Alexandre Salim

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
#10 lore raw

Il 04/07/2011 21:00, Michel Alexandre Salim ha scritto:

Quoted 1 line

Hi Marco,

Hi,

Quoted 3 lines

Unfortunately, the results are, again, rather confusing. With sony-laptop.ko, after running backlight_fix once, actual_brightness has a nonsensical value -- 55.

It looks reasonable, don't worry about it.

Quoted 5 lines

I tried setting it to 5, and something
actually happens this time - actual_brightness now reads 5 rather than -1, and the screen brightness actually changes -- but, alas, too much (if the brightness range is from 0 to 7, 5 should be rather bright, instead it looked more like a 2 to me).

This is weird, brightness level should be ~75%.

Quoted 4 lines

Further attempts to adjust brightness produced no result -- actual_brightness now tallies with brightness, like the video.ko's behavior, but the screen remained dim. Repeatedly running backlight_fix does not resolve matter either.

even more weird. I don't know if IGID has changed in the meantime, but there's something not working properly elsewhere. But definitely it's not a problem belonging to sony-laptop or video (which should be used because SBRT/GBRT methods, with 0 based values and 9 values range, pose problems with the current backlight device implementation in sony-laptop).

Quoted 1 line

Anything else I can try?

The patches attached by Rui. Sorry but I can't help further.

#7 lore raw
In reply to Zhang Rui

The patches don't apply, but looks like the native backlight control patch is now in Linus' 3.0 tree, and I could cherry-pick Matthew's last iteration of the i915 patch (from July 7th) from linux-next onto 3.0-rc7.

Going to update my bug report to reflect this. Now the only problem is I have both acpi_video0 and intel_backlight, and GNOME Power Manager uses the former rather than the latter. Manually setting the brightness through the intel_backlight interface works.

Thanks, everyone.

Signature · 1 line
Michel
Quoted 27 lines · Zhang Rui

Hi, Michael,

please check if the two patches attached help.

thanks,
rui

Quoted 19 lines · Michel Alexandre Salim
Quoted 8 lines · Michel Alexandre Salim

Here are the ectool dumps, before setting any brightness (backlight=0), after setting it to 5, and after setting it to 3, plus the typescript log of the commands issued and the sysfs readings.

I then set brightness back to 0 (ec-after3.txt) -- didn't log the keyboard interactions because it's the same (value for brightness concurs with what is set, but actual_brightness is still -1)

Quoted 6 lines

Let me know if you need anything else. Once we can at least pinpoint the problem to the right subsystem, I'll add these attachments to the correct bug report.

Thanks,

And here's the last dump file, forgot to attach it earlier.

Thanks,

Signature · 7 lines
Michel Alexandre Salim
µblog:      http://identi.ca/hircus
            http://twitter.com/hircus
GPG key ID: 78884778

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments