Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
  backlight: Convert corgi backlight driver into a more generic driver
  backlight: Add Samsung LTV350QV LCD driver
  backlight: Fix cr_bllcd allocations and error paths
  backlight/leds: Make two structs static
  • Loading branch information
Linus Torvalds committed Oct 12, 2007
2 parents 19ad7ae + c3f8f65 commit 6f35308
Show file tree
Hide file tree
Showing 12 changed files with 518 additions and 44 deletions.
18 changes: 16 additions & 2 deletions arch/arm/mach-pxa/corgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/interrupt.h>
#include <linux/mmc/host.h>
#include <linux/pm.h>
#include <linux/backlight.h>

#include <asm/setup.h>
#include <asm/memory.h>
Expand Down Expand Up @@ -142,15 +143,28 @@ struct corgissp_machinfo corgi_ssp_machinfo = {
/*
* 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,
.default_intensity = 0x1f,
.limit_mask = 0x0b,
.set_bl_intensity = corgi_bl_set_intensity,
.kick_battery = corgi_bl_kick_battery,
};

static struct platform_device corgibl_device = {
.name = "corgi-bl",
.name = "generic-bl",
.dev = {
.parent = &corgifb_device.dev,
.platform_data = &corgi_bl_machinfo,
Expand Down
18 changes: 16 additions & 2 deletions arch/arm/mach-pxa/spitz.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/interrupt.h>
#include <linux/mmc/host.h>
#include <linux/pm.h>
#include <linux/backlight.h>

#include <asm/setup.h>
#include <asm/memory.h>
Expand Down Expand Up @@ -222,14 +223,27 @@ struct corgissp_machinfo spitz_ssp_machinfo = {
/*
* 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,
.limit_mask = 0x0b,
.max_intensity = 0x2f,
.kick_battery = spitz_bl_kick_battery,
};

static struct platform_device spitzbl_device = {
.name = "corgi-bl",
.name = "generic-bl",
.dev = {
.platform_data = &spitz_bl_machinfo,
},
Expand Down
23 changes: 18 additions & 5 deletions drivers/video/backlight/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ config LCD_CLASS_DEVICE
To have support for your specific LCD panel you will have to
select the proper drivers which depend on this option.

config LCD_LTV350QV
tristate "Samsung LTV350QV LCD Panel"
depends on LCD_CLASS_DEVICE && SPI_MASTER
default n
help
If you have a Samsung LTV350QV LCD panel, say y to include a
power control driver for it. The panel starts up in power
off state, so you need this driver in order to see any
output.

The LTV350QV panel is present on all ATSTK1000 boards.

#
# Backlight
#
Expand All @@ -39,12 +51,13 @@ config BACKLIGHT_CLASS_DEVICE
select the proper drivers which depend on this option.

config BACKLIGHT_CORGI
tristate "Sharp Corgi Backlight Driver (SL Series)"
depends on BACKLIGHT_CLASS_DEVICE && PXA_SHARPSL
default y
tristate "Generic (aka Sharp Corgi) Backlight Driver"
depends on BACKLIGHT_CLASS_DEVICE
default n
help
If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the
backlight driver.
Say y to enable the generic platform backlight driver previously
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
tristate "Sharp LOCOMO LCD/Backlight Driver"
Expand Down
2 changes: 2 additions & 0 deletions drivers/video/backlight/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Backlight & LCD drivers

obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o
obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o

obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o
obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static ssize_t backlight_show_actual_brightness(struct device *dev,
return rc;
}

struct class *backlight_class;
static struct class *backlight_class;

static void bl_device_release(struct device *dev)
{
Expand Down
22 changes: 10 additions & 12 deletions drivers/video/backlight/corgi_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@
#include <linux/mutex.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <asm/arch/sharpsl.h>
#include <asm/hardware/sharpsl_pm.h>

static int corgibl_intensity;
static struct backlight_properties corgibl_data;
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;
#define CORGIBL_SUSPENDED 0x01
#define CORGIBL_BATTLOW 0x02

static int corgibl_send_intensity(struct backlight_device *bd)
{
void (*corgi_kick_batt)(void);
int intensity = bd->props.brightness;

if (bd->props.power != FB_BLANK_UNBLANK)
Expand All @@ -48,11 +45,8 @@ static int corgibl_send_intensity(struct backlight_device *bd)

corgibl_intensity = intensity;

corgi_kick_batt = symbol_get(sharpsl_battery_kick);
if (corgi_kick_batt) {
corgi_kick_batt();
symbol_put(sharpsl_battery_kick);
}
if (bl_machinfo->kick_battery)
bl_machinfo->kick_battery();

return 0;
}
Expand Down Expand Up @@ -107,13 +101,17 @@ static struct backlight_ops corgibl_ops = {

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;
if (!machinfo->limit_mask)
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);
if (IS_ERR (corgi_backlight_device))
return PTR_ERR (corgi_backlight_device);
Expand Down Expand Up @@ -149,7 +147,7 @@ static struct platform_driver corgibl_driver = {
.suspend = corgibl_suspend,
.resume = corgibl_resume,
.driver = {
.name = "corgi-bl",
.name = "generic-bl",
},
};

Expand Down
35 changes: 20 additions & 15 deletions drivers/video/backlight/cr_bllcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,11 @@ static struct lcd_ops cr_lcd_ops = {

static int cr_backlight_probe(struct platform_device *pdev)
{
struct backlight_device *bdp;
struct lcd_device *ldp;
struct cr_panel *crp;
u8 dev_en;

crp = kzalloc(sizeof(*crp), GFP_KERNEL);
if (crp == NULL)
return -ENOMEM;

lpc_dev = pci_get_device(PCI_VENDOR_ID_INTEL,
CRVML_DEVICE_LPC, NULL);
if (!lpc_dev) {
Expand All @@ -193,27 +191,34 @@ static int cr_backlight_probe(struct platform_device *pdev)
return -ENODEV;
}

crp->cr_backlight_device = backlight_device_register("cr-backlight",
&pdev->dev, NULL,
&cr_backlight_ops);
if (IS_ERR(crp->cr_backlight_device)) {
bdp = backlight_device_register("cr-backlight",
&pdev->dev, NULL, &cr_backlight_ops);
if (IS_ERR(bdp)) {
pci_dev_put(lpc_dev);
return PTR_ERR(crp->cr_backlight_device);
return PTR_ERR(bdp);
}

crp->cr_lcd_device = lcd_device_register("cr-lcd",
&pdev->dev, NULL,
&cr_lcd_ops);

if (IS_ERR(crp->cr_lcd_device)) {
ldp = lcd_device_register("cr-lcd", &pdev->dev, NULL, &cr_lcd_ops);
if (IS_ERR(ldp)) {
backlight_device_unregister(bdp);
pci_dev_put(lpc_dev);
return PTR_ERR(crp->cr_backlight_device);
return PTR_ERR(bdp);
}

pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR,
&gpio_bar);
gpio_bar &= ~0x3F;

crp = kzalloc(sizeof(*crp), GFP_KERNEL);
if (!crp) {
lcd_device_unregister(ldp);
backlight_device_unregister(bdp);
pci_dev_put(lpc_dev);
return -ENOMEM;
}

crp->cr_backlight_device = bdp;
crp->cr_lcd_device = ldp;
crp->cr_backlight_device->props.power = FB_BLANK_UNBLANK;
crp->cr_backlight_device->props.brightness = 0;
crp->cr_backlight_device->props.max_brightness = 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/backlight/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static ssize_t lcd_show_max_contrast(struct device *dev,
return sprintf(buf, "%d\n", ld->props.max_contrast);
}

struct class *lcd_class;
static struct class *lcd_class;

static void lcd_device_release(struct device *dev)
{
Expand Down
Loading

0 comments on commit 6f35308

Please sign in to comment.