Commit d00ba726 authored by Richard Purdie's avatar Richard Purdie

backlight: Rename the corgi backlight driver to generic

The corgi backlight driver is really generic code. This rename makes
this a lot clearer and completes the partial rename made a while ago.
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent f4f6bda0
...@@ -123,17 +123,14 @@ config BACKLIGHT_ATMEL_PWM ...@@ -123,17 +123,14 @@ config BACKLIGHT_ATMEL_PWM
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called atmel-pwm-bl. called atmel-pwm-bl.
config BACKLIGHT_CORGI config BACKLIGHT_GENERIC
tristate "Generic (aka Sharp Corgi) Backlight Driver (DEPRECATED)" tristate "Generic (aka Sharp Corgi) Backlight Driver"
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
default n default y
help help
Say y to enable the generic platform backlight driver previously Say y to enable the generic platform backlight driver previously
known as the Corgi backlight driver. If you have a Sharp Zaurus known as the Corgi backlight driver. If you have a Sharp Zaurus
SL-C7xx, SL-Cxx00 or SL-6000x say y. Most users can say n. SL-C7xx, SL-Cxx00 or SL-6000x say y.
Note: this driver is marked as deprecated, try enable SPI and
use the new corgi_lcd driver with integrated backlight control
config BACKLIGHT_LOCOMO config BACKLIGHT_LOCOMO
tristate "Sharp LOCOMO LCD/Backlight Driver" tristate "Sharp LOCOMO LCD/Backlight Driver"
......
...@@ -11,7 +11,7 @@ obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o ...@@ -11,7 +11,7 @@ obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o
obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o
obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o
obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
......
/* /*
* Backlight Driver for Sharp Zaurus Handhelds (various models) * Generic Backlight Driver
* *
* Copyright (c) 2004-2006 Richard Purdie * Copyright (c) 2004-2008 Richard Purdie
*
* Based on Sharp's 2.4 Backlight Driver
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -19,15 +17,14 @@ ...@@ -19,15 +17,14 @@
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/backlight.h> #include <linux/backlight.h>
static int corgibl_intensity; static int genericbl_intensity;
static struct backlight_properties corgibl_data; static struct backlight_device *generic_backlight_device;
static struct backlight_device *corgi_backlight_device;
static struct generic_bl_info *bl_machinfo; static struct generic_bl_info *bl_machinfo;
/* Flag to signal when the battery is low */ /* Flag to signal when the battery is low */
#define CORGIBL_BATTLOW BL_CORE_DRIVER1 #define GENERICBL_BATTLOW BL_CORE_DRIVER1
static int corgibl_send_intensity(struct backlight_device *bd) static int genericbl_send_intensity(struct backlight_device *bd)
{ {
int intensity = bd->props.brightness; int intensity = bd->props.brightness;
...@@ -37,12 +34,12 @@ static int corgibl_send_intensity(struct backlight_device *bd) ...@@ -37,12 +34,12 @@ static int corgibl_send_intensity(struct backlight_device *bd)
intensity = 0; intensity = 0;
if (bd->props.state & BL_CORE_SUSPENDED) if (bd->props.state & BL_CORE_SUSPENDED)
intensity = 0; intensity = 0;
if (bd->props.state & CORGIBL_BATTLOW) if (bd->props.state & GENERICBL_BATTLOW)
intensity &= bl_machinfo->limit_mask; intensity &= bl_machinfo->limit_mask;
bl_machinfo->set_bl_intensity(intensity); bl_machinfo->set_bl_intensity(intensity);
corgibl_intensity = intensity; genericbl_intensity = intensity;
if (bl_machinfo->kick_battery) if (bl_machinfo->kick_battery)
bl_machinfo->kick_battery(); bl_machinfo->kick_battery();
...@@ -50,9 +47,9 @@ static int corgibl_send_intensity(struct backlight_device *bd) ...@@ -50,9 +47,9 @@ static int corgibl_send_intensity(struct backlight_device *bd)
return 0; return 0;
} }
static int corgibl_get_intensity(struct backlight_device *bd) static int genericbl_get_intensity(struct backlight_device *bd)
{ {
return corgibl_intensity; return genericbl_intensity;
} }
/* /*
...@@ -61,29 +58,29 @@ static int corgibl_get_intensity(struct backlight_device *bd) ...@@ -61,29 +58,29 @@ static int corgibl_get_intensity(struct backlight_device *bd)
*/ */
void corgibl_limit_intensity(int limit) void corgibl_limit_intensity(int limit)
{ {
struct backlight_device *bd = corgi_backlight_device; struct backlight_device *bd = generic_backlight_device;
mutex_lock(&bd->ops_lock); mutex_lock(&bd->ops_lock);
if (limit) if (limit)
bd->props.state |= CORGIBL_BATTLOW; bd->props.state |= GENERICBL_BATTLOW;
else else
bd->props.state &= ~CORGIBL_BATTLOW; bd->props.state &= ~GENERICBL_BATTLOW;
backlight_update_status(corgi_backlight_device); backlight_update_status(generic_backlight_device);
mutex_unlock(&bd->ops_lock); mutex_unlock(&bd->ops_lock);
} }
EXPORT_SYMBOL(corgibl_limit_intensity); EXPORT_SYMBOL(corgibl_limit_intensity);
static struct backlight_ops genericbl_ops = {
static struct backlight_ops corgibl_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.get_brightness = corgibl_get_intensity, .get_brightness = genericbl_get_intensity,
.update_status = corgibl_send_intensity, .update_status = genericbl_send_intensity,
}; };
static int corgibl_probe(struct platform_device *pdev) static int genericbl_probe(struct platform_device *pdev)
{ {
struct generic_bl_info *machinfo = pdev->dev.platform_data; struct generic_bl_info *machinfo = pdev->dev.platform_data;
const char *name = "generic-bl"; const char *name = "generic-bl";
struct backlight_device *bd;
bl_machinfo = machinfo; bl_machinfo = machinfo;
if (!machinfo->limit_mask) if (!machinfo->limit_mask)
...@@ -92,57 +89,59 @@ static int corgibl_probe(struct platform_device *pdev) ...@@ -92,57 +89,59 @@ static int corgibl_probe(struct platform_device *pdev)
if (machinfo->name) if (machinfo->name)
name = machinfo->name; name = machinfo->name;
corgi_backlight_device = backlight_device_register (name, bd = backlight_device_register (name,
&pdev->dev, NULL, &corgibl_ops); &pdev->dev, NULL, &genericbl_ops);
if (IS_ERR (corgi_backlight_device)) if (IS_ERR (bd))
return PTR_ERR (corgi_backlight_device); return PTR_ERR (bd);
platform_set_drvdata(pdev, corgi_backlight_device); platform_set_drvdata(pdev, bd);
bd->props.max_brightness = machinfo->max_intensity;
bd->props.power = FB_BLANK_UNBLANK;
bd->props.brightness = machinfo->default_intensity;
backlight_update_status(bd);
corgi_backlight_device->props.max_brightness = machinfo->max_intensity; generic_backlight_device = bd;
corgi_backlight_device->props.power = FB_BLANK_UNBLANK;
corgi_backlight_device->props.brightness = machinfo->default_intensity;
backlight_update_status(corgi_backlight_device);
printk("Corgi Backlight Driver Initialized.\n"); printk("Generic Backlight Driver Initialized.\n");
return 0; return 0;
} }
static int corgibl_remove(struct platform_device *pdev) static int genericbl_remove(struct platform_device *pdev)
{ {
struct backlight_device *bd = platform_get_drvdata(pdev); struct backlight_device *bd = platform_get_drvdata(pdev);
corgibl_data.power = 0; bd->props.power = 0;
corgibl_data.brightness = 0; bd->props.brightness = 0;
backlight_update_status(bd); backlight_update_status(bd);
backlight_device_unregister(bd); backlight_device_unregister(bd);
printk("Corgi Backlight Driver Unloaded\n"); printk("Generic Backlight Driver Unloaded\n");
return 0; return 0;
} }
static struct platform_driver corgibl_driver = { static struct platform_driver genericbl_driver = {
.probe = corgibl_probe, .probe = genericbl_probe,
.remove = corgibl_remove, .remove = genericbl_remove,
.driver = { .driver = {
.name = "generic-bl", .name = "generic-bl",
}, },
}; };
static int __init corgibl_init(void) static int __init genericbl_init(void)
{ {
return platform_driver_register(&corgibl_driver); return platform_driver_register(&genericbl_driver);
} }
static void __exit corgibl_exit(void) static void __exit genericbl_exit(void)
{ {
platform_driver_unregister(&corgibl_driver); platform_driver_unregister(&genericbl_driver);
} }
module_init(corgibl_init); module_init(genericbl_init);
module_exit(corgibl_exit); module_exit(genericbl_exit);
MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
MODULE_DESCRIPTION("Corgi Backlight Driver"); MODULE_DESCRIPTION("Generic Backlight Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
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