Commit 039d5790 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

ARM: OMAP: osk+mistral backlight, power, driver specific

Generic backlight driver updates:

  - Don't oops on misconfigured platform device

  - Writing to /sys/class/backlight/omap-bl/brightness now works
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent e394f62e
...@@ -110,8 +110,7 @@ static int omapbl_update_status(struct backlight_device *dev) ...@@ -110,8 +110,7 @@ static int omapbl_update_status(struct backlight_device *dev)
struct omap_backlight *bl = class_get_devdata(&dev->class_dev); struct omap_backlight *bl = class_get_devdata(&dev->class_dev);
if (bl->current_intensity != dev->props->brightness) { if (bl->current_intensity != dev->props->brightness) {
if (dev->props->brightness > OMAPBL_MAX_INTENSITY || if (dev->props->brightness < 0)
dev->props->brightness < 0)
return -EPERM; /* Leave current_intensity untouched */ return -EPERM; /* Leave current_intensity untouched */
if (bl->powermode == FB_BLANK_UNBLANK) if (bl->powermode == FB_BLANK_UNBLANK)
...@@ -135,6 +134,7 @@ static struct backlight_properties omapbl_data = { ...@@ -135,6 +134,7 @@ static struct backlight_properties omapbl_data = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_brightness = omapbl_get_intensity, .get_brightness = omapbl_get_intensity,
.update_status = omapbl_update_status, .update_status = omapbl_update_status,
.max_brightness = OMAPBL_MAX_INTENSITY,
}; };
static int omapbl_probe(struct platform_device *pdev) static int omapbl_probe(struct platform_device *pdev)
...@@ -143,12 +143,20 @@ static int omapbl_probe(struct platform_device *pdev) ...@@ -143,12 +143,20 @@ static int omapbl_probe(struct platform_device *pdev)
struct omap_backlight *bl; struct omap_backlight *bl;
struct omap_backlight_config *pdata = pdev->dev.platform_data; struct omap_backlight_config *pdata = pdev->dev.platform_data;
if (!pdata)
return -ENXIO;
omapbl_data.check_fb = pdata->check_fb; omapbl_data.check_fb = pdata->check_fb;
bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL); bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL);
if (unlikely(!bl)) if (unlikely(!bl))
return -ENOMEM; return -ENOMEM;
/* REVISIT backlight API glitch: we can't associate the
* class device with "pdev" ... probably pass &pdev->dev
* instead of a string.
*/
dev = backlight_device_register("omap-bl", bl, &omapbl_data); dev = backlight_device_register("omap-bl", bl, &omapbl_data);
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
kfree(bl); kfree(bl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment