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: panasonic-laptop - Fix incomplete registration failure handling
  backlight: msi-laptop, msi-wmi: fix incomplete registration failure handling
  backlight: blackfin - Fix missing registration failure handling
  backlight: classmate-laptop - Fix missing registration failure handling
  backlight: mbp_nvidia_bl - add five more MacBook variants
  backlight: Allow properties to be passed at registration
  backlight: Add backlight_device parameter to check_fb
  video: backlight/progear, fix pci device refcounting
  backlight: l4f00242t03: Fix module licence absence.
  backlight: Revert some const qualifiers
  backlight: Add Epson L4F00242T03 LCD driver
  • Loading branch information
torvalds committed Mar 18, 2010
2 parents 5dbc2f5 + ec57af9 commit 61d7180
Show file tree
Hide file tree
Showing 53 changed files with 658 additions and 167 deletions.
9 changes: 6 additions & 3 deletions drivers/acpi/video.c
Expand Up @@ -998,6 +998,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
}

if (acpi_video_backlight_support()) {
struct backlight_properties props;
int result;
static int count = 0;
char *name;
Expand All @@ -1010,12 +1011,14 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
return;

sprintf(name, "acpi_video%d", count++);
device->backlight = backlight_device_register(name,
NULL, device, &acpi_backlight_ops);
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = device->brightness->count - 3;
device->backlight = backlight_device_register(name, NULL, device,
&acpi_backlight_ops,
&props);
kfree(name);
if (IS_ERR(device->backlight))
return;
device->backlight->props.max_brightness = device->brightness->count-3;

result = sysfs_create_link(&device->backlight->dev.kobj,
&device->dev->dev.kobj, "device");
Expand Down
12 changes: 8 additions & 4 deletions drivers/gpu/drm/nouveau/nouveau_backlight.c
Expand Up @@ -89,19 +89,21 @@ static struct backlight_ops nv50_bl_ops = {

static int nouveau_nv40_backlight_init(struct drm_device *dev)
{
struct backlight_properties props;
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct backlight_device *bd;

if (!(nv_rd32(dev, NV40_PMC_BACKLIGHT) & NV40_PMC_BACKLIGHT_MASK))
return 0;

memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 31;
bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
&nv40_bl_ops);
&nv40_bl_ops, &props);
if (IS_ERR(bd))
return PTR_ERR(bd);

dev_priv->backlight = bd;
bd->props.max_brightness = 31;
bd->props.brightness = nv40_get_intensity(bd);
backlight_update_status(bd);

Expand All @@ -110,19 +112,21 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)

static int nouveau_nv50_backlight_init(struct drm_device *dev)
{
struct backlight_properties props;
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct backlight_device *bd;

if (!nv_rd32(dev, NV50_PDISPLAY_SOR_BACKLIGHT))
return 0;

memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 1025;
bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
&nv50_bl_ops);
&nv50_bl_ops, &props);
if (IS_ERR(bd))
return PTR_ERR(bd);

dev_priv->backlight = bd;
bd->props.max_brightness = 1025;
bd->props.brightness = nv50_get_intensity(bd);
backlight_update_status(bd);
return 0;
Expand Down
7 changes: 5 additions & 2 deletions drivers/macintosh/via-pmu-backlight.c
Expand Up @@ -144,6 +144,7 @@ void pmu_backlight_set_sleep(int sleep)

void __init pmu_backlight_init()
{
struct backlight_properties props;
struct backlight_device *bd;
char name[10];
int level, autosave;
Expand All @@ -161,13 +162,15 @@ void __init pmu_backlight_init()

snprintf(name, sizeof(name), "pmubl");

bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data);
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data,
&props);
if (IS_ERR(bd)) {
printk(KERN_ERR "PMU Backlight registration failed\n");
return;
}
uses_pmu_bl = 1;
bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
pmu_backlight_init_curve(0x7F, 0x46, 0x0E);

