[yocto] [PATCH 1/1][KERNEL 3.2] bsp/emenlow: initialize lvds backlight only if lvds enabled

tom.zanussi at intel.com tom.zanussi at intel.com
Thu Apr 26 11:48:38 PDT 2012


From: Tom Zanussi <tom.zanussi at intel.com>

intel_lvds_init() initializes the lvds backlight even if the lvds init
failed.  That doesn't make sense, and causes unnecessary error
messages in the kernel log.

Put the backlight init code into a separat function and only call it
if the lvds panel was successfully initialized.

Signed-off-by: Tom Zanussi <tom.zanussi at intel.com>
---
 drivers/gpu/drm-psb/intel_lvds.c |   51 ++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm-psb/intel_lvds.c b/drivers/gpu/drm-psb/intel_lvds.c
index 218e895..6a55c9b 100644
--- a/drivers/gpu/drm-psb/intel_lvds.c
+++ b/drivers/gpu/drm-psb/intel_lvds.c
@@ -611,6 +611,33 @@ int intel_get_acpi_dod(char *method)
 	kfree(buffer.pointer);
 	return found;
 }
+
+static void intel_lvds_backlight_init(struct drm_device *dev)
+{
+	if ((blc_type == BLC_I2C_TYPE) || (blc_type == BLC_PWM_TYPE)){	
+		struct backlight_properties props;
+		memset(&props, 0, sizeof(struct backlight_properties));
+		props.type = BACKLIGHT_RAW;
+		/* add /sys/class/backlight interface as standard */
+		psbbl_device = backlight_device_register("psblvds", &dev->pdev->dev, dev, &psbbl_ops, &props);
+		if (psbbl_device){
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
+			down(&psbbl_device->sem);
+			psbbl_device->props->max_brightness = BRIGHTNESS_MAX_LEVEL;
+			psbbl_device->props->brightness = lvds_backlight;
+			psbbl_device->props->power = FB_BLANK_UNBLANK;
+			psbbl_device->props->update_status(psbbl_device);
+			up(&psbbl_device->sem);
+#else
+			psbbl_device->props.max_brightness = BRIGHTNESS_MAX_LEVEL;
+			psbbl_device->props.brightness = lvds_backlight;
+			psbbl_device->props.power = FB_BLANK_UNBLANK;
+			backlight_update_status(psbbl_device);
+#endif
+		}
+	}
+}
+
 /**
  * intel_lvds_init - setup LVDS outputs on this device
  * @dev: drm device
@@ -802,29 +829,6 @@ void intel_lvds_init(struct drm_device *dev)
 		}
 	}
 
-	if ((blc_type == BLC_I2C_TYPE) || (blc_type == BLC_PWM_TYPE)){	
-		struct backlight_properties props;
-		memset(&props, 0, sizeof(struct backlight_properties));
-		props.type = BACKLIGHT_RAW;
-		/* add /sys/class/backlight interface as standard */
-		psbbl_device = backlight_device_register("psblvds", &dev->pdev->dev, dev, &psbbl_ops, &props);
-		if (psbbl_device){
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
-			down(&psbbl_device->sem);
-			psbbl_device->props->max_brightness = BRIGHTNESS_MAX_LEVEL;
-			psbbl_device->props->brightness = lvds_backlight;
-			psbbl_device->props->power = FB_BLANK_UNBLANK;
-			psbbl_device->props->update_status(psbbl_device);
-			up(&psbbl_device->sem);
-#else
-			psbbl_device->props.max_brightness = BRIGHTNESS_MAX_LEVEL;
-			psbbl_device->props.brightness = lvds_backlight;
-			psbbl_device->props.power = FB_BLANK_UNBLANK;
-			backlight_update_status(psbbl_device);
-#endif
-		}
-	}
-
 blc_out:
 
 	/* Set up the DDC bus. */
@@ -939,6 +943,7 @@ blc_out:
 #endif
 
 out:
+	intel_lvds_backlight_init(dev);
 	return;
 
 failed:
-- 
1.7.0.4




More information about the yocto mailing list