Commit bb7ca747f8d6243b3943c5b133048652020f4a50

Authored by Matthew Garrett
Committed by Linus Torvalds
1 parent ccd7510fd8

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>

Showing 59 changed files with 111 additions and 2 deletions Side-by-side Diff

Documentation/ABI/stable/sysfs-class-backlight
... ... @@ -34,4 +34,24 @@
34 34 Description:
35 35 Maximum brightness for <backlight>.
36 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.
drivers/acpi/video.c
... ... @@ -795,6 +795,7 @@
795 795 count++;
796 796  
797 797 memset(&props, 0, sizeof(struct backlight_properties));
  798 + props.type = BACKLIGHT_FIRMWARE;
798 799 props.max_brightness = device->brightness->count - 3;
799 800 device->backlight = backlight_device_register(name, NULL, device,
800 801 &acpi_backlight_ops,
drivers/gpu/drm/nouveau/nouveau_backlight.c
... ... @@ -98,6 +98,7 @@
98 98 return 0;
99 99  
100 100 memset(&props, 0, sizeof(struct backlight_properties));
  101 + props.type = BACKLIGHT_RAW;
101 102 props.max_brightness = 31;
102 103 bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
103 104 &nv40_bl_ops, &props);
... ... @@ -121,6 +122,7 @@
121 122 return 0;
122 123  
123 124 memset(&props, 0, sizeof(struct backlight_properties));
  125 + props.type = BACKLIGHT_RAW;
124 126 props.max_brightness = 1025;
125 127 bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
126 128 &nv50_bl_ops, &props);
drivers/hid/hid-picolcd.c
... ... @@ -944,6 +944,7 @@
944 944 }
945 945  
946 946 memset(&props, 0, sizeof(props));
  947 + props.type = BACKLIGHT_RAW;
947 948 props.max_brightness = 0xff;
948 949 bdev = backlight_device_register(dev_name(dev), dev, data,
949 950 &picolcd_blops, &props);
drivers/macintosh/via-pmu-backlight.c
... ... @@ -163,6 +163,7 @@
163 163 snprintf(name, sizeof(name), "pmubl");
164 164  
165 165 memset(&props, 0, sizeof(struct backlight_properties));
  166 + props.type = BACKLIGHT_PLATFORM;
166 167 props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
167 168 bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data,
168 169 &props);
drivers/platform/x86/acer-wmi.c
... ... @@ -1031,6 +1031,7 @@
1031 1031 struct backlight_device *bd;
1032 1032  
1033 1033 memset(&props, 0, sizeof(struct backlight_properties));
  1034 + props.type = BACKLIGHT_PLATFORM;
1034 1035 props.max_brightness = max_brightness;
1035 1036 bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops,
1036 1037 &props);
drivers/platform/x86/asus-laptop.c
... ... @@ -667,6 +667,7 @@
667 667  
668 668 memset(&props, 0, sizeof(struct backlight_properties));
669 669 props.max_brightness = 15;
  670 + props.type = BACKLIGHT_PLATFORM;
670 671  
671 672 bd = backlight_device_register(ASUS_LAPTOP_FILE,
672 673 &asus->platform_device->dev, asus,
drivers/platform/x86/asus_acpi.c
... ... @@ -1507,6 +1507,7 @@
1507 1507 }
1508 1508  
1509 1509 memset(&props, 0, sizeof(struct backlight_properties));
  1510 + props.type = BACKLIGHT_PLATFORM;
