drivers/video/backlight/tps65217_bl.c add default brightness value option

Signed-off-by: Matus Ujhelyi <[email protected]>
Cc: Grant Likely <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Matus Ujhelyi 2013-04-29 16:18:08 -07:00 • committed by Linus Torvalds
commit 4d22f8c306
3 changed files with 18 additions and 1 deletions

View file

@ -245,6 +245,18 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
}
}
if (!of_property_read_u32(node, "default-brightness", &val)) {
if (val < 0 ||
val > 100) {
dev_err(&pdev->dev,
"invalid 'default-brightness' value in the device tree\n");
err = ERR_PTR(-EINVAL);
goto err;
}
pdata->dft_brightness = val;
}
of_node_put(node);
return pdata;
@ -311,7 +323,8 @@ static int tps65217_bl_probe(struct platform_device *pdev)
return PTR_ERR(tps65217_bl->bl);
}
tps65217_bl->bl->props.brightness = 0;
tps65217_bl->bl->props.brightness = pdata->dft_brightness;
backlight_update_status(tps65217_bl->bl);
platform_set_drvdata(pdev, tps65217_bl);
return 0;