Skip to contentSkip to conversation

backlight: Set backlight type and max_brightness before backlights are registered

PATCH JinGoo Han 1 participant 1 message Jul 5, 2011

lore
Share & tools
lore

JinGoo Han

author Acked-by
#0 lore raw

The ams369fg06 driver is tested.

Quoted 133 lines

-----Original Message-----
From: Axel Lin [mailto:[email protected]]
Sent: Tuesday, July 05, 2011 1:38 PM
To: [email protected]
Cc: Matthew Garrett; Jingoo Han; Donghwa Lee; InKi Dae; Richard Purdie; Andrew Morton
Subject: [PATCH] backlight: Set backlight type and max_brightness before backlights are registered

Since commit a19a6ee "backlight: Allow properties to be passed at registration"
and commit bb7ca74 "backlight: add backlight type",
we can set backlight type and max_brightness before backlights are registered.
Some newly added drivers did not set it properly, let's fix it.

Cc Matthew Garrett <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Donghwa Lee <[email protected]>
Cc InKi Dae <[email protected]>
---
 drivers/video/backlight/ams369fg06.c |    9 ++++++---
 drivers/video/backlight/ld9040.c     |    8 ++++++--
 drivers/video/backlight/s6e63m0.c    |    9 ++++++---
 3 files changed, 18 insertions(+), 8 deletions(-)
drivers/video/backlight/ams369fg06.c +1 -0
index 6462d05..201a593 100644
@@ -479,6 +479,7 @@ static int __init ams369fg06_probe(struct spi_device
 *spi)
 	struct ams369fg06 *lcd = NULL;
 	struct lcd_device *ld = NULL;
 	struct backlight_device *bd = NULL;
+	struct backlight_properties props;
 
 	lcd = kzalloc(sizeof(struct ams369fg06), GFP_KERNEL);
drivers/video/backlight/ams369fg06.c +5 -3
 	if (!lcd)
@@ -511,16 +512,18 @@ static int __init ams369fg06_probe(struct spi_device
 *spi)
 
 	lcd->ld = ld;
 
+	memset(&props, 0, sizeof(struct backlight_properties));
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = MAX_BRIGHTNESS;
+
 	bd = backlight_device_register("ams369fg06-bl", &spi->dev, lcd,
-		&ams369fg06_backlight_ops, NULL);
+		&ams369fg06_backlight_ops, &props);
 	if (IS_ERR(bd)) {
 		ret =  PTR_ERR(bd);
 		goto out_lcd_unregister;
 	}
 
-	bd->props.max_brightness = MAX_BRIGHTNESS;
 	bd->props.brightness = DEFAULT_BRIGHTNESS;
-	bd->props.type = BACKLIGHT_RAW;
 	lcd->bd = bd;
 
drivers/video/backlight/ams369fg06.c +0 -0
 	if (!lcd->lcd_pd->lcd_enabled) {
drivers/video/backlight/ld9040.c +6 -2
index 62bcde3..5934655 100644
@@ -668,6 +668,7 @@ static int ld9040_probe(struct spi_device *spi)
 	struct ld9040 *lcd = NULL;
 	struct lcd_device *ld = NULL;
 	struct backlight_device *bd = NULL;
+	struct backlight_properties props;
 
 	lcd = kzalloc(sizeof(struct ld9040), GFP_KERNEL);
 	if (!lcd)
@@ -699,14 +700,17 @@ static int ld9040_probe(struct spi_device *spi)
 
 	lcd->ld = ld;
 
+	memset(&props, 0, sizeof(struct backlight_properties));
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = MAX_BRIGHTNESS;
+
 	bd = backlight_device_register("ld9040-bl", &spi->dev,
-		lcd, &ld9040_backlight_ops, NULL);
+		lcd, &ld9040_backlight_ops, &props);
 	if (IS_ERR(bd)) {
 		ret = PTR_ERR(bd);
 		goto out_unregister_lcd;
 	}
 
-	bd->props.max_brightness = MAX_BRIGHTNESS;
 	bd->props.brightness = MAX_BRIGHTNESS;
 	lcd->bd = bd;
 
drivers/video/backlight/s6e63m0.c +1 -0
index e1803ba..694e5aa 100644
@@ -738,6 +738,7 @@ static int __devinit s6e63m0_probe(struct spi_device
 *spi)
 	struct s6e63m0 *lcd = NULL;
 	struct lcd_device *ld = NULL;
 	struct backlight_device *bd = NULL;
+	struct backlight_properties props;
 
 	lcd = kzalloc(sizeof(struct s6e63m0), GFP_KERNEL);
drivers/video/backlight/s6e63m0.c +5 -3
 	if (!lcd)
@@ -769,16 +770,18 @@ static int __devinit s6e63m0_probe(struct spi_device
 *spi)
 
 	lcd->ld = ld;
 
+	memset(&props, 0, sizeof(struct backlight_properties));
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = MAX_BRIGHTNESS;
+
 	bd = backlight_device_register("s6e63m0bl-bl", &spi->dev, lcd,
-		&s6e63m0_backlight_ops, NULL);
+		&s6e63m0_backlight_ops, &props);
 	if (IS_ERR(bd)) {
 		ret =  PTR_ERR(bd);
 		goto out_lcd_unregister;
 	}
 
-	bd->props.max_brightness = MAX_BRIGHTNESS;
 	bd->props.brightness = MAX_BRIGHTNESS;
-	bd->props.type = BACKLIGHT_RAW;
 	lcd->bd = bd;
 
Quoted 4 lines

/*
--
1.7.4.1

�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m��� �띠�◀?뻀