Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
  backlight: Remove bogus SYSFS dependency
  backlight: simplify corgi_bl locking
  backlight: Separate backlight properties from backlight ops pointers
  backlight: Clean up pmac_backlight handling
  backlight: Improve backlight selection for fbdev drivers
  backlight: Rework backlight/fb interaction simplifying, lots
  backlight: Remove unneeded backlight update_status calls
  backlight: Remove uneeded update_status call from chipsfb.c
  backlight/fbcon: Add FB_EVENT_CONBLANK
  backlight: Fix Kconfig entries
  backlight: Remove uneeded nvidia set_power calls
  backlight: Convert semaphore -> mutex
  backlight: Fix external uses of backlight internal semaphore
  backlight: Minor code cleanups for hp680_bl.c
  backlight: Minor code cleanups for corgi_bl.c
  backlight: Remove excessive (un)likelys
  backlight: Remove unneeded owner field
  backlight: Fix error handling
  backlight: Add Frontpath ProGear HX1050+ driver
  backlight: Add maintainer entry
This commit is contained in:
Linus Torvalds
2007-02-20 10:17:32 -08:00
36 changed files with 629 additions and 766 deletions
+5
View File
@@ -679,6 +679,11 @@ L: linux-hams@vger.kernel.org
W: http://www.linux-ax25.org/
S: Maintained
BACKLIGHT CLASS/SUBSYSTEM
P: Richard Purdie
M: rpurdie@rpsys.net
S: Maintained
BAYCOM/HDLCDRV DRIVERS FOR AX.25
P: Thomas Sailer
M: t.sailer@alumni.ethz.ch
+2 -4
View File
@@ -107,12 +107,10 @@ int die(const char *str, struct pt_regs *regs, long err)
if (machine_is(powermac) && pmac_backlight) {
struct backlight_properties *props;
down(&pmac_backlight->sem);
props = pmac_backlight->props;
props = &pmac_backlight->props;
props->brightness = props->max_brightness;
props->power = FB_BLANK_UNBLANK;
props->update_status(pmac_backlight);
up(&pmac_backlight->sem);
backlight_update_status(pmac_backlight);
}
mutex_unlock(&pmac_backlight_mutex);
#endif
+9 -18
View File
@@ -37,21 +37,20 @@ static int pmac_backlight_set_legacy_queued;
*/
static atomic_t kernel_backlight_disabled = ATOMIC_INIT(0);
/* Protect the pmac_backlight variable */
/* Protect the pmac_backlight variable below.
You should hold this lock when using the pmac_backlight pointer to
prevent its potential removal. */
DEFINE_MUTEX(pmac_backlight_mutex);
/* Main backlight storage
*
* Backlight drivers in this variable are required to have the "props"
* Backlight drivers in this variable are required to have the "ops"
* attribute set and to have an update_status function.
*
* We can only store one backlight here, but since Apple laptops have only one
* internal display, it doesn't matter. Other backlight drivers can be used
* independently.
*
* Lock ordering:
* pmac_backlight_mutex (global, main backlight)
* pmac_backlight->sem (backlight class)
*/
struct backlight_device *pmac_backlight;
@@ -104,8 +103,7 @@ static void pmac_backlight_key_worker(struct work_struct *work)
struct backlight_properties *props;
int brightness;
down(&pmac_backlight->sem);
props = pmac_backlight->props;
props = &pmac_backlight->props;
brightness = props->brightness +
((pmac_backlight_key_queued?-1:1) *
@@ -117,9 +115,7 @@ static void pmac_backlight_key_worker(struct work_struct *work)
brightness = props->max_brightness;
props->brightness = brightness;
props->update_status(pmac_backlight);
up(&pmac_backlight->sem);
backlight_update_status(pmac_backlight);
}
mutex_unlock(&pmac_backlight_mutex);
}
@@ -145,8 +141,7 @@ static int __pmac_backlight_set_legacy_brightness(int brightness)
if (pmac_backlight) {
struct backlight_properties *props;
down(&pmac_backlight->sem);
props = pmac_backlight->props;
props = &pmac_backlight->props;
props->brightness = brightness *
(props->max_brightness + 1) /
(OLD_BACKLIGHT_MAX + 1);
@@ -156,8 +151,7 @@ static int __pmac_backlight_set_legacy_brightness(int brightness)
else if (props->brightness < 0)
props->brightness = 0;
props->update_status(pmac_backlight);
up(&pmac_backlight->sem);
backlight_update_status(pmac_backlight);
error = 0;
}
@@ -196,14 +190,11 @@ int pmac_backlight_get_legacy_brightness()
if (pmac_backlight) {
struct backlight_properties *props;
down(&pmac_backlight->sem);
props = pmac_backlight->props;
props = &pmac_backlight->props;
result = props->brightness *
(OLD_BACKLIGHT_MAX + 1) /
(props->max_brightness + 1);
up(&pmac_backlight->sem);
}
mutex_unlock(&pmac_backlight_mutex);
+3 -4
View File
@@ -848,7 +848,7 @@ out:
static int set_brightness_status(struct backlight_device *bd)
{
return set_brightness(bd->props->brightness);
return set_brightness(bd->props.brightness);
}
static int
@@ -1352,11 +1352,9 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
return 0;
}
static struct backlight_properties asus_backlight_data = {
.owner = THIS_MODULE,
static struct backlight_ops asus_backlight_data = {
.get_brightness = read_brightness,
.update_status = set_brightness_status,
.max_brightness = 15,
};
static void __exit asus_acpi_exit(void)
@@ -1410,6 +1408,7 @@ static int __init asus_acpi_init(void)
asus_backlight_device = NULL;
asus_acpi_exit();
}
asus_backlight_device->props.max_brightness = 15;
return 0;
}
+4 -4
View File
@@ -1701,14 +1701,12 @@ static int brightness_write(char *buf)
static int brightness_update_status(struct backlight_device *bd)
{
return brightness_set(bd->props->brightness);
return brightness_set(bd->props.brightness);
}
static struct backlight_properties ibm_backlight_data = {
.owner = THIS_MODULE,
static struct backlight_ops ibm_backlight_data = {
.get_brightness = brightness_get,
.update_status = brightness_update_status,
.max_brightness = 7,
};
static int brightness_init(void)
@@ -1720,6 +1718,8 @@ static int brightness_init(void)
return PTR_ERR(ibm_backlight_device);
}
ibm_backlight_device->props.max_brightness = 7;
return 0;
}
+3 -4
View File
@@ -315,7 +315,7 @@ static int set_lcd(int value)
static int set_lcd_status(struct backlight_device *bd)
{
return set_lcd(bd->props->brightness);
return set_lcd(bd->props.brightness);
}
static unsigned long write_lcd(const char *buffer, unsigned long count)
@@ -533,11 +533,9 @@ static acpi_status __exit remove_device(void)
return AE_OK;
}
static struct backlight_properties toshiba_backlight_data = {
.owner = THIS_MODULE,
static struct backlight_ops toshiba_backlight_data = {
.get_brightness = get_lcd,
.update_status = set_lcd_status,
.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1,
};
static void __exit toshiba_acpi_exit(void)
@@ -597,6 +595,7 @@ static int __init toshiba_acpi_init(void)
toshiba_backlight_device = NULL;
toshiba_acpi_exit();
}
toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
}
+12 -24
View File
@@ -169,7 +169,6 @@ struct acpi_video_device {
struct acpi_device *dev;
struct acpi_video_device_brightness *brightness;
struct backlight_device *backlight;
struct backlight_properties *data;
};
/* bus */
@@ -286,13 +285,18 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
static int acpi_video_set_brightness(struct backlight_device *bd)
{
int request_level = bd->props->brightness;
int request_level = bd->props.brightness;
struct acpi_video_device *vd =
(struct acpi_video_device *)class_get_devdata(&bd->class_dev);
acpi_video_device_lcd_set_level(vd, request_level);
return 0;
}
static struct backlight_ops acpi_backlight_ops = {
.get_brightness = acpi_video_get_brightness,
.update_status = acpi_video_set_brightness,
};
/* --------------------------------------------------------------------------
Video Management
-------------------------------------------------------------------------- */
@@ -608,31 +612,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
unsigned long tmp;
static int count = 0;
char *name;
struct backlight_properties *acpi_video_data;
name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
if (!name)
return;
acpi_video_data = kzalloc(
sizeof(struct backlight_properties),
GFP_KERNEL);
if (!acpi_video_data){
kfree(name);
return;
}
acpi_video_data->owner = THIS_MODULE;
acpi_video_data->get_brightness =
acpi_video_get_brightness;
acpi_video_data->update_status =
acpi_video_set_brightness;
sprintf(name, "acpi_video%d", count++);
device->data = acpi_video_data;
acpi_video_data->max_brightness = max_level;
acpi_video_device_lcd_get_level_current(device, &tmp);
acpi_video_data->brightness = (int)tmp;
device->backlight = backlight_device_register(name,
NULL, device, acpi_video_data);
NULL, device, &acpi_backlight_ops);
device->backlight->props.max_brightness = max_level;
device->backlight->props.brightness = (int)tmp;
backlight_update_status(device->backlight);
kfree(name);
}
return;
@@ -1677,10 +1668,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
status = acpi_remove_notify_handler(device->dev->handle,
ACPI_DEVICE_NOTIFY,
acpi_video_device_notify);
if (device->backlight){
backlight_device_unregister(device->backlight);
kfree(device->data);
}
backlight_device_unregister(device->backlight);
return 0;
}
+13 -20
View File
@@ -15,7 +15,7 @@
#define MAX_PMU_LEVEL 0xFF
static struct backlight_properties pmu_backlight_data;
static struct backlight_ops pmu_backlight_data;
static DEFINE_SPINLOCK(pmu_backlight_lock);
static int sleeping;
static u8 bl_curve[FB_BACKLIGHT_LEVELS];
@@ -72,7 +72,7 @@ static int pmu_backlight_update_status(struct backlight_device *bd)
{
struct adb_request req;
unsigned long flags;
int level = bd->props->brightness;
int level = bd->props.brightness;
spin_lock_irqsave(&pmu_backlight_lock, flags);
@@ -80,8 +80,8 @@ static int pmu_backlight_update_status(struct backlight_device *bd)
if (sleeping)
goto out;
if (bd->props->power != FB_BLANK_UNBLANK ||
bd->props->fb_blank != FB_BLANK_UNBLANK)
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
if (level > 0) {
@@ -107,14 +107,13 @@ out:
static int pmu_backlight_get_brightness(struct backlight_device *bd)
{
return bd->props->brightness;
return bd->props.brightness;
}
static struct backlight_properties pmu_backlight_data = {
.owner = THIS_MODULE,
static struct backlight_ops pmu_backlight_data = {
.get_brightness = pmu_backlight_get_brightness,
.update_status = pmu_backlight_update_status,
.max_brightness = (FB_BACKLIGHT_LEVELS - 1),
};
#ifdef CONFIG_PM
@@ -152,9 +151,10 @@ void __init pmu_backlight_init()
printk("pmubl: Backlight registration failed\n");
goto error;
}
bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
pmu_backlight_init_curve(0x7F, 0x46, 0x0E);
level = pmu_backlight_data.max_brightness;
level = bd->props.max_brightness;
if (autosave) {
/* read autosaved value if available */
@@ -164,19 +164,12 @@ void __init pmu_backlight_init()
level = pmu_backlight_curve_lookup(
(req.reply[0] >> 4) *
pmu_backlight_data.max_brightness / 15);
bd->props.max_brightness / 15);
}
down(&bd->sem);
bd->props->brightness = level;
bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd);
up(&bd->sem);
mutex_lock(&pmac_backlight_mutex);
if (!pmac_backlight)
pmac_backlight = bd;
mutex_unlock(&pmac_backlight_mutex);
bd->props.brightness = level;
bd->props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
printk("pmubl: Backlight initialized (%s)\n", name);
+10 -21
View File
@@ -195,11 +195,9 @@ static struct backlight_device *asus_backlight_device;
*/
static int read_brightness(struct backlight_device *bd);
static int update_bl_status(struct backlight_device *bd);
static struct backlight_properties asusbl_data = {
.owner = THIS_MODULE,
static struct backlight_ops asusbl_ops = {
.get_brightness = read_brightness,
.update_status = update_bl_status,
.max_brightness = 15,
};
/* These functions actually update the LED's, and are called from a
@@ -349,13 +347,8 @@ static void lcd_blank(int blank)
struct backlight_device *bd = asus_backlight_device;
if (bd) {
down(&bd->sem);
if (likely(bd->props)) {
bd->props->power = blank;
if (likely(bd->props->update_status))
bd->props->update_status(bd);
}
up(&bd->sem);
bd->props.power = blank;
backlight_update_status(bd);
}
}
@@ -387,13 +380,13 @@ static int set_brightness(struct backlight_device *bd, int value)
static int update_bl_status(struct backlight_device *bd)
{
int rv;
int value = bd->props->brightness;
int value = bd->props.brightness;
rv = set_brightness(bd, value);
if (rv)
return rv;
value = (bd->props->power == FB_BLANK_UNBLANK) ? 1 : 0;
value = (bd->props.power == FB_BLANK_UNBLANK) ? 1 : 0;
return set_lcd_state(value);
}
@@ -1019,7 +1012,7 @@ static int asus_backlight_init(struct device *dev)
if (brightness_set_handle && lcd_switch_handle) {
bd = backlight_device_register(ASUS_HOTK_FILE, dev,
NULL, &asusbl_data);
NULL, &asusbl_ops);
if (IS_ERR(bd)) {
printk(ASUS_ERR
"Could not register asus backlight device\n");
@@ -1029,14 +1022,10 @@ static int asus_backlight_init(struct device *dev)
asus_backlight_device = bd;
down(&bd->sem);
if (likely(bd->props)) {
bd->props->brightness = read_brightness(NULL);
bd->props->power = FB_BLANK_UNBLANK;
if (likely(bd->props->update_status))
bd->props->update_status(bd);
}
up(&bd->sem);
bd->props.max_brightness = 15;
bd->props.brightness = read_brightness(NULL);
bd->props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
}
return 0;
}
+5 -5
View File
@@ -157,14 +157,12 @@ static int bl_get_brightness(struct backlight_device *b)
static int bl_update_status(struct backlight_device *b)
{
return set_lcd_level(b->props->brightness);
return set_lcd_level(b->props.brightness);
}
static struct backlight_properties msibl_props = {
.owner = THIS_MODULE,
static struct backlight_ops msibl_ops = {
.get_brightness = bl_get_brightness,
.update_status = bl_update_status,
.max_brightness = MSI_LCD_LEVEL_MAX-1,
};
static struct backlight_device *msibl_device;
@@ -318,10 +316,12 @@ static int __init msi_init(void)
/* Register backlight stuff */
msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL,
&msibl_props);
&msibl_ops);
if (IS_ERR(msibl_device))
return PTR_ERR(msibl_device);
msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1,
ret = platform_driver_register(&msipf_driver);
if (ret)
goto fail_backlight;
+9 -7
View File
@@ -384,7 +384,7 @@ static void sony_snc_pf_remove(void)
static int sony_backlight_update_status(struct backlight_device *bd)
{
return acpi_callsetfunc(sony_acpi_handle, "SBRT",
bd->props->brightness + 1, NULL);
bd->props.brightness + 1, NULL);
}
static int sony_backlight_get_brightness(struct backlight_device *bd)
@@ -398,11 +398,9 @@ static int sony_backlight_get_brightness(struct backlight_device *bd)
}
static struct backlight_device *sony_backlight_device;
static struct backlight_properties sony_backlight_properties = {
.owner = THIS_MODULE,
static struct backlight_ops sony_backlight_ops = {
.update_status = sony_backlight_update_status,
.get_brightness = sony_backlight_get_brightness,
.max_brightness = SONY_MAX_BRIGHTNESS - 1,
};
/*
@@ -484,15 +482,19 @@ static int sony_acpi_add(struct acpi_device *device)
if (ACPI_SUCCESS(acpi_get_handle(sony_acpi_handle, "GBRT", &handle))) {
sony_backlight_device = backlight_device_register("sony", NULL,
NULL,
&sony_backlight_properties);
&sony_backlight_ops);
if (IS_ERR(sony_backlight_device)) {
printk(LOG_PFX "unable to register backlight device\n");
sony_backlight_device = NULL;
} else
sony_backlight_properties.brightness =
} else {
sony_backlight_device->props.brightness =
sony_backlight_get_brightness
(sony_backlight_device);
sony_backlight_device->props.max_brightness =
SONY_MAX_BRIGHTNESS - 1;
}
}
if (sony_snc_pf_add())
+6 -12
View File
@@ -141,7 +141,7 @@ static int appledisplay_bl_update_status(struct backlight_device *bd)
int retval;
pdata->msgdata[0] = 0x10;
pdata->msgdata[1] = bd->props->brightness;
pdata->msgdata[1] = bd->props.brightness;
retval = usb_control_msg(
pdata->udev,
@@ -177,11 +177,9 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd)
return pdata->msgdata[1];
}
static struct backlight_properties appledisplay_bl_data = {
.owner = THIS_MODULE,
static struct backlight_ops appledisplay_bl_data = {
.get_brightness = appledisplay_bl_get_brightness,
.update_status = appledisplay_bl_update_status,
.max_brightness = 0xFF
};
static void appledisplay_work(struct work_struct *work)
@@ -190,11 +188,9 @@ static void appledisplay_work(struct work_struct *work)
container_of(work, struct appledisplay, work.work);
int retval;
up(&pdata->bd->sem);
retval = appledisplay_bl_get_brightness(pdata->bd);
if (retval >= 0)
pdata->bd->props->brightness = retval;
down(&pdata->bd->sem);
pdata->bd->props.brightness = retval;
/* Poll again in about 125ms if there's still a button pressed */
if (pdata->button_pressed)
@@ -288,10 +284,10 @@ static int appledisplay_probe(struct usb_interface *iface,
goto error;
}
pdata->bd->props.max_brightness = 0xff;
/* Try to get brightness */
up(&pdata->bd->sem);
brightness = appledisplay_bl_get_brightness(pdata->bd);
down(&pdata->bd->sem);
if (brightness < 0) {
retval = brightness;
@@ -300,9 +296,7 @@ static int appledisplay_probe(struct usb_interface *iface,
}
/* Set brightness in backlight device */
up(&pdata->bd->sem);
pdata->bd->props->brightness = brightness;
down(&pdata->bd->sem);
pdata->bd->props.brightness = brightness;
/* save our data pointer in the interface device */
usb_set_intfdata(iface, pdata);
+34 -37
View File
@@ -4,20 +4,7 @@
menu "Graphics support"
config FIRMWARE_EDID
bool "Enable firmware EDID"
default y
---help---
This enables access to the EDID transferred from the firmware.
On the i386, this is from the Video BIOS. Enable this if DDC/I2C
transfers do not work for your driver and if you are using
nvidiafb, i810fb or savagefb.
In general, choosing Y for this option is safe. If you
experience extremely long delays while booting before you get
something on your display, try setting this to N. Matrox cards in
combination with certain motherboards and monitors are known to
suffer from this problem.
source "drivers/video/backlight/Kconfig"
config FB
tristate "Support for frame buffer devices"
@@ -53,9 +40,27 @@ config FB
(e.g. an accelerated X server) and that are not frame buffer
device-aware may cause unexpected results. If unsure, say N.
config FIRMWARE_EDID
bool "Enable firmware EDID"
depends on FB
default n
---help---
This enables access to the EDID transferred from the firmware.
On the i386, this is from the Video BIOS. Enable this if DDC/I2C
transfers do not work for your driver and if you are using
nvidiafb, i810fb or savagefb.
In general, choosing Y for this option is safe. If you
experience extremely long delays while booting before you get
something on your display, try setting this to N. Matrox cards in
combination with certain motherboards and monitors are known to
suffer from this problem.
config FB_DDC
tristate
depends on FB && I2C && I2C_ALGOBIT
depends on FB
select I2C_ALGOBIT
select I2C
default n
config FB_CFB_FILLRECT
@@ -134,6 +139,9 @@ config FB_TILEBLITTING
This is particularly important to one driver, matroxfb. If
unsure, say N.
comment "Frambuffer hardware drivers"
depends on FB
config FB_CIRRUS
tristate "Cirrus Logic support"
depends on FB && (ZORRO || PCI)
@@ -671,6 +679,7 @@ config FB_NVIDIA
depends on FB && PCI
select I2C_ALGOBIT if FB_NVIDIA_I2C
select I2C if FB_NVIDIA_I2C
select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -699,8 +708,7 @@ config FB_NVIDIA_I2C
config FB_NVIDIA_BACKLIGHT
bool "Support for backlight control"
depends on FB_NVIDIA && PMAC_BACKLIGHT
select FB_BACKLIGHT
depends on FB_NVIDIA
default y
help
Say Y here if you want to control the backlight of your display.
@@ -708,9 +716,8 @@ config FB_NVIDIA_BACKLIGHT
config FB_RIVA
tristate "nVidia Riva support"
depends on FB && PCI
select I2C_ALGOBIT if FB_RIVA_I2C
select I2C if FB_RIVA_I2C
select FB_DDC if FB_RIVA_I2C
select FB_BACKLIGHT if FB_RIVA_BACKLIGHT
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -747,8 +754,7 @@ config FB_RIVA_DEBUG
config FB_RIVA_BACKLIGHT
bool "Support for backlight control"
depends on FB_RIVA && PMAC_BACKLIGHT
select FB_BACKLIGHT
depends on FB_RIVA
default y
help
Say Y here if you want to control the backlight of your display.
@@ -798,8 +804,6 @@ config FB_I810_GTF
config FB_I810_I2C
bool "Enable DDC Support"
depends on FB_I810 && FB_I810_GTF
select I2C
select I2C_ALGOBIT
select FB_DDC
help
@@ -989,9 +993,8 @@ config FB_MATROX_MULTIHEAD
config FB_RADEON
tristate "ATI Radeon display support"
depends on FB && PCI
select I2C_ALGOBIT if FB_RADEON_I2C
select I2C if FB_RADEON_I2C
select FB_DDC if FB_RADEON_I2C
select FB_BACKLIGHT if FB_RADEON_BACKLIGHT
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -1021,8 +1024,7 @@ config FB_RADEON_I2C
config FB_RADEON_BACKLIGHT
bool "Support for backlight control"
depends on FB_RADEON && PMAC_BACKLIGHT
select FB_BACKLIGHT
depends on FB_RADEON
default y
help
Say Y here if you want to control the backlight of your display.
@@ -1042,6 +1044,7 @@ config FB_ATY128
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
select FB_BACKLIGHT if FB_ATY128_BACKLIGHT
select FB_MACMODES if PPC_PMAC
help
This driver supports graphics boards with the ATI Rage128 chips.
@@ -1053,8 +1056,7 @@ config FB_ATY128
config FB_ATY128_BACKLIGHT
bool "Support for backlight control"
depends on FB_ATY128 && PMAC_BACKLIGHT
select FB_BACKLIGHT
depends on FB_ATY128
default y
help
Say Y here if you want to control the backlight of your display.
@@ -1065,6 +1067,7 @@ config FB_ATY
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
select FB_BACKLIGHT if FB_ATY_BACKLIGHT
select FB_MACMODES if PPC
help
This driver supports graphics boards with the ATI Mach64 chips.
@@ -1103,8 +1106,7 @@ config FB_ATY_GX
config FB_ATY_BACKLIGHT
bool "Support for backlight control"
depends on FB_ATY && PMAC_BACKLIGHT
select FB_BACKLIGHT
depends on FB_ATY
default y
help
Say Y here if you want to control the backlight of your display.
@@ -1123,8 +1125,6 @@ config FB_S3
config FB_SAVAGE
tristate "S3 Savage support"
depends on FB && PCI && EXPERIMENTAL
select I2C_ALGOBIT if FB_SAVAGE_I2C
select I2C if FB_SAVAGE_I2C
select FB_DDC if FB_SAVAGE_I2C
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
@@ -1639,6 +1639,7 @@ config FB_VIRTUAL
the vfb_enable=1 option.
If unsure, say N.
if VT
source "drivers/video/console/Kconfig"
endif
@@ -1647,9 +1648,5 @@ if FB || SGI_NEWPORT_CONSOLE
source "drivers/video/logo/Kconfig"
endif
if SYSFS
source "drivers/video/backlight/Kconfig"
endif
endmenu
+1 -1
View File
@@ -12,7 +12,7 @@ fb-objs := $(fb-y)
obj-$(CONFIG_VT) += console/
obj-$(CONFIG_LOGO) += logo/
obj-$(CONFIG_SYSFS) += backlight/
obj-y += backlight/
obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
+19 -83
View File
@@ -1695,9 +1695,6 @@ static int __devinit aty128fb_setup(char *options)
#ifdef CONFIG_FB_ATY128_BACKLIGHT
#define MAX_LEVEL 0xFF
static struct backlight_properties aty128_bl_data;
/* Call with fb_info->bl_mutex held */
static int aty128_bl_get_level_brightness(struct aty128fb_par *par,
int level)
{
@@ -1705,6 +1702,7 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par,
int atylevel;
/* Get and convert the value */
/* No locking of bl_curve since we read a single value */
atylevel = MAX_LEVEL -
(info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL);
@@ -1724,19 +1722,18 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par,
/* That one prevents proper CRT output with LCD off */
#undef BACKLIGHT_DAC_OFF
/* Call with fb_info->bl_mutex held */
static int __aty128_bl_update_status(struct backlight_device *bd)
static int aty128_bl_update_status(struct backlight_device *bd)
{
struct aty128fb_par *par = class_get_devdata(&bd->class_dev);
unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
int level;
if (bd->props->power != FB_BLANK_UNBLANK ||
bd->props->fb_blank != FB_BLANK_UNBLANK ||
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK ||
!par->lcd_on)
level = 0;
else
level = bd->props->brightness;
level = bd->props.brightness;
reg |= LVDS_BL_MOD_EN | LVDS_BLON;
if (level > 0) {
@@ -1778,43 +1775,22 @@ static int __aty128_bl_update_status(struct backlight_device *bd)
return 0;
}
static int aty128_bl_update_status(struct backlight_device *bd)
{
struct aty128fb_par *par = class_get_devdata(&bd->class_dev);
struct fb_info *info = pci_get_drvdata(par->pdev);
int ret;
mutex_lock(&info->bl_mutex);
ret = __aty128_bl_update_status(bd);
mutex_unlock(&info->bl_mutex);
return ret;
}
static int aty128_bl_get_brightness(struct backlight_device *bd)
{
return bd->props->brightness;
return bd->props.brightness;
}
static struct backlight_properties aty128_bl_data = {
.owner = THIS_MODULE,
static struct backlight_ops aty128_bl_data = {
.get_brightness = aty128_bl_get_brightness,
.update_status = aty128_bl_update_status,
.max_brightness = (FB_BACKLIGHT_LEVELS - 1),
};
static void aty128_bl_set_power(struct fb_info *info, int power)
{
mutex_lock(&info->bl_mutex);
if (info->bl_dev) {
down(&info->bl_dev->sem);
info->bl_dev->props->power = power;
__aty128_bl_update_status(info->bl_dev);
up(&info->bl_dev->sem);
info->bl_dev->props.power = power;
backlight_update_status(info->bl_dev);
}
mutex_unlock(&info->bl_mutex);
}
static void aty128_bl_init(struct aty128fb_par *par)
@@ -1841,25 +1817,15 @@ static void aty128_bl_init(struct aty128fb_par *par)
goto error;
}
mutex_lock(&info->bl_mutex);
info->bl_dev = bd;
fb_bl_default_curve(info, 0,
63 * FB_BACKLIGHT_MAX / MAX_LEVEL,
219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
mutex_unlock(&info->bl_mutex);
down(&bd->sem);
bd->props->brightness = aty128_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd);
up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex);
if (!pmac_backlight)
pmac_backlight = bd;
mutex_unlock(&pmac_backlight_mutex);
#endif
bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
bd->props.brightness = bd->props.max_brightness;
bd->props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
printk("aty128: Backlight initialized (%s)\n", name);
@@ -1869,31 +1835,10 @@ error:
return;
}
static void aty128_bl_exit(struct aty128fb_par *par)
static void aty128_bl_exit(struct backlight_device *bd)
{
struct fb_info *info = pci_get_drvdata(par->pdev);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex);
#endif
mutex_lock(&info->bl_mutex);
if (info->bl_dev) {
#ifdef CONFIG_PMAC_BACKLIGHT
if (pmac_backlight == info->bl_dev)
pmac_backlight = NULL;
#endif
backlight_device_unregister(info->bl_dev);
info->bl_dev = NULL;
printk("aty128: Backlight unloaded\n");
}
mutex_unlock(&info->bl_mutex);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_unlock(&pmac_backlight_mutex);
#endif
backlight_device_unregister(bd);
printk("aty128: Backlight unloaded\n");
}
#endif /* CONFIG_FB_ATY128_BACKLIGHT */
@@ -2180,11 +2125,12 @@ static void __devexit aty128_remove(struct pci_dev *pdev)
par = info->par;
unregister_framebuffer(info);
#ifdef CONFIG_FB_ATY128_BACKLIGHT
aty128_bl_exit(par);
aty128_bl_exit(info->bl_dev);
#endif
unregister_framebuffer(info);
#ifdef CONFIG_MTRR
if (par->mtrr.vram_valid)
mtrr_del(par->mtrr.vram, info->fix.smem_start,
@@ -2214,11 +2160,6 @@ static int aty128fb_blank(int blank, struct fb_info *fb)
if (par->lock_blank || par->asleep)
return 0;
#ifdef CONFIG_FB_ATY128_BACKLIGHT
if (machine_is(powermac) && blank)
aty128_bl_set_power(fb, FB_BLANK_POWERDOWN);
#endif
if (blank & FB_BLANK_VSYNC_SUSPEND)
state |= 2;
if (blank & FB_BLANK_HSYNC_SUSPEND)
@@ -2233,11 +2174,6 @@ static int aty128fb_blank(int blank, struct fb_info *fb)
aty128_set_lcd_enable(par, par->lcd_on && !blank);
}
#ifdef CONFIG_FB_ATY128_BACKLIGHT
if (machine_is(powermac) && !blank)
aty128_bl_set_power(fb, FB_BLANK_UNBLANK);
#endif
return 0;
}
+17 -83
View File
@@ -2114,15 +2114,13 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
#ifdef CONFIG_FB_ATY_BACKLIGHT
#define MAX_LEVEL 0xFF
static struct backlight_properties aty_bl_data;
/* Call with fb_info->bl_mutex held */
static int aty_bl_get_level_brightness(struct atyfb_par *par, int level)
{
struct fb_info *info = pci_get_drvdata(par->pdev);
int atylevel;
/* Get and convert the value */
/* No locking of bl_curve since we read a single value */
atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL;
if (atylevel < 0)
@@ -2133,18 +2131,17 @@ static int aty_bl_get_level_brightness(struct atyfb_par *par, int level)
return atylevel;
}
/* Call with fb_info->bl_mutex held */
static int __aty_bl_update_status(struct backlight_device *bd)
static int aty_bl_update_status(struct backlight_device *bd)
{
struct atyfb_par *par = class_get_devdata(&bd->class_dev);
unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
int level;
if (bd->props->power != FB_BLANK_UNBLANK ||
bd->props->fb_blank != FB_BLANK_UNBLANK)
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
level = bd->props->brightness;
level = bd->props.brightness;
reg |= (BLMOD_EN | BIASMOD_EN);
if (level > 0) {
@@ -2159,45 +2156,16 @@ static int __aty_bl_update_status(struct backlight_device *bd)
return 0;
}
static int aty_bl_update_status(struct backlight_device *bd)
{
struct atyfb_par *par = class_get_devdata(&bd->class_dev);
struct fb_info *info = pci_get_drvdata(par->pdev);
int ret;
mutex_lock(&info->bl_mutex);
ret = __aty_bl_update_status(bd);
mutex_unlock(&info->bl_mutex);
return ret;
}
static int aty_bl_get_brightness(struct backlight_device *bd)
{
return bd->props->brightness;
return bd->props.brightness;
}
static struct backlight_properties aty_bl_data = {
.owner = THIS_MODULE,
static struct backlight_ops aty_bl_data = {
.get_brightness = aty_bl_get_brightness,
.update_status = aty_bl_update_status,
.max_brightness = (FB_BACKLIGHT_LEVELS - 1),
};
static void aty_bl_set_power(struct fb_info *info, int power)
{
mutex_lock(&info->bl_mutex);
if (info->bl_dev) {
down(&info->bl_dev->sem);
info->bl_dev->props->power = power;
__aty_bl_update_status(info->bl_dev);
up(&info->bl_dev->sem);
}
mutex_unlock(&info->bl_mutex);
}
static void aty_bl_init(struct atyfb_par *par)
{
struct fb_info *info = pci_get_drvdata(par->pdev);
@@ -2218,25 +2186,15 @@ static void aty_bl_init(struct atyfb_par *par)
goto error;
}
mutex_lock(&info->bl_mutex);
info->bl_dev = bd;
fb_bl_default_curve(info, 0,
0x3F * FB_BACKLIGHT_MAX / MAX_LEVEL,
0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL);
mutex_unlock(&info->bl_mutex);
down(&bd->sem);
bd->props->brightness = aty_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd);
up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex);
if (!pmac_backlight)
pmac_backlight = bd;
mutex_unlock(&pmac_backlight_mutex);
#endif
bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
bd->props.brightness = bd->props.max_brightness;
bd->props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
printk("aty: Backlight initialized (%s)\n", name);
@@ -2246,30 +2204,10 @@ error:
return;
}
static void aty_bl_exit(struct atyfb_par *par)
static void aty_bl_exit(struct backlight_device *bd)
{
struct fb_info *info = pci_get_drvdata(par->pdev);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex);
#endif
mutex_lock(&info->bl_mutex);
if (info->bl_dev) {
#ifdef CONFIG_PMAC_BACKLIGHT
if (pmac_backlight == info->bl_dev)
pmac_backlight = NULL;
#endif
backlight_device_unregister(info->bl_dev);
printk("aty: Backlight unloaded\n");
}
mutex_unlock(&info->bl_mutex);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_unlock(&pmac_backlight_mutex);
#endif
backlight_device_unregister(bd);
printk("aty: Backlight unloaded\n");
}
#endif /* CONFIG_FB_ATY_BACKLIGHT */
@@ -2814,8 +2752,6 @@ static int atyfb_blank(int blank, struct fb_info *info)
return 0;
#ifdef CONFIG_FB_ATY_BACKLIGHT
if (machine_is(powermac) && blank > FB_BLANK_NORMAL)
aty_bl_set_power(info, FB_BLANK_POWERDOWN);
#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
if (par->lcd_table && blank > FB_BLANK_NORMAL &&
(aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) {
@@ -2846,8 +2782,6 @@ static int atyfb_blank(int blank, struct fb_info *info)
aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par);
#ifdef CONFIG_FB_ATY_BACKLIGHT
if (machine_is(powermac) && blank <= FB_BLANK_NORMAL)
aty_bl_set_power(info, FB_BLANK_UNBLANK);
#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
if (par->lcd_table && blank <= FB_BLANK_NORMAL &&
(aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) {
@@ -3726,13 +3660,13 @@ static void __devexit atyfb_remove(struct fb_info *info)
aty_set_crtc(par, &saved_crtc);
par->pll_ops->set_pll(info, &saved_pll);
unregister_framebuffer(info);
#ifdef CONFIG_FB_ATY_BACKLIGHT
if (M64_HAS(MOBIL_BUS))
aty_bl_exit(par);
aty_bl_exit(info->bl_dev);
#endif
unregister_framebuffer(info);
#ifdef CONFIG_MTRR
if (par->mtrr_reg >= 0) {
mtrr_del(par->mtrr_reg, 0, 0);
+14 -45
View File
@@ -19,8 +19,6 @@
#define MAX_RADEON_LEVEL 0xFF
static struct backlight_properties radeon_bl_data;
struct radeon_bl_privdata {
struct radeonfb_info *rinfo;
uint8_t negative;
@@ -29,17 +27,13 @@ struct radeon_bl_privdata {
static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata,
int level)
{
struct fb_info *info = pdata->rinfo->info;
int rlevel;
mutex_lock(&info->bl_mutex);
/* Get and convert the value */
/* No locking of bl_curve since we read a single value */
rlevel = pdata->rinfo->info->bl_curve[level] *
FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL;
mutex_unlock(&info->bl_mutex);
if (rlevel < 0)
rlevel = 0;
else if (rlevel > MAX_RADEON_LEVEL)
@@ -65,11 +59,11 @@ static int radeon_bl_update_status(struct backlight_device *bd)
* backlight. This provides some greater power saving and the display
* is useless without backlight anyway.
*/
if (bd->props->power != FB_BLANK_UNBLANK ||
bd->props->fb_blank != FB_BLANK_UNBLANK)
if (bd->props.power != FB_BLANK_UNBLANK ||
bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
level = bd->props->brightness;
level = bd->props.brightness;
del_timer_sync(&rinfo->lvds_timer);
radeon_engine_idle();
@@ -130,14 +124,12 @@ static int radeon_bl_update_status(struct backlight_device *bd)
static int radeon_bl_get_brightness(struct backlight_device *bd)
{
return bd->props->brightness;
return bd->props.brightness;
}
static struct backlight_properties radeon_bl_data = {
.owner = THIS_MODULE,
static struct backlight_ops radeon_bl_data = {
.get_brightness = radeon_bl_get_brightness,
.update_status = radeon_bl_update_status,
.max_brightness = (FB_BACKLIGHT_LEVELS - 1),
};
void radeonfb_bl_init(struct radeonfb_info *rinfo)
@@ -188,25 +180,15 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
machine_is_compatible("PowerBook6,5");
#endif
mutex_lock(&rinfo->info->bl_mutex);
rinfo->info->bl_dev = bd;
fb_bl_default_curve(rinfo->info, 0,
63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL,
217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
mutex_unlock(&rinfo->info->bl_mutex);
down(&bd->sem);
bd->props->brightness = radeon_bl_data.max_brightness;
bd->props->power = FB_BLANK_UNBLANK;
bd->props->update_status(bd);
up(&bd->sem);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex);
if (!pmac_backlight)
pmac_backlight = bd;
mutex_unlock(&pmac_backlight_mutex);
#endif
bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
bd->props.brightness = bd->props.max_brightness;
bd->props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
printk("radeonfb: Backlight initialized (%s)\n", name);
@@ -219,29 +201,16 @@ error:
void radeonfb_bl_exit(struct radeonfb_info *rinfo)
{
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_lock(&pmac_backlight_mutex);
#endif
struct backlight_device *bd = rinfo->info->bl_dev;
mutex_lock(&rinfo->info->bl_mutex);
if (rinfo->info->bl_dev) {
if (bd) {
struct radeon_bl_privdata *pdata;
#ifdef CONFIG_PMAC_BACKLIGHT
if (pmac_backlight == rinfo->info->bl_dev)
pmac_backlight = NULL;
#endif
pdata = class_get_devdata(&rinfo->info->bl_dev->class_dev);
backlight_device_unregister(rinfo->info->bl_dev);
pdata = class_get_devdata(&bd->class_dev);
backlight_device_unregister(bd);
kfree(pdata);
rinfo->info->bl_dev = NULL;
printk("radeonfb: Backlight unloaded\n");
}
mutex_unlock(&rinfo->info->bl_mutex);
#ifdef CONFIG_PMAC_BACKLIGHT
mutex_unlock(&pmac_backlight_mutex);
#endif
}
+2 -1
View File
@@ -2393,7 +2393,6 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev)
if (!rinfo)
return;
radeonfb_bl_exit(rinfo);
radeonfb_pm_exit(rinfo);
if (rinfo->mon1_EDID)
@@ -2420,6 +2419,8 @@ static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev)
unregister_framebuffer(info);
radeonfb_bl_exit(rinfo);
iounmap(rinfo->mmio_base);
iounmap(rinfo->fb_base);
+10 -13
View File
@@ -19,11 +19,6 @@ config BACKLIGHT_CLASS_DEVICE
To have support for your specific LCD panel you will have to
select the proper drivers which depend on this option.
config BACKLIGHT_DEVICE
bool
depends on BACKLIGHT_CLASS_DEVICE
default y
config LCD_CLASS_DEVICE
tristate "Lowlevel LCD controls"
depends on BACKLIGHT_LCD_SUPPORT
@@ -37,14 +32,9 @@ 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_DEVICE
bool
depends on LCD_CLASS_DEVICE
default y
config BACKLIGHT_CORGI
tristate "Sharp Corgi Backlight Driver (SL Series)"
depends on BACKLIGHT_DEVICE && PXA_SHARPSL
depends on BACKLIGHT_CLASS_DEVICE && PXA_SHARPSL
default y
help
If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the
@@ -52,7 +42,7 @@ config BACKLIGHT_CORGI
config BACKLIGHT_LOCOMO
tristate "Sharp LOCOMO LCD/Backlight Driver"
depends on BACKLIGHT_DEVICE && SHARP_LOCOMO
depends on BACKLIGHT_CLASS_DEVICE && SHARP_LOCOMO
default y
help
If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to
@@ -60,9 +50,16 @@ config BACKLIGHT_LOCOMO
config BACKLIGHT_HP680
tristate "HP Jornada 680 Backlight Driver"
depends on BACKLIGHT_DEVICE && SH_HP6XX
depends on BACKLIGHT_CLASS_DEVICE && SH_HP6XX
default y
help
If you have a HP Jornada 680, say y to enable the
backlight driver.
config BACKLIGHT_PROGEAR
tristate "Frontpath ProGear Backlight Driver"
depends on BACKLIGHT_CLASS_DEVICE && PCI && X86
default n
help
If you have a Frontpath ProGear say Y to enable the
backlight driver.
+1
View File
@@ -5,3 +5,4 @@ obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o
obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o

Some files were not shown because too many files have changed in this diff Show More