1510 1511 props.max_brightness = 15;
1511 1512 asus_backlight_device = backlight_device_register("asus", NULL, NULL,
1512 1513 &asus_backlight_data,
drivers/platform/x86/classmate-laptop.c
... ... @@ -564,6 +564,7 @@
564 564 return -ENOMEM;
565 565  
566 566 memset(&props, 0, sizeof(struct backlight_properties));
  567 + props.type = BACKLIGHT_PLATFORM;
567 568 props.max_brightness = 7;
568 569 ipml->bd = backlight_device_register("cmpc_bl", &acpi->dev,
569 570 acpi->handle, &cmpc_bl_ops,
drivers/platform/x86/compal-laptop.c
... ... @@ -970,6 +970,7 @@
970 970 if (!acpi_video_backlight_support()) {
971 971 struct backlight_properties props;
972 972 memset(&props, 0, sizeof(struct backlight_properties));
  973 + props.type = BACKLIGHT_PLATFORM;
973 974 props.max_brightness = BACKLIGHT_LEVEL_MAX;
974 975 compalbl_device = backlight_device_register(DRIVER_NAME,
975 976 NULL, NULL,
drivers/platform/x86/dell-laptop.c
... ... @@ -671,6 +671,7 @@
671 671 if (max_intensity) {
672 672 struct backlight_properties props;
673 673 memset(&props, 0, sizeof(struct backlight_properties));
  674 + props.type = BACKLIGHT_PLATFORM;
674 675 props.max_brightness = max_intensity;
675 676 dell_backlight_device = backlight_device_register("dell_backlight",
676 677 &platform_device->dev,
drivers/platform/x86/eeepc-laptop.c
... ... @@ -1147,6 +1147,7 @@
1147 1147 struct backlight_device *bd;
1148 1148  
1149 1149 memset(&props, 0, sizeof(struct backlight_properties));
  1150 + props.type = BACKLIGHT_PLATFORM;
1150 1151 props.max_brightness = 15;
1151 1152 bd = backlight_device_register(EEEPC_LAPTOP_FILE,
1152 1153 &eeepc->platform_device->dev, eeepc,
drivers/platform/x86/fujitsu-laptop.c
... ... @@ -1128,6 +1128,7 @@
1128 1128  
1129 1129 memset(&props, 0, sizeof(struct backlight_properties));
1130 1130 max_brightness = fujitsu->max_brightness;
  1131 + props.type = BACKLIGHT_PLATFORM;
1131 1132 props.max_brightness = max_brightness - 1;
1132 1133 fujitsu->bl_device = backlight_device_register("fujitsu-laptop",
1133 1134 NULL, NULL,
drivers/platform/x86/msi-laptop.c
... ... @@ -804,6 +804,7 @@
804 804 } else {
805 805 struct backlight_properties props;
806 806 memset(&props, 0, sizeof(struct backlight_properties));
  807 + props.type = BACKLIGHT_PLATFORM;
807 808 props.max_brightness = MSI_LCD_LEVEL_MAX - 1;
808 809 msibl_device = backlight_device_register("msi-laptop-bl", NULL,
809 810 NULL, &msibl_ops,
drivers/platform/x86/msi-wmi.c
... ... @@ -254,6 +254,7 @@
254 254 if (!acpi_video_backlight_support()) {
255 255 struct backlight_properties props;
256 256 memset(&props, 0, sizeof(struct backlight_properties));
  257 + props.type = BACKLIGHT_PLATFORM;
257 258 props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
258 259 backlight = backlight_device_register(DRV_NAME, NULL, NULL,
259 260 &msi_backlight_ops,
drivers/platform/x86/panasonic-laptop.c
... ... @@ -602,6 +602,7 @@
602 602 }
603 603 /* initialize backlight */
604 604 memset(&props, 0, sizeof(struct backlight_properties));
  605 + props.type = BACKLIGHT_PLATFORM;
605 606 props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
606 607 pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
607 608 &pcc_backlight_ops, &props);
drivers/platform/x86/sony-laptop.c
... ... @@ -1305,8 +1305,9 @@
1305 1305 "controlled by ACPI video driver\n");
1306 1306 } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT",
1307 1307 &handle))) {
1308   - struct backlight_properties props;
  1308 + struct backlight_properties props;
1309 1309 memset(&props, 0, sizeof(struct backlight_properties));
  1310 + props.type = BACKLIGHT_PLATFORM;
1310 1311 props.max_brightness = SONY_MAX_BRIGHTNESS - 1;
1311 1312 sony_backlight_device = backlight_device_register("sony", NULL,
1312 1313 NULL,
drivers/platform/x86/thinkpad_acpi.c
... ... @@ -6307,6 +6307,7 @@
6307 6307 return 1;
6308 6308  
6309 6309 memset(&props, 0, sizeof(struct backlight_properties));
  6310 + props.type = BACKLIGHT_PLATFORM;
6310 6311 props.max_brightness = bright_maxlvl;
6311 6312 props.brightness = b & TP_EC_BACKLIGHT_LVLMSK;
6312 6313 ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME,
drivers/platform/x86/toshiba_acpi.c
... ... @@ -1018,6 +1018,7 @@
1018 1018 create_toshiba_proc_entries();
1019 1019 }
1020 1020  
  1021 + props.type = BACKLIGHT_PLATFORM;
1021 1022 props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
1022 1023 toshiba_backlight_device = backlight_device_register("toshiba",
1023 1024 &toshiba_acpi.p_dev->dev,
drivers/staging/olpc_dcon/olpc_dcon.c
... ... @@ -574,6 +574,7 @@
574 574  
575 575 static struct backlight_properties dcon_bl_props = {
576 576 .max_brightness = 15,
  577 + .type = BACKLIGHT_RAW,
577 578 .power = FB_BLANK_UNBLANK,
578 579 };
579 580  
drivers/staging/samsung-laptop/samsung-laptop.c
... ... @@ -781,6 +781,7 @@
781 781  
782 782 /* create a backlight device to talk to this one */
783 783 memset(&props, 0, sizeof(struct backlight_properties));
  784 + props.type = BACKLIGHT_PLATFORM;
784 785 props.max_brightness = sabi_config->max_brightness;
785 786 backlight_device = backlight_device_register("samsung", &sdev->dev,
786 787 NULL, &backlight_ops,
drivers/usb/misc/appledisplay.c
... ... @@ -282,6 +282,7 @@
282 282 snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
283 283 atomic_inc_return(&count_displays) - 1);
284 284 memset(&props, 0, sizeof(struct backlight_properties));
  285 + props.type = BACKLIGHT_RAW;
285 286 props.max_brightness = 0xff;
286 287 pdata->bd = backlight_device_register(bl_name, NULL, pdata,
287 288 &appledisplay_bl_data, &props);
drivers/video/atmel_lcdfb.c
... ... @@ -127,6 +127,7 @@
127 127 return;
128 128  
129 129 memset(&props, 0, sizeof(struct backlight_properties));
  130 + props.type = BACKLIGHT_RAW;
130 131 props.max_brightness = 0xff;
131 132 bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
132 133 &atmel_lcdc_bl_ops, &props);
drivers/video/aty/aty128fb.c
... ... @@ -1818,6 +1818,7 @@
1818 1818 snprintf(name, sizeof(name), "aty128bl%d", info->node);
1819 1819  
1820 1820 memset(&props, 0, sizeof(struct backlight_properties));
  1821 + props.type = BACKLIGHT_RAW;
1821 1822 props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
1822 1823 bd = backlight_device_register(name, info->dev, par, &aty128_bl_data,
1823 1824 &props);
drivers/video/aty/atyfb_base.c
... ... @@ -2241,6 +2241,7 @@
2241 2241 snprintf(name, sizeof(name), "atybl%d", info->node);
2242 2242  
2243 2243 memset(&props, 0, sizeof(struct backlight_properties));
  2244 + props.type = BACKLIGHT_RAW;
2244 2245 props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
2245 2246 bd = backlight_device_register(name, info->dev, par, &aty_bl_data,
2246 2247 &props);
drivers/video/aty/radeon_backlight.c
... ... @@ -158,6 +158,7 @@
158 158 snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node);
159 159  
160 160 memset(&props, 0, sizeof(struct backlight_properties));
  161 + props.type = BACKLIGHT_RAW;
161 162 props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
162 163 bd = backlight_device_register(name, rinfo->info->dev, pdata,
163 164 &radeon_bl_data, &props);
drivers/video/backlight/88pm860x_bl.c
... ... @@ -227,6 +227,7 @@
227 227 }
228 228  
229 229 memset(&props, 0, sizeof(struct backlight_properties));
  230 + props.type = BACKLIGHT_RAW;
230 231 props.max_brightness = MAX_BRIGHTNESS;
231 232 bl = backlight_device_register(name, &pdev->dev, data,
232 233 &pm860x_backlight_ops, &props);
drivers/video/backlight/adp5520_bl.c
... ... @@ -303,6 +303,7 @@
303 303 mutex_init(&data->lock);
304 304  
305 305 memset(&props, 0, sizeof(struct backlight_properties));
  306 + props.type = BACKLIGHT_RAW;
306 307 props.max_brightness = ADP5020_MAX_BRIGHTNESS;
307 308 bl = backlight_device_register(pdev->name, data->master, data,
308 309 &adp5520_bl_ops, &props);
drivers/video/backlight/adp8860_bl.c
... ... @@ -709,6 +709,7 @@
709 709 i2c_set_clientdata(client, data);
710 710  
711 711 memset(&props, 0, sizeof(props));
  712 + props.type = BACKLIGHT_RAW;
712 713 props.max_brightness = ADP8860_MAX_BRIGHTNESS;
713 714  
714 715 mutex_init(&data->lock);
drivers/video/backlight/adx_bl.c
... ... @@ -104,6 +104,7 @@
104 104 }
105 105  
106 106 memset(&props, 0, sizeof(struct backlight_properties));
  107 + props.type = BACKLIGHT_RAW;
107 108 props.max_brightness = 0xff;
108 109 bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev,
109 110 bl, &adx_backlight_ops, &props);
drivers/video/backlight/atmel-pwm-bl.c
... ... @@ -168,6 +168,7 @@
168 168 }
169 169  
170 170 memset(&props, 0, sizeof(struct backlight_properties));
  171 + props.type = BACKLIGHT_RAW;
