diff options
author | Matthew Garrett <mjg@redhat.com> | 2011-03-22 19:30:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:43:59 -0400 |
commit | bb7ca747f8d6243b3943c5b133048652020f4a50 (patch) | |
tree | b40e879a7b26e3763aea2af2d4dd9079483de11e | |
parent | ccd7510fd8dea5b4b2af87fb2aef2ebd6b23b76b (diff) |
backlight: add backlight type
There may be multiple ways of controlling the backlight on a given
machine. Allow drivers to expose the type of interface they are
providing, making it possible for userspace to make appropriate policy
decisions.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
59 files changed, 111 insertions, 2 deletions
diff --git a/Documentation/ABI/stable/sysfs-class-backlight b/Documentation/ABI/stable/sysfs-class-backlight index 4d637e1c4ff7..70302f370e7e 100644 --- a/Documentation/ABI/stable/sysfs-class-backlight +++ b/Documentation/ABI/stable/sysfs-class-backlight | |||
@@ -34,3 +34,23 @@ Contact: Richard Purdie <rpurdie@rpsys.net> | |||
34 | Description: | 34 | Description: |
35 | Maximum brightness for <backlight>. | 35 | Maximum brightness for <backlight>. |
36 | Users: HAL | 36 | Users: HAL |
37 | |||
38 | What: /sys/class/backlight/<backlight>/type | ||
39 | Date: September 2010 | ||
40 | KernelVersion: 2.6.37 | ||
41 | Contact: Matthew Garrett <mjg@redhat.com> | ||
42 | Description: | ||
43 | The type of interface controlled by <backlight>. | ||
44 | "firmware": The driver uses a standard firmware interface | ||
45 | "platform": The driver uses a platform-specific interface | ||
46 | "raw": The driver controls hardware registers directly | ||
47 | |||
48 | In the general case, when multiple backlight | ||
49 | interfaces are available for a single device, firmware | ||
50 | control should be preferred to platform control should | ||
51 | be preferred to raw control. Using a firmware | ||
52 | interface reduces the probability of confusion with | ||
53 | the hardware and the OS independently updating the | ||
54 | backlight state. Platform interfaces are mostly a | ||
55 | holdover from pre-standardisation of firmware | ||
56 | interfaces. | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 90f8f7676d1f..a9eec8c95a1f 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -795,6 +795,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
795 | count++; | 795 | count++; |
796 | 796 | ||
797 | memset(&props, 0, sizeof(struct backlight_properties)); | 797 | memset(&props, 0, sizeof(struct backlight_properties)); |
798 | props.type = BACKLIGHT_FIRMWARE; | ||
798 | props.max_brightness = device->brightness->count - 3; | 799 | props.max_brightness = device->brightness->count - 3; |
799 | device->backlight = backlight_device_register(name, NULL, device, | 800 | device->backlight = backlight_device_register(name, NULL, device, |
800 | &acpi_backlight_ops, | 801 | &acpi_backlight_ops, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index d3a9c6e02477..18d7bcc54ce0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c | |||
@@ -98,6 +98,7 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev) | |||
98 | return 0; | 98 | return 0; |
99 | 99 | ||
100 | memset(&props, 0, sizeof(struct backlight_properties)); | 100 | memset(&props, 0, sizeof(struct backlight_properties)); |
101 | props.type = BACKLIGHT_RAW; | ||
101 | props.max_brightness = 31; | 102 | props.max_brightness = 31; |
102 | bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev, | 103 | bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev, |
103 | &nv40_bl_ops, &props); | 104 | &nv40_bl_ops, &props); |
@@ -121,6 +122,7 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev) | |||
121 | return 0; | 122 | return 0; |
122 | 123 | ||
123 | memset(&props, 0, sizeof(struct backlight_properties)); | 124 | memset(&props, 0, sizeof(struct backlight_properties)); |
125 | props.type = BACKLIGHT_RAW; | ||
124 | props.max_brightness = 1025; | 126 | props.max_brightness = 1025; |
125 | bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev, | 127 | bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev, |
126 | &nv50_bl_ops, &props); | 128 | &nv50_bl_ops, &props); |
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index de9cf21b3494..657da5a3d5c6 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -944,6 +944,7 @@ static int picolcd_init_backlight(struct picolcd_data *data, struct hid_report * | |||
944 | } | 944 | } |
945 | 945 | ||
946 | memset(&props, 0, sizeof(props)); | 946 | memset(&props, 0, sizeof(props)); |
947 | props.type = BACKLIGHT_RAW; | ||
947 | props.max_brightness = 0xff; | 948 | props.max_brightness = 0xff; |
948 | bdev = backlight_device_register(dev_name(dev), dev, data, | 949 | bdev = backlight_device_register(dev_name(dev), dev, data, |
949 | &picolcd_blops, &props); | 950 | &picolcd_blops, &props); |
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index ade1e656bfb2..b1d91170ded0 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -163,6 +163,7 @@ void __init pmu_backlight_init() | |||
163 | snprintf(name, sizeof(name), "pmubl"); | 163 | snprintf(name, sizeof(name), "pmubl"); |
164 | 164 | ||
165 | memset(&props, 0, sizeof(struct backlight_properties)); | 165 | memset(&props, 0, sizeof(struct backlight_properties)); |
166 | props.type = BACKLIGHT_PLATFORM; | ||
166 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 167 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
167 | bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data, | 168 | bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data, |
168 | &props); | 169 | &props); |
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index ad3d099bf5c1..c9784705f6ac 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -1031,6 +1031,7 @@ static int __devinit acer_backlight_init(struct device *dev) | |||
1031 | struct backlight_device *bd; | 1031 | struct backlight_device *bd; |
1032 | 1032 | ||
1033 | memset(&props, 0, sizeof(struct backlight_properties)); | 1033 | memset(&props, 0, sizeof(struct backlight_properties)); |
1034 | props.type = BACKLIGHT_PLATFORM; | ||
1034 | props.max_brightness = max_brightness; | 1035 | props.max_brightness = max_brightness; |
1035 | bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops, | 1036 | bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops, |
1036 | &props); | 1037 | &props); |
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index f3aa6a7fdab6..5a6f7d7575d6 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -667,6 +667,7 @@ static int asus_backlight_init(struct asus_laptop *asus) | |||
667 | 667 | ||
668 | memset(&props, 0, sizeof(struct backlight_properties)); | 668 | memset(&props, 0, sizeof(struct backlight_properties)); |
669 | props.max_brightness = 15; | 669 | props.max_brightness = 15; |
670 | props.type = BACKLIGHT_PLATFORM; | ||
670 | 671 | ||
671 | bd = backlight_device_register(ASUS_LAPTOP_FILE, | 672 | bd = backlight_device_register(ASUS_LAPTOP_FILE, |
672 | &asus->platform_device->dev, asus, | 673 | &asus->platform_device->dev, asus, |
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index fe495939c307..f503607c0645 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
@@ -1507,6 +1507,7 @@ static int __init asus_acpi_init(void) | |||
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | memset(&props, 0, sizeof(struct backlight_properties)); | 1509 | memset(&props, 0, sizeof(struct backlight_properties)); |
1510 | props.type = BACKLIGHT_PLATFORM; | ||
1510 | props.max_brightness = 15; | 1511 | props.max_brightness = 15; |
1511 | asus_backlight_device = backlight_device_register("asus", NULL, NULL, | 1512 | asus_backlight_device = backlight_device_register("asus", NULL, NULL, |
1512 | &asus_backlight_data, | 1513 | &asus_backlight_data, |
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 911135425224..94f93b621d7b 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c | |||
@@ -564,6 +564,7 @@ static int cmpc_ipml_add(struct acpi_device *acpi) | |||
564 | return -ENOMEM; | 564 | return -ENOMEM; |
565 | 565 | ||
566 | memset(&props, 0, sizeof(struct backlight_properties)); | 566 | memset(&props, 0, sizeof(struct backlight_properties)); |
567 | props.type = BACKLIGHT_PLATFORM; | ||
567 | props.max_brightness = 7; | 568 | props.max_brightness = 7; |
568 | ipml->bd = backlight_device_register("cmpc_bl", &acpi->dev, | 569 | ipml->bd = backlight_device_register("cmpc_bl", &acpi->dev, |
569 | acpi->handle, &cmpc_bl_ops, | 570 | acpi->handle, &cmpc_bl_ops, |
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 034572b980c9..eb95878fa583 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c | |||
@@ -970,6 +970,7 @@ static int __init compal_init(void) | |||
970 | if (!acpi_video_backlight_support()) { | 970 | if (!acpi_video_backlight_support()) { |
971 | struct backlight_properties props; | 971 | struct backlight_properties props; |
972 | memset(&props, 0, sizeof(struct backlight_properties)); | 972 | memset(&props, 0, sizeof(struct backlight_properties)); |
973 | props.type = BACKLIGHT_PLATFORM; | ||
973 | props.max_brightness = BACKLIGHT_LEVEL_MAX; | 974 | props.max_brightness = BACKLIGHT_LEVEL_MAX; |
974 | compalbl_device = backlight_device_register(DRIVER_NAME, | 975 | compalbl_device = backlight_device_register(DRIVER_NAME, |
975 | NULL, NULL, | 976 | NULL, NULL, |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index ad24ef36f9f7..de301aa8e5c3 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -671,6 +671,7 @@ static int __init dell_init(void) | |||
671 | if (max_intensity) { | 671 | if (max_intensity) { |
672 | struct backlight_properties props; | 672 | struct backlight_properties props; |
673 | memset(&props, 0, sizeof(struct backlight_properties)); | 673 | memset(&props, 0, sizeof(struct backlight_properties)); |
674 | props.type = BACKLIGHT_PLATFORM; | ||
674 | props.max_brightness = max_intensity; | 675 | props.max_brightness = max_intensity; |
675 | dell_backlight_device = backlight_device_register("dell_backlight", | 676 | dell_backlight_device = backlight_device_register("dell_backlight", |
676 | &platform_device->dev, | 677 | &platform_device->dev, |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 49d9ad708f89..6605beac0d0e 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -1147,6 +1147,7 @@ static int eeepc_backlight_init(struct eeepc_laptop *eeepc) | |||
1147 | struct backlight_device *bd; | 1147 | struct backlight_device *bd; |
1148 | 1148 | ||
1149 | memset(&props, 0, sizeof(struct backlight_properties)); | 1149 | memset(&props, 0, sizeof(struct backlight_properties)); |
1150 | props.type = BACKLIGHT_PLATFORM; | ||
1150 | props.max_brightness = 15; | 1151 | props.max_brightness = 15; |
1151 | bd = backlight_device_register(EEEPC_LAPTOP_FILE, | 1152 | bd = backlight_device_register(EEEPC_LAPTOP_FILE, |
1152 | &eeepc->platform_device->dev, eeepc, | 1153 | &eeepc->platform_device->dev, eeepc, |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 95e3b0948e9c..493054c2dbe1 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -1128,6 +1128,7 @@ static int __init fujitsu_init(void) | |||
1128 | 1128 | ||
1129 | memset(&props, 0, sizeof(struct backlight_properties)); | 1129 | memset(&props, 0, sizeof(struct backlight_properties)); |
1130 | max_brightness = fujitsu->max_brightness; | 1130 | max_brightness = fujitsu->max_brightness; |
1131 | props.type = BACKLIGHT_PLATFORM; | ||
1131 | props.max_brightness = max_brightness - 1; | 1132 | props.max_brightness = max_brightness - 1; |
1132 | fujitsu->bl_device = backlight_device_register("fujitsu-laptop", | 1133 | fujitsu->bl_device = backlight_device_register("fujitsu-laptop", |
1133 | NULL, NULL, | 1134 | NULL, NULL, |
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 7e9bb6df9d39..142d38579314 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
@@ -804,6 +804,7 @@ static int __init msi_init(void) | |||
804 | } else { | 804 | } else { |
805 | struct backlight_properties props; | 805 | struct backlight_properties props; |
806 | memset(&props, 0, sizeof(struct backlight_properties)); | 806 | memset(&props, 0, sizeof(struct backlight_properties)); |
807 | props.type = BACKLIGHT_PLATFORM; | ||
807 | props.max_brightness = MSI_LCD_LEVEL_MAX - 1; | 808 | props.max_brightness = MSI_LCD_LEVEL_MAX - 1; |
808 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, | 809 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, |
809 | NULL, &msibl_ops, | 810 | NULL, &msibl_ops, |
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index 35278ad7e628..d5419c9ec07a 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -254,6 +254,7 @@ static int __init msi_wmi_init(void) | |||
254 | if (!acpi_video_backlight_support()) { | 254 | if (!acpi_video_backlight_support()) { |
255 | struct backlight_properties props; | 255 | struct backlight_properties props; |
256 | memset(&props, 0, sizeof(struct backlight_properties)); | 256 | memset(&props, 0, sizeof(struct backlight_properties)); |
257 | props.type = BACKLIGHT_PLATFORM; | ||
257 | props.max_brightness = ARRAY_SIZE(backlight_map) - 1; | 258 | props.max_brightness = ARRAY_SIZE(backlight_map) - 1; |
258 | backlight = backlight_device_register(DRV_NAME, NULL, NULL, | 259 | backlight = backlight_device_register(DRV_NAME, NULL, NULL, |
259 | &msi_backlight_ops, | 260 | &msi_backlight_ops, |
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index cc1e0ba104d7..05be30ee158b 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -602,6 +602,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
602 | } | 602 | } |
603 | /* initialize backlight */ | 603 | /* initialize backlight */ |
604 | memset(&props, 0, sizeof(struct backlight_properties)); | 604 | memset(&props, 0, sizeof(struct backlight_properties)); |
605 | props.type = BACKLIGHT_PLATFORM; | ||
605 | props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; | 606 | props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; |
606 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | 607 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, |
607 | &pcc_backlight_ops, &props); | 608 | &pcc_backlight_ops, &props); |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 5e83370b0812..13d8d63bcca9 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -1305,8 +1305,9 @@ static int sony_nc_add(struct acpi_device *device) | |||
1305 | "controlled by ACPI video driver\n"); | 1305 | "controlled by ACPI video driver\n"); |
1306 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | 1306 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
1307 | &handle))) { | 1307 | &handle))) { |
1308 | struct backlight_properties props; | 1308 | struct backlight_properties props; |
1309 | memset(&props, 0, sizeof(struct backlight_properties)); | 1309 | memset(&props, 0, sizeof(struct backlight_properties)); |
1310 | props.type = BACKLIGHT_PLATFORM; | ||
1310 | props.max_brightness = SONY_MAX_BRIGHTNESS - 1; | 1311 | props.max_brightness = SONY_MAX_BRIGHTNESS - 1; |
1311 | sony_backlight_device = backlight_device_register("sony", NULL, | 1312 | sony_backlight_device = backlight_device_register("sony", NULL, |
1312 | NULL, | 1313 | NULL, |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index eb9922385ef8..947bdcaa0ce9 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -6307,6 +6307,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6307 | return 1; | 6307 | return 1; |
6308 | 6308 | ||
6309 | memset(&props, 0, sizeof(struct backlight_properties)); | 6309 | memset(&props, 0, sizeof(struct backlight_properties)); |
6310 | props.type = BACKLIGHT_PLATFORM; | ||
6310 | props.max_brightness = bright_maxlvl; | 6311 | props.max_brightness = bright_maxlvl; |
6311 | props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; | 6312 | props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; |
6312 | ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, | 6313 | ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 209cced786c6..63f42a22e102 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1018,6 +1018,7 @@ static int __init toshiba_acpi_init(void) | |||
1018 | create_toshiba_proc_entries(); | 1018 | create_toshiba_proc_entries(); |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | props.type = BACKLIGHT_PLATFORM; | ||
1021 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | 1022 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; |
1022 | toshiba_backlight_device = backlight_device_register("toshiba", | 1023 | toshiba_backlight_device = backlight_device_register("toshiba", |
1023 | &toshiba_acpi.p_dev->dev, | 1024 | &toshiba_acpi.p_dev->dev, |
diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index b90c2cf3e247..750fe5045efa 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c | |||
@@ -574,6 +574,7 @@ static const struct backlight_ops dcon_bl_ops = { | |||
574 | 574 | ||
575 | static struct backlight_properties dcon_bl_props = { | 575 | static struct backlight_properties dcon_bl_props = { |
576 | .max_brightness = 15, | 576 | .max_brightness = 15, |
577 | .type = BACKLIGHT_RAW, | ||
577 | .power = FB_BLANK_UNBLANK, | 578 | .power = FB_BLANK_UNBLANK, |
578 | }; | 579 | }; |
579 | 580 | ||
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c index 6607a89ccb4b..25294462b8b6 100644 --- a/drivers/staging/samsung-laptop/samsung-laptop.c +++ b/drivers/staging/samsung-laptop/samsung-laptop.c | |||
@@ -781,6 +781,7 @@ static int __init samsung_init(void) | |||
781 | 781 | ||
782 | /* create a backlight device to talk to this one */ | 782 | /* create a backlight device to talk to this one */ |
783 | memset(&props, 0, sizeof(struct backlight_properties)); | 783 | memset(&props, 0, sizeof(struct backlight_properties)); |
784 | props.type = BACKLIGHT_PLATFORM; | ||
784 | props.max_brightness = sabi_config->max_brightness; | 785 | props.max_brightness = sabi_config->max_brightness; |
785 | backlight_device = backlight_device_register("samsung", &sdev->dev, | 786 | backlight_device = backlight_device_register("samsung", &sdev->dev, |
786 | NULL, &backlight_ops, | 787 | NULL, &backlight_ops, |
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 1fa6ce3e4a23..68ab460a735c 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -282,6 +282,7 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
282 | snprintf(bl_name, sizeof(bl_name), "appledisplay%d", | 282 | snprintf(bl_name, sizeof(bl_name), "appledisplay%d", |
283 | atomic_inc_return(&count_displays) - 1); | 283 | atomic_inc_return(&count_displays) - 1); |
284 | memset(&props, 0, sizeof(struct backlight_properties)); | 284 | memset(&props, 0, sizeof(struct backlight_properties)); |
285 | props.type = BACKLIGHT_RAW; | ||
285 | props.max_brightness = 0xff; | 286 | props.max_brightness = 0xff; |
286 | pdata->bd = backlight_device_register(bl_name, NULL, pdata, | 287 | pdata->bd = backlight_device_register(bl_name, NULL, pdata, |
287 | &appledisplay_bl_data, &props); | 288 | &appledisplay_bl_data, &props); |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index bac163450216..4b4e8dadd6b2 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -127,6 +127,7 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) | |||
127 | return; | 127 | return; |
128 | 128 | ||
129 | memset(&props, 0, sizeof(struct backlight_properties)); | 129 | memset(&props, 0, sizeof(struct backlight_properties)); |
130 | props.type = BACKLIGHT_RAW; | ||
130 | props.max_brightness = 0xff; | 131 | props.max_brightness = 0xff; |
131 | bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo, | 132 | bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo, |
132 | &atmel_lcdc_bl_ops, &props); | 133 | &atmel_lcdc_bl_ops, &props); |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 4cb6a576c567..b0b2ac335347 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1818,6 +1818,7 @@ static void aty128_bl_init(struct aty128fb_par *par) | |||
1818 | snprintf(name, sizeof(name), "aty128bl%d", info->node); | 1818 | snprintf(name, sizeof(name), "aty128bl%d", info->node); |
1819 | 1819 | ||
1820 | memset(&props, 0, sizeof(struct backlight_properties)); | 1820 | memset(&props, 0, sizeof(struct backlight_properties)); |
1821 | props.type = BACKLIGHT_RAW; | ||
1821 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 1822 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
1822 | bd = backlight_device_register(name, info->dev, par, &aty128_bl_data, | 1823 | bd = backlight_device_register(name, info->dev, par, &aty128_bl_data, |
1823 | &props); | 1824 | &props); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 94e293fce1d2..d437b3daf1f5 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2241,6 +2241,7 @@ static void aty_bl_init(struct atyfb_par *par) | |||
2241 | snprintf(name, sizeof(name), "atybl%d", info->node); | 2241 | snprintf(name, sizeof(name), "atybl%d", info->node); |
2242 | 2242 | ||
2243 | memset(&props, 0, sizeof(struct backlight_properties)); | 2243 | memset(&props, 0, sizeof(struct backlight_properties)); |
2244 | props.type = BACKLIGHT_RAW; | ||
2244 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 2245 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
2245 | bd = backlight_device_register(name, info->dev, par, &aty_bl_data, | 2246 | bd = backlight_device_register(name, info->dev, par, &aty_bl_data, |
2246 | &props); | 2247 | &props); |
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c index 9b811ddbce83..db572df7e1ef 100644 --- a/drivers/video/aty/radeon_backlight.c +++ b/drivers/video/aty/radeon_backlight.c | |||
@@ -158,6 +158,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) | |||
158 | snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); | 158 | snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); |
159 | 159 | ||
160 | memset(&props, 0, sizeof(struct backlight_properties)); | 160 | memset(&props, 0, sizeof(struct backlight_properties)); |
161 | props.type = BACKLIGHT_RAW; | ||
161 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 162 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
162 | bd = backlight_device_register(name, rinfo->info->dev, pdata, | 163 | bd = backlight_device_register(name, rinfo->info->dev, pdata, |
163 | &radeon_bl_data, &props); | 164 | &radeon_bl_data, &props); |
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index b224396b86d5..e59623a15f3f 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c | |||
@@ -227,6 +227,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | memset(&props, 0, sizeof(struct backlight_properties)); | 229 | memset(&props, 0, sizeof(struct backlight_properties)); |
230 | props.type = BACKLIGHT_RAW; | ||
230 | props.max_brightness = MAX_BRIGHTNESS; | 231 | props.max_brightness = MAX_BRIGHTNESS; |
231 | bl = backlight_device_register(name, &pdev->dev, data, | 232 | bl = backlight_device_register(name, &pdev->dev, data, |
232 | &pm860x_backlight_ops, &props); | 233 | &pm860x_backlight_ops, &props); |
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 9f436e014f85..af3119707dbf 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c | |||
@@ -303,6 +303,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
303 | mutex_init(&data->lock); | 303 | mutex_init(&data->lock); |
304 | 304 | ||
305 | memset(&props, 0, sizeof(struct backlight_properties)); | 305 | memset(&props, 0, sizeof(struct backlight_properties)); |
306 | props.type = BACKLIGHT_RAW; | ||
306 | props.max_brightness = ADP5020_MAX_BRIGHTNESS; | 307 | props.max_brightness = ADP5020_MAX_BRIGHTNESS; |
307 | bl = backlight_device_register(pdev->name, data->master, data, | 308 | bl = backlight_device_register(pdev->name, data->master, data, |
308 | &adp5520_bl_ops, &props); | 309 | &adp5520_bl_ops, &props); |
diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 734c650a47c4..d2a96a421ffd 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c | |||
@@ -709,6 +709,7 @@ static int __devinit adp8860_probe(struct i2c_client *client, | |||
709 | i2c_set_clientdata(client, data); | 709 | i2c_set_clientdata(client, data); |
710 | 710 | ||
711 | memset(&props, 0, sizeof(props)); | 711 | memset(&props, 0, sizeof(props)); |
712 | props.type = BACKLIGHT_RAW; | ||
712 | props.max_brightness = ADP8860_MAX_BRIGHTNESS; | 713 | props.max_brightness = ADP8860_MAX_BRIGHTNESS; |
713 | 714 | ||
714 | mutex_init(&data->lock); | 715 | mutex_init(&data->lock); |
diff --git a/drivers/video/backlight/adx_bl.c b/drivers/video/backlight/adx_bl.c index fe9af129c5dd..c861c41af442 100644 --- a/drivers/video/backlight/adx_bl.c +++ b/drivers/video/backlight/adx_bl.c | |||
@@ -104,6 +104,7 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | memset(&props, 0, sizeof(struct backlight_properties)); | 106 | memset(&props, 0, sizeof(struct backlight_properties)); |
107 | props.type = BACKLIGHT_RAW; | ||
107 | props.max_brightness = 0xff; | 108 | props.max_brightness = 0xff; |
108 | bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, | 109 | bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, |
109 | bl, &adx_backlight_ops, &props); | 110 | bl, &adx_backlight_ops, &props); |
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index e6a66dab088c..0443a4f71858 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c | |||
@@ -168,6 +168,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | memset(&props, 0, sizeof(struct backlight_properties)); | 170 | memset(&props, 0, sizeof(struct backlight_properties)); |
171 | props.type = BACKLIGHT_RAW; | ||
171 | props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; | 172 | props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; |
172 | bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl, | 173 | bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl, |
173 | &atmel_pwm_bl_ops, &props); | 174 | &atmel_pwm_bl_ops, &props); |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 08703299ef61..80d292fb92d8 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -19,6 +19,12 @@ | |||
19 | #include <asm/backlight.h> | 19 | #include <asm/backlight.h> |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | static const char const *backlight_types[] = { | ||
23 | [BACKLIGHT_RAW] = "raw", | ||
24 | [BACKLIGHT_PLATFORM] = "platform", | ||
25 | [BACKLIGHT_FIRMWARE] = "firmware", | ||
26 | }; | ||
27 | |||
22 | #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ | 28 | #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ |
23 | defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) | 29 | defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) |
24 | /* This callback gets called when something important happens inside a | 30 | /* This callback gets called when something important happens inside a |
@@ -169,6 +175,14 @@ static ssize_t backlight_store_brightness(struct device *dev, | |||
169 | return rc; | 175 | return rc; |
170 | } | 176 | } |
171 | 177 | ||
178 | static ssize_t backlight_show_type(struct device *dev, | ||
179 | struct device_attribute *attr, char *buf) | ||
180 | { | ||
181 | struct backlight_device *bd = to_backlight_device(dev); | ||
182 | |||
183 | return sprintf(buf, "%s\n", backlight_types[bd->props.type]); | ||
184 | } | ||
185 | |||
172 | static ssize_t backlight_show_max_brightness(struct device *dev, | 186 | static ssize_t backlight_show_max_brightness(struct device *dev, |
173 | struct device_attribute *attr, char *buf) | 187 | struct device_attribute *attr, char *buf) |
174 | { | 188 | { |
@@ -234,6 +248,7 @@ static struct device_attribute bl_device_attributes[] = { | |||
234 | __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, | 248 | __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, |
235 | NULL), | 249 | NULL), |
236 | __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), | 250 | __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), |
251 | __ATTR(type, 0444, backlight_show_type, NULL), | ||
237 | __ATTR_NULL, | 252 | __ATTR_NULL, |
238 | }; | 253 | }; |
239 | 254 | ||
@@ -292,9 +307,16 @@ struct backlight_device *backlight_device_register(const char *name, | |||
292 | dev_set_drvdata(&new_bd->dev, devdata); | 307 | dev_set_drvdata(&new_bd->dev, devdata); |
293 | 308 | ||
294 | /* Set default properties */ | 309 | /* Set default properties */ |
295 | if (props) | 310 | if (props) { |
296 | memcpy(&new_bd->props, props, | 311 | memcpy(&new_bd->props, props, |
297 | sizeof(struct backlight_properties)); | 312 | sizeof(struct backlight_properties)); |
313 | if (props->type <= 0 || props->type >= BACKLIGHT_TYPE_MAX) { | ||
314 | WARN(1, "%s: invalid backlight type", name); | ||
315 | new_bd->props.type = BACKLIGHT_RAW; | ||
316 | } | ||
317 | } else { | ||
318 | new_bd->props.type = BACKLIGHT_RAW; | ||
319 | } | ||
298 | 320 | ||
299 | rc = device_register(&new_bd->dev); | 321 | rc = device_register(&new_bd->dev); |
300 | if (rc) { | 322 | if (rc) { |
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 1e71c35083bb..af6098396fe6 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c | |||
@@ -562,6 +562,7 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi) | |||
562 | lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; | 562 | lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; |
563 | 563 | ||
564 | memset(&props, 0, sizeof(struct backlight_properties)); | 564 | memset(&props, 0, sizeof(struct backlight_properties)); |
565 | props.type = BACKLIGHT_RAW; | ||
565 | props.max_brightness = pdata->max_intensity; | 566 | props.max_brightness = pdata->max_intensity; |
566 | lcd->bl_dev = backlight_device_register("corgi_bl", &spi->dev, lcd, | 567 | lcd->bl_dev = backlight_device_register("corgi_bl", &spi->dev, lcd, |
567 | &corgi_bl_ops, &props); | 568 | &corgi_bl_ops, &props); |
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 397d15eb1ea8..6c8c54041fae 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c | |||
@@ -193,6 +193,7 @@ static int cr_backlight_probe(struct platform_device *pdev) | |||
193 | } | 193 | } |
194 | 194 | ||
195 | memset(&props, 0, sizeof(struct backlight_properties)); | 195 | memset(&props, 0, sizeof(struct backlight_properties)); |
196 | props.type = BACKLIGHT_RAW; | ||
196 | bdp = backlight_device_register("cr-backlight", &pdev->dev, NULL, | 197 | bdp = backlight_device_register("cr-backlight", &pdev->dev, NULL, |
197 | &cr_backlight_ops, &props); | 198 | &cr_backlight_ops, &props); |
198 | if (IS_ERR(bdp)) { | 199 | if (IS_ERR(bdp)) { |
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 87659ed79bd7..62043f12a5a4 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c | |||
@@ -136,6 +136,7 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
136 | da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2, | 136 | da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2, |
137 | DA9034_WLED_ISET(pdata->output_current)); | 137 | DA9034_WLED_ISET(pdata->output_current)); |
138 | 138 | ||
139 | props.type = BACKLIGHT_RAW; | ||
139 | props.max_brightness = max_brightness; | 140 | props.max_brightness = max_brightness; |
140 | bl = backlight_device_register(pdev->name, data->da903x_dev, data, | 141 | bl = backlight_device_register(pdev->name, data->da903x_dev, data, |
141 | &da903x_backlight_ops, &props); | 142 | &da903x_backlight_ops, &props); |
diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index b0cc49184803..9f1e389d51d2 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c | |||
@@ -87,6 +87,7 @@ static int __init ep93xxbl_probe(struct platform_device *dev) | |||
87 | ep93xxbl->mmio = EP93XX_RASTER_BRIGHTNESS; | 87 | ep93xxbl->mmio = EP93XX_RASTER_BRIGHTNESS; |
88 | 88 | ||
89 | memset(&props, 0, sizeof(struct backlight_properties)); | 89 | memset(&props, 0, sizeof(struct backlight_properties)); |
90 | props.type = BACKLIGHT_RAW; | ||
90 | props.max_brightness = EP93XX_MAX_BRIGHT; | 91 | props.max_brightness = EP93XX_MAX_BRIGHT; |
91 | bl = backlight_device_register(dev->name, &dev->dev, ep93xxbl, | 92 | bl = backlight_device_register(dev->name, &dev->dev, ep93xxbl, |
92 | &ep93xxbl_ops, &props); | 93 | &ep93xxbl_ops, &props); |
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c index 312ca619735d..8c6befd65a33 100644 --- a/drivers/video/backlight/generic_bl.c +++ b/drivers/video/backlight/generic_bl.c | |||
@@ -91,6 +91,7 @@ static int genericbl_probe(struct platform_device *pdev) | |||
91 | name = machinfo->name; | 91 | name = machinfo->name; |
92 | 92 | ||
93 | memset(&props, 0, sizeof(struct backlight_properties)); | 93 | memset(&props, 0, sizeof(struct backlight_properties)); |
94 | props.type = BACKLIGHT_RAW; | ||
94 | props.max_brightness = machinfo->max_intensity; | 95 | props.max_brightness = machinfo->max_intensity; |
95 | bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops, | 96 | bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops, |
96 | &props); | 97 | &props); |
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index 267d23f8d645..38aa00272141 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c | |||
@@ -109,6 +109,7 @@ static int __devinit hp680bl_probe(struct platform_device *pdev) | |||
109 | struct backlight_device *bd; | 109 | struct backlight_device *bd; |
110 | 110 | ||
111 | memset(&props, 0, sizeof(struct backlight_properties)); | 111 | memset(&props, 0, sizeof(struct backlight_properties)); |
112 | props.type = BACKLIGHT_RAW; | ||
112 | props.max_brightness = HP680_MAX_INTENSITY; | 113 | props.max_brightness = HP680_MAX_INTENSITY; |
113 | bd = backlight_device_register("hp680-bl", &pdev->dev, NULL, | 114 | bd = backlight_device_register("hp680-bl", &pdev->dev, NULL, |
114 | &hp680bl_ops, &props); | 115 | &hp680bl_ops, &props); |
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index 2f177b3a4885..40e4fa8fcf92 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c | |||
@@ -106,6 +106,7 @@ static int jornada_bl_probe(struct platform_device *pdev) | |||
106 | struct backlight_device *bd; | 106 | struct backlight_device *bd; |
107 | 107 | ||
108 | memset(&props, 0, sizeof(struct backlight_properties)); | 108 | memset(&props, 0, sizeof(struct backlight_properties)); |
109 | props.type = BACKLIGHT_RAW; | ||
109 | props.max_brightness = BL_MAX_BRIGHT; | 110 | props.max_brightness = BL_MAX_BRIGHT; |
110 | bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL, | 111 | bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL, |
111 | &jornada_bl_ops, &props); | 112 | &jornada_bl_ops, &props); |
diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index f439a8632287..72dd5556a35b 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c | |||
@@ -149,6 +149,7 @@ static int kb3886bl_probe(struct platform_device *pdev) | |||
149 | machinfo->limit_mask = -1; | 149 | machinfo->limit_mask = -1; |
150 | 150 | ||
151 | memset(&props, 0, sizeof(struct backlight_properties)); | 151 | memset(&props, 0, sizeof(struct backlight_properties)); |
152 | props.type = BACKLIGHT_RAW; | ||
152 | props.max_brightness = machinfo->max_intensity; | 153 | props.max_brightness = machinfo->max_intensity; |
153 | kb3886_backlight_device = backlight_device_register("kb3886-bl", | 154 | kb3886_backlight_device = backlight_device_register("kb3886-bl", |
154 | &pdev->dev, NULL, | 155 | &pdev->dev, NULL, |
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index d2f59015d517..bbca3127071e 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -184,6 +184,7 @@ static int locomolcd_probe(struct locomo_dev *ldev) | |||
184 | local_irq_restore(flags); | 184 | local_irq_restore(flags); |
185 | 185 | ||
186 | memset(&props, 0, sizeof(struct backlight_properties)); | 186 | memset(&props, 0, sizeof(struct backlight_properties)); |
187 | props.type = BACKLIGHT_RAW; | ||
187 | props.max_brightness = 4; | 188 | props.max_brightness = 4; |
188 | locomolcd_bl_device = backlight_device_register("locomo-bl", | 189 | locomolcd_bl_device = backlight_device_register("locomo-bl", |
189 | &ldev->dev, NULL, | 190 | &ldev->dev, NULL, |
diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 209acc105cbc..07e8e273ced0 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c | |||
@@ -136,6 +136,7 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) | |||
136 | data->current_brightness = 0; | 136 | data->current_brightness = 0; |
137 | 137 | ||
138 | memset(&props, 0, sizeof(struct backlight_properties)); | 138 | memset(&props, 0, sizeof(struct backlight_properties)); |
139 | props.type = BACKLIGHT_RAW; | ||
139 | props.max_brightness = MAX_BRIGHTNESS; | 140 | props.max_brightness = MAX_BRIGHTNESS; |
140 | bl = backlight_device_register(name, &pdev->dev, data, | 141 | bl = backlight_device_register(name, &pdev->dev, data, |
141 | &max8925_backlight_ops, &props); | 142 | &max8925_backlight_ops, &props); |
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c index 1485f7345f49..74c33944aa86 100644 --- a/drivers/video/backlight/mbp_nvidia_bl.c +++ b/drivers/video/backlight/mbp_nvidia_bl.c | |||
@@ -367,6 +367,7 @@ static int __init mbp_init(void) | |||
367 | return -ENXIO; | 367 | return -ENXIO; |
368 | 368 | ||
369 | memset(&props, 0, sizeof(struct backlight_properties)); | 369 | memset(&props, 0, sizeof(struct backlight_properties)); |
370 | props.type = BACKLIGHT_PLATFORM; | ||
370 | props.max_brightness = 15; | 371 | props.max_brightness = 15; |
371 | mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, | 372 | mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, |
372 | NULL, | 373 | NULL, |
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index d3bc56296c8d..08d26a72394c 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c | |||
@@ -146,6 +146,7 @@ static int omapbl_probe(struct platform_device *pdev) | |||
146 | return -ENOMEM; | 146 | return -ENOMEM; |
147 | 147 | ||
148 | memset(&props, 0, sizeof(struct backlight_properties)); | 148 | memset(&props, 0, sizeof(struct backlight_properties)); |
149 | props.type = BACKLIGHT_RAW; | ||
149 | props.max_brightness = OMAPBL_MAX_INTENSITY; | 150 | props.max_brightness = OMAPBL_MAX_INTENSITY; |
150 | dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops, | 151 | dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops, |
151 | &props); | 152 | &props); |
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c index 3c424f7efdcc..ef5628d60563 100644 --- a/drivers/video/backlight/pcf50633-backlight.c +++ b/drivers/video/backlight/pcf50633-backlight.c | |||
@@ -112,6 +112,7 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev) | |||
112 | if (!pcf_bl) | 112 | if (!pcf_bl) |
113 | return -ENOMEM; | 113 | return -ENOMEM; |
114 | 114 | ||
115 | bl_props.type = BACKLIGHT_RAW; | ||
115 | bl_props.max_brightness = 0x3f; | 116 | bl_props.max_brightness = 0x3f; |
116 | bl_props.power = FB_BLANK_UNBLANK; | 117 | bl_props.power = FB_BLANK_UNBLANK; |
117 | 118 | ||
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c index 809278c90738..6af183d6465e 100644 --- a/drivers/video/backlight/progear_bl.c +++ b/drivers/video/backlight/progear_bl.c | |||
@@ -84,6 +84,7 @@ static int progearbl_probe(struct platform_device *pdev) | |||
84 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); | 84 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); |
85 | 85 | ||
86 | memset(&props, 0, sizeof(struct backlight_properties)); | 86 | memset(&props, 0, sizeof(struct backlight_properties)); |
87 | props.type = BACKLIGHT_RAW; | ||
87 | props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | 88 | props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; |
88 | progear_backlight_device = backlight_device_register("progear-bl", | 89 | progear_backlight_device = backlight_device_register("progear-bl", |
89 | &pdev->dev, NULL, | 90 | &pdev->dev, NULL, |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 21866ec69656..2c2a2c703c14 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -108,6 +108,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
108 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); | 108 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); |
109 | 109 | ||
110 | memset(&props, 0, sizeof(struct backlight_properties)); | 110 | memset(&props, 0, sizeof(struct backlight_properties)); |
111 | props.type = BACKLIGHT_RAW; | ||
111 | props.max_brightness = data->max_brightness; | 112 | props.max_brightness = data->max_brightness; |
112 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb, | 113 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb, |
113 | &pwm_backlight_ops, &props); | 114 | &pwm_backlight_ops, &props); |
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c index 5927db0da999..322040f686c2 100644 --- a/drivers/video/backlight/s6e63m0.c +++ b/drivers/video/backlight/s6e63m0.c | |||
@@ -778,6 +778,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi) | |||
778 | 778 | ||
779 | bd->props.max_brightness = MAX_BRIGHTNESS; | 779 | bd->props.max_brightness = MAX_BRIGHTNESS; |
780 | bd->props.brightness = MAX_BRIGHTNESS; | 780 | bd->props.brightness = MAX_BRIGHTNESS; |
781 | bd->props.type = BACKLIGHT_RAW; | ||
781 | lcd->bd = bd; | 782 | lcd->bd = bd; |
782 | 783 | ||
783 | /* | 784 | /* |
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index 2a04b382ec48..425a7365470b 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c | |||
@@ -102,6 +102,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, | |||
102 | data->i2c = client; | 102 | data->i2c = client; |
103 | 103 | ||
104 | memset(&props, 0, sizeof(struct backlight_properties)); | 104 | memset(&props, 0, sizeof(struct backlight_properties)); |
105 | props.type = BACKLIGHT_RAW; | ||
105 | props.max_brightness = 512 - 1; | 106 | props.max_brightness = 512 - 1; |
106 | data->bl = backlight_device_register("tosa-bl", &client->dev, data, | 107 | data->bl = backlight_device_register("tosa-bl", &client->dev, data, |
107 | &bl_ops, &props); | 108 | &bl_ops, &props); |
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index 08fd87f3aecc..d4c6eb248ff9 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c | |||
@@ -193,6 +193,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
193 | data->current_brightness = 0; | 193 | data->current_brightness = 0; |
194 | data->isink_reg = isink_reg; | 194 | data->isink_reg = isink_reg; |
195 | 195 | ||
196 | props.type = BACKLIGHT_RAW; | ||
196 | props.max_brightness = max_isel; | 197 | props.max_brightness = max_isel; |
197 | bl = backlight_device_register("wm831x", &pdev->dev, data, | 198 | bl = backlight_device_register("wm831x", &pdev->dev, data, |
198 | &wm831x_backlight_ops, &props); | 199 | &wm831x_backlight_ops, &props); |
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index e7d0f525041e..2464b910b590 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -649,6 +649,7 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) | |||
649 | } | 649 | } |
650 | #ifndef NO_BL_SUPPORT | 650 | #ifndef NO_BL_SUPPORT |
651 | memset(&props, 0, sizeof(struct backlight_properties)); | 651 | memset(&props, 0, sizeof(struct backlight_properties)); |
652 | props.type = BACKLIGHT_RAW; | ||
652 | props.max_brightness = 255; | 653 | props.max_brightness = 255; |
653 | bl_dev = backlight_device_register("bf54x-bl", NULL, NULL, | 654 | bl_dev = backlight_device_register("bf54x-bl", NULL, NULL, |
654 | &bfin_lq043fb_bl_ops, &props); | 655 | &bfin_lq043fb_bl_ops, &props); |
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index 3cf77676947c..d8de29f0dd8d 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c | |||
@@ -545,6 +545,7 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) | |||
545 | } | 545 | } |
546 | #ifndef NO_BL_SUPPORT | 546 | #ifndef NO_BL_SUPPORT |
547 | memset(&props, 0, sizeof(struct backlight_properties)); | 547 | memset(&props, 0, sizeof(struct backlight_properties)); |
548 | props.type = BACKLIGHT_RAW; | ||
548 | props.max_brightness = 255; | 549 | props.max_brightness = 255; |
549 | bl_dev = backlight_device_register("bf52x-bl", NULL, NULL, | 550 | bl_dev = backlight_device_register("bf52x-bl", NULL, NULL, |
550 | &bfin_lq043fb_bl_ops, &props); | 551 | &bfin_lq043fb_bl_ops, &props); |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 69bd4a581d4a..ef72cb483834 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -499,6 +499,7 @@ static void imxfb_init_backlight(struct imxfb_info *fbi) | |||
499 | 499 | ||
500 | memset(&props, 0, sizeof(struct backlight_properties)); | 500 | memset(&props, 0, sizeof(struct backlight_properties)); |
501 | props.max_brightness = 0xff; | 501 | props.max_brightness = 0xff; |
502 | props.type = BACKLIGHT_RAW; | ||
502 | writel(fbi->pwmr, fbi->regs + LCDC_PWMR); | 503 | writel(fbi->pwmr, fbi->regs + LCDC_PWMR); |
503 | 504 | ||
504 | bl = backlight_device_register("imxfb-bl", &fbi->pdev->dev, fbi, | 505 | bl = backlight_device_register("imxfb-bl", &fbi->pdev->dev, fbi, |
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c index 6aac6d1b937b..8471008aa6ff 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/nvidia/nv_backlight.c | |||
@@ -111,6 +111,7 @@ void nvidia_bl_init(struct nvidia_par *par) | |||
111 | snprintf(name, sizeof(name), "nvidiabl%d", info->node); | 111 | snprintf(name, sizeof(name), "nvidiabl%d", info->node); |
112 | 112 | ||
113 | memset(&props, 0, sizeof(struct backlight_properties)); | 113 | memset(&props, 0, sizeof(struct backlight_properties)); |
114 | props.type = BACKLIGHT_RAW; | ||
114 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 115 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
115 | bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops, | 116 | bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops, |
116 | &props); | 117 | &props); |
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c index e77310653207..7e04c921aa2a 100644 --- a/drivers/video/omap2/displays/panel-acx565akm.c +++ b/drivers/video/omap2/displays/panel-acx565akm.c | |||
@@ -534,6 +534,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev) | |||
534 | 534 | ||
535 | props.fb_blank = FB_BLANK_UNBLANK; | 535 | props.fb_blank = FB_BLANK_UNBLANK; |
536 | props.power = FB_BLANK_UNBLANK; | 536 | props.power = FB_BLANK_UNBLANK; |
537 | props.type = BACKLIGHT_RAW; | ||
537 | 538 | ||
538 | bldev = backlight_device_register("acx565akm", &md->spi->dev, | 539 | bldev = backlight_device_register("acx565akm", &md->spi->dev, |
539 | md, &acx565akm_bl_ops, &props); | 540 | md, &acx565akm_bl_ops, &props); |
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c index 9a138f650e05..d2b35d2df2a6 100644 --- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | |||
@@ -99,6 +99,7 @@ static int sharp_ls_panel_probe(struct omap_dss_device *dssdev) | |||
99 | 99 | ||
100 | memset(&props, 0, sizeof(struct backlight_properties)); | 100 | memset(&props, 0, sizeof(struct backlight_properties)); |
101 | props.max_brightness = dssdev->max_backlight_level; | 101 | props.max_brightness = dssdev->max_backlight_level; |
102 | props.type = BACKLIGHT_RAW; | ||
102 | 103 | ||
103 | bl = backlight_device_register("sharp-ls", &dssdev->dev, dssdev, | 104 | bl = backlight_device_register("sharp-ls", &dssdev->dev, dssdev, |
104 | &sharp_ls_bl_ops, &props); | 105 | &sharp_ls_bl_ops, &props); |
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 61026f96ad20..c74e8b778ba1 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -729,6 +729,8 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
729 | props.max_brightness = 255; | 729 | props.max_brightness = 255; |
730 | else | 730 | else |
731 | props.max_brightness = 127; | 731 | props.max_brightness = 127; |
732 | |||
733 | props.type = BACKLIGHT_RAW; | ||
732 | bldev = backlight_device_register("taal", &dssdev->dev, dssdev, | 734 | bldev = backlight_device_register("taal", &dssdev->dev, dssdev, |
733 | &taal_bl_ops, &props); | 735 | &taal_bl_ops, &props); |
734 | if (IS_ERR(bldev)) { | 736 | if (IS_ERR(bldev)) { |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index da388186d617..d8ab7be4fd6b 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -355,6 +355,7 @@ static void riva_bl_init(struct riva_par *par) | |||
355 | snprintf(name, sizeof(name), "rivabl%d", info->node); | 355 | snprintf(name, sizeof(name), "rivabl%d", info->node); |
356 | 356 | ||
357 | memset(&props, 0, sizeof(struct backlight_properties)); | 357 | memset(&props, 0, sizeof(struct backlight_properties)); |
358 | props.type = BACKLIGHT_RAW; | ||
358 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 359 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
359 | bd = backlight_device_register(name, info->dev, par, &riva_bl_ops, | 360 | bd = backlight_device_register(name, info->dev, par, &riva_bl_ops, |
360 | &props); | 361 | &props); |
diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 4a3d52e545e1..5ffc6dda4675 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h | |||
@@ -32,6 +32,13 @@ enum backlight_update_reason { | |||
32 | BACKLIGHT_UPDATE_SYSFS, | 32 | BACKLIGHT_UPDATE_SYSFS, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | enum backlight_type { | ||
36 | BACKLIGHT_RAW = 1, | ||
37 | BACKLIGHT_PLATFORM, | ||
38 | BACKLIGHT_FIRMWARE, | ||
39 | BACKLIGHT_TYPE_MAX, | ||
40 | }; | ||
41 | |||
35 | struct backlight_device; | 42 | struct backlight_device; |
36 | struct fb_info; | 43 | struct fb_info; |
37 | 44 | ||
@@ -62,6 +69,8 @@ struct backlight_properties { | |||
62 | /* FB Blanking active? (values as for power) */ | 69 | /* FB Blanking active? (values as for power) */ |
63 | /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ | 70 | /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ |
64 | int fb_blank; | 71 | int fb_blank; |
72 | /* Backlight type */ | ||
73 | enum backlight_type type; | ||
65 | /* Flags used to signal drivers of state changes */ | 74 | /* Flags used to signal drivers of state changes */ |
66 | /* Upper 4 bits are reserved for driver internal use */ | 75 | /* Upper 4 bits are reserved for driver internal use */ |
67 | unsigned int state; | 76 | unsigned int state; |