backlight: Allow properties to be passed at registration
Subsystems (24)
PATCH 1/2 backlight: Allow properties to be passed at registration
Values such as max_brightness should be set before backlights are registered, but the current API doesn't allow that. Add a parameter to backlight_device_register and update drivers to ensure that they set this correctly.
--- drivers/acpi/video.c | 9 +++++-- drivers/gpu/drm/nouveau/nouveau_backlight.c | 12 +++++++--- drivers/macintosh/via-pmu-backlight.c | 7 ++++- drivers/platform/x86/acer-wmi.c | 7 ++++- drivers/platform/x86/asus-laptop.c | 8 ++++-- drivers/platform/x86/asus_acpi.c | 7 ++++- drivers/platform/x86/classmate-laptop.c | 8 ++++-- drivers/platform/x86/compal-laptop.c | 11 ++++++--- drivers/platform/x86/dell-laptop.c | 13 +++++++---- drivers/platform/x86/eeepc-laptop.c | 8 ++++-- drivers/platform/x86/fujitsu-laptop.c | 14 ++++++++---- drivers/platform/x86/msi-laptop.c | 7 ++++- drivers/platform/x86/msi-wmi.c | 9 +++++-- drivers/platform/x86/panasonic-laptop.c | 24 +++++++++++----------- drivers/platform/x86/sony-laptop.c | 8 ++++-- drivers/platform/x86/thinkpad_acpi.c | 12 ++++++---- drivers/platform/x86/toshiba_acpi.c | 10 +++++--- drivers/staging/samsung-laptop/samsung-laptop.c | 7 ++++- drivers/usb/misc/appledisplay.c | 7 +++-- drivers/video/atmel_lcdfb.c | 8 ++++-- drivers/video/aty/aty128fb.c | 7 ++++- drivers/video/aty/atyfb_base.c | 7 ++++- drivers/video/aty/radeon_backlight.c | 7 ++++- drivers/video/backlight/adp5520_bl.c | 11 +++++---- drivers/video/backlight/adx_bl.c | 8 ++++-- drivers/video/backlight/atmel-pwm-bl.c | 8 ++++-- drivers/video/backlight/backlight.c | 8 ++++++- drivers/video/backlight/corgi_lcd.c | 8 ++++-- drivers/video/backlight/cr_bllcd.c | 8 +++--- drivers/video/backlight/da903x_bl.c | 7 +++-- drivers/video/backlight/generic_bl.c | 8 ++++-- drivers/video/backlight/hp680_bl.c | 8 ++++-- drivers/video/backlight/jornada720_bl.c | 7 ++++- drivers/video/backlight/kb3886_bl.c | 8 +++++- drivers/video/backlight/locomolcd.c | 8 +++++- drivers/video/backlight/mbp_nvidia_bl.c | 10 ++++++-- drivers/video/backlight/omap1_bl.c | 7 ++++- drivers/video/backlight/progear_bl.c | 7 ++++- drivers/video/backlight/pwm_bl.c | 8 ++++-- drivers/video/backlight/tosa_bl.c | 8 ++++-- drivers/video/backlight/wm831x_bl.c | 7 +++-- drivers/video/bf54x-lq043fb.c | 9 ++++--- drivers/video/bfin-t350mcqb-fb.c | 9 ++++--- drivers/video/nvidia/nv_backlight.c | 7 ++++- drivers/video/omap2/displays/panel-taal.c | 15 ++++++++----- drivers/video/riva/fbdev.c | 7 ++++- include/linux/backlight.h | 3 +- 47 files changed, 263 insertions(+), 148 deletions(-)
drivers/acpi/video.c +6 -3
@@ -992,6 +992,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) }if (acpi_video_backlight_support ()) { +struct backlight_properties props;int result;static int count =0 ;char *name;
@@ -1004,12 +1005,14 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)return ;sprintf (name,"acpi_video%d" , count++); - device->backlight =backlight_device_register (name, -NULL , device, &acpi_backlight_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = device->brightness->count -3 ; + device->backlight =backlight_device_register (name,NULL , device, + &acpi_backlight_ops, + &props);kfree (name);if (IS_ERR (device->backlight))return ; - device->backlight->props.max_brightness = device->brightness->count-3 ; result =sysfs_create_link (&device->backlight->dev.kobj, &device->dev->dev.kobj,"device" );
drivers/gpu/drm/nouveau/nouveau_backlight.c +8 -4
@@ -89,19 +89,21 @@ static struct backlight_ops nv50_bl_ops = {static int nouveau_nv40_backlight_init (struct drm_device *dev) { +struct backlight_properties props;struct drm_nouveau_private *dev_priv = dev->dev_private;struct backlight_device *bd;if (!(nv_rd32 (dev,NV40_PMC_BACKLIGHT ) &NV40_PMC_BACKLIGHT_MASK ))return 0 ; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =31 ; bd =backlight_device_register ("nv_backlight" , &dev->pdev->dev, dev, - &nv40_bl_ops); + &nv40_bl_ops, &props);if (IS_ERR (bd))return PTR_ERR (bd); dev_priv->backlight = bd; - bd->props.max_brightness =31 ; bd->props.brightness =nv40_get_intensity (bd);backlight_update_status (bd);
@@ -110,19 +112,21 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)static int nouveau_nv50_backlight_init (struct drm_device *dev) { +struct backlight_properties props;struct drm_nouveau_private *dev_priv = dev->dev_private;struct backlight_device *bd;if (!nv_rd32 (dev,NV50_PDISPLAY_SOR_BACKLIGHT ))return 0 ; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =1025 ; bd =backlight_device_register ("nv_backlight" , &dev->pdev->dev, dev, - &nv50_bl_ops); + &nv50_bl_ops, &props);if (IS_ERR (bd))return PTR_ERR (bd); dev_priv->backlight = bd; - bd->props.max_brightness =1025 ; bd->props.brightness =nv50_get_intensity (bd);backlight_update_status (bd);return 0 ;
drivers/macintosh/via-pmu-backlight.c +5 -2
@@ -144,6 +144,7 @@ void pmu_backlight_set_sleep(int sleep)void __init pmu_backlight_init () { +struct backlight_properties props;struct backlight_device *bd;char name[10 ];int level, autosave;
@@ -161,13 +162,15 @@ void __init pmu_backlight_init()snprintf (name,sizeof (name),"pmubl" ); - bd =backlight_device_register (name,NULL ,NULL , &pmu_backlight_data); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; + bd =backlight_device_register (name,NULL ,NULL , &pmu_backlight_data, + &props);if (IS_ERR (bd)) {printk (KERN_ERR "PMU Backlight registration failed\n" );return ; } uses_pmu_bl =1 ; - bd->props.max_brightness =FB_BACKLIGHT_LEVELS -1 ;pmu_backlight_init_curve (0x7F ,0x46 ,0x0E ); level = bd->props.max_brightness;
drivers/platform/x86/acer-wmi.c +5 -2
@@ -922,9 +922,13 @@ static struct backlight_ops acer_bl_ops = {static int __devinit acer_backlight_init (struct device *dev) { +struct backlight_properties props;struct backlight_device *bd; - bd =backlight_device_register ("acer-wmi" , dev,NULL , &acer_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = max_brightness; + bd =backlight_device_register ("acer-wmi" , dev,NULL , &acer_bl_ops, + &props);if (IS_ERR (bd)) {printk (ACER_ERR "Could not register Acer backlight device\n" ); acer_backlight_device =NULL ;
@@ -935,7 +939,6 @@ static int __devinit acer_backlight_init(struct device *dev) bd->props.power =FB_BLANK_UNBLANK ; bd->props.brightness = max_brightness; - bd->props.max_brightness = max_brightness;backlight_update_status (bd);return 0 ; }
drivers/platform/x86/asus-laptop.c +5 -3
@@ -1363,8 +1363,11 @@ static int asus_backlight_init(struct device *dev)struct backlight_device *bd;if (brightness_set_handle && lcd_switch_handle) { - bd =backlight_device_register (ASUS_HOTK_FILE , dev, -NULL , &asusbl_ops); +struct backlight_properties props; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =15 ; + bd =backlight_device_register (ASUS_HOTK_FILE , dev,NULL , + &asusbl_ops, &props);if (IS_ERR (bd)) {pr_err ("Could not register asus backlight device\n" ); asus_backlight_device =NULL ;
@@ -1373,7 +1376,6 @@ static int asus_backlight_init(struct device *dev) asus_backlight_device = bd; - bd->props.max_brightness =15 ; bd->props.brightness =read_brightness (NULL ); bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
drivers/platform/x86/asus_acpi.c +5 -2
@@ -1482,6 +1482,7 @@ static void asus_acpi_exit(void)static int __init asus_acpi_init (void ) { +struct backlight_properties props;int result; result =acpi_bus_register_driver (&asus_hotk_driver);
@@ -1508,15 +1509,17 @@ static int __init asus_acpi_init(void)return -ENODEV ; } +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =15 ; asus_backlight_device =backlight_device_register ("asus" ,NULL ,NULL , - &asus_backlight_data); + &asus_backlight_data, + &props);if (IS_ERR (asus_backlight_device)) {printk (KERN_ERR "Could not register asus backlight device\n" ); asus_backlight_device =NULL ;asus_acpi_exit ();return -ENODEV ; } - asus_backlight_device->props.max_brightness =15 ;return 0 ; }
drivers/platform/x86/classmate-laptop.c +5 -3
@@ -459,11 +459,13 @@ static struct backlight_ops cmpc_bl_ops = {static int cmpc_bl_add (struct acpi_device *acpi) { +struct backlight_properties props;struct backlight_device *bd; - bd =backlight_device_register ("cmpc_bl" , &acpi->dev, - acpi->handle, &cmpc_bl_ops); - bd->props.max_brightness =7 ; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =7 ; + bd =backlight_device_register ("cmpc_bl" , &acpi->dev, acpi->handle, + &cmpc_bl_ops, &props);dev_set_drvdata (&acpi->dev, bd);return 0 ; }
drivers/platform/x86/compal-laptop.c +7 -4
@@ -326,12 +326,15 @@ static int __init compal_init(void)/* Register backlight stuff */ if (!acpi_video_backlight_support ()) { - compalbl_device =backlight_device_register ("compal-laptop" ,NULL ,NULL , - &compalbl_ops); +struct backlight_properties props; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =COMPAL_LCD_LEVEL_MAX -1 ; + compalbl_device =backlight_device_register ("compal-laptop" , +NULL ,NULL , + &compalbl_ops, + &props);if (IS_ERR (compalbl_device))return PTR_ERR (compalbl_device); - - compalbl_device->props.max_brightness =COMPAL_LCD_LEVEL_MAX -1 ; } ret =platform_driver_register (&compal_driver);
drivers/platform/x86/dell-laptop.c +8 -5
@@ -390,10 +390,14 @@ static int __init dell_init(void) }if (max_intensity) { - dell_backlight_device =backlight_device_register ( -"dell_backlight" , - &platform_device->dev,NULL , - &dell_ops); +struct backlight_properties props; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = max_intensity; + dell_backlight_device =backlight_device_register ("dell_backlight" , + &platform_device->dev, +NULL , + &dell_ops, + &props);if (IS_ERR (dell_backlight_device)) { ret =PTR_ERR (dell_backlight_device);
@@ -401,7 +405,6 @@ static int __init dell_init(void) goto fail_backlight; } - dell_backlight_device->props.max_brightness = max_intensity; dell_backlight_device->props.brightness =dell_get_intensity (dell_backlight_device);backlight_update_status (dell_backlight_device);
drivers/platform/x86/eeepc-laptop.c +5 -3
@@ -1113,18 +1113,20 @@ static int eeepc_backlight_notify(struct eeepc_laptop *eeepc)static int eeepc_backlight_init (struct eeepc_laptop *eeepc) { +struct backlight_properties props;struct backlight_device *bd; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =15 ; bd =backlight_device_register (EEEPC_LAPTOP_FILE , - &eeepc->platform_device->dev, - eeepc, &eeepcbl_ops); + &eeepc->platform_device->dev, eeepc, + &eeepcbl_ops, &props);if (IS_ERR (bd)) {pr_err ("Could not register eeepc backlight device\n" ); eeepc->backlight_device =NULL ;return PTR_ERR (bd); } eeepc->backlight_device = bd; - bd->props.max_brightness =15 ; bd->props.brightness =read_brightness (bd); bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
drivers/platform/x86/fujitsu-laptop.c +9 -5
@@ -1126,16 +1126,20 @@ static int __init fujitsu_init(void)/* Register backlight stuff */ if (!acpi_video_backlight_support ()) { - fujitsu->bl_device = -backlight_device_register ("fujitsu-laptop" ,NULL ,NULL , - &fujitsubl_ops); +struct backlight_properties props; + +memset (&props,0 ,sizeof (struct backlight_properties )); + max_brightness = fujitsu->max_brightness; + props.max_brightness = max_brightness -1 ; + fujitsu->bl_device =backlight_device_register ("fujitsu-laptop" , +NULL ,NULL , + &fujitsubl_ops, + &props);if (IS_ERR (fujitsu->bl_device)) { ret =PTR_ERR (fujitsu->bl_device); fujitsu->bl_device =NULL ; goto fail_sysfs_group; } - max_brightness = fujitsu->max_brightness; - fujitsu->bl_device->props.max_brightness = max_brightness -1 ; fujitsu->bl_device->props.brightness = fujitsu->brightness_level; }
drivers/platform/x86/msi-laptop.c +5 -2
@@ -351,11 +351,14 @@ static int __init msi_init(void)printk (KERN_INFO "MSI: Brightness ignored, must be controlled " "by ACPI video driver\n" ); }else { +struct backlight_properties props; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =MSI_LCD_LEVEL_MAX -1 ; msibl_device =backlight_device_register ("msi-laptop-bl" ,NULL , -NULL , &msibl_ops); +NULL , &msibl_ops, + &props);if (IS_ERR (msibl_device))return PTR_ERR (msibl_device); - msibl_device->props.max_brightness =MSI_LCD_LEVEL_MAX -1 ; } ret =platform_driver_register (&msipf_driver);
drivers/platform/x86/msi-wmi.c +6 -3
@@ -249,12 +249,15 @@ static int __init msi_wmi_init(void) goto err_uninstall_notifier;if (!acpi_video_backlight_support ()) { - backlight =backlight_device_register (DRV_NAME , -NULL ,NULL , &msi_backlight_ops); +struct backlight_properties props; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =ARRAY_SIZE (backlight_map) -1 ; + backlight =backlight_device_register (DRV_NAME ,NULL ,NULL , + &msi_backlight_ops, + &props);if (IS_ERR (backlight)) goto err_free_input; - backlight->props.max_brightness =ARRAY_SIZE (backlight_map) -1 ; err =bl_get (NULL );if (err <0 ) goto err_free_backlight;
drivers/platform/x86/panasonic-laptop.c +12 -12
@@ -601,6 +601,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device)static int acpi_pcc_hotkey_add (struct acpi_device *device) { +struct backlight_properties props;struct pcc_acpi *pcc;int num_sifr, result;
@@ -638,24 +639,23 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)if (result) {ACPI_DEBUG_PRINT ((ACPI_DB_ERROR ,"Error installing keyinput handler\n" )); - goto out_sinf; + goto out_hotkey; } -/* initialize backlight */ - pcc->backlight =backlight_device_register ("panasonic" ,NULL , pcc, - &pcc_backlight_ops); -if (IS_ERR (pcc->backlight)) - goto out_input; -if (!acpi_pcc_retrieve_biosdata (pcc, pcc->sinf)) {ACPI_DEBUG_PRINT ((ACPI_DB_ERROR ,"Couldn't retrieve BIOS data\n" )); - goto out_backlight; + goto out_input; } +/* initialize backlight */ +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT ]; + pcc->backlight =backlight_device_register ("panasonic" ,NULL , pcc, + &pcc_backlight_ops, &props); +if (IS_ERR (pcc->backlight)) + goto out_sinf;/* read the initial brightness setting from the hardware */ - pcc->backlight->props.max_brightness = - pcc->sinf[SINF_AC_MAX_BRIGHT ]; pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT ];/* read the initial sticky key mode from the hardware */
@@ -670,12 +670,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) out_backlight:backlight_device_unregister (pcc->backlight); +out_sinf: +kfree (pcc->sinf); out_input:input_unregister_device (pcc->input_dev);/* no need to input_free_device() since core input API refcount and * free()s the device */ -out_sinf: -kfree (pcc->sinf); out_hotkey:kfree (pcc);
drivers/platform/x86/sony-laptop.c +5 -3
@@ -1288,9 +1288,13 @@ 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; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =SONY_MAX_BRIGHTNESS -1 ; sony_backlight_device =backlight_device_register ("sony" ,NULL ,NULL , - &sony_backlight_ops); + &sony_backlight_ops, + &props);if (IS_ERR (sony_backlight_device)) { printk(KERN_WARNING DRV_PFX "unable to register backlight device\n");
@@ -1299,8 +1303,6 @@ static int sony_nc_add(struct acpi_device *device) sony_backlight_device->props.brightness =sony_backlight_get_brightness (sony_backlight_device); - sony_backlight_device->props.max_brightness = -SONY_MAX_BRIGHTNESS -1 ; } }
drivers/platform/x86/thinkpad_acpi.c +7 -5
@@ -6151,6 +6151,7 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = {static int __init brightness_init (struct ibm_init_struct *iibm) { +struct backlight_properties props;int b;unsigned long quirks;
@@ -6240,9 +6241,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm)printk (TPACPI_INFO "detected a 16-level brightness capable ThinkPad\n" ); - ibm_backlight_device =backlight_device_register ( -TPACPI_BACKLIGHT_DEV_NAME ,NULL ,NULL , - &ibm_backlight_data); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = (tp_features.bright_16levels) ?15 :7 ; + ibm_backlight_device =backlight_device_register (TPACPI_BACKLIGHT_DEV_NAME , +NULL ,NULL , + &ibm_backlight_data, + &props);if (IS_ERR (ibm_backlight_device)) {int rc =PTR_ERR (ibm_backlight_device); ibm_backlight_device =NULL ;
@@ -6261,8 +6265,6 @@ static int __init brightness_init(struct ibm_init_struct *iibm) "or not on your ThinkPad\n", TPACPI_MAIL); } - ibm_backlight_device->props.max_brightness = - (tp_features.bright_16levels)?15 :7 ; ibm_backlight_device->props.brightness = b &TP_EC_BACKLIGHT_LVLMSK ;backlight_update_status (ibm_backlight_device);
drivers/platform/x86/toshiba_acpi.c +6 -4
@@ -737,6 +737,7 @@ static int __init toshiba_acpi_init(void)u32 hci_result;bool bt_present;int ret =0 ; +struct backlight_properties props;if (acpi_disabled)return -ENODEV ;
@@ -783,10 +784,12 @@ static int __init toshiba_acpi_init(void) } } + props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ; toshiba_backlight_device =backlight_device_register ("toshiba" , - &toshiba_acpi.p_dev->dev, -NULL , - &toshiba_backlight_data); + &toshiba_acpi.p_dev->dev, +NULL , + &toshiba_backlight_data, + &props);if (IS_ERR (toshiba_backlight_device)) { ret =PTR_ERR (toshiba_backlight_device);
@@ -795,7 +798,6 @@ static int __init toshiba_acpi_init(void)toshiba_acpi_exit ();return ret; } - toshiba_backlight_device->props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ;/* Register rfkill switch for Bluetooth */ if (hci_get_bt_present (&bt_present) ==HCI_SUCCESS && bt_present) {
drivers/staging/samsung-laptop/samsung-laptop.c +5 -2
@@ -391,6 +391,7 @@ MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);static int __init samsung_init (void ) { +struct backlight_properties props;struct sabi_retval sretval;const char *testStr ="SECLINUX" ;void __iomem *memcheck;
@@ -483,12 +484,14 @@ static int __init samsung_init(void) goto error_no_platform;/* create a backlight device to talk to this one */ +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =MAX_BRIGHT ; backlight_device =backlight_device_register ("samsung" , &sdev->dev, -NULL , &backlight_ops); +NULL , &backlight_ops, + &props);if (IS_ERR (backlight_device)) goto error_no_backlight; - backlight_device->props.max_brightness =MAX_BRIGHT ; backlight_device->props.brightness =read_brightness (); backlight_device->props.power =FB_BLANK_UNBLANK ;backlight_update_status (backlight_device);
drivers/usb/misc/appledisplay.c +4 -3
@@ -202,6 +202,7 @@ static void appledisplay_work(struct work_struct *work)static int appledisplay_probe (struct usb_interface *iface,const struct usb_device_id *id) { +struct backlight_properties props;struct appledisplay *pdata;struct usb_device *udev =interface_to_usbdev (iface);struct usb_host_interface *iface_desc;
@@ -279,15 +280,15 @@ static int appledisplay_probe(struct usb_interface *iface,/* Register backlight device */ snprintf (bl_name,sizeof (bl_name),"appledisplay%d" ,atomic_inc_return (&count_displays) -1 ); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =0xff ; pdata->bd =backlight_device_register (bl_name,NULL , pdata, - &appledisplay_bl_data); + &appledisplay_bl_data, &props);if (IS_ERR (pdata->bd)) {dev_err (&iface->dev,"Backlight registration failed\n" ); goto error; } - pdata->bd->props.max_brightness =0xff ; -/* Try to get brightness */ brightness =appledisplay_bl_get_brightness (pdata->bd);
drivers/video/atmel_lcdfb.c +5 -3
@@ -117,6 +117,7 @@ static struct backlight_ops atmel_lcdc_bl_ops = {static void init_backlight (struct atmel_lcdfb_info *sinfo) { +struct backlight_properties props;struct backlight_device *bl; sinfo->bl_power =FB_BLANK_UNBLANK ;
@@ -124,8 +125,10 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)if (sinfo->backlight)return ; - bl =backlight_device_register ("backlight" , &sinfo->pdev->dev, - sinfo, &atmel_lcdc_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =0xff ; + bl =backlight_device_register ("backlight" , &sinfo->pdev->dev, sinfo, + &atmel_lcdc_bl_ops, &props);if (IS_ERR (bl)) {dev_err (&sinfo->pdev->dev,"error %ld on backlight register\n" ,PTR_ERR (bl));
@@ -135,7 +138,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo) bl->props.power =FB_BLANK_UNBLANK ; bl->props.fb_blank =FB_BLANK_UNBLANK ; - bl->props.max_brightness =0xff ; bl->props.brightness =atmel_bl_get_brightness (bl); }
drivers/video/aty/aty128fb.c +5 -2
@@ -1802,6 +1802,7 @@ static void aty128_bl_set_power(struct fb_info *info, int power)static void aty128_bl_init (struct aty128fb_par *par) { +struct backlight_properties props;struct fb_info *info =pci_get_drvdata (par->pdev);struct backlight_device *bd;char name[12 ];
@@ -1817,7 +1818,10 @@ static void aty128_bl_init(struct aty128fb_par *par)snprintf (name,sizeof (name),"aty128bl%d" , info->node); - bd =backlight_device_register (name, info->dev, par, &aty128_bl_data); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; + bd =backlight_device_register (name, info->dev, par, &aty128_bl_data, + &props);if (IS_ERR (bd)) { info->bl_dev =NULL ;printk (KERN_WARNING "aty128: Backlight registration failed\n" );
@@ -1829,7 +1833,6 @@ static void aty128_bl_init(struct aty128fb_par *par)63 *FB_BACKLIGHT_MAX /MAX_LEVEL , 219 * FB_BACKLIGHT_MAX / MAX_LEVEL); - bd->props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd->props.brightness = bd->props.max_brightness; bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
drivers/video/aty/atyfb_base.c +5 -2
@@ -2232,6 +2232,7 @@ static struct backlight_ops aty_bl_data = {static void aty_bl_init (struct atyfb_par *par) { +struct backlight_properties props;struct fb_info *info =pci_get_drvdata (par->pdev);struct backlight_device *bd;char name[12 ];
@@ -2243,7 +2244,10 @@ static void aty_bl_init(struct atyfb_par *par)snprintf (name,sizeof (name),"atybl%d" , info->node); - bd =backlight_device_register (name, info->dev, par, &aty_bl_data); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; + bd =backlight_device_register (name, info->dev, par, &aty_bl_data, + &props);if (IS_ERR (bd)) { info->bl_dev =NULL ;printk (KERN_WARNING "aty: Backlight registration failed\n" );
@@ -2255,7 +2259,6 @@ static void aty_bl_init(struct atyfb_par *par)0x3F *FB_BACKLIGHT_MAX /MAX_LEVEL , 0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL); - bd->props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd->props.brightness = bd->props.max_brightness; bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
drivers/video/aty/radeon_backlight.c +5 -2
@@ -134,6 +134,7 @@ static struct backlight_ops radeon_bl_data = {void radeonfb_bl_init (struct radeonfb_info *rinfo) { +struct backlight_properties props;struct backlight_device *bd;struct radeon_bl_privdata *pdata;char name[12 ];
@@ -155,7 +156,10 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)snprintf (name,sizeof (name),"radeonbl%d" , rinfo->info->node); - bd =backlight_device_register (name, rinfo->info->dev, pdata, &radeon_bl_data); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; + bd =backlight_device_register (name, rinfo->info->dev, pdata, + &radeon_bl_data, &props);if (IS_ERR (bd)) { rinfo->info->bl_dev =NULL ;printk ("radeonfb: Backlight registration failed\n" );
@@ -185,7 +189,6 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)63 *FB_BACKLIGHT_MAX /MAX_RADEON_LEVEL , 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); - bd->props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd->props.brightness = bd->props.max_brightness; bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
drivers/video/backlight/adp5520_bl.c +6 -5
@@ -278,6 +278,7 @@ static const struct attribute_group adp5520_bl_attr_group = {static int __devinit adp5520_bl_probe (struct platform_device *pdev) { +struct backlight_properties props;struct backlight_device *bl;struct adp5520_bl *data;int ret =0 ;
@@ -300,17 +301,17 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)mutex_init (&data->lock); - bl =backlight_device_register (pdev->name, data->master, - data, &adp5520_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =ADP5020_MAX_BRIGHTNESS ; + bl =backlight_device_register (pdev->name, data->master, data, + &adp5520_bl_ops, &props);if (IS_ERR (bl)) {dev_err (&pdev->dev,"failed to register backlight\n" );kfree (data);return PTR_ERR (bl); } - bl->props.max_brightness = - bl->props.brightness =ADP5020_MAX_BRIGHTNESS ; - + bl->props.brightness =ADP5020_MAX_BRIGHTNESS ;if (data->pdata->en_ambl_sens) ret =sysfs_create_group (&bl->dev.kobj, &adp5520_bl_attr_group);
drivers/video/backlight/adx_bl.c +5 -3
@@ -70,6 +70,7 @@ static const struct backlight_ops adx_backlight_ops = {static int __devinit adx_backlight_probe (struct platform_device *pdev) { +struct backlight_properties props;struct backlight_device *bldev;struct resource *res;struct adxbl *bl;
@@ -101,14 +102,15 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev) goto out; } - bldev =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, bl, - &adx_backlight_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =0xff ; + bldev =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, + bl, &adx_backlight_ops, &props);if (!bldev) { ret = -ENOMEM ; goto out; } - bldev->props.max_brightness =0xff ; bldev->props.brightness =0xff ; bldev->props.power =FB_BLANK_UNBLANK ;
drivers/video/backlight/atmel-pwm-bl.c +5 -3
@@ -120,6 +120,7 @@ static const struct backlight_ops atmel_pwm_bl_ops = {static int atmel_pwm_bl_probe (struct platform_device *pdev) { +struct backlight_properties props;const struct atmel_pwm_bl_platform_data *pdata;struct backlight_device *bldev;struct atmel_pwm_bl *pwmbl;
@@ -165,8 +166,10 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) goto err_free_gpio; } - bldev =backlight_device_register ("atmel-pwm-bl" , - &pdev->dev, pwmbl, &atmel_pwm_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + 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);if (IS_ERR (bldev)) { retval =PTR_ERR (bldev); goto err_free_gpio;
@@ -178,7 +181,6 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)/* Power up the backlight by default at middle intesity. */ bldev->props.power =FB_BLANK_UNBLANK ; - bldev->props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; bldev->props.brightness = bldev->props.max_brightness /2 ; retval =atmel_pwm_bl_init_pwm (pwmbl);
drivers/video/backlight/backlight.c +7 -1
@@ -269,7 +269,8 @@ EXPORT_SYMBOL(backlight_force_update);* ERR_PTR() or a pointer to the newly allocated device. */ struct backlight_device *backlight_device_register (const char *name, -struct device *parent,void *devdata,const struct backlight_ops *ops) +struct device *parent,void *devdata,const struct backlight_ops *ops, +const struct backlight_properties *props) {struct backlight_device *new_bd;int rc;
@@ -289,6 +290,11 @@ struct backlight_device *backlight_device_register(const char *name,dev_set_name (&new_bd->dev, name);dev_set_drvdata (&new_bd->dev, devdata); +/* Set default properties */ +if (props) +memcpy (&new_bd->props, props, +sizeof (struct backlight_properties )); + rc =device_register (&new_bd->dev);if (rc) {kfree (new_bd);
drivers/video/backlight/corgi_lcd.c +5 -3
@@ -533,6 +533,7 @@ err_free_backlight_on:static int __devinit corgi_lcd_probe (struct spi_device *spi) { +struct backlight_properties props;struct corgi_lcd_platform_data *pdata = spi->dev.platform_data;struct corgi_lcd *lcd;int ret =0 ;
@@ -559,13 +560,14 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi) lcd->power =FB_BLANK_POWERDOWN ; lcd->mode = (pdata) ? pdata->init_mode :CORGI_LCD_MODE_VGA ; - lcd->bl_dev =backlight_device_register ("corgi_bl" , &spi->dev, - lcd, &corgi_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = pdata->max_intensity; + lcd->bl_dev =backlight_device_register ("corgi_bl" , &spi->dev, lcd, + &corgi_bl_ops, &props);if (IS_ERR (lcd->bl_dev)) { ret =PTR_ERR (lcd->bl_dev); goto err_unregister_lcd; } - lcd->bl_dev->props.max_brightness = pdata->max_intensity; lcd->bl_dev->props.brightness = pdata->default_intensity; lcd->bl_dev->props.power =FB_BLANK_UNBLANK ;
drivers/video/backlight/cr_bllcd.c +4 -4
@@ -170,6 +170,7 @@ static struct lcd_ops cr_lcd_ops = {static int cr_backlight_probe (struct platform_device *pdev) { +struct backlight_properties props;struct backlight_device *bdp;struct lcd_device *ldp;struct cr_panel *crp;
@@ -190,8 +191,9 @@ static int cr_backlight_probe(struct platform_device *pdev)return -ENODEV ; } - bdp =backlight_device_register ("cr-backlight" , - &pdev->dev,NULL , &cr_backlight_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + bdp =backlight_device_register ("cr-backlight" , &pdev->dev,NULL , + &cr_backlight_ops, &props);if (IS_ERR (bdp)) {pci_dev_put (lpc_dev);return PTR_ERR (bdp);
@@ -220,9 +222,7 @@ static int cr_backlight_probe(struct platform_device *pdev) crp->cr_lcd_device = ldp; crp->cr_backlight_device->props.power =FB_BLANK_UNBLANK ; crp->cr_backlight_device->props.brightness =0 ; - crp->cr_backlight_device->props.max_brightness =0 ;cr_backlight_set_intensity (crp->cr_backlight_device); -cr_lcd_set_power (crp->cr_lcd_device,FB_BLANK_UNBLANK );platform_set_drvdata (pdev, crp);
drivers/video/backlight/da903x_bl.c +4 -3
@@ -105,6 +105,7 @@ static int da903x_backlight_probe(struct platform_device *pdev)struct da9034_backlight_pdata *pdata = pdev->dev.platform_data;struct da903x_backlight_data *data;struct backlight_device *bl; +struct backlight_properties props;int max_brightness; data =kzalloc (sizeof (*data),GFP_KERNEL );
@@ -134,15 +135,15 @@ static int da903x_backlight_probe(struct platform_device *pdev)da903x_write (data->da903x_dev,DA9034_WLED_CONTROL2 ,DA9034_WLED_ISET (pdata->output_current)); - bl =backlight_device_register (pdev->name, data->da903x_dev, - data, &da903x_backlight_ops); + props.max_brightness = max_brightness; + bl =backlight_device_register (pdev->name, data->da903x_dev, data, + &da903x_backlight_ops, &props);if (IS_ERR (bl)) {dev_err (&pdev->dev,"failed to register backlight\n" );kfree (data);return PTR_ERR (bl); } - bl->props.max_brightness = max_brightness; bl->props.brightness = max_brightness;platform_set_drvdata (pdev, bl);
drivers/video/backlight/generic_bl.c +5 -3
@@ -78,6 +78,7 @@ static const struct backlight_ops genericbl_ops = {static int genericbl_probe (struct platform_device *pdev) { +struct backlight_properties props;struct generic_bl_info *machinfo = pdev->dev.platform_data;const char *name ="generic-bl" ;struct backlight_device *bd;
@@ -89,14 +90,15 @@ static int genericbl_probe(struct platform_device *pdev)if (machinfo->name) name = machinfo->name; - bd =backlight_device_register (name, - &pdev->dev,NULL , &genericbl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = machinfo->max_intensity; + bd =backlight_device_register (name, &pdev->dev,NULL , &genericbl_ops, + &props);if (IS_ERR (bd))return PTR_ERR (bd);platform_set_drvdata (pdev, bd); - bd->props.max_brightness = machinfo->max_intensity; bd->props.power =FB_BLANK_UNBLANK ; bd->props.brightness = machinfo->default_intensity;backlight_update_status (bd);
drivers/video/backlight/hp680_bl.c +5 -3
@@ -105,16 +105,18 @@ static const struct backlight_ops hp680bl_ops = {static int __devinit hp680bl_probe (struct platform_device *pdev) { +struct backlight_properties props;struct backlight_device *bd; - bd =backlight_device_register ("hp680-bl" , &pdev->dev,NULL , - &hp680bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =HP680_MAX_INTENSITY ; + bd =backlight_device_register ("hp680-bl" , &pdev->dev,NULL , + &hp680bl_ops, &props);if (IS_ERR (bd))return PTR_ERR (bd);platform_set_drvdata (pdev, bd); - bd->props.max_brightness =HP680_MAX_INTENSITY ; bd->props.brightness =HP680_DEFAULT_INTENSITY ;hp680bl_send_intensity (bd);
drivers/video/backlight/jornada720_bl.c +5 -2
@@ -101,10 +101,14 @@ static const struct backlight_ops jornada_bl_ops = {static int jornada_bl_probe (struct platform_device *pdev) { +struct backlight_properties props;int ret;struct backlight_device *bd; - bd =backlight_device_register (S1D_DEVICENAME , &pdev->dev,NULL , &jornada_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =BL_MAX_BRIGHT ; + bd =backlight_device_register (S1D_DEVICENAME , &pdev->dev,NULL , + &jornada_bl_ops, &props);if (IS_ERR (bd)) { ret =PTR_ERR (bd);
@@ -117,7 +121,6 @@ static int jornada_bl_probe(struct platform_device *pdev)/* note. make sure max brightness is set otherwise you will get seemingly non-related errors when trying to change brightness */ - bd->props.max_brightness =BL_MAX_BRIGHT ;jornada_bl_update_status (bd);platform_set_drvdata (pdev, bd);
drivers/video/backlight/kb3886_bl.c +6 -2
@@ -141,20 +141,24 @@ static const struct backlight_ops kb3886bl_ops = {static int kb3886bl_probe (struct platform_device *pdev) { +struct backlight_properties props;struct kb3886bl_machinfo *machinfo = pdev->dev.platform_data; bl_machinfo = machinfo;if (!machinfo->limit_mask) machinfo->limit_mask =-1 ; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = machinfo->max_intensity; kb3886_backlight_device =backlight_device_register ("kb3886-bl" , - &pdev->dev,NULL , &kb3886bl_ops); + &pdev->dev,NULL , + &kb3886bl_ops, + &props);if (IS_ERR (kb3886_backlight_device))return PTR_ERR (kb3886_backlight_device);platform_set_drvdata (pdev, kb3886_backlight_device); - kb3886_backlight_device->props.max_brightness = machinfo->max_intensity; kb3886_backlight_device->props.power =FB_BLANK_UNBLANK ; kb3886_backlight_device->props.brightness = machinfo->default_intensity;backlight_update_status (kb3886_backlight_device);
drivers/video/backlight/locomolcd.c +6 -2
@@ -167,6 +167,7 @@ static int locomolcd_resume(struct locomo_dev *dev)static int locomolcd_probe (struct locomo_dev *ldev) { +struct backlight_properties props;unsigned long flags;local_irq_save (flags);
@@ -182,13 +183,16 @@ static int locomolcd_probe(struct locomo_dev *ldev)local_irq_restore (flags); - locomolcd_bl_device =backlight_device_register ("locomo-bl" , &ldev->dev,NULL , &locomobl_data); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =4 ; + locomolcd_bl_device =backlight_device_register ("locomo-bl" , + &ldev->dev,NULL , + &locomobl_data, &props);if (IS_ERR (locomolcd_bl_device))return PTR_ERR (locomolcd_bl_device);/* Set up frontlight so that screen is readable */ - locomolcd_bl_device->props.max_brightness =4 , locomolcd_bl_device->props.brightness =2 ;locomolcd_set_intensity (locomolcd_bl_device);
drivers/video/backlight/mbp_nvidia_bl.c +7 -3
@@ -250,6 +250,7 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {static int __init mbp_init (void ) { +struct backlight_properties props;if (!dmi_check_system (mbp_device_table))return -ENODEV ;
@@ -257,14 +258,17 @@ static int __init mbp_init(void) "Macbook Pro backlight"))return -ENXIO ; - mbp_backlight_device =backlight_device_register ("mbp_backlight" , -NULL ,NULL , &driver_data->backlight_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =15 ; + mbp_backlight_device =backlight_device_register ("mbp_backlight" ,NULL , +NULL , + &driver_data->backlight_ops, + &props);if (IS_ERR (mbp_backlight_device)) {release_region (driver_data->iostart, driver_data->iolen);return PTR_ERR (mbp_backlight_device); } - mbp_backlight_device->props.max_brightness =15 ; mbp_backlight_device->props.brightness = driver_data->backlight_ops.get_brightness (mbp_backlight_device);backlight_update_status (mbp_backlight_device);
drivers/video/backlight/omap1_bl.c +5 -2
@@ -132,6 +132,7 @@ static const struct backlight_ops omapbl_ops = {static int omapbl_probe (struct platform_device *pdev) { +struct backlight_properties props;struct backlight_device *dev;struct omap_backlight *bl;struct omap_backlight_config *pdata = pdev->dev.platform_data;
@@ -143,7 +144,10 @@ static int omapbl_probe(struct platform_device *pdev)if (unlikely (!bl))return -ENOMEM ; - dev =backlight_device_register ("omap-bl" , &pdev->dev, bl, &omapbl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =OMAPBL_MAX_INTENSITY ; + dev =backlight_device_register ("omap-bl" , &pdev->dev, bl, &omapbl_ops, + &props);if (IS_ERR (dev)) {kfree (bl);return PTR_ERR (dev);
@@ -160,7 +164,6 @@ static int omapbl_probe(struct platform_device *pdev)omap_cfg_reg (PWL );/* Conflicts with UART3 */ dev->props.fb_blank =FB_BLANK_UNBLANK ; - dev->props.max_brightness =OMAPBL_MAX_INTENSITY ; dev->props.brightness = pdata->default_intensity;omapbl_update_status (dev);
drivers/video/backlight/progear_bl.c +5 -2
@@ -61,6 +61,7 @@ static const struct backlight_ops progearbl_ops = {static int progearbl_probe (struct platform_device *pdev) { +struct backlight_properties props;u8 temp;struct backlight_device *progear_backlight_device;int ret;
@@ -82,9 +83,12 @@ static int progearbl_probe(struct platform_device *pdev)pci_read_config_byte (sb_dev,SB_MPS1 , &temp);pci_write_config_byte (sb_dev,SB_MPS1 , temp |0x20 ); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =HW_LEVEL_MAX -HW_LEVEL_MIN ; progear_backlight_device =backlight_device_register ("progear-bl" , &pdev->dev,NULL , - &progearbl_ops); + &progearbl_ops, + &props);if (IS_ERR (progear_backlight_device)) { ret =PTR_ERR (progear_backlight_device); goto put_sb;
@@ -94,7 +98,6 @@ static int progearbl_probe(struct platform_device *pdev) progear_backlight_device->props.power =FB_BLANK_UNBLANK ; progear_backlight_device->props.brightness =HW_LEVEL_MAX -HW_LEVEL_MIN ; - progear_backlight_device->props.max_brightness =HW_LEVEL_MAX -HW_LEVEL_MIN ;progearbl_set_intensity (progear_backlight_device);return 0 ;
drivers/video/backlight/pwm_bl.c +5 -3
@@ -65,6 +65,7 @@ static const struct backlight_ops pwm_backlight_ops = {static int pwm_backlight_probe (struct platform_device *pdev) { +struct backlight_properties props;struct platform_pwm_backlight_data *data = pdev->dev.platform_data;struct backlight_device *bl;struct pwm_bl_data *pb;
@@ -100,15 +101,16 @@ static int pwm_backlight_probe(struct platform_device *pdev) }else dev_dbg (&pdev->dev,"got pwm for backlight\n" ); - bl =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, - pb, &pwm_backlight_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness = data->max_brightness; + bl =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, pb, + &pwm_backlight_ops, &props);if (IS_ERR (bl)) {dev_err (&pdev->dev,"failed to register backlight\n" ); ret =PTR_ERR (bl); goto err_bl; } - bl->props.max_brightness = data->max_brightness; bl->props.brightness = data->dft_brightness;backlight_update_status (bl);
drivers/video/backlight/tosa_bl.c +5 -3
@@ -80,6 +80,7 @@ static const struct backlight_ops bl_ops = {static int __devinit tosa_bl_probe (struct i2c_client *client,const struct i2c_device_id *id) { +struct backlight_properties props;struct tosa_bl_data *data =kzalloc (sizeof (struct tosa_bl_data ),GFP_KERNEL );int ret =0 ;if (!data)
@@ -99,15 +100,16 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,i2c_set_clientdata (client, data); data->i2c = client; - data->bl =backlight_device_register ("tosa-bl" , &client->dev, - data, &bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =512 -1 ; + data->bl =backlight_device_register ("tosa-bl" , &client->dev, data, + &bl_ops, &props);if (IS_ERR (data->bl)) { ret =PTR_ERR (data->bl); goto err_reg; } data->bl->props.brightness =69 ; - data->bl->props.max_brightness =512 -1 ; data->bl->props.power =FB_BLANK_UNBLANK ;backlight_update_status (data->bl);
drivers/video/backlight/wm831x_bl.c +4 -3
@@ -125,6 +125,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev)struct wm831x_backlight_pdata *pdata;struct wm831x_backlight_data *data;struct backlight_device *bl; +struct backlight_properties props;int ret, i, max_isel, isink_reg, dcdc_cfg;/* We need platform data */
@@ -191,15 +192,15 @@ static int wm831x_backlight_probe(struct platform_device *pdev) data->current_brightness =0 ; data->isink_reg = isink_reg; - bl =backlight_device_register ("wm831x" , &pdev->dev, - data, &wm831x_backlight_ops); + props.max_brightness = max_isel; + bl =backlight_device_register ("wm831x" , &pdev->dev, data, + &wm831x_backlight_ops, &props);if (IS_ERR (bl)) {dev_err (&pdev->dev,"failed to register backlight\n" );kfree (data);return PTR_ERR (bl); } - bl->props.max_brightness = max_isel; bl->props.brightness = max_isel;platform_set_drvdata (pdev, bl);
drivers/video/bf54x-lq043fb.c +5 -4
@@ -531,6 +531,7 @@ static irqreturn_t bfin_bf54x_irq_error(int irq, void *dev_id)static int __devinit bfin_bf54x_probe (struct platform_device *pdev) { +struct backlight_properties props;struct bfin_bf54xfb_info *info;struct fb_info *fbinfo;int ret;
@@ -675,10 +676,10 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) goto out8; }#ifndef NO_BL_SUPPORT - bl_dev = -backlight_device_register ("bf54x-bl" ,NULL ,NULL , - &bfin_lq043fb_bl_ops); - bl_dev->props.max_brightness =255 ; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =255 ; + bl_dev =backlight_device_register ("bf54x-bl" ,NULL ,NULL , + &bfin_lq043fb_bl_ops, &props); lcd_dev =lcd_device_register (DRIVER_NAME , &pdev->dev,NULL , &bfin_lcd_ops); lcd_dev->props.max_contrast =255 ,printk (KERN_INFO "Done.\n" );
drivers/video/bfin-t350mcqb-fb.c +5 -4
@@ -448,6 +448,7 @@ static irqreturn_t bfin_t350mcqb_irq_error(int irq, void *dev_id)static int __devinit bfin_t350mcqb_probe (struct platform_device *pdev) { +struct backlight_properties props;struct bfin_t350mcqbfb_info *info;struct fb_info *fbinfo;int ret;
@@ -569,10 +570,10 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) goto out8; }#ifndef NO_BL_SUPPORT - bl_dev = -backlight_device_register ("bf52x-bl" ,NULL ,NULL , - &bfin_lq043fb_bl_ops); - bl_dev->props.max_brightness =255 ; +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =255 ; + bl_dev =backlight_device_register ("bf52x-bl" ,NULL ,NULL , + &bfin_lq043fb_bl_ops, &props); lcd_dev =lcd_device_register (DRIVER_NAME ,NULL , &bfin_lcd_ops); lcd_dev->props.max_contrast =255 ,printk (KERN_INFO "Done.\n" );
drivers/video/nvidia/nv_backlight.c +5 -2
@@ -94,6 +94,7 @@ static struct backlight_ops nvidia_bl_ops = {void nvidia_bl_init (struct nvidia_par *par) { +struct backlight_properties props;struct fb_info *info =pci_get_drvdata (par->pci_dev);struct backlight_device *bd;char name[12 ];
@@ -109,7 +110,10 @@ void nvidia_bl_init(struct nvidia_par *par)snprintf (name,sizeof (name),"nvidiabl%d" , info->node); - bd =backlight_device_register (name, info->dev, par, &nvidia_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; + bd =backlight_device_register (name, info->dev, par, &nvidia_bl_ops, + &props);if (IS_ERR (bd)) { info->bl_dev =NULL ;printk (KERN_WARNING "nvidia: Backlight registration failed\n" );
@@ -121,7 +125,6 @@ void nvidia_bl_init(struct nvidia_par *par)0x158 *FB_BACKLIGHT_MAX /MAX_LEVEL , 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); - bd->props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd->props.brightness = bd->props.max_brightness; bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
drivers/video/omap2/displays/panel-taal.c +9 -6
@@ -484,6 +484,7 @@ static struct attribute_group taal_attr_group = {static int taal_probe (struct omap_dss_device *dssdev) { +struct backlight_properties props;struct taal_data *td;struct backlight_device *bldev;int r;
@@ -521,11 +522,16 @@ static int taal_probe(struct omap_dss_device *dssdev)/* if no platform set_backlight() defined, presume DSI backlight * control */ +memset (&props,0 ,sizeof (struct backlight_properties ));if (!dssdev->set_backlight) td->use_dsi_bl = true; +if (td->use_dsi_bl) + props.max_brightness =255 ; +else + props.max_brightness =127 ; bldev =backlight_device_register ("taal" , &dssdev->dev, dssdev, - &taal_bl_ops); + &taal_bl_ops, &props);if (IS_ERR (bldev)) { r =PTR_ERR (bldev); goto err1;
@@ -535,13 +541,10 @@ static int taal_probe(struct omap_dss_device *dssdev) bldev->props.fb_blank =FB_BLANK_UNBLANK ; bldev->props.power =FB_BLANK_UNBLANK ; -if (td->use_dsi_bl) { - bldev->props.max_brightness =255 ; +if (td->use_dsi_bl) bldev->props.brightness =255 ; - }else { - bldev->props.max_brightness =127 ; +else bldev->props.brightness =127 ; - }taal_bl_update_status (bldev);
drivers/video/riva/fbdev.c +5 -2
@@ -338,6 +338,7 @@ static struct backlight_ops riva_bl_ops = {static void riva_bl_init (struct riva_par *par) { +struct backlight_properties props;struct fb_info *info =pci_get_drvdata (par->pdev);struct backlight_device *bd;char name[12 ];
@@ -353,7 +354,10 @@ static void riva_bl_init(struct riva_par *par)snprintf (name,sizeof (name),"rivabl%d" , info->node); - bd =backlight_device_register (name, info->dev, par, &riva_bl_ops); +memset (&props,0 ,sizeof (struct backlight_properties )); + props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; + bd =backlight_device_register (name, info->dev, par, &riva_bl_ops, + &props);if (IS_ERR (bd)) { info->bl_dev =NULL ;printk (KERN_WARNING "riva: Backlight registration failed\n" );
@@ -365,7 +369,6 @@ static void riva_bl_init(struct riva_par *par)MIN_LEVEL *FB_BACKLIGHT_MAX /MAX_LEVEL , FB_BACKLIGHT_MAX); - bd->props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd->props.brightness = bd->props.max_brightness; bd->props.power =FB_BLANK_UNBLANK ;backlight_update_status (bd);
include/linux/backlight.h +2 -1
@@ -103,7 +103,8 @@ static inline void backlight_update_status(struct backlight_device *bd) }extern struct backlight_device *backlight_device_register (const char *name, -struct device *dev,void *devdata,const struct backlight_ops *ops); +struct device *dev,void *devdata,const struct backlight_ops *ops, +const struct backlight_properties *props);extern void backlight_device_unregister (struct backlight_device *bd);extern void backlight_force_update (struct backlight_device *bd,enum backlight_update_reason reason);
Signature · 1 line
1.6.6.1
PATCH 2/2 backlight: Add support for exposing backlight types
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.
--- Documentation/ABI/stable/sysfs-class-backlight | 10 ++++++++++ drivers/acpi/video.c | 1 + drivers/gpu/drm/nouveau/nouveau_backlight.c | 2 ++ drivers/macintosh/via-pmu-backlight.c | 1 + drivers/platform/x86/acer-wmi.c | 1 + drivers/platform/x86/asus-laptop.c | 1 + drivers/platform/x86/asus_acpi.c | 1 + drivers/platform/x86/classmate-laptop.c | 1 + drivers/platform/x86/compal-laptop.c | 1 + drivers/platform/x86/dell-laptop.c | 1 + drivers/platform/x86/eeepc-laptop.c | 1 + drivers/platform/x86/fujitsu-laptop.c | 1 + drivers/platform/x86/msi-laptop.c | 1 + drivers/platform/x86/msi-wmi.c | 1 + drivers/platform/x86/panasonic-laptop.c | 1 + drivers/platform/x86/sony-laptop.c | 1 + drivers/platform/x86/thinkpad_acpi.c | 1 + drivers/platform/x86/toshiba_acpi.c | 1 + drivers/staging/samsung-laptop/samsung-laptop.c | 1 + drivers/usb/misc/appledisplay.c | 1 + drivers/video/atmel_lcdfb.c | 1 + drivers/video/aty/aty128fb.c | 1 + drivers/video/aty/atyfb_base.c | 1 + drivers/video/aty/radeon_backlight.c | 1 + drivers/video/backlight/adp5520_bl.c | 1 + drivers/video/backlight/adx_bl.c | 1 + drivers/video/backlight/atmel-pwm-bl.c | 1 + drivers/video/backlight/backlight.c | 15 +++++++++++++++ drivers/video/backlight/corgi_lcd.c | 1 + drivers/video/backlight/da903x_bl.c | 1 + drivers/video/backlight/generic_bl.c | 1 + drivers/video/backlight/hp680_bl.c | 1 + drivers/video/backlight/jornada720_bl.c | 1 + drivers/video/backlight/kb3886_bl.c | 1 + drivers/video/backlight/locomolcd.c | 1 + drivers/video/backlight/mbp_nvidia_bl.c | 1 + drivers/video/backlight/omap1_bl.c | 1 + drivers/video/backlight/progear_bl.c | 1 + drivers/video/backlight/pwm_bl.c | 1 + drivers/video/backlight/tosa_bl.c | 1 + drivers/video/backlight/wm831x_bl.c | 1 + drivers/video/bf54x-lq043fb.c | 1 + drivers/video/bfin-t350mcqb-fb.c | 1 + drivers/video/nvidia/nv_backlight.c | 1 + drivers/video/omap2/displays/panel-taal.c | 2 ++ drivers/video/riva/fbdev.c | 1 + include/linux/backlight.h | 8 ++++++++ 47 files changed, 79 insertions(+), 0 deletions(-)
Documentation/ABI/stable/sysfs-class-backlight +10 -0
@@ -34,3 +34,13 @@ Contact: Richard Purdie <[email protected]> Description: Maximum brightness for <backlight>. Users: HAL + +What: /sys/class/backlight/<backlight>/type +Date: February 2010 +KernelVersion: 2.6.34 +Contact: Matthew Garrett <[email protected]> +Description: + The type of interface controlled by <backlight>. + "firmware": The driver uses a standard firmware interface + "platform": The driver uses a platform-specific interface + "gpu": The driver controls hardware registers directly
drivers/acpi/video.c +1 -0
@@ -1006,6 +1006,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)sprintf (name,"acpi_video%d" , 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,
drivers/gpu/drm/nouveau/nouveau_backlight.c +2 -0
@@ -97,6 +97,7 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)return 0 ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =31 ; bd =backlight_device_register ("nv_backlight" , &dev->pdev->dev, dev, &nv40_bl_ops, &props);
@@ -120,6 +121,7 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev)return 0 ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =1025 ; bd =backlight_device_register ("nv_backlight" , &dev->pdev->dev, dev, &nv50_bl_ops, &props);
drivers/macintosh/via-pmu-backlight.c +1 -0
@@ -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);
drivers/platform/x86/acer-wmi.c +1 -0
@@ -926,6 +926,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);
drivers/platform/x86/asus-laptop.c +1 -0
@@ -1365,6 +1365,7 @@ static int asus_backlight_init(struct device *dev)if (brightness_set_handle && lcd_switch_handle) {struct backlight_properties props;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =15 ; bd =backlight_device_register (ASUS_HOTK_FILE , dev,NULL , &asusbl_ops, &props);
drivers/platform/x86/asus_acpi.c +1 -0
@@ -1510,6 +1510,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,
drivers/platform/x86/classmate-laptop.c +1 -0
@@ -463,6 +463,7 @@ static int cmpc_bl_add(struct acpi_device *acpi)struct backlight_device *bd;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =7 ; bd =backlight_device_register ("cmpc_bl" , &acpi->dev, acpi->handle, &cmpc_bl_ops, &props);
drivers/platform/x86/compal-laptop.c +1 -0
@@ -328,6 +328,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 =COMPAL_LCD_LEVEL_MAX -1 ; compalbl_device = backlight_device_register("compal-laptop", NULL, NULL,
drivers/platform/x86/dell-laptop.c +1 -0
@@ -392,6 +392,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,
drivers/platform/x86/eeepc-laptop.c +1 -0
@@ -1117,6 +1117,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,
drivers/platform/x86/fujitsu-laptop.c +1 -0
@@ -1130,6 +1130,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,
drivers/platform/x86/msi-laptop.c +1 -0
@@ -353,6 +353,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,
drivers/platform/x86/msi-wmi.c +1 -0
@@ -251,6 +251,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,
drivers/platform/x86/panasonic-laptop.c +1 -0
@@ -649,6 +649,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);
drivers/platform/x86/sony-laptop.c +1 -0
@@ -1290,6 +1290,7 @@ static int sony_nc_add(struct acpi_device *device) &handle))) {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,
drivers/platform/x86/thinkpad_acpi.c +1 -0
@@ -6242,6 +6242,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) "detected a 16-level brightness capable ThinkPad\n");memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness = (tp_features.bright_16levels) ?15 :7 ; ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
drivers/platform/x86/toshiba_acpi.c +1 -0
@@ -784,6 +784,7 @@ static int __init toshiba_acpi_init(void) } } + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ; toshiba_backlight_device = backlight_device_register("toshiba", &toshiba_acpi.p_dev->dev,
drivers/staging/samsung-laptop/samsung-laptop.c +1 -0
@@ -485,6 +485,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 =MAX_BRIGHT ; backlight_device = backlight_device_register("samsung", &sdev->dev, NULL, &backlight_ops,
drivers/usb/misc/appledisplay.c +1 -0
@@ -281,6 +281,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_PLATFORM ; props.max_brightness =0xff ; pdata->bd =backlight_device_register (bl_name,NULL , pdata, &appledisplay_bl_data, &props);
drivers/video/atmel_lcdfb.c +1 -0
@@ -126,6 +126,7 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)return ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_GPU ; props.max_brightness =0xff ; bl =backlight_device_register ("backlight" , &sinfo->pdev->dev, sinfo, &atmel_lcdc_bl_ops, &props);
drivers/video/aty/aty128fb.c +1 -0
@@ -1819,6 +1819,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_GPU ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, info->dev, par, &aty128_bl_data, &props);
drivers/video/aty/atyfb_base.c +1 -0
@@ -2245,6 +2245,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_GPU ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, info->dev, par, &aty_bl_data, &props);
drivers/video/aty/radeon_backlight.c +1 -0
@@ -157,6 +157,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_GPU ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, rinfo->info->dev, pdata, &radeon_bl_data, &props);
drivers/video/backlight/adp5520_bl.c +1 -0
@@ -302,6 +302,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_GPU ; props.max_brightness =ADP5020_MAX_BRIGHTNESS ; bl =backlight_device_register (pdev->name, data->master, data, &adp5520_bl_ops, &props);
drivers/video/backlight/adx_bl.c +1 -0
@@ -103,6 +103,7 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev) }memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_GPU ; props.max_brightness =0xff ; bldev =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, bl, &adx_backlight_ops, &props);
drivers/video/backlight/atmel-pwm-bl.c +1 -0
@@ -167,6 +167,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) }memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_GPU ; 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);
drivers/video/backlight/backlight.c +15 -0
@@ -18,6 +18,12 @@#include <asm/backlight.h> #endif +static const char *backlight_types[] = { +"gpu" , +"platform" , +"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
@@ -168,6 +174,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) {
@@ -233,6 +247,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, };
drivers/video/backlight/corgi_lcd.c +1 -0
@@ -561,6 +561,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_GPU ; props.max_brightness = pdata->max_intensity; lcd->bl_dev =backlight_device_register ("corgi_bl" , &spi->dev, lcd, &corgi_bl_ops, &props);
drivers/video/backlight/da903x_bl.c +1 -0
@@ -135,6 +135,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_GPU ; props.max_brightness = max_brightness; bl =backlight_device_register (pdev->name, data->da903x_dev, data, &da903x_backlight_ops, &props);
drivers/video/backlight/generic_bl.c +1 -0
@@ -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_GPU ; props.max_brightness = machinfo->max_intensity; bd =backlight_device_register (name, &pdev->dev,NULL , &genericbl_ops, &props);
drivers/video/backlight/hp680_bl.c +1 -0
@@ -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_GPU ; props.max_brightness =HP680_MAX_INTENSITY ; bd =backlight_device_register ("hp680-bl" , &pdev->dev,NULL , &hp680bl_ops, &props);
drivers/video/backlight/jornada720_bl.c +1 -0
@@ -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_GPU ; props.max_brightness =BL_MAX_BRIGHT ; bd =backlight_device_register (S1D_DEVICENAME , &pdev->dev,NULL , &jornada_bl_ops, &props);
drivers/video/backlight/kb3886_bl.c +1 -0
@@ -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_GPU ; props.max_brightness = machinfo->max_intensity; kb3886_backlight_device = backlight_device_register("kb3886-bl", &pdev->dev, NULL,
drivers/video/backlight/locomolcd.c +1 -0
@@ -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_GPU ; props.max_brightness =4 ; locomolcd_bl_device = backlight_device_register("locomo-bl", &ldev->dev, NULL,
drivers/video/backlight/mbp_nvidia_bl.c +1 -0
@@ -259,6 +259,7 @@ static int __init mbp_init(void)return -ENXIO ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_GPU ; props.max_brightness =15 ; mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, NULL,
drivers/video/backlight/omap1_bl.c +1 -0
@@ -145,6 +145,7 @@ static int omapbl_probe(struct platform_device *pdev)return -ENOMEM ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_GPU ; props.max_brightness =OMAPBL_MAX_INTENSITY ; dev =backlight_device_register ("omap-bl" , &pdev->dev, bl, &omapbl_ops, &props);
drivers/video/backlight/progear_bl.c +1 -0
@@ -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_GPU ; props.max_brightness =HW_LEVEL_MAX -HW_LEVEL_MIN ; progear_backlight_device = backlight_device_register("progear-bl", &pdev->dev, NULL,
drivers/video/backlight/pwm_bl.c +1 -0
@@ -102,6 +102,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_GPU ; props.max_brightness = data->max_brightness; bl =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, pb, &pwm_backlight_ops, &props);
drivers/video/backlight/tosa_bl.c +1 -0
@@ -101,6 +101,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, data->i2c = client;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_GPU ; props.max_brightness =512 -1 ; data->bl =backlight_device_register ("tosa-bl" , &client->dev, data, &bl_ops, &props);
drivers/video/backlight/wm831x_bl.c +1 -0
@@ -192,6 +192,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) data->current_brightness =0 ; data->isink_reg = isink_reg; + props.type =BACKLIGHT_GPU ; props.max_brightness = max_isel; bl =backlight_device_register ("wm831x" , &pdev->dev, data, &wm831x_backlight_ops, &props);
drivers/video/bf54x-lq043fb.c +1 -0
@@ -677,6 +677,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_GPU ; props.max_brightness =255 ; bl_dev =backlight_device_register ("bf54x-bl" ,NULL ,NULL , &bfin_lq043fb_bl_ops, &props);
drivers/video/bfin-t350mcqb-fb.c +1 -0
@@ -571,6 +571,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_GPU ; props.max_brightness =255 ; bl_dev =backlight_device_register ("bf52x-bl" ,NULL ,NULL , &bfin_lq043fb_bl_ops, &props);
drivers/video/nvidia/nv_backlight.c +1 -0
@@ -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_GPU ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, info->dev, par, &nvidia_bl_ops, &props);
drivers/video/omap2/displays/panel-taal.c +2 -0
@@ -530,6 +530,8 @@ static int taal_probe(struct omap_dss_device *dssdev) props.max_brightness =255 ; else props.max_brightness = 127; + + props.type =BACKLIGHT_GPU ; bldev =backlight_device_register ("taal" , &dssdev->dev, dssdev, &taal_bl_ops, &props);if (IS_ERR (bldev)) {
drivers/video/riva/fbdev.c +1 -0
@@ -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_GPU ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, info->dev, par, &riva_bl_ops, &props);
include/linux/backlight.h +8 -0
@@ -32,6 +32,12 @@ enum backlight_update_reason { BACKLIGHT_UPDATE_SYSFS, }; +enum backlight_type { +BACKLIGHT_GPU , +BACKLIGHT_PLATFORM , +BACKLIGHT_FIRMWARE , +}; +struct backlight_device ;struct fb_info ;
@@ -62,6 +68,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;
Signature · 1 line
1.6.6.1
Re: [PATCH 2/2] backlight: Add support for exposing backlight types
Quoted 3 lines · Matthew Garrett
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.
Firstly, I agree we need to solve this problem one way or another. I want to make that clear. We also need to make sure whatever solution we pick works for everyone and scales though.
What I'm interested in is how userspace is going to determine which driver(s) it should use?
BACKLIGHT_GPU > BACKLIGHT_PLATFORM > BACKLIGHT_FIRMWARE ?
or something looking at the device names as well along with some kind of "XXX is better than YYY"?
We should really have some indication of how these values can be interpreted in the kernel as documentation.
Documentation/ABI/stable/sysfs-class-backlight Contact: Richard Purdie <[email protected]> · line 46
Quoted 4 lines
Documentation/ABI/stable/sysfs-class-backlight +4
-0+ The type of interface controlled by <backlight>. + "firmware": The driver uses a standard firmware interface + "platform": The driver uses a platform-specific interface + "gpu": The driver controls hardware registers directly
These descriptions really don't help me much. I can think of several "platform" backlight drivers which control hardware registers directly. When people see these described as "gpu", I can see bug reports coming in. Would "raw" be a better description?
I'm also wondering how we associate backlights to displays. Lets say I have a three output video card which has a backlight control for each connected output. "gpu" isn't going to help me much and I suspect the framebuffer association code already in the backlight class won't help much either since nobody uses it and the framebuffer interfaces are mostly replaced with drm on desktops/laptops? Do we have any plans on how to handle this - its certainly a related problem.
As an aside for the patch itself, I'd like a note about the list of strings in backlight.c needing to be in sync with the ENUM.
Cheers,
Richard
Re: [PATCH 2/2] backlight: Add support for exposing backlight types
Quoted 4 lines · Richard Purdie
What I'm interested in is how userspace is going to determine which driver(s) it should use?
BACKLIGHT_GPU>BACKLIGHT_PLATFORM>BACKLIGHT_FIRMWARE?
Other way around, at least on x86. We generally want to use as abstract an approach as possible in order to ensure that we pick respond to changes that the firmware has made.
Quoted 2 lines
or something looking at the device names as well along with some kind of "XXX is better than YYY"?
In the hypothetical future where we can get plug-in displays with backlights yeah.
Quoted 9 lines
Documentation/ABI/stable/sysfs-class-backlight Contact: Richard Purdie <[email protected]> · line 46
Quoted 4 lines
Documentation/ABI/stable/sysfs-class-backlight +4
-0+ The type of interface controlled by <backlight>. + "firmware": The driver uses a standard firmware interface + "platform": The driver uses a platform-specific interface + "gpu": The driver controls hardware registers directlyThese descriptions really don't help me much. I can think of several "platform" backlight drivers which control hardware registers directly. When people see these described as "gpu", I can see bug reports coming in. Would "raw" be a better description?
Sure.
Quoted 7 lines
I'm also wondering how we associate backlights to displays. Lets say I have a three output video card which has a backlight control for each connected output. "gpu" isn't going to help me much and I suspect the framebuffer association code already in the backlight class won't help much either since nobody uses it and the framebuffer interfaces are mostly replaced with drm on desktops/laptops? Do we have any plans on how to handle this - its certainly a related problem.
Right now, control of anything other than internal displays is going to involve ddcci which is a whole different set of constraints. The only real way of handling that is going to be for userspace to look at the parent device of the backlight, I think.
Quoted 2 lines
As an aside for the patch itself, I'd like a note about the list of strings in
backlight.cneeding to be in sync with the ENUM.
Fair enough.
Signature · 1 line
Matthew Garrett | [email protected]
PATCH v2 2/2 backlight: Add support for exposing backlight types
In reply to Richard PurdieThere 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.
---
s/gpu/raw/, updated the documentation a little
Documentation/ABI/stable/sysfs-class-backlight | 20 ++++++++++++++++++++ drivers/acpi/video.c | 1 + drivers/gpu/drm/nouveau/nouveau_backlight.c | 2 ++ drivers/macintosh/via-pmu-backlight.c | 1 + drivers/platform/x86/acer-wmi.c | 1 + drivers/platform/x86/asus-laptop.c | 1 + drivers/platform/x86/asus_acpi.c | 1 + drivers/platform/x86/classmate-laptop.c | 1 + drivers/platform/x86/compal-laptop.c | 1 + drivers/platform/x86/dell-laptop.c | 1 + drivers/platform/x86/eeepc-laptop.c | 1 + drivers/platform/x86/fujitsu-laptop.c | 1 + drivers/platform/x86/msi-laptop.c | 1 + drivers/platform/x86/msi-wmi.c | 1 + drivers/platform/x86/panasonic-laptop.c | 1 + drivers/platform/x86/sony-laptop.c | 1 + drivers/platform/x86/thinkpad_acpi.c | 1 + drivers/platform/x86/toshiba_acpi.c | 1 + drivers/staging/samsung-laptop/samsung-laptop.c | 1 + drivers/usb/misc/appledisplay.c | 1 + drivers/video/atmel_lcdfb.c | 1 + drivers/video/aty/aty128fb.c | 1 + drivers/video/aty/atyfb_base.c | 1 + drivers/video/aty/radeon_backlight.c | 1 + drivers/video/backlight/adp5520_bl.c | 1 + drivers/video/backlight/adx_bl.c | 1 + drivers/video/backlight/atmel-pwm-bl.c | 1 + drivers/video/backlight/backlight.c | 16 ++++++++++++++++ drivers/video/backlight/corgi_lcd.c | 1 + drivers/video/backlight/da903x_bl.c | 1 + drivers/video/backlight/generic_bl.c | 1 + drivers/video/backlight/hp680_bl.c | 1 + drivers/video/backlight/jornada720_bl.c | 1 + drivers/video/backlight/kb3886_bl.c | 1 + drivers/video/backlight/locomolcd.c | 1 + drivers/video/backlight/mbp_nvidia_bl.c | 1 + drivers/video/backlight/omap1_bl.c | 1 + drivers/video/backlight/progear_bl.c | 1 + drivers/video/backlight/pwm_bl.c | 1 + drivers/video/backlight/tosa_bl.c | 1 + drivers/video/backlight/wm831x_bl.c | 1 + drivers/video/bf54x-lq043fb.c | 1 + drivers/video/bfin-t350mcqb-fb.c | 1 + drivers/video/nvidia/nv_backlight.c | 1 + drivers/video/omap2/displays/panel-taal.c | 2 ++ drivers/video/riva/fbdev.c | 1 + include/linux/backlight.h | 8 ++++++++ 47 files changed, 90 insertions(+), 0 deletions(-)
Documentation/ABI/stable/sysfs-class-backlight +20 -0
@@ -34,3 +34,23 @@ Contact: Richard Purdie <[email protected]> Description: Maximum brightness for <backlight>. Users: HAL + +What: /sys/class/backlight/<backlight>/type +Date: February 2010 +KernelVersion: 2.6.34 +Contact: Matthew Garrett <[email protected]> +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.
drivers/acpi/video.c +1 -0
@@ -1006,6 +1006,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)sprintf (name,"acpi_video%d" , 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,
drivers/gpu/drm/nouveau/nouveau_backlight.c +2 -0
@@ -97,6 +97,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);
@@ -120,6 +121,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);
drivers/macintosh/via-pmu-backlight.c +1 -0
@@ -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);
drivers/platform/x86/acer-wmi.c +1 -0
@@ -926,6 +926,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);
drivers/platform/x86/asus-laptop.c +1 -0
@@ -1365,6 +1365,7 @@ static int asus_backlight_init(struct device *dev)if (brightness_set_handle && lcd_switch_handle) {struct backlight_properties props;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =15 ; bd =backlight_device_register (ASUS_HOTK_FILE , dev,NULL , &asusbl_ops, &props);
drivers/platform/x86/asus_acpi.c +1 -0
@@ -1510,6 +1510,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,
drivers/platform/x86/classmate-laptop.c +1 -0
@@ -463,6 +463,7 @@ static int cmpc_bl_add(struct acpi_device *acpi)struct backlight_device *bd;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =7 ; bd =backlight_device_register ("cmpc_bl" , &acpi->dev, acpi->handle, &cmpc_bl_ops, &props);
drivers/platform/x86/compal-laptop.c +1 -0
@@ -328,6 +328,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 =COMPAL_LCD_LEVEL_MAX -1 ; compalbl_device = backlight_device_register("compal-laptop", NULL, NULL,
drivers/platform/x86/dell-laptop.c +1 -0
@@ -392,6 +392,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,
drivers/platform/x86/eeepc-laptop.c +1 -0
@@ -1117,6 +1117,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,
drivers/platform/x86/fujitsu-laptop.c +1 -0
@@ -1130,6 +1130,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,
drivers/platform/x86/msi-laptop.c +1 -0
@@ -353,6 +353,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,
drivers/platform/x86/msi-wmi.c +1 -0
@@ -251,6 +251,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,
drivers/platform/x86/panasonic-laptop.c +1 -0
@@ -649,6 +649,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);
drivers/platform/x86/sony-laptop.c +1 -0
@@ -1290,6 +1290,7 @@ static int sony_nc_add(struct acpi_device *device) &handle))) {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,
drivers/platform/x86/thinkpad_acpi.c +1 -0
@@ -6242,6 +6242,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) "detected a 16-level brightness capable ThinkPad\n");memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness = (tp_features.bright_16levels) ?15 :7 ; ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
drivers/platform/x86/toshiba_acpi.c +1 -0
@@ -784,6 +784,7 @@ static int __init toshiba_acpi_init(void) } } + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ; toshiba_backlight_device = backlight_device_register("toshiba", &toshiba_acpi.p_dev->dev,
drivers/staging/samsung-laptop/samsung-laptop.c +1 -0
@@ -485,6 +485,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 =MAX_BRIGHT ; backlight_device = backlight_device_register("samsung", &sdev->dev, NULL, &backlight_ops,
drivers/usb/misc/appledisplay.c +1 -0
@@ -281,6 +281,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_PLATFORM ; props.max_brightness =0xff ; pdata->bd =backlight_device_register (bl_name,NULL , pdata, &appledisplay_bl_data, &props);
drivers/video/atmel_lcdfb.c +1 -0
@@ -126,6 +126,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);
drivers/video/aty/aty128fb.c +1 -0
@@ -1819,6 +1819,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);
drivers/video/aty/atyfb_base.c +1 -0
@@ -2245,6 +2245,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);
drivers/video/aty/radeon_backlight.c +1 -0
@@ -157,6 +157,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);
drivers/video/backlight/adp5520_bl.c +1 -0
@@ -302,6 +302,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);
drivers/video/backlight/adx_bl.c +1 -0
@@ -103,6 +103,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);
drivers/video/backlight/atmel-pwm-bl.c +1 -0
@@ -167,6 +167,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);
drivers/video/backlight/backlight.c +16 -0
@@ -18,6 +18,13 @@#include <asm/backlight.h> #endif +/* This must be kept in sync with the type enum in include/linux/backlight.h */ +static const char *backlight_types[] = { +"raw" , +"platform" , +"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
@@ -168,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) {
@@ -233,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, };
drivers/video/backlight/corgi_lcd.c +1 -0
@@ -561,6 +561,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);
drivers/video/backlight/da903x_bl.c +1 -0
@@ -135,6 +135,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);
drivers/video/backlight/generic_bl.c +1 -0
@@ -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);
drivers/video/backlight/hp680_bl.c +1 -0
@@ -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);
drivers/video/backlight/jornada720_bl.c +1 -0
@@ -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);
drivers/video/backlight/kb3886_bl.c +1 -0
@@ -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,
drivers/video/backlight/locomolcd.c +1 -0
@@ -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,
drivers/video/backlight/mbp_nvidia_bl.c +1 -0
@@ -259,6 +259,7 @@ static int __init mbp_init(void)return -ENXIO ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =15 ; mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, NULL,
drivers/video/backlight/omap1_bl.c +1 -0
@@ -145,6 +145,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);
drivers/video/backlight/progear_bl.c +1 -0
@@ -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,
drivers/video/backlight/pwm_bl.c +1 -0
@@ -102,6 +102,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);
drivers/video/backlight/tosa_bl.c +1 -0
@@ -101,6 +101,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);
drivers/video/backlight/wm831x_bl.c +1 -0
@@ -192,6 +192,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);
drivers/video/bf54x-lq043fb.c +1 -0
@@ -677,6 +677,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);
drivers/video/bfin-t350mcqb-fb.c +1 -0
@@ -571,6 +571,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);
drivers/video/nvidia/nv_backlight.c +1 -0
@@ -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);
drivers/video/omap2/displays/panel-taal.c +2 -0
@@ -530,6 +530,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)) {
drivers/video/riva/fbdev.c +1 -0
@@ -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);
include/linux/backlight.h +8 -0
@@ -32,6 +32,12 @@ enum backlight_update_reason { BACKLIGHT_UPDATE_SYSFS, }; +enum backlight_type { +BACKLIGHT_RAW , +BACKLIGHT_PLATFORM , +BACKLIGHT_FIRMWARE , +}; +struct backlight_device ;struct fb_info ;
@@ -62,6 +68,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;
Signature · 1 line
1.6.6.1