171 172 props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min;
172 173 bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl,
173 174 &atmel_pwm_bl_ops, &props);
drivers/video/backlight/backlight.c
... ... @@ -19,6 +19,12 @@
19 19 #include <asm/backlight.h>
20 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 28 #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \
23 29 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
24 30 /* This callback gets called when something important happens inside a
... ... @@ -169,6 +175,14 @@
169 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 186 static ssize_t backlight_show_max_brightness(struct device *dev,
173 187 struct device_attribute *attr, char *buf)
174 188 {
... ... @@ -234,6 +248,7 @@
234 248 __ATTR(actual_brightness, 0444, backlight_show_actual_brightness,
235 249 NULL),
236 250 __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL),
  251 + __ATTR(type, 0444, backlight_show_type, NULL),
237 252 __ATTR_NULL,
238 253 };
239 254  
240 255  
... ... @@ -292,9 +307,16 @@
292 307 dev_set_drvdata(&new_bd->dev, devdata);
293 308  
294 309 /* Set default properties */
295   - if (props)
  310 + if (props) {
296 311 memcpy(&new_bd->props, props,
297 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 321 rc = device_register(&new_bd->dev);
300 322 if (rc) {
drivers/video/backlight/corgi_lcd.c
... ... @@ -562,6 +562,7 @@
562 562 lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA;
563 563  
564 564 memset(&props, 0, sizeof(struct backlight_properties));
  565 + props.type = BACKLIGHT_RAW;
565 566 props.max_brightness = pdata->max_intensity;
566 567 lcd->bl_dev = backlight_device_register("corgi_bl", &spi->dev, lcd,
567 568 &corgi_bl_ops, &props);
drivers/video/backlight/cr_bllcd.c
... ... @@ -193,6 +193,7 @@
193 193 }
194 194  
195 195 memset(&props, 0, sizeof(struct backlight_properties));
  196 + props.type = BACKLIGHT_RAW;
196 197 bdp = backlight_device_register("cr-backlight", &pdev->dev, NULL,
197 198 &cr_backlight_ops, &props);
198 199 if (IS_ERR(bdp)) {
drivers/video/backlight/da903x_bl.c
... ... @@ -136,6 +136,7 @@
136 136 da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2,
137 137 DA9034_WLED_ISET(pdata->output_current));
138 138  
  139 + props.type = BACKLIGHT_RAW;
139 140 props.max_brightness = max_brightness;
140 141 bl = backlight_device_register(pdev->name, data->da903x_dev, data,
141 142 &da903x_backlight_ops, &props);
drivers/video/backlight/ep93xx_bl.c
... ... @@ -87,6 +87,7 @@
87 87 ep93xxbl->mmio = EP93XX_RASTER_BRIGHTNESS;
88 88  
89 89 memset(&props, 0, sizeof(struct backlight_properties));
  90 + props.type = BACKLIGHT_RAW;
90 91 props.max_brightness = EP93XX_MAX_BRIGHT;
91 92 bl = backlight_device_register(dev->name, &dev->dev, ep93xxbl,
92 93 &ep93xxbl_ops, &props);
drivers/video/backlight/generic_bl.c
... ... @@ -91,6 +91,7 @@
91 91 name = machinfo->name;
92 92  
93 93 memset(&props, 0, sizeof(struct backlight_properties));
  94 + props.type = BACKLIGHT_RAW;
94 95 props.max_brightness = machinfo->max_intensity;
95 96 bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops,
96 97 &props);
drivers/video/backlight/hp680_bl.c
... ... @@ -109,6 +109,7 @@
109 109 struct backlight_device *bd;
110 110  
111 111 memset(&props, 0, sizeof(struct backlight_properties));
  112 + props.type = BACKLIGHT_RAW;
112 113 props.max_brightness = HP680_MAX_INTENSITY;
113 114 bd = backlight_device_register("hp680-bl", &pdev->dev, NULL,
114 115 &hp680bl_ops, &props);
drivers/video/backlight/jornada720_bl.c
... ... @@ -106,6 +106,7 @@
106 106 struct backlight_device *bd;
107 107  
108 108 memset(&props, 0, sizeof(struct backlight_properties));
  109 + props.type = BACKLIGHT_RAW;
109 110 props.max_brightness = BL_MAX_BRIGHT;
110 111 bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL,
111 112 &jornada_bl_ops, &props);
drivers/video/backlight/kb3886_bl.c
... ... @@ -149,6 +149,7 @@
149 149 machinfo->limit_mask = -1;
150 150  
151 151 memset(&props, 0, sizeof(struct backlight_properties));
  152 + props.type = BACKLIGHT_RAW;
