backlight: Allow properties to be passed at registration

Values such as max_brightness should be set before backlights are
registered, but the current API doesn't allow that. Add a parameter to
backlight_device_register and update drivers to ensure that they
set this correctly.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Matthew Garrett
2010-02-17 16:39:44 -05:00
committed by Richard Purdie
parent 57e148b6a9
commit a19a6ee6ca
49 changed files with 271 additions and 151 deletions

View File

@@ -922,9 +922,13 @@ static struct backlight_ops acer_bl_ops = {
static int __devinit acer_backlight_init(struct device *dev)
{
struct backlight_properties props;
struct backlight_device *bd;
bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops);
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = max_brightness;
bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops,
&props);
if (IS_ERR(bd)) {
printk(ACER_ERR "Could not register Acer backlight device\n");
acer_backlight_device = NULL;
@@ -935,7 +939,6 @@ static int __devinit acer_backlight_init(struct device *dev)
bd->props.power = FB_BLANK_UNBLANK;
bd->props.brightness = read_brightness(bd);
bd->props.max_brightness = max_brightness;
backlight_update_status(bd);
return 0;
}