Implement direct pineview backlight control.
Subsystems (3)
PATCH 1/1 Implement direct pineview backlight control.
drm/i915: Add a direct interface for pineview backlight support.
This adds a Kconfig variable CONFIG_DRM_I915_DIRECT_BACKLIGHT to optionally include the new source file i915_backlight.c. This file registers a couple backlight set/get routines with the standard drivers/video/backlight interface to add a directory under /sys/class/backlight/.
The big problem I see with this modification is that the i915 driver _already_ supports backlight level adjustment in i915_opregion.c. Unfortunately, that requires an IRQ to occur as the result of writing some ASLE (ACPI Source Language Event) register, and this requires BIOS support for the ACPI hook. It looks like we will not have such support in our initial custom BIOS.
So I copy a small amount of code from i915_opregion.c to make backlight adjustment directly available to the backlight framework.
Another problem is that I do not cover all the cases handled by the i915_opregion.c code. It would be too much untested code copying to do so. I enforce the lack of support by checking for IS_PINEVIEW() in i915_backlight_init().
Review URL: http://codereview.chromium.org/2830015
--- drivers/gpu/drm/Kconfig | 12 +++ drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_backlight.c | 120 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_dma.c | 5 ++ drivers/gpu/drm/i915/i915_drv.h | 19 +++++ 5 files changed, 157 insertions(+), 0 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_backlight.c
drivers/gpu/drm/Kconfig +12 -0
@@ -124,6 +124,18 @@ config DRM_I915_KMS the driver to bind to PCI devices, which precludes loading things like intelfb. +config DRM_I915_DIRECT_BACKLIGHT + bool "Enable direct backlight control" + depends on DRM_I915 + help + Choose this option if you want the i915 driver to provide direct + backlight control via /sys/class/backlight/i915_backlight. This + is in addition to the ACPI interface (which may also be in that + directory) that uses ASLE (ACPI Source Language Events) events to + get to i915_opregion.c code. + Direct backlight control gives finer granularity (0-256) than ACPI + and does not require BIOS support. + endchoice config DRM_MGA
drivers/gpu/drm/i915/Makefile +1 -0
@@ -31,5 +31,6 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \ i915-$(CONFIG_ACPI) += i915_opregion.o i915-$(CONFIG_COMPAT) += i915_ioc32.o +i915-$(CONFIG_DRM_I915_DIRECT_BACKLIGHT) += i915_backlight.o obj-$(CONFIG_DRM_I915) += i915.o
drivers/gpu/drm/i915/i915_backlight.c new file +120 -0
120 lines not on this page · raw message
drivers/gpu/drm/i915/i915_dma.c +5 -0
@@ -1504,6 +1504,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)setup_timer (&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, (unsigned long ) dev); + +i915_backlight_init (dev); +return 0 ; out_workqueue_free:
@@ -1523,6 +1526,8 @@ int i915_driver_unload(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; +i915_backlight_exit (dev); +destroy_workqueue (dev_priv->wq);del_timer_sync (&dev_priv->hangcheck_timer);
drivers/gpu/drm/i915/i915_drv.h +19 -0
@@ -34,6 +34,10 @@#include "intel_bios.h" #include <linux/io-mapping.h> +#ifdef CONFIG_DRM_I915_DIRECT_BACKLIGHT +#include <linux/backlight.h> +#endif +/* General customization: */
@@ -590,6 +594,12 @@ typedef struct drm_i915_private {int child_dev_num;struct child_device_config *child_dev;struct drm_connector *int_lvds_connector; + +#ifdef CONFIG_DRM_I915_DIRECT_BACKLIGHT +/* direct backlight interface */ +struct backlight_device *backlight; +#endif + } drm_i915_private_t;/** driver private structure attached to each drm_gem_object */
@@ -939,6 +949,15 @@ static inline void ironlake_opregion_gse_intr(struct drm_device *dev) { return;static inline void opregion_enable_asle (struct drm_device *dev) {return ; }#endif +#ifdef CONFIG_DRM_I915_DIRECT_BACKLIGHT +/* i915_backlight.c */ +extern void i915_backlight_init (struct drm_device *dev); +extern void i915_backlight_exit (struct drm_device *dev); +#else +extern inline void i915_backlight_init (struct drm_device *dev) {return ; } +extern inline void i915_backlight_exit (struct drm_device *dev) {return ; } +#endif +/* modesetting */ extern void intel_modeset_init (struct drm_device *dev);extern void intel_modeset_cleanup (struct drm_device *dev);
Signature · 1 line
1.7.0.1
Quoted 18 lines · On Tue, 22 Jun 2010 16:58:27 -0700 Bryan Freed <[email protected]> wrote:
drm/i915: Add a direct interface for pineview backlight support.
This adds a
KconfigvariableCONFIG_DRM_I915_DIRECT_BACKLIGHTto optionally include the new source filei915_backlight.c. This file registers a couple backlight set/get routines with the standarddrivers/video/backlightinterface to add a directory under/sys/class/backlight/.The big problem I see with this modification is that the i915 driver _already_ supports backlight level adjustment in
i915_opregion.c. Unfortunately, that requires an IRQ to occur as the result of writing some ASLE (ACPI Source Language Event) register, and this requires BIOS support for the ACPI hook. It looks like we will not have such support in our initial custom BIOS.So I copy a small amount of code from
i915_opregion.cto make backlight adjustment directly available to the backlight framework.
Quoted 7 lines
Another problem is that I do not cover all the cases handled by the
i915_opregion.ccode. It would be too much untested code copying to do so. I enforce the lack of support by checking forIS_PINEVIEW()ini915_backlight_init().Review URL: http://codereview.chromium.org/2830015
Signed-off-by Bryan Freed <[email protected]>
How does this compare to Matthew's native backlight support? AFAIK that patch is still outstanding due to the need for some changes to the backlight subsystem.
Matthew?
Signature · 7 lines
Jesse Barnes, Intel Open Source Technology Center ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first --
Quoted 18 lines · On Tue, 22 Jun 2010 16:58:27 -0700 Bryan Freed <[email protected]> wrote:
drm/i915: Add a direct interface for pineview backlight support.
This adds a
KconfigvariableCONFIG_DRM_I915_DIRECT_BACKLIGHTto optionally include the new source filei915_backlight.c. This file registers a couple backlight set/get routines with the standarddrivers/video/backlightinterface to add a directory under/sys/class/backlight/.The big problem I see with this modification is that the i915 driver _already_ supports backlight level adjustment in
i915_opregion.c. Unfortunately, that requires an IRQ to occur as the result of writing some ASLE (ACPI Source Language Event) register, and this requires BIOS support for the ACPI hook. It looks like we will not have such support in our initial custom BIOS.So I copy a small amount of code from
i915_opregion.cto make backlight adjustment directly available to the backlight framework.
Quoted 7 lines
Another problem is that I do not cover all the cases handled by the
i915_opregion.ccode. It would be too much untested code copying to do so. I enforce the lack of support by checking forIS_PINEVIEW()ini915_backlight_init().Review URL: http://codereview.chromium.org/2830015
Signed-off-by Bryan Freed <[email protected]>
How does this compare to Matthew's native backlight support? AFAIK that patch is still outstanding due to the need for some changes to the backlight subsystem.
Matthew?
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center