level = bd->props.max_brightness;
Expand Down
7 changes: 5 additions & 2 deletions drivers/platform/x86/acer-wmi.c
Expand Up @@ -922,9 +922,13 @@ static struct backlight_ops acer_bl_ops = {

static int __devinit acer_backlight_init(struct device *dev)
{
struct backlight_properties props;
struct backlight_device *bd;

bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops);
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = max_brightness;
bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops,
&props);
if (IS_ERR(bd)) {
printk(ACER_ERR "Could not register Acer backlight device\n");
acer_backlight_device = NULL;
Expand All @@ -935,7 +939,6 @@ static int __devinit acer_backlight_init(struct device *dev)

bd->props.power = FB_BLANK_UNBLANK;
bd->props.brightness = read_brightness(bd);
bd->props.max_brightness = max_brightness;
backlight_update_status(bd);
return 0;
}
Expand Down
7 changes: 5 additions & 2 deletions drivers/platform/x86/asus-laptop.c
Expand Up @@ -639,12 +639,16 @@ static int asus_backlight_init(struct asus_laptop *asus)
{
struct backlight_device *bd;
struct device *dev = &asus->platform_device->dev;
struct backlight_properties props;

if (!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) &&
!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) &&
lcd_switch_handle) {
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 15;

bd = backlight_device_register(ASUS_LAPTOP_FILE, dev,
asus, &asusbl_ops);
asus, &asusbl_ops, &props);
if (IS_ERR(bd)) {
pr_err("Could not register asus backlight device\n");
asus->backlight_device = NULL;
Expand All @@ -653,7 +657,6 @@ static int asus_backlight_init(struct asus_laptop *asus)

asus->backlight_device = bd;

bd->props.max_brightness = 15;
bd->props.power = FB_BLANK_UNBLANK;
bd->props.brightness = asus_read_brightness(bd);
backlight_update_status(bd);
Expand Down
7 changes: 5 additions & 2 deletions drivers/platform/x86/asus_acpi.c
Expand Up @@ -1481,6 +1481,7 @@ static void asus_acpi_exit(void)

static int __init asus_acpi_init(void)
{
struct backlight_properties props;
int result;

result = acpi_bus_register_driver(&asus_hotk_driver);
Expand All @@ -1507,15 +1508,17 @@ static int __init asus_acpi_init(void)
return -ENODEV;
}

memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 15;
asus_backlight_device = backlight_device_register("asus", NULL, NULL,
&asus_backlight_data);
&asus_backlight_data,
&props);
if (IS_ERR(asus_backlight_device)) {
printk(KERN_ERR "Could not register asus backlight device\n");
asus_backlight_device = NULL;
asus_acpi_exit();
return -ENODEV;
}
asus_backlight_device->props.max_brightness = 15;

return 0;
}
Expand Down
12 changes: 8 additions & 4 deletions drivers/platform/x86/classmate-laptop.c
Expand Up @@ -455,18 +455,22 @@ static int cmpc_bl_update_status(struct backlight_device *bd)
return -1;
}

static struct backlight_ops cmpc_bl_ops = {
static const struct backlight_ops cmpc_bl_ops = {
.get_brightness = cmpc_bl_get_brightness,
.update_status = cmpc_bl_update_status
};

static int cmpc_bl_add(struct acpi_device *acpi)
{
struct backlight_properties props;
struct backlight_device *bd;

bd = backlight_device_register("cmpc_bl", &acpi->dev,
acpi->handle, &cmpc_bl_ops);
bd->props.max_brightness = 7;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 7;
bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle,
&cmpc_bl_ops, &props);
if (IS_ERR(bd))
return PTR_ERR(bd);
dev_set_drvdata(&acpi->dev, bd);
return 0;
}
Expand Down
11 changes: 7 additions & 4 deletions drivers/platform/x86/compal-laptop.c
Expand Up @@ -291,12 +291,15 @@ static int __init compal_init(void)
/* Register backlight stuff */

if (!acpi_video_backlight_support()) {
compalbl_device = backlight_device_register("compal-laptop", NULL, NULL,
&compalbl_ops);
struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = COMPAL_LCD_LEVEL_MAX - 1;
compalbl_device = backlight_device_register("compal-laptop",
NULL, NULL,
&compalbl_ops,
&props);
if (IS_ERR(compalbl_device))
return PTR_ERR(compalbl_device);

compalbl_device->props.max_brightness = COMPAL_LCD_LEVEL_MAX-1;
}

ret = platform_driver_register(&compal_driver);
Expand Down
13 changes: 8 additions & 5 deletions drivers/platform/x86/dell-laptop.c
Expand Up @@ -559,18 +559,21 @@ static int __init dell_init(void)
release_buffer();

