backlight: add backlight type
authorMatthew Garrett <mjg@redhat.com>
Tue, 22 Mar 2011 23:30:21 +0000 (16:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2011 00:43:59 +0000 (17:43 -0700)
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:
Documentation/ABI/stable/sysfs-class-backlight
drivers/acpi/video.c
drivers/gpu/drm/nouveau/nouveau_backlight.c
drivers/hid/hid-picolcd.c
drivers/macintosh/via-pmu-backlight.c
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/asus_acpi.c
drivers/platform/x86/classmate-laptop.c
drivers/platform/x86/compal-laptop.c
drivers/platform/x86/dell-laptop.c
drivers/platform/x86/eeepc-laptop.c
drivers/platform/x86/fujitsu-laptop.c
drivers/platform/x86/msi-laptop.c
drivers/platform/x86/msi-wmi.c
drivers/platform/x86/panasonic-laptop.c
drivers/platform/x86/sony-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/staging/olpc_dcon/olpc_dcon.c
drivers/staging/samsung-laptop/samsung-laptop.c
drivers/usb/misc/appledisplay.c
drivers/video/atmel_lcdfb.c
drivers/video/aty/aty128fb.c
drivers/video/aty/atyfb_base.c
drivers/video/aty/radeon_backlight.c
drivers/video/backlight/88pm860x_bl.c
drivers/video/backlight/adp5520_bl.c
drivers/video/backlight/adp8860_bl.c
drivers/video/backlight/adx_bl.c
drivers/video/backlight/atmel-pwm-bl.c
drivers/video/backlight/backlight.c
drivers/video/backlight/corgi_lcd.c
drivers/video/backlight/cr_bllcd.c
drivers/video/backlight/da903x_bl.c
drivers/video/backlight/ep93xx_bl.c
drivers/video/backlight/generic_bl.c
drivers/video/backlight/hp680_bl.c
drivers/video/backlight/jornada720_bl.c
drivers/video/backlight/kb3886_bl.c
drivers/video/backlight/locomolcd.c
drivers/video/backlight/max8925_bl.c
drivers/video/backlight/mbp_nvidia_bl.c
drivers/video/backlight/omap1_bl.c
drivers/video/backlight/pcf50633-backlight.c
drivers/video/backlight/progear_bl.c
drivers/video/backlight/pwm_bl.c
drivers/video/backlight/s6e63m0.c
drivers/video/backlight/tosa_bl.c
drivers/video/backlight/wm831x_bl.c
drivers/video/bf54x-lq043fb.c
drivers/video/bfin-t350mcqb-fb.c
drivers/video/imxfb.c
drivers/video/nvidia/nv_backlight.c
drivers/video/omap2/displays/panel-acx565akm.c
drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
drivers/video/omap2/displays/panel-taal.c
drivers/video/riva/fbdev.c
include/linux/backlight.h

index 4d637e1c4ff7723fd2e7e247b9cd6b7feb80eec0..70302f370e7ec1c1d46e4d278f41319e1ce536c1 100644 (file)
@@ -34,3 +34,23 @@ Contact:     Richard Purdie <rpurdie@rpsys.net>
 Description:
                Maximum brightness for <backlight>.
 Users:         HAL
+
+What:          /sys/class/backlight/<backlight>/type
+Date:          September 2010
+KernelVersion: 2.6.37
+Contact:       Matthew Garrett <mjg@redhat.com>
+Description:
+               The type of interface controlled by <backlight>.
+               "firmware": The driver uses a standard firmware interface
+               "platform": The driver uses a platform-specific interface
+               "raw": The driver controls hardware registers directly
+
+               In the general case, when multiple backlight
+               interfaces are available for a single device, firmware
+               control should be preferred to platform control should
+               be preferred to raw control. Using a firmware
+               interface reduces the probability of confusion with
+               the hardware and the OS independently updating the
+               backlight state. Platform interfaces are mostly a
+               holdover from pre-standardisation of firmware
+               interfaces.
index 90f8f7676d1faeb346ef02791ab919987e95c08e..a9eec8c95a1f6ddd411d454b3e9afd7877df9ebb 100644 (file)
@@ -795,6 +795,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
                count++;
 
                memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_FIRMWARE;
                props.max_brightness = device->brightness->count - 3;
                device->backlight = backlight_device_register(name, NULL, device,
                                                              &acpi_backlight_ops,
index d3a9c6e024772343a8be94d04db52840cd2d6304..18d7bcc54ce0371ccadc272af9eb68ca1ae0c76e 100644 (file)
@@ -98,6 +98,7 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)
                return 0;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 31;
        bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
                                       &nv40_bl_ops, &props);
