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

@@ -105,16 +105,18 @@ static const struct backlight_ops hp680bl_ops = {
static int __devinit hp680bl_probe(struct platform_device *pdev)
{
struct backlight_properties props;
struct backlight_device *bd;
bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL,
&hp680bl_ops);
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = HP680_MAX_INTENSITY;
bd = backlight_device_register("hp680-bl", &pdev->dev, NULL,
&hp680bl_ops, &props);
if (IS_ERR(bd))
return PTR_ERR(bd);
platform_set_drvdata(pdev, bd);
bd->props.max_brightness = HP680_MAX_INTENSITY;
bd->props.brightness = HP680_DEFAULT_INTENSITY;
hp680bl_send_intensity(bd);