if (max_intensity) {
dell_backlight_device = backlight_device_register(
"dell_backlight",
&platform_device->dev, NULL,
&dell_ops);
struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = max_intensity;
dell_backlight_device = backlight_device_register("dell_backlight",
&platform_device->dev,
NULL,
&dell_ops,
&props);

if (IS_ERR(dell_backlight_device)) {
ret = PTR_ERR(dell_backlight_device);
dell_backlight_device = NULL;
goto fail_backlight;
}

dell_backlight_device->props.max_brightness = max_intensity;
dell_backlight_device->props.brightness =
dell_get_intensity(dell_backlight_device);
backlight_update_status(dell_backlight_device);
Expand Down
8 changes: 5 additions & 3 deletions drivers/platform/x86/eeepc-laptop.c
Expand Up @@ -1131,18 +1131,20 @@ static int eeepc_backlight_notify(struct eeepc_laptop *eeepc)

static int eeepc_backlight_init(struct eeepc_laptop *eeepc)
{
struct backlight_properties props;
struct backlight_device *bd;

memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 15;
bd = backlight_device_register(EEEPC_LAPTOP_FILE,
&eeepc->platform_device->dev,
eeepc, &eeepcbl_ops);
&eeepc->platform_device->dev, eeepc,
&eeepcbl_ops, &props);
if (IS_ERR(bd)) {
pr_err("Could not register eeepc backlight device\n");
eeepc->backlight_device = NULL;
return PTR_ERR(bd);
}
eeepc->backlight_device = bd;
bd->props.max_brightness = 15;
bd->props.brightness = read_brightness(bd);
bd->props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
Expand Down
14 changes: 9 additions & 5 deletions drivers/platform/x86/fujitsu-laptop.c
Expand Up @@ -1126,16 +1126,20 @@ static int __init fujitsu_init(void)
/* Register backlight stuff */

if (!acpi_video_backlight_support()) {
fujitsu->bl_device =
backlight_device_register("fujitsu-laptop", NULL, NULL,
&fujitsubl_ops);
struct backlight_properties props;

memset(&props, 0, sizeof(struct backlight_properties));
max_brightness = fujitsu->max_brightness;
props.max_brightness = max_brightness - 1;
fujitsu->bl_device = backlight_device_register("fujitsu-laptop",
NULL, NULL,
&fujitsubl_ops,
&props);
if (IS_ERR(fujitsu->bl_device)) {
ret = PTR_ERR(fujitsu->bl_device);
fujitsu->bl_device = NULL;
goto fail_sysfs_group;
}
max_brightness = fujitsu->max_brightness;
fujitsu->bl_device->props.max_brightness = max_brightness - 1;
fujitsu->bl_device->props.brightness = fujitsu->brightness_level;
}

Expand Down
7 changes: 5 additions & 2 deletions drivers/platform/x86/msi-laptop.c
Expand Up @@ -683,11 +683,14 @@ static int __init msi_init(void)
printk(KERN_INFO "MSI: Brightness ignored, must be controlled "
"by ACPI video driver\n");
} else {
struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = MSI_LCD_LEVEL_MAX - 1;
msibl_device = backlight_device_register("msi-laptop-bl", NULL,
NULL, &msibl_ops);
NULL, &msibl_ops,
&props);
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);
Expand Down
15 changes: 10 additions & 5 deletions drivers/platform/x86/msi-wmi.c
Expand Up @@ -138,7 +138,7 @@ static int bl_set_status(struct backlight_device *bd)
return msi_wmi_set_block(0, backlight_map[bright]);
}

static struct backlight_ops msi_backlight_ops = {
static const struct backlight_ops msi_backlight_ops = {
.get_brightness = bl_get,
.update_status = bl_set_status,
};
Expand Down Expand Up @@ -249,12 +249,17 @@ static int __init msi_wmi_init(void)
goto err_uninstall_notifier;

if (!acpi_video_backlight_support()) {
backlight = backlight_device_register(DRV_NAME,
NULL, NULL, &msi_backlight_ops);
if (IS_ERR(backlight))
struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
backlight = backlight_device_register(DRV_NAME, NULL, NULL,
&msi_backlight_ops,
&props);
if (IS_ERR(backlight)) {
err = PTR_ERR(backlight);
goto err_free_input;
}

backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
err = bl_get(NULL);
if (err < 0)
goto err_free_backlight;
Expand Down

0 comments on commit 61d7180

Please sign in to comment.