@@ -121,6 +122,7 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev)
                return 0;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 1025;
        bd = backlight_device_register("nv_backlight", &dev->pdev->dev, dev,
                                       &nv50_bl_ops, &props);
index de9cf21b3494c39d7a105f75a90078ebfe8b145e..657da5a3d5c6213040dbea89f2de4339bf19dfd8 100644 (file)
@@ -944,6 +944,7 @@ static int picolcd_init_backlight(struct picolcd_data *data, struct hid_report *
        }
 
        memset(&props, 0, sizeof(props));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 0xff;
        bdev = backlight_device_register(dev_name(dev), dev, data,
                        &picolcd_blops, &props);
index ade1e656bfb25b0ce7343af35f53638bfc778018..b1d91170ded00eeb13d93dbdbef3117d131b224b 100644 (file)
@@ -163,6 +163,7 @@ void __init pmu_backlight_init()
        snprintf(name, sizeof(name), "pmubl");
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
        bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data,
                                       &props);
index ad3d099bf5c14c3431d9035ba21694bf1f561627..c9784705f6ac41ca63666b6d330cfb651c080b0b 100644 (file)
@@ -1031,6 +1031,7 @@ static int __devinit acer_backlight_init(struct device *dev)
        struct backlight_device *bd;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = max_brightness;
        bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops,
                                       &props);
index f3aa6a7fdab60c71448b85bb6eeb68a3f8c1cc7f..5a6f7d7575d61605e92c8e6bbf826ed9c2fcc6d2 100644 (file)
@@ -667,6 +667,7 @@ static int asus_backlight_init(struct asus_laptop *asus)
 
        memset(&props, 0, sizeof(struct backlight_properties));
        props.max_brightness = 15;
