Commit c3f8f650 authored by Richard Purdie's avatar Richard Purdie

backlight: Convert corgi backlight driver into a more generic driver

Convert the corgi backlight driver to a more generic version
so it can be reused by other code rather than being Zaurus/PXA
specific.
Signed-off-by: default avatarRichard Purdie <rpurdie@rpsys.net>
parent 18f65c79
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/backlight.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/memory.h> #include <asm/memory.h>
...@@ -142,15 +143,28 @@ struct corgissp_machinfo corgi_ssp_machinfo = { ...@@ -142,15 +143,28 @@ struct corgissp_machinfo corgi_ssp_machinfo = {
/* /*
* Corgi Backlight Device * Corgi Backlight Device
*/ */
static struct corgibl_machinfo corgi_bl_machinfo = { static void corgi_bl_kick_battery(void)
{
void (*kick_batt)(void);
kick_batt = symbol_get(sharpsl_battery_kick);
if (kick_batt) {
kick_batt();
symbol_put(sharpsl_battery_kick);
}
}
static struct generic_bl_info corgi_bl_machinfo = {
.name = "corgi-bl",
.max_intensity = 0x2f, .max_intensity = 0x2f,
.default_intensity = 0x1f, .default_intensity = 0x1f,
.limit_mask = 0x0b, .limit_mask = 0x0b,
.set_bl_intensity = corgi_bl_set_intensity, .set_bl_intensity = corgi_bl_set_intensity,
.kick_battery = corgi_bl_kick_battery,
}; };
static struct platform_device corgibl_device = { static struct platform_device corgibl_device = {
.name = "corgi-bl", .name = "generic-bl",
.dev = { .dev = {
.parent = &corgifb_device.dev, .parent = &corgifb_device.dev,
.platform_data = &corgi_bl_machinfo, .platform_data = &corgi_bl_machinfo,
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/backlight.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/memory.h> #include <asm/memory.h>
...@@ -222,14 +223,27 @@ struct corgissp_machinfo spitz_ssp_machinfo = { ...@@ -222,14 +223,27 @@ struct corgissp_machinfo spitz_ssp_machinfo = {
/* /*
* Spitz Backlight Device * Spitz Backlight Device
*/ */
static struct corgibl_machinfo spitz_bl_machinfo = { static void spitz_bl_kick_battery(void)
{
void (*kick_batt)(void);
kick_batt = symbol_get(sharpsl_battery_kick);
if (kick_batt) {
kick_batt();
symbol_put(sharpsl_battery_kick);
}
}
static struct generic_bl_info spitz_bl_machinfo = {
.name = "corgi-bl",
.default_intensity = 0x1f, .default_intensity = 0x1f,
.limit_mask = 0x0b, .limit_mask = 0x0b,
.max_intensity = 0x2f, .max_intensity = 0x2f,
.kick_battery = spitz_bl_kick_battery,
}; };
static struct platform_device spitzbl_device = { static struct platform_device spitzbl_device = {
.name = "corgi-bl", .name = "generic-bl",
.dev = { .dev = {
.platform_data = &spitz_bl_machinfo, .platform_data = &spitz_bl_machinfo,
}, },
......
...@@ -51,12 +51,13 @@ config BACKLIGHT_CLASS_DEVICE ...@@ -51,12 +51,13 @@ config BACKLIGHT_CLASS_DEVICE
select the proper drivers which depend on this option. select the proper drivers which depend on this option.
config BACKLIGHT_CORGI config BACKLIGHT_CORGI
tristate "Sharp Corgi Backlight Driver (SL Series)" tristate "Generic (aka Sharp Corgi) Backlight Driver"
depends on BACKLIGHT_CLASS_DEVICE && PXA_SHARPSL depends on BACKLIGHT_CLASS_DEVICE
default y default n
help help
If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the Say y to enable the generic platform backlight driver previously
backlight driver. 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.
config BACKLIGHT_LOCOMO config BACKLIGHT_LOCOMO
tristate "Sharp LOCOMO LCD/Backlight Driver" tristate "Sharp LOCOMO LCD/Backlight Driver"
......
...@@ -18,13 +18,11 @@ ...@@ -18,13 +18,11 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include <asm/arch/sharpsl.h>
#include <asm/hardware/sharpsl_pm.h>
static int corgibl_intensity; static int corgibl_intensity;
static struct backlight_properties corgibl_data; static struct backlight_properties corgibl_data;
static struct backlight_device *corgi_backlight_device; static struct backlight_device *corgi_backlight_device;
static struct corgibl_machinfo *bl_machinfo; static struct generic_bl_info *bl_machinfo;
static unsigned long corgibl_flags; static unsigned long corgibl_flags;
#define CORGIBL_SUSPENDED 0x01 #define CORGIBL_SUSPENDED 0x01
...@@ -32,7 +30,6 @@ static unsigned long corgibl_flags; ...@@ -32,7 +30,6 @@ static unsigned long corgibl_flags;
static int corgibl_send_intensity(struct backlight_device *bd) static int corgibl_send_intensity(struct backlight_device *bd)
{ {
void (*corgi_kick_batt)(void);
int intensity = bd->props.brightness; int intensity = bd->props.brightness;
if (bd->props.power != FB_BLANK_UNBLANK) if (bd->props.power != FB_BLANK_UNBLANK)
...@@ -48,11 +45,8 @@ static int corgibl_send_intensity(struct backlight_device *bd) ...@@ -48,11 +45,8 @@ static int corgibl_send_intensity(struct backlight_device *bd)
corgibl_intensity = intensity; corgibl_intensity = intensity;
corgi_kick_batt = symbol_get(sharpsl_battery_kick); if (bl_machinfo->kick_battery)
if (corgi_kick_batt) { bl_machinfo->kick_battery();
corgi_kick_batt();
symbol_put(sharpsl_battery_kick);
}
return 0; return 0;
} }
...@@ -107,13 +101,17 @@ static struct backlight_ops corgibl_ops = { ...@@ -107,13 +101,17 @@ static struct backlight_ops corgibl_ops = {
static int corgibl_probe(struct platform_device *pdev) static int corgibl_probe(struct platform_device *pdev)
{ {
struct corgibl_machinfo *machinfo = pdev->dev.platform_data; struct generic_bl_info *machinfo = pdev->dev.platform_data;
const char *name = "generic-bl";
bl_machinfo = machinfo; bl_machinfo = machinfo;
if (!machinfo->limit_mask) if (!machinfo->limit_mask)
machinfo->limit_mask = -1; machinfo->limit_mask = -1;
corgi_backlight_device = backlight_device_register ("corgi-bl", if (machinfo->name)
name = machinfo->name;
corgi_backlight_device = backlight_device_register (name,
&pdev->dev, NULL, &corgibl_ops); &pdev->dev, NULL, &corgibl_ops);
if (IS_ERR (corgi_backlight_device)) if (IS_ERR (corgi_backlight_device))
return PTR_ERR (corgi_backlight_device); return PTR_ERR (corgi_backlight_device);
...@@ -149,7 +147,7 @@ static struct platform_driver corgibl_driver = { ...@@ -149,7 +147,7 @@ static struct platform_driver corgibl_driver = {
.suspend = corgibl_suspend, .suspend = corgibl_suspend,
.resume = corgibl_resume, .resume = corgibl_resume,
.driver = { .driver = {
.name = "corgi-bl", .name = "generic-bl",
}, },
}; };
......
...@@ -25,12 +25,6 @@ struct corgits_machinfo { ...@@ -25,12 +25,6 @@ struct corgits_machinfo {
/* /*
* SharpSL Backlight * SharpSL Backlight
*/ */
struct corgibl_machinfo {
int max_intensity;
int default_intensity;
int limit_mask;
void (*set_bl_intensity)(int intensity);
};
extern void corgibl_limit_intensity(int limit); extern void corgibl_limit_intensity(int limit);
......
...@@ -92,4 +92,13 @@ static inline void * bl_get_data(struct backlight_device *bl_dev) ...@@ -92,4 +92,13 @@ static inline void * bl_get_data(struct backlight_device *bl_dev)
return dev_get_drvdata(&bl_dev->dev); return dev_get_drvdata(&bl_dev->dev);
} }
struct generic_bl_info {
const char *name;
int max_intensity;
int default_intensity;
int limit_mask;
void (*set_bl_intensity)(int intensity);
void (*kick_battery)(void);
};
#endif #endif
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