152 153 props.max_brightness = machinfo->max_intensity;
153 154 kb3886_backlight_device = backlight_device_register("kb3886-bl",
154 155 &pdev->dev, NULL,
drivers/video/backlight/locomolcd.c
... ... @@ -184,6 +184,7 @@
184 184 local_irq_restore(flags);
185 185  
186 186 memset(&props, 0, sizeof(struct backlight_properties));
  187 + props.type = BACKLIGHT_RAW;
187 188 props.max_brightness = 4;
188 189 locomolcd_bl_device = backlight_device_register("locomo-bl",
189 190 &ldev->dev, NULL,
drivers/video/backlight/max8925_bl.c
... ... @@ -136,6 +136,7 @@
136 136 data->current_brightness = 0;
137 137  
138 138 memset(&props, 0, sizeof(struct backlight_properties));
  139 + props.type = BACKLIGHT_RAW;
139 140 props.max_brightness = MAX_BRIGHTNESS;
140 141 bl = backlight_device_register(name, &pdev->dev, data,
141 142 &max8925_backlight_ops, &props);
drivers/video/backlight/mbp_nvidia_bl.c
... ... @@ -367,6 +367,7 @@
367 367 return -ENXIO;
368 368  
369 369 memset(&props, 0, sizeof(struct backlight_properties));
  370 + props.type = BACKLIGHT_PLATFORM;
370 371 props.max_brightness = 15;
371 372 mbp_backlight_device = backlight_device_register("mbp_backlight", NULL,
372 373 NULL,
drivers/video/backlight/omap1_bl.c
... ... @@ -146,6 +146,7 @@
146 146 return -ENOMEM;
147 147  
148 148 memset(&props, 0, sizeof(struct backlight_properties));
  149 + props.type = BACKLIGHT_RAW;
149 150 props.max_brightness = OMAPBL_MAX_INTENSITY;
150 151 dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops,
151 152 &props);
drivers/video/backlight/pcf50633-backlight.c
... ... @@ -112,6 +112,7 @@
112 112 if (!pcf_bl)
113 113 return -ENOMEM;
114 114  
  115 + bl_props.type = BACKLIGHT_RAW;
115 116 bl_props.max_brightness = 0x3f;
116 117 bl_props.power = FB_BLANK_UNBLANK;
117 118  
drivers/video/backlight/progear_bl.c
... ... @@ -84,6 +84,7 @@
84 84 pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
85 85  
86 86 memset(&props, 0, sizeof(struct backlight_properties));
  87 + props.type = BACKLIGHT_RAW;
87 88 props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
88 89 progear_backlight_device = backlight_device_register("progear-bl",
89 90 &pdev->dev, NULL,
drivers/video/backlight/pwm_bl.c
... ... @@ -108,6 +108,7 @@
108 108 dev_dbg(&pdev->dev, "got pwm for backlight\n");
109 109  
110 110 memset(&props, 0, sizeof(struct backlight_properties));
  111 + props.type = BACKLIGHT_RAW;
111 112 props.max_brightness = data->max_brightness;
112 113 bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb,
113 114 &pwm_backlight_ops, &props);
drivers/video/backlight/s6e63m0.c
... ... @@ -778,6 +778,7 @@
778 778  
779 779 bd->props.max_brightness = MAX_BRIGHTNESS;
780 780 bd->props.brightness = MAX_BRIGHTNESS;
  781 + bd->props.type = BACKLIGHT_RAW;
781 782 lcd->bd = bd;
782 783  
783 784 /*
drivers/video/backlight/tosa_bl.c
... ... @@ -102,6 +102,7 @@
102 102 data->i2c = client;
103 103  
104 104 memset(&props, 0, sizeof(struct backlight_properties));
  105 + props.type = BACKLIGHT_RAW;
105 106 props.max_brightness = 512 - 1;
106 107 data->bl = backlight_device_register("tosa-bl", &client->dev, data,
107 108 &bl_ops, &props);
drivers/video/backlight/wm831x_bl.c
... ... @@ -193,6 +193,7 @@
193 193 data->current_brightness = 0;
194 194 data->isink_reg = isink_reg;
195 195  
  196 + props.type = BACKLIGHT_RAW;
196 197 props.max_brightness = max_isel;
197 198 bl = backlight_device_register("wm831x", &pdev->dev, data,
198 199 &wm831x_backlight_ops, &props);
drivers/video/bf54x-lq043fb.c
... ... @@ -649,6 +649,7 @@
649 649 }
650 650 #ifndef NO_BL_SUPPORT
651 651 memset(&props, 0, sizeof(struct backlight_properties));
  652 + props.type = BACKLIGHT_RAW;
652 653 props.max_brightness = 255;
653 654 bl_dev = backlight_device_register("bf54x-bl", NULL, NULL,
654 655 &bfin_lq043fb_bl_ops, &props);
drivers/video/bfin-t350mcqb-fb.c
... ... @@ -545,6 +545,7 @@
545 545 }
546 546 #ifndef NO_BL_SUPPORT
547 547 memset(&props, 0, sizeof(struct backlight_properties));
  548 + props.type = BACKLIGHT_RAW;
548 549 props.max_brightness = 255;
549 550 bl_dev = backlight_device_register("bf52x-bl", NULL, NULL,
550 551 &bfin_lq043fb_bl_ops, &props);
drivers/video/imxfb.c
... ... @@ -499,6 +499,7 @@
499 499  
500 500 memset(&props, 0, sizeof(struct backlight_properties));
501 501 props.max_brightness = 0xff;
  502 + props.type = BACKLIGHT_RAW;
502 503 writel(fbi->pwmr, fbi->regs + LCDC_PWMR);
503 504  
504 505 bl = backlight_device_register("imxfb-bl", &fbi->pdev->dev, fbi,
drivers/video/nvidia/nv_backlight.c
... ... @@ -111,6 +111,7 @@
111 111 snprintf(name, sizeof(name), "nvidiabl%d", info->node);
112 112  
113 113 memset(&props, 0, sizeof(struct backlight_properties));
  114 + props.type = BACKLIGHT_RAW;
114 115 props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
115 116 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops,
116 117 &props);
drivers/video/omap2/displays/panel-acx565akm.c
... ... @@ -534,6 +534,7 @@
534 534  
535 535 props.fb_blank = FB_BLANK_UNBLANK;
536 536 props.power = FB_BLANK_UNBLANK;
  537 + props.type = BACKLIGHT_RAW;
537 538  
538 539 bldev = backlight_device_register("acx565akm", &md->spi->dev,
539 540 md, &acx565akm_bl_ops, &props);
drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
... ... @@ -99,6 +99,7 @@
99 99  
100 100 memset(&props, 0, sizeof(struct backlight_properties));
101 101 props.max_brightness = dssdev->max_backlight_level;
  102 + props.type = BACKLIGHT_RAW;
102 103  
103 104 bl = backlight_device_register("sharp-ls", &dssdev->dev, dssdev,
104 105 &sharp_ls_bl_ops, &props);
drivers/video/omap2/displays/panel-taal.c
... ... @@ -729,6 +729,8 @@
729 729 props.max_brightness = 255;
730 730 else
731 731 props.max_brightness = 127;
  732 +
  733 + props.type = BACKLIGHT_RAW;
732 734 bldev = backlight_device_register("taal", &dssdev->dev, dssdev,
733 735 &taal_bl_ops, &props);
734 736 if (IS_ERR(bldev)) {
drivers/video/riva/fbdev.c
... ... @@ -355,6 +355,7 @@
355 355 snprintf(name, sizeof(name), "rivabl%d", info->node);
356 356  
357 357 memset(&props, 0, sizeof(struct backlight_properties));
  358 + props.type = BACKLIGHT_RAW;
358 359 props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
359 360 bd = backlight_device_register(name, info->dev, par, &riva_bl_ops,
360 361 &props);
include/linux/backlight.h
... ... @@ -32,6 +32,13 @@
32 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 42 struct backlight_device;
36 43 struct fb_info;
37 44  
... ... @@ -62,6 +69,8 @@
62 69 /* FB Blanking active? (values as for power) */
63 70 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
64 71 int fb_blank;
  72 + /* Backlight type */
  73 + enum backlight_type type;
65 74 /* Flags used to signal drivers of state changes */
66 75 /* Upper 4 bits are reserved for driver internal use */
67 76 unsigned int state;