Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188180
b: refs/heads/master
c: a19a6ee
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Garrett authored and Richard Purdie committed Mar 16, 2010
1 parent d01b25e commit 0428079
Show file tree
Hide file tree
Showing 50 changed files with 272 additions and 152 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 57e148b6a975980944f4466ccb669b1d02dfc6a1
refs/heads/master: a19a6ee6cad2b20292a774c2f56ba8039b0fac9c
9 changes: 6 additions & 3 deletions trunk/drivers/acpi/video.c
Original file line number Diff line number Diff line change
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 trunk/drivers/gpu/drm/nouveau/nouveau_backlight.c
Original file line number Diff line number Diff line change
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 trunk/drivers/macintosh/via-pmu-backlight.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/acer-wmi.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/asus-laptop.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/asus_acpi.c
Original file line number Diff line number Diff line change
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
8 changes: 5 additions & 3 deletions trunk/drivers/platform/x86/classmate-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,13 @@ static struct backlight_ops cmpc_bl_ops = {

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);
dev_set_drvdata(&acpi->dev, bd);
return 0;
}
Expand Down
11 changes: 7 additions & 4 deletions trunk/drivers/platform/x86/compal-laptop.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/dell-laptop.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/eeepc-laptop.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/fujitsu-laptop.c
Original file line number Diff line number Diff line change
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 trunk/drivers/platform/x86/msi-laptop.c
Original file line number Diff line number Diff line change
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
9 changes: 6 additions & 3 deletions trunk/drivers/platform/x86/msi-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,15 @@ 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);
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))
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
24 changes: 12 additions & 12 deletions trunk/drivers/platform/x86/panasonic-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device)

static int acpi_pcc_hotkey_add(struct acpi_device *device)
{
struct backlight_properties props;
struct pcc_acpi *pcc;
int num_sifr, result;

Expand Down Expand Up @@ -637,24 +638,23 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing keyinput handler\n"));
goto out_sinf;
goto out_hotkey;
}

/* initialize backlight */
pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
&pcc_backlight_ops);
if (IS_ERR(pcc->backlight))
goto out_input;

if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Couldn't retrieve BIOS data\n"));
goto out_backlight;
goto out_input;
}
/* initialize backlight */
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
&pcc_backlight_ops, &props);
if (IS_ERR(pcc->backlight))
goto out_sinf;

/* read the initial brightness setting from the hardware */
pcc->backlight->props.max_brightness =
pcc->sinf[SINF_AC_MAX_BRIGHT];
pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];

/* read the initial sticky key mode from the hardware */
Expand All @@ -669,12 +669,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)

out_backlight:
backlight_device_unregister(pcc->backlight);
out_sinf:
kfree(pcc->sinf);
out_input:
input_unregister_device(pcc->input_dev);
/* no need to input_free_device() since core input API refcount and
* free()s the device */
out_sinf:
kfree(pcc->sinf);
out_hotkey:
kfree(pcc);

Expand Down
Loading

0 comments on commit 0428079

Please sign in to comment.