+       props.type = BACKLIGHT_PLATFORM;
 
        bd = backlight_device_register(ASUS_LAPTOP_FILE,
                                       &asus->platform_device->dev, asus,
index fe495939c30745f4ea279a33fbb5a2e64467dada..f503607c0645b015e46fdc963f22fa6e3ba8725c 100644 (file)
@@ -1507,6 +1507,7 @@ static int __init asus_acpi_init(void)
        }
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = 15;
        asus_backlight_device = backlight_device_register("asus", NULL, NULL,
                                                          &asus_backlight_data,
index 911135425224b4e8aab137d9b696500c794aaa71..94f93b621d7b67474808fb6c33cdf81248ca3936 100644 (file)
@@ -564,6 +564,7 @@ static int cmpc_ipml_add(struct acpi_device *acpi)
                return -ENOMEM;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = 7;
        ipml->bd = backlight_device_register("cmpc_bl", &acpi->dev,
                                             acpi->handle, &cmpc_bl_ops,
index 034572b980c99cb102e0aad04719bf6279baa75a..eb95878fa58335aa3a22bea204be4ecb28746046 100644 (file)
@@ -970,6 +970,7 @@ static int __init compal_init(void)
        if (!acpi_video_backlight_support()) {
                struct backlight_properties props;
                memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_PLATFORM;
                props.max_brightness = BACKLIGHT_LEVEL_MAX;
                compalbl_device = backlight_device_register(DRIVER_NAME,
                                                            NULL, NULL,
index ad24ef36f9f73958edf966213bf6fc8d580a7a84..de301aa8e5c3799620ff5a06372b5e1942c2dab2 100644 (file)
@@ -671,6 +671,7 @@ static int __init dell_init(void)
        if (max_intensity) {
                struct backlight_properties props;
                memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_PLATFORM;
                props.max_brightness = max_intensity;
                dell_backlight_device = backlight_device_register("dell_backlight",
                                                                  &platform_device->dev,
index 49d9ad708f8959f3f39602ca3b262f4f934630d7..6605beac0d0e5e570b0b0e7baf6edf6abbd03f73 100644 (file)
@@ -1147,6 +1147,7 @@ static int eeepc_backlight_init(struct eeepc_laptop *eeepc)
        struct backlight_device *bd;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = 15;
        bd = backlight_device_register(EEEPC_LAPTOP_FILE,
                                       &eeepc->platform_device->dev, eeepc,
index 95e3b0948e9c2a508fcf920b0ad861b841376785..493054c2dbe15ec114922ce6446ad5f75b21beaa 100644 (file)
@@ -1128,6 +1128,7 @@ static int __init fujitsu_init(void)
 
                memset(&props, 0, sizeof(struct backlight_properties));
                max_brightness = fujitsu->max_brightness;
+               props.type = BACKLIGHT_PLATFORM;
                props.max_brightness = max_brightness - 1;
                fujitsu->bl_device = backlight_device_register("fujitsu-laptop",
                                                               NULL, NULL,
index 7e9bb6df9d394659deeef7dba46090bc06d129bb..142d38579314837085930228752ed92adfaf4b0e 100644 (file)
@@ -804,6 +804,7 @@ static int __init msi_init(void)
        } else {
                struct backlight_properties props;
                memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_PLATFORM;
                props.max_brightness = MSI_LCD_LEVEL_MAX - 1;
                msibl_device = backlight_device_register("msi-laptop-bl", NULL,
                                                         NULL, &msibl_ops,
index 35278ad7e628412754e9d8bcc1281cfbfd38c178..d5419c9ec07a39e34ebc49d7698d39cb933a0da9 100644 (file)
@@ -254,6 +254,7 @@ static int __init msi_wmi_init(void)
        if (!acpi_video_backlight_support()) {
                struct backlight_properties props;
                memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_PLATFORM;
                props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
                backlight = backlight_device_register(DRV_NAME, NULL, NULL,
                                                      &msi_backlight_ops,
index cc1e0ba104d749603957d0017d6f1a364b38cc0b..05be30ee158b54e4e7a3d8344b2476c62fef6c78 100644 (file)
@@ -602,6 +602,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
        }
        /* initialize backlight */
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
        pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
                                                   &pcc_backlight_ops, &props);
index 5e83370b0812975c780630ca0782ef0cfbaac306..13d8d63bcca9ef7cf307860a72f9b94c06466ed8 100644 (file)
@@ -1305,8 +1305,9 @@ static int sony_nc_add(struct acpi_device *device)
                       "controlled by ACPI video driver\n");
        } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT",
                                                &handle))) {
-                                                       struct backlight_properties props;
+               struct backlight_properties props;
                memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_PLATFORM;
                props.max_brightness = SONY_MAX_BRIGHTNESS - 1;
                sony_backlight_device = backlight_device_register("sony", NULL,
                                                                  NULL,
index eb9922385ef8ff59c0148a2c764d747a07516685..947bdcaa0ce9b624b858ca786c7dffaff410056f 100644 (file)
@@ -6307,6 +6307,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
                return 1;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = bright_maxlvl;
        props.brightness = b & TP_EC_BACKLIGHT_LVLMSK;
        ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME,
index 209cced786c60628b87455b6be7b60c977257c00..63f42a22e10240a32d58c6f4bd1ce7ddc87428b6 100644 (file)
@@ -1018,6 +1018,7 @@ static int __init toshiba_acpi_init(void)
                create_toshiba_proc_entries();
        }
 
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
        toshiba_backlight_device = backlight_device_register("toshiba",
                                                             &toshiba_acpi.p_dev->dev,
index b90c2cf3e2476e8b5dc625dd8b847be0a3895b82..750fe5045efaa5babdd33fa7b5babd0649d67c89 100644 (file)
@@ -574,6 +574,7 @@ static const struct backlight_ops dcon_bl_ops = {
 
 static struct backlight_properties dcon_bl_props = {
        .max_brightness = 15,
+       .type = BACKLIGHT_RAW,
        .power = FB_BLANK_UNBLANK,
 };
 
index 6607a89ccb4b309a4e34b3f7171e82cee06ba978..25294462b8b6aa55dbe031e10a173e70739eea5e 100644 (file)
@@ -781,6 +781,7 @@ static int __init samsung_init(void)
 
        /* create a backlight device to talk to this one */
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = sabi_config->max_brightness;
        backlight_device = backlight_device_register("samsung", &sdev->dev,
                                                     NULL, &backlight_ops,
index 1fa6ce3e4a23367a47503136f02892ad760ace1c..68ab460a735c15e94c9cd04600a9e499582b3200 100644 (file)
@@ -282,6 +282,7 @@ static int appledisplay_probe(struct usb_interface *iface,
        snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
                atomic_inc_return(&count_displays) - 1);
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 0xff;
        pdata->bd = backlight_device_register(bl_name, NULL, pdata,
                                              &appledisplay_bl_data, &props);
index bac1634502167bbac687fe49eec161e903fead35..4b4e8dadd6b27a9f3a05429dda3a798e1b95acc5 100644 (file)
@@ -127,6 +127,7 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
                return;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 0xff;
        bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
                                       &atmel_lcdc_bl_ops, &props);
index 4cb6a576c5672ea1576ed12c80fc46fbacbff8c8..b0b2ac335347c7c1c9c311c6569a38139117d823 100644 (file)
@@ -1818,6 +1818,7 @@ static void aty128_bl_init(struct aty128fb_par *par)
        snprintf(name, sizeof(name), "aty128bl%d", info->node);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
        bd = backlight_device_register(name, info->dev, par, &aty128_bl_data,
                                       &props);
index 94e293fce1d2c8f6eb66f6fc03e44064eb270e0d..d437b3daf1f5f08b39172048f44e6c2c7510ffca 100644 (file)
@@ -2241,6 +2241,7 @@ static void aty_bl_init(struct atyfb_par *par)
        snprintf(name, sizeof(name), "atybl%d", info->node);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
        bd = backlight_device_register(name, info->dev, par, &aty_bl_data,
                                       &props);
index 9b811ddbce83853207d24903854d81bf5bc630e5..db572df7e1ef0fddd4d267523bf29daef6584f03 100644 (file)
@@ -158,6 +158,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
        snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
        bd = backlight_device_register(name, rinfo->info->dev, pdata,
                                       &radeon_bl_data, &props);
index b224396b86d56ce0f63ecd765b14e6e59d010fd0..e59623a15f3f841f4fe8710572c2e1aa1afb2ac5 100644 (file)
@@ -227,6 +227,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
        }
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = MAX_BRIGHTNESS;
        bl = backlight_device_register(name, &pdev->dev, data,
                                        &pm860x_backlight_ops, &props);
index 9f436e014f85b3e809198f37e42d8b57cc387fe1..af3119707dbfe2a65b4f9a9da2e9eadee6e5360d 100644 (file)
@@ -303,6 +303,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
        mutex_init(&data->lock);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = ADP5020_MAX_BRIGHTNESS;
        bl = backlight_device_register(pdev->name, data->master, data,
                                       &adp5520_bl_ops, &props);
index 734c650a47c433be7524e27b35b5e3c5b5eea0ad..d2a96a421ffda737048ea7e30169ecfbb9a71d65 100644 (file)
@@ -709,6 +709,7 @@ static int __devinit adp8860_probe(struct i2c_client *client,
        i2c_set_clientdata(client, data);
 
        memset(&props, 0, sizeof(props));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = ADP8860_MAX_BRIGHTNESS;
 
        mutex_init(&data->lock);
index fe9af129c5dd1cb969ea0e0cf418a7b66d5db3b2..c861c41af4423382e42692ce4108e31a44cecf8a 100644 (file)
@@ -104,6 +104,7 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev)
        }
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 0xff;
        bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev,
                                          bl, &adx_backlight_ops, &props);
index e6a66dab088c10a697f438625651d6d17f2aed4c..0443a4f718580c4381acf7d5cb538e941b7e2aa5 100644 (file)
@@ -168,6 +168,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
        }
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min;
        bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl,
                                          &atmel_pwm_bl_ops, &props);
index 08703299ef61184bf3e0cd212601f2817e9e8e63..80d292fb92d8a3c10825130867dbdc55b586f939 100644 (file)
 #include <asm/backlight.h>
 #endif
 
+static const char const *backlight_types[] = {
+       [BACKLIGHT_RAW] = "raw",
+       [BACKLIGHT_PLATFORM] = "platform",
+       [BACKLIGHT_FIRMWARE] = "firmware",
+};
+
 #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \
                           defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
 /* This callback gets called when something important happens inside a
@@ -169,6 +175,14 @@ static ssize_t backlight_store_brightness(struct device *dev,
        return rc;
 }
 
+static ssize_t backlight_show_type(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       struct backlight_device *bd = to_backlight_device(dev);
+
+       return sprintf(buf, "%s\n", backlight_types[bd->props.type]);
+}
+
 static ssize_t backlight_show_max_brightness(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
@@ -234,6 +248,7 @@ static struct device_attribute bl_device_attributes[] = {
        __ATTR(actual_brightness, 0444, backlight_show_actual_brightness,
                     NULL),
        __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL),
+       __ATTR(type, 0444, backlight_show_type, NULL),
        __ATTR_NULL,
 };
 
@@ -292,9 +307,16 @@ struct backlight_device *backlight_device_register(const char *name,
        dev_set_drvdata(&new_bd->dev, devdata);
 
        /* Set default properties */
-       if (props)
+       if (props) {
                memcpy(&new_bd->props, props,
                       sizeof(struct backlight_properties));
+               if (props->type <= 0 || props->type >= BACKLIGHT_TYPE_MAX) {
+                       WARN(1, "%s: invalid backlight type", name);
+                       new_bd->props.type = BACKLIGHT_RAW;
+               }
+       } else {
+               new_bd->props.type = BACKLIGHT_RAW;
+       }
 
        rc = device_register(&new_bd->dev);
        if (rc) {
index 1e71c35083bb4ca8505031efeee5db036a2a2c51..af6098396fe6d067d17a40e439c56ba254a72ab5 100644 (file)
@@ -562,6 +562,7 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi)
        lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = pdata->max_intensity;
        lcd->bl_dev = backlight_device_register("corgi_bl", &spi->dev, lcd,
                                                &corgi_bl_ops, &props);
index 397d15eb1ea8aee3d4fe870ae87f8b14f161654f..6c8c54041fae84f7bb33faf084e3ec9ff932f081 100644 (file)
@@ -193,6 +193,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
        }
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        bdp = backlight_device_register("cr-backlight", &pdev->dev, NULL,
                                        &cr_backlight_ops, &props);
        if (IS_ERR(bdp)) {
index 87659ed79bd7aa3eae7cc1fafd6e12e8cad79e25..62043f12a5a4845d35ee4d338693ed23193c7d36 100644 (file)
@@ -136,6 +136,7 @@ static int da903x_backlight_probe(struct platform_device *pdev)
                da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2,
                                DA9034_WLED_ISET(pdata->output_current));
 
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = max_brightness;
        bl = backlight_device_register(pdev->name, data->da903x_dev, data,
                                       &da903x_backlight_ops, &props);
index b0cc49184803344c11f8802a9ce147ec61c072fe..9f1e389d51d2f8fac9337bf6be305705b2fd6b07 100644 (file)
@@ -87,6 +87,7 @@ static int __init ep93xxbl_probe(struct platform_device *dev)
        ep93xxbl->mmio = EP93XX_RASTER_BRIGHTNESS;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = EP93XX_MAX_BRIGHT;
        bl = backlight_device_register(dev->name, &dev->dev, ep93xxbl,
                                       &ep93xxbl_ops, &props);
index 312ca619735d4dcafa4a0bb70294be13fe5081db..8c6befd65a33240ceed7da9f2a784a463b5f0381 100644 (file)
@@ -91,6 +91,7 @@ static int genericbl_probe(struct platform_device *pdev)
                name = machinfo->name;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = machinfo->max_intensity;
        bd = backlight_device_register(name, &pdev->dev, NULL, &genericbl_ops,
                                       &props);
index 267d23f8d645fc889d7f5faace0d951e93ae41c0..38aa002721416d2b195f6673f610216b5f77527e 100644 (file)
@@ -109,6 +109,7 @@ static int __devinit hp680bl_probe(struct platform_device *pdev)
        struct backlight_device *bd;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = HP680_MAX_INTENSITY;
        bd = backlight_device_register("hp680-bl", &pdev->dev, NULL,
                                       &hp680bl_ops, &props);
index 2f177b3a4885c1658685712703d266184b5b35ed..40e4fa8fcf921043270d1e419f30db434177d9ec 100644 (file)
@@ -106,6 +106,7 @@ static int jornada_bl_probe(struct platform_device *pdev)
        struct backlight_device *bd;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = BL_MAX_BRIGHT;
        bd = backlight_device_register(S1D_DEVICENAME, &pdev->dev, NULL,
                                       &jornada_bl_ops, &props);
index f439a863228755d22621f57b4ecb384327ab3966..72dd5556a35bdbe825f4fb86033f82828f206bc3 100644 (file)
@@ -149,6 +149,7 @@ static int kb3886bl_probe(struct platform_device *pdev)
                machinfo->limit_mask = -1;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = machinfo->max_intensity;
        kb3886_backlight_device = backlight_device_register("kb3886-bl",
                                                            &pdev->dev, NULL,
index d2f59015d517093b01a1901466b871a82c17a4b2..bbca3127071e3a380acce9a843c8b963361fc322 100644 (file)
@@ -184,6 +184,7 @@ static int locomolcd_probe(struct locomo_dev *ldev)
        local_irq_restore(flags);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 4;
        locomolcd_bl_device = backlight_device_register("locomo-bl",
                                                        &ldev->dev, NULL,
index 209acc105cbcb440c4ed289c81a26f7b65ce0dfe..07e8e273ced0b98898e0509dcc1de30424142eda 100644 (file)
@@ -136,6 +136,7 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev)
        data->current_brightness = 0;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = MAX_BRIGHTNESS;
        bl = backlight_device_register(name, &pdev->dev, data,
                                        &max8925_backlight_ops, &props);
index 1485f7345f49ee32586d5d665d1bd624cfcd3e1a..74c33944aa868590f593b980c4a3837878657c70 100644 (file)
@@ -367,6 +367,7 @@ static int __init mbp_init(void)
                return -ENXIO;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_PLATFORM;
        props.max_brightness = 15;
        mbp_backlight_device = backlight_device_register("mbp_backlight", NULL,
                                                         NULL,
index d3bc56296c8d98007321a1cce4945c7bdd7e0259..08d26a72394c8e9920cc23e115802c642902305d 100644 (file)
@@ -146,6 +146,7 @@ static int omapbl_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = OMAPBL_MAX_INTENSITY;
        dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops,
                                        &props);
index 3c424f7efdccc895f1b9b0be2ed768a9b0ca471e..ef5628d60563841aceab7bca62191c0faf57f763 100644 (file)
@@ -112,6 +112,7 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev)
        if (!pcf_bl)
                return -ENOMEM;
 
+       bl_props.type = BACKLIGHT_RAW;
        bl_props.max_brightness = 0x3f;
        bl_props.power = FB_BLANK_UNBLANK;
 
index 809278c90738945b8546bad7faeb7676f842114f..6af183d6465ee80b4892c671fce687b85a6a272a 100644 (file)
@@ -84,6 +84,7 @@ static int progearbl_probe(struct platform_device *pdev)
        pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN;
        progear_backlight_device = backlight_device_register("progear-bl",
                                                             &pdev->dev, NULL,
index 21866ec69656d6be90e69af18a56316895f9d69f..2c2a2c703c1465e3e98978d0bf7d6307ba494ac9 100644 (file)
@@ -108,6 +108,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
                dev_dbg(&pdev->dev, "got pwm for backlight\n");
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = data->max_brightness;
        bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb,
                                       &pwm_backlight_ops, &props);
index 5927db0da9998f87f273d9430d782c26723fb16e..322040f686c2c7bd9be40932fda03392cbfb3577 100644 (file)
@@ -778,6 +778,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi)
 
        bd->props.max_brightness = MAX_BRIGHTNESS;
        bd->props.brightness = MAX_BRIGHTNESS;
+       bd->props.type = BACKLIGHT_RAW;
        lcd->bd = bd;
 
        /*
index 2a04b382ec4834a03270db15701136f5f01694cf..425a7365470b14861f47da75e72fbb46fb915e3f 100644 (file)
@@ -102,6 +102,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
        data->i2c = client;
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 512 - 1;
        data->bl = backlight_device_register("tosa-bl", &client->dev, data,
                                             &bl_ops, &props);
index 08fd87f3aecce368219ed7cb08dfdaa0aebafef6..d4c6eb248ff997893499a13dd2d824fe4abebabc 100644 (file)
@@ -193,6 +193,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev)
        data->current_brightness = 0;
        data->isink_reg = isink_reg;
 
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = max_isel;
        bl = backlight_device_register("wm831x", &pdev->dev, data,
                                       &wm831x_backlight_ops, &props);
index e7d0f525041e7aa8ec0da2c6f34880ad4493def2..2464b910b5905cd3fb4db743eb5904f8c13e1ea4 100644 (file)
@@ -649,6 +649,7 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
        }
 #ifndef NO_BL_SUPPORT
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 255;
        bl_dev = backlight_device_register("bf54x-bl", NULL, NULL,
                                           &bfin_lq043fb_bl_ops, &props);
index 3cf77676947cbd19a59e3ec0a0604337e49df072..d8de29f0dd8d9111f772cc43a02627c20ac36e6f 100644 (file)
@@ -545,6 +545,7 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
        }
 #ifndef NO_BL_SUPPORT
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = 255;
        bl_dev = backlight_device_register("bf52x-bl", NULL, NULL,
                                           &bfin_lq043fb_bl_ops, &props);
index 69bd4a581d4aaec71b211f2f3328fd2f3db07a1c..ef72cb4838349f2b0e674362e13eb831584432fe 100644 (file)
@@ -499,6 +499,7 @@ static void imxfb_init_backlight(struct imxfb_info *fbi)
 
        memset(&props, 0, sizeof(struct backlight_properties));
        props.max_brightness = 0xff;
+       props.type = BACKLIGHT_RAW;
        writel(fbi->pwmr, fbi->regs + LCDC_PWMR);
 
        bl = backlight_device_register("imxfb-bl", &fbi->pdev->dev, fbi,
index 6aac6d1b937bed75a5c0e160c0ff60f0cbdaf2fe..8471008aa6ff6b97c60425d09238174f3a4644e8 100644 (file)
@@ -111,6 +111,7 @@ void nvidia_bl_init(struct nvidia_par *par)
        snprintf(name, sizeof(name), "nvidiabl%d", info->node);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
        bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops,
                                       &props);
index e77310653207c1c8202c0bbabddc692c6df4f2b6..7e04c921aa2a8585d4cb180776d9469c0b4d44ce 100644 (file)
@@ -534,6 +534,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)
 
        props.fb_blank = FB_BLANK_UNBLANK;
        props.power = FB_BLANK_UNBLANK;
+       props.type = BACKLIGHT_RAW;
 
        bldev = backlight_device_register("acx565akm", &md->spi->dev,
                        md, &acx565akm_bl_ops, &props);
index 9a138f650e0567e9e9f60118648fcd39543e06f6..d2b35d2df2a60ad03c29b3cf18b0ebae9cce65b7 100644 (file)
@@ -99,6 +99,7 @@ static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
 
        memset(&props, 0, sizeof(struct backlight_properties));
        props.max_brightness = dssdev->max_backlight_level;
+       props.type = BACKLIGHT_RAW;
 
        bl = backlight_device_register("sharp-ls", &dssdev->dev, dssdev,
                        &sharp_ls_bl_ops, &props);
index 61026f96ad20a012bcba26ad1e76a981e8a4f7d8..c74e8b778ba120656622683941ed434920bfd43d 100644 (file)
@@ -729,6 +729,8 @@ static int taal_probe(struct omap_dss_device *dssdev)
                props.max_brightness = 255;
        else
                props.max_brightness = 127;
+
+       props.type = BACKLIGHT_RAW;
        bldev = backlight_device_register("taal", &dssdev->dev, dssdev,
                                          &taal_bl_ops, &props);
        if (IS_ERR(bldev)) {
index da388186d617154174c8ad9dbdaf3bde5c6f345e..d8ab7be4fd6b5953ba1f2d57928b541038554c60 100644 (file)
@@ -355,6 +355,7 @@ static void riva_bl_init(struct riva_par *par)
        snprintf(name, sizeof(name), "rivabl%d", info->node);
 
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
        props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
        bd = backlight_device_register(name, info->dev, par, &riva_bl_ops,
                                       &props);
index 4a3d52e545e186876f2e36d679c9812e4ce1d8a0..5ffc6dda46751a44681ee3f94808ceeb50fd0d38 100644 (file)
@@ -32,6 +32,13 @@ enum backlight_update_reason {
        BACKLIGHT_UPDATE_SYSFS,
 };
 
+enum backlight_type {
+       BACKLIGHT_RAW = 1,
+       BACKLIGHT_PLATFORM,
+       BACKLIGHT_FIRMWARE,
+       BACKLIGHT_TYPE_MAX,
+};
+
 struct backlight_device;
 struct fb_info;
 
@@ -62,6 +69,8 @@ struct backlight_properties {
        /* FB Blanking active? (values as for power) */
        /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
        int fb_blank;
+       /* Backlight type */
+       enum backlight_type type;
        /* Flags used to signal drivers of state changes */
        /* Upper 4 bits are reserved for driver internal use */
        unsigned int state;