22 #include <linux/module.h>
23 #include <linux/kernel.h>
48 val /= bd->
props.max_brightness;
72 return bd->
props.brightness;
83 if ((brightness < 0) || (bd->
props.max_brightness < brightness)) {
84 dev_err(&bd->
dev,
"invalid brightness, %d\n", brightness);
88 dev_dbg(&bd->
dev,
"brightness=%d, power=%d, state=%d\n",
97 (
u8)aat2870_brightness(aat2870_bl, brightness));
101 if (brightness == 0) {
102 ret = aat2870_bl_disable(aat2870_bl);
106 ret = aat2870_bl_enable(aat2870_bl);
123 .get_brightness = aat2870_bl_get_brightness,
124 .update_status = aat2870_bl_update_status,
125 .check_fb = aat2870_bl_check_fb,
143 dev_err(&pdev->
dev,
"Invalid device ID, %d\n", pdev->
id);
153 "Failed to allocate memory for aat2870 backlight\n");
162 aat2870_bl, &aat2870_bl_ops, &props);
165 "Failed allocate memory for backlight device\n");
170 aat2870_bl->
pdev = pdev;
171 platform_set_drvdata(pdev, aat2870_bl);
188 bd->
props.max_brightness = 255;
192 bd->
props.brightness = bd->
props.max_brightness;
194 ret = aat2870_bl_update_status(bd);
196 dev_err(&pdev->
dev,
"Failed to initialize\n");
197 goto out_bl_dev_unregister;
202 out_bl_dev_unregister:
214 bd->
props.brightness = 0;
215 backlight_update_status(bd);
224 .name =
"aat2870-backlight",
227 .probe = aat2870_bl_probe,
228 .remove = aat2870_bl_remove,
231 static int __init aat2870_bl_init(
void)
237 static void __exit aat2870_bl_exit(
void)