drm/radeon: add a module parameter for backlight control (v2)
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Sep 2014 00:57:26 +0000 (20:57 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 22 Sep 2014 21:24:27 +0000 (17:24 -0400)
Add a module parameter to disable the radeon GPU backlight
controller to override the automatic detection.  Some
laptops seems to indicate that they use the integrated
controller, but appear to actually use an external
controller.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=81382

v2: fix module parameter description

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_drv.c
drivers/gpu/drm/radeon/radeon_encoders.c

index 5f05b4c8433807bf26a1b0ef80fd31a2c25d9a36..3247bfd144106d54fa24161f898f24ae538f9a3c 100644 (file)
@@ -106,6 +106,7 @@ extern int radeon_vm_block_size;
 extern int radeon_deep_color;
 extern int radeon_use_pflipirq;
 extern int radeon_bapm;
+extern int radeon_backlight;
 
 /*
  * Copy from radeon_drv.h so we don't have to include both and have conflicting
index e8545be7d5845dfad813d7b21474fa48c37d5699..6864682e91a7bdccbb39b0e8d129036f05e9809b 100644 (file)
@@ -181,6 +181,7 @@ int radeon_vm_block_size = -1;
 int radeon_deep_color = 0;
 int radeon_use_pflipirq = 2;
 int radeon_bapm = -1;
+int radeon_backlight = -1;
 
 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
 module_param_named(no_wb, radeon_no_wb, int, 0444);
@@ -263,6 +264,9 @@ module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444);
 MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)");
 module_param_named(bapm, radeon_bapm, int, 0444);
 
+MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)");
+module_param_named(backlight, radeon_backlight, int, 0444);
+
 static struct pci_device_id pciidlist[] = {
        radeon_PCI_IDS
 };
index 3c2094c25b537516a8b181e26fd2bca00dca0411..2a9cd7be9aad736f30a715d5aabd85126ce7416e 100644 (file)
@@ -158,10 +158,36 @@ radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8
        return ret;
 }
 
+static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder,
+                                        struct drm_connector *connector)
+{
+       struct drm_device *dev = radeon_encoder->base.dev;
+       struct radeon_device *rdev = dev->dev_private;
+       bool use_bl = false;
+
+       if (!(radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)))
+               return;
+
+       if (radeon_backlight == 0) {
+               return;
+       } else if (radeon_backlight == 1) {
+               use_bl = true;
+       } else if (radeon_backlight == -1) {
+               use_bl = true;
+       }
+
+       if (use_bl) {
+               if (rdev->is_atom_bios)
+                       radeon_atom_backlight_init(radeon_encoder, connector);
+               else
+                       radeon_legacy_backlight_init(radeon_encoder, connector);
+               rdev->mode_info.bl_encoder = radeon_encoder;
+       }
+}
+
 void
 radeon_link_encoder_connector(struct drm_device *dev)
 {
-       struct radeon_device *rdev = dev->dev_private;
        struct drm_connector *connector;
        struct radeon_connector *radeon_connector;
        struct drm_encoder *encoder;
@@ -174,13 +200,8 @@ radeon_link_encoder_connector(struct drm_device *dev)
                        radeon_encoder = to_radeon_encoder(encoder);
                        if (radeon_encoder->devices & radeon_connector->devices) {
                                drm_mode_connector_attach_encoder(connector, encoder);
-                               if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
-                                       if (rdev->is_atom_bios)
-                                               radeon_atom_backlight_init(radeon_encoder, connector);
-                                       else
-                                               radeon_legacy_backlight_init(radeon_encoder, connector);
-                                       rdev->mode_info.bl_encoder = radeon_encoder;
-                               }
+                               if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
+                                       radeon_encoder_add_backlight(radeon_encoder, connector);
                        }
                }
        }