Backlight: Add backlight type
Subsystems (30)
PATCH 1/5 Backlight: Add backlight type
There may be multiple ways of controlling the backlight on a given machine. Allow drivers to expose the type of interface they are providing, making it possible for userspace to make appropriate policy decisions.
--- Documentation/ABI/stable/sysfs-class-backlight | 20 ++++++++++++++++++++ drivers/acpi/video.c | 1 + drivers/gpu/drm/nouveau/nouveau_backlight.c | 2 ++ drivers/hid/hid-picolcd.c | 1 + 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/eeepc-wmi.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/olpc_dcon/olpc_dcon.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/88pm860x_bl.c | 1 + drivers/video/backlight/adp5520_bl.c | 1 + drivers/video/backlight/adp8860_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/cr_bllcd.c | 1 + drivers/video/backlight/da903x_bl.c | 1 + drivers/video/backlight/ep93xx_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/max8925_bl.c | 1 + drivers/video/backlight/mbp_nvidia_bl.c | 1 + drivers/video/backlight/omap1_bl.c | 1 + drivers/video/backlight/pcf50633-backlight.c | 1 + drivers/video/backlight/progear_bl.c | 1 + drivers/video/backlight/pwm_bl.c | 1 + drivers/video/backlight/s6e63m0.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/imxfb.c | 1 + drivers/video/nvidia/nv_backlight.c | 1 + drivers/video/omap2/displays/panel-acx565akm.c | 1 + .../video/omap2/displays/panel-sharp-ls037v7dw01.c | 1 + drivers/video/omap2/displays/panel-taal.c | 2 ++ drivers/video/riva/fbdev.c | 1 + include/linux/backlight.h | 8 ++++++++ 60 files changed, 102 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: September 2010 +KernelVersion: 2.6.37 +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
@@ -856,6 +856,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) count++;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_FIRMWARE ; props.max_brightness = device->brightness->count -3 ; device->backlight = backlight_device_register(name, NULL, device, &acpi_backlight_ops,
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/hid/hid-picolcd.c +1 -0
@@ -944,6 +944,7 @@ static int picolcd_init_backlight(struct picolcd_data *data, struct hid_report * }memset (&props,0 ,sizeof (props)); + props.type =BACKLIGHT_RAW ; props.max_brightness =0xff ; bdev =backlight_device_register (dev_name (dev), dev, data, &picolcd_blops, &props);
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
@@ -648,6 +648,7 @@ static int asus_backlight_init(struct asus_laptop *asus)memset (&props,0 ,sizeof (struct backlight_properties )); props.max_brightness =15 ; + props.type =BACKLIGHT_PLATFORM ; bd = backlight_device_register(ASUS_LAPTOP_FILE, &asus->platform_device->dev, asus,
drivers/platform/x86/asus_acpi.c +1 -0
@@ -1513,6 +1513,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
@@ -562,6 +562,7 @@ static int cmpc_ipml_add(struct acpi_device *acpi)return -ENOMEM ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =7 ; ipml->bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle, &cmpc_bl_ops,
drivers/platform/x86/compal-laptop.c +1 -0
@@ -962,6 +962,7 @@ static int __init compal_init(void)if (!acpi_video_backlight_support ()) {struct backlight_properties props;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =BACKLIGHT_LEVEL_MAX ; compalbl_device = backlight_device_register(DRIVER_NAME, NULL, NULL,
drivers/platform/x86/dell-laptop.c +1 -0
@@ -651,6 +651,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
@@ -1136,6 +1136,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/eeepc-wmi.c +1 -0
@@ -233,6 +233,7 @@ static int eeepc_wmi_backlight_init(struct eeepc_wmi *eeepc)memset (&props,0 ,sizeof (struct backlight_properties )); props.max_brightness =15 ; + props.type =BACKLIGHT_PLATFORM ; bd =backlight_device_register (EEEPC_WMI_FILE , &platform_device->dev, eeepc, &eeepc_wmi_bl_ops, &props);
drivers/platform/x86/fujitsu-laptop.c +1 -0
@@ -1128,6 +1128,7 @@ static int __init fujitsu_init(void)memset (&props,0 ,sizeof (struct backlight_properties )); max_brightness = fujitsu->max_brightness; + props.type =BACKLIGHT_PLATFORM ; props.max_brightness = max_brightness -1 ; fujitsu->bl_device = backlight_device_register("fujitsu-laptop", NULL, NULL,
drivers/platform/x86/msi-laptop.c +1 -0
@@ -804,6 +804,7 @@ static int __init msi_init(void) }else {struct backlight_properties props;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =MSI_LCD_LEVEL_MAX -1 ; msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL, &msibl_ops,
drivers/platform/x86/msi-wmi.c +1 -0
@@ -252,6 +252,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
@@ -602,6 +602,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) }/* initialize backlight */ memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT ]; pcc->backlight =backlight_device_register ("panasonic" ,NULL , pcc, &pcc_backlight_ops, &props);
drivers/platform/x86/sony-laptop.c +1 -0
@@ -1297,6 +1297,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
@@ -6310,6 +6310,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm)return 1 ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness = bright_maxlvl; props.brightness = b &TP_EC_BACKLIGHT_LVLMSK ; ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME,
drivers/platform/x86/toshiba_acpi.c +1 -0
@@ -1017,6 +1017,7 @@ static int __init toshiba_acpi_init(void)create_toshiba_proc_entries (); } + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ; toshiba_backlight_device = backlight_device_register("toshiba", &toshiba_acpi.p_dev->dev,
drivers/staging/olpc_dcon/olpc_dcon.c +1 -0
@@ -718,6 +718,7 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id) }else { dcon_bl_dev->props.max_brightness =15 ; + dcon_bl_dev->props.type =BACKLIGHT_RAW ; dcon_bl_dev->props.power =FB_BLANK_UNBLANK ; dcon_bl_dev->props.brightness =dcon_get_backlight ();
drivers/staging/samsung-laptop/samsung-laptop.c +1 -0
@@ -488,6 +488,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
@@ -282,6 +282,7 @@ static int appledisplay_probe(struct usb_interface *iface,snprintf (bl_name,sizeof (bl_name),"appledisplay%d" ,atomic_inc_return (&count_displays) -1 );memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =0xff ; pdata->bd =backlight_device_register (bl_name,NULL , pdata, &appledisplay_bl_data, &props);
drivers/video/atmel_lcdfb.c +1 -0
@@ -127,6 +127,7 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)return ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =0xff ; bl =backlight_device_register ("backlight" , &sinfo->pdev->dev, sinfo, &atmel_lcdc_bl_ops, &props);
drivers/video/aty/aty128fb.c +1 -0
@@ -1818,6 +1818,7 @@ static void aty128_bl_init(struct aty128fb_par *par)snprintf (name,sizeof (name),"aty128bl%d" , info->node);memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, info->dev, par, &aty128_bl_data, &props);
drivers/video/aty/atyfb_base.c +1 -0
@@ -2241,6 +2241,7 @@ static void aty_bl_init(struct atyfb_par *par)snprintf (name,sizeof (name),"atybl%d" , info->node);memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, info->dev, par, &aty_bl_data, &props);
drivers/video/aty/radeon_backlight.c +1 -0
@@ -158,6 +158,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)snprintf (name,sizeof (name),"radeonbl%d" , rinfo->info->node);memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =FB_BACKLIGHT_LEVELS -1 ; bd =backlight_device_register (name, rinfo->info->dev, pdata, &radeon_bl_data, &props);
drivers/video/backlight/88pm860x_bl.c +1 -0
@@ -227,6 +227,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev) }memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =MAX_BRIGHTNESS ; bl =backlight_device_register (name, &pdev->dev, data, &pm860x_backlight_ops, &props);
drivers/video/backlight/adp5520_bl.c +1 -0
@@ -303,6 +303,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)mutex_init (&data->lock);memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =ADP5020_MAX_BRIGHTNESS ; bl =backlight_device_register (pdev->name, data->master, data, &adp5520_bl_ops, &props);
drivers/video/backlight/adp8860_bl.c +1 -0
@@ -709,6 +709,7 @@ static int __devinit adp8860_probe(struct i2c_client *client,i2c_set_clientdata (client, data);memset (&props,0 ,sizeof (props)); + props.type =BACKLIGHT_RAW ; props.max_brightness =ADP8860_MAX_BRIGHTNESS ;mutex_init (&data->lock);
drivers/video/backlight/adx_bl.c +1 -0
@@ -104,6 +104,7 @@ static int __devinit adx_backlight_probe(struct platform_device *pdev) }memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =0xff ; bldev =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, bl, &adx_backlight_ops, &props);
drivers/video/backlight/atmel-pwm-bl.c +1 -0
@@ -168,6 +168,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) }memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; bldev =backlight_device_register ("atmel-pwm-bl" , &pdev->dev, pwmbl, &atmel_pwm_bl_ops, &props);
drivers/video/backlight/backlight.c +15 -0
@@ -19,6 +19,12 @@#include <asm/backlight.h> #endif +static const char *backlight_types[] = { + [BACKLIGHT_RAW ] ="raw" , + [BACKLIGHT_PLATFORM ] ="platform" , + [BACKLIGHT_FIRMWARE ] ="firmware" , +}; +#if defined(CONFIG_FB ) || (defined(CONFIG_FB_MODULE ) && \ defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE ))/* This callback gets called when something important happens inside a
@@ -169,6 +175,14 @@ static ssize_t backlight_store_brightness(struct device *dev,return rc; } +static ssize_t backlight_show_type (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct backlight_device *bd =to_backlight_device (dev); + +return sprintf (buf,"%s\n" , backlight_types[bd->props.type]); +} +static ssize_t backlight_show_max_brightness (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -234,6 +248,7 @@ static struct device_attribute bl_device_attributes[] = {__ATTR (actual_brightness,0444 , backlight_show_actual_brightness,NULL ),__ATTR (max_brightness,0444 , backlight_show_max_brightness,NULL ), +__ATTR (type,0444 , backlight_show_type,NULL ), __ATTR_NULL, };
drivers/video/backlight/corgi_lcd.c +1 -0
@@ -562,6 +562,7 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi) lcd->mode = (pdata) ? pdata->init_mode :CORGI_LCD_MODE_VGA ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness = pdata->max_intensity; lcd->bl_dev =backlight_device_register ("corgi_bl" , &spi->dev, lcd, &corgi_bl_ops, &props);
drivers/video/backlight/cr_bllcd.c +1 -0
@@ -193,6 +193,7 @@ static int cr_backlight_probe(struct platform_device *pdev) }memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; bdp =backlight_device_register ("cr-backlight" , &pdev->dev,NULL , &cr_backlight_ops, &props);if (IS_ERR (bdp)) {
drivers/video/backlight/da903x_bl.c +1 -0
@@ -136,6 +136,7 @@ static int da903x_backlight_probe(struct platform_device *pdev)da903x_write (data->da903x_dev,DA9034_WLED_CONTROL2 ,DA9034_WLED_ISET (pdata->output_current)); + props.type =BACKLIGHT_RAW ; props.max_brightness = max_brightness; bl =backlight_device_register (pdev->name, data->da903x_dev, data, &da903x_backlight_ops, &props);
drivers/video/backlight/ep93xx_bl.c +1 -0
@@ -87,6 +87,7 @@ static int __init ep93xxbl_probe(struct platform_device *dev) ep93xxbl->mmio =EP93XX_RASTER_BRIGHTNESS ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =EP93XX_MAX_BRIGHT ; bl =backlight_device_register (dev->name, &dev->dev, ep93xxbl, &ep93xxbl_ops, &props);
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/max8925_bl.c +1 -0
@@ -136,6 +136,7 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) data->current_brightness =0 ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =MAX_BRIGHTNESS ; bl =backlight_device_register (name, &pdev->dev, data, &max8925_backlight_ops, &props);
drivers/video/backlight/mbp_nvidia_bl.c +1 -0
@@ -367,6 +367,7 @@ static int __init mbp_init(void)return -ENXIO ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_PLATFORM ; props.max_brightness =15 ; mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, NULL,
drivers/video/backlight/omap1_bl.c +1 -0
@@ -146,6 +146,7 @@ static int omapbl_probe(struct platform_device *pdev)return -ENOMEM ;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =OMAPBL_MAX_INTENSITY ; dev =backlight_device_register ("omap-bl" , &pdev->dev, bl, &omapbl_ops, &props);
drivers/video/backlight/pcf50633-backlight.c +1 -0
@@ -112,6 +112,7 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev)if (!pcf_bl)return -ENOMEM ; + bl_props.type =BACKLIGHT_RAW ; bl_props.max_brightness =0x3f ; bl_props.power =FB_BLANK_UNBLANK ;
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
@@ -108,6 +108,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)dev_dbg (&pdev->dev,"got pwm for backlight\n" );memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness = data->max_brightness; bl =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, pb, &pwm_backlight_ops, &props);
drivers/video/backlight/s6e63m0.c +1 -0
@@ -778,6 +778,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi) bd->props.max_brightness =MAX_BRIGHTNESS ; bd->props.brightness =MAX_BRIGHTNESS ; + bd->props.type =BACKLIGHT_RAW ; lcd->bd = bd;/*
drivers/video/backlight/tosa_bl.c +1 -0
@@ -102,6 +102,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, data->i2c = client;memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =512 -1 ; data->bl =backlight_device_register ("tosa-bl" , &client->dev, data, &bl_ops, &props);
drivers/video/backlight/wm831x_bl.c +1 -0
@@ -193,6 +193,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) data->current_brightness =0 ; data->isink_reg = isink_reg; + props.type =BACKLIGHT_RAW ; props.max_brightness = max_isel; bl =backlight_device_register ("wm831x" , &pdev->dev, data, &wm831x_backlight_ops, &props);
drivers/video/bf54x-lq043fb.c +1 -0
@@ -649,6 +649,7 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev) }#ifndef NO_BL_SUPPORT memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =255 ; bl_dev =backlight_device_register ("bf54x-bl" ,NULL ,NULL , &bfin_lq043fb_bl_ops, &props);
drivers/video/bfin-t350mcqb-fb.c +1 -0
@@ -545,6 +545,7 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) }#ifndef NO_BL_SUPPORT memset (&props,0 ,sizeof (struct backlight_properties )); + props.type =BACKLIGHT_RAW ; props.max_brightness =255 ; bl_dev =backlight_device_register ("bf52x-bl" ,NULL ,NULL , &bfin_lq043fb_bl_ops, &props);
drivers/video/imxfb.c +1 -0
@@ -502,6 +502,7 @@ static void imxfb_init_backlight(struct imxfb_info *fbi)memset (&props,0 ,sizeof (struct backlight_properties )); props.max_brightness =0xff ; + props.type =BACKLIGHT_RAW ;writel (fbi->pwmr, fbi->regs +LCDC_PWMR ); bl = backlight_device_register("imxfb-bl", &fbi->pdev->dev, fbi,
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-acx565akm.c +1 -0
@@ -534,6 +534,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev) props.fb_blank =FB_BLANK_UNBLANK ; props.power =FB_BLANK_UNBLANK ; + props.type =BACKLIGHT_RAW ; bldev =backlight_device_register ("acx565akm" , &md->spi->dev, md, &acx565akm_bl_ops, &props);
drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c +1 -0
@@ -99,6 +99,7 @@ static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)memset (&props,0 ,sizeof (struct backlight_properties )); props.max_brightness = dssdev->max_backlight_level; + props.type =BACKLIGHT_RAW ; bl =backlight_device_register ("sharp-ls" , &dssdev->dev, dssdev, &sharp_ls_bl_ops, &props);
drivers/video/omap2/displays/panel-taal.c +2 -0
@@ -729,6 +729,8 @@ static int taal_probe(struct omap_dss_device *dssdev) props.max_brightness =255 ; else props.max_brightness = 127; + + props.type =BACKLIGHT_RAW ; bldev =backlight_device_register ("taal" , &dssdev->dev, dssdev, &taal_bl_ops, &props);if (IS_ERR (bldev)) {
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.7.3.2
PATCH 2/5 i915: Add native backlight control
Not all systems expose a firmware or platform mechanism for changing the backlight intensity on i915, so add native driver support.
--- drivers/gpu/drm/i915/i915_drv.h | 4 ++ drivers/gpu/drm/i915/intel_dp.c | 7 +++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_lvds.c | 5 ++ drivers/gpu/drm/i915/intel_opregion.c | 1 - drivers/gpu/drm/i915/intel_panel.c | 67 +++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -36,6 +36,7 @@#include <linux/io-mapping.h> #include <linux/i2c.h> #include <drm/intel-gtt.h> +#include <linux/backlight.h> /* General customization: */
@@ -679,6 +680,7 @@ typedef struct drm_i915_private {int child_dev_num;struct child_device_config *child_dev;struct drm_connector *int_lvds_connector; +struct drm_connector *int_edp_connector;bool mchbar_need_disable;
@@ -707,6 +709,8 @@ typedef struct drm_i915_private {/* list of fbdev register on this device */ struct intel_fbdev *fbdev; + +struct backlight_device *backlight; } drm_i915_private_t;/** driver private structure attached to each drm_gem_object */
drivers/gpu/drm/i915/intel_dp.c +7 -0
@@ -1639,6 +1639,11 @@ done:static void intel_dp_destroy (struct drm_connector *connector) { +struct drm_device *dev = connector->dev; + +if (intel_dpd_is_edp (dev)) +intel_panel_backlight_destroy (dev); +drm_sysfs_connector_remove (connector);drm_connector_cleanup (connector);kfree (connector);
@@ -1868,6 +1873,8 @@ intel_dp_init(struct drm_device *dev, int output_reg)DRM_MODE_TYPE_PREFERRED ; } } + dev_priv->int_edp_connector = connector; +intel_panel_backlight_setup (dev); }intel_dp_add_properties (intel_dp, connector);
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -256,6 +256,8 @@ extern void intel_pch_panel_fitting(struct drm_device *dev,extern u32 intel_panel_get_max_backlight (struct drm_device *dev);extern u32 intel_panel_get_backlight (struct drm_device *dev);extern void intel_panel_set_backlight (struct drm_device *dev,u32 level); +extern int intel_panel_backlight_setup (struct drm_device *dev); +extern void intel_panel_backlight_destroy (struct drm_device *dev);extern void intel_crtc_load_lut (struct drm_crtc *crtc);extern void intel_encoder_prepare (struct drm_encoder *encoder);
drivers/gpu/drm/i915/intel_lvds.c +5 -0
@@ -569,6 +569,8 @@ static void intel_lvds_destroy(struct drm_connector *connector)struct drm_device *dev = connector->dev;struct drm_i915_private *dev_priv = dev->dev_private; +intel_panel_backlight_destroy (dev); +if (dev_priv->lid_notifier.notifier_call)acpi_lid_notifier_unregister (&dev_priv->lid_notifier);drm_sysfs_connector_remove (connector);
@@ -1026,6 +1028,9 @@ out:/* keep the LVDS connector */ dev_priv->int_lvds_connector = connector;drm_sysfs_connector_add (connector); + +intel_panel_backlight_setup (dev); +return ; failed:
drivers/gpu/drm/i915/intel_opregion.c +0 -1
@@ -224,7 +224,6 @@ void intel_opregion_asle_intr(struct drm_device *dev) asle->aslc = asle_stat; } -/* Only present on Ironlake+ */ void intel_opregion_gse_intr (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_panel.c +67 -0
70 lines not on this page · raw message
Signature · 1 line
1.7.3.2
PATCH 3/5 radeon: Expose backlight class device for legacy LVDS encoder
In reply to Matthew GarrettFrom: Michel Dänzer <[email protected]>
Allows e.g. power management daemons to control the backlight level. Inspired by the corresponding code in radeonfb.
(Updated to add backlight type and make the connector the parent device - mjg)
--- drivers/gpu/drm/radeon/Kconfig | 1 + drivers/gpu/drm/radeon/radeon_connectors.c | 15 ++ drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 257 ++++++++++++++++++++++- drivers/gpu/drm/radeon/radeon_mode.h | 10 + 4 files changed, 277 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/Kconfig +1 -0
@@ -1,6 +1,7 @@ config DRM_RADEON_KMS bool "Enable modesetting on radeon by default - NEW DRIVER" depends on DRM_RADEON + select BACKLIGHT_CLASS_DEVICE help Choose this option if you want kernel modesetting enabled by default.
drivers/gpu/drm/radeon/radeon_connectors.c +15 -0
@@ -40,6 +40,10 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,struct drm_encoder *encoder, bool connected); +extern void +radeon_legacy_backlight_init (struct radeon_encoder *radeon_encoder, +struct drm_connector *drm_connector); +void radeon_connector_hotplug (struct drm_connector *connector) {struct drm_device *dev = connector->dev;
@@ -1462,6 +1466,17 @@ radeon_add_legacy_connector(struct drm_device *dev, connector->polled =DRM_CONNECTOR_POLL_HPD ; connector->display_info.subpixel_order = subpixel_order;drm_sysfs_connector_add (connector); +if (connector_type ==DRM_MODE_CONNECTOR_LVDS ) { +struct drm_encoder *drm_encoder; + +list_for_each_entry (drm_encoder, &dev->mode_config.encoder_list, head) { +struct radeon_encoder *radeon_encoder; + + radeon_encoder =to_radeon_encoder (drm_encoder); +if (radeon_encoder->encoder_id ==ENCODER_OBJECT_ID_INTERNAL_LVDS ) +radeon_legacy_backlight_init (radeon_encoder, connector); + } + }return ; failed:
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +251 -6
312 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_mode.h +10 -0
@@ -297,6 +297,11 @@ struct radeon_encoder_lvds {uint32_t lvds_gen_cntl;/* panel mode */ struct drm_display_mode native_mode; +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE +struct backlight_device *bl_dev; +int dpms_mode; +uint8_t backlight_level; +#endif };struct radeon_encoder_tv_dac {
@@ -350,6 +355,11 @@ struct radeon_encoder_atom_dig {uint32_t lcd_ss_id;/* panel mode */ struct drm_display_mode native_mode; +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE +struct backlight_device *bl_dev; +int dpms_mode; +uint8_t backlight_level; +#endif };struct radeon_encoder_atom_dac {
Signature · 1 line
1.7.3.2
PATCH 4/5 nouveau: Change the backlight parent device to the connector, not the PCI dev
In reply to Matthew GarrettWe may eventually end up with per-connector backlights, especially with ddcci devices. Make sure that the parent node for the backlight device is the connector rather than the PCI device.
--- drivers/gpu/drm/nouveau/nouveau_backlight.c | 21 ++++++++++++--------- drivers/gpu/drm/nouveau/nouveau_connector.c | 9 +++++++++ drivers/gpu/drm/nouveau/nouveau_drv.h | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +12 -9
@@ -87,10 +87,11 @@ static struct backlight_ops nv50_bl_ops = { .update_status = nv50_set_intensity, }; -static int nouveau_nv40_backlight_init (struct drm_device *dev) +static int nouveau_nv40_backlight_init (struct drm_connector *connector) { -struct backlight_properties props; +struct drm_device *dev = connector->dev;struct drm_nouveau_private *dev_priv = dev->dev_private; +struct backlight_properties props;struct backlight_device *bd;if (!(nv_rd32 (dev,NV40_PMC_BACKLIGHT ) &NV40_PMC_BACKLIGHT_MASK ))
@@ -99,7 +100,7 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)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, + bd =backlight_device_register ("nv_backlight" , &connector->kdev, dev, &nv40_bl_ops, &props);if (IS_ERR (bd))return PTR_ERR (bd);
@@ -111,10 +112,11 @@ static int nouveau_nv40_backlight_init(struct drm_device *dev)return 0 ; } -static int nouveau_nv50_backlight_init (struct drm_device *dev) +static int nouveau_nv50_backlight_init (struct drm_connector *connector) { -struct backlight_properties props; +struct drm_device *dev = connector->dev;struct drm_nouveau_private *dev_priv = dev->dev_private; +struct backlight_properties props;struct backlight_device *bd;if (!nv_rd32 (dev,NV50_PDISPLAY_SOR_BACKLIGHT ))
@@ -123,7 +125,7 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev)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, + bd =backlight_device_register ("nv_backlight" , &connector->kdev, dev, &nv50_bl_ops, &props);if (IS_ERR (bd))return PTR_ERR (bd);
@@ -134,15 +136,16 @@ static int nouveau_nv50_backlight_init(struct drm_device *dev)return 0 ; } -int nouveau_backlight_init (struct drm_device *dev) +int nouveau_backlight_init (struct drm_connector *connector) { +struct drm_device *dev = connector->dev;struct drm_nouveau_private *dev_priv = dev->dev_private;switch (dev_priv->card_type) {case NV_40 : -return nouveau_nv40_backlight_init (dev); +return nouveau_nv40_backlight_init (connector);case NV_50 : -return nouveau_nv50_backlight_init (dev); +return nouveau_nv50_backlight_init (connector);default :break ; }
drivers/gpu/drm/nouveau/nouveau_connector.c +9 -0
@@ -106,6 +106,10 @@ nouveau_connector_destroy(struct drm_connector *drm_connector) dev = nv_connector->base.dev;NV_DEBUG_KMS (dev,"\n" ); +if (drm_connector->connector_type ==DRM_MODE_CONNECTOR_LVDS || + drm_connector->connector_type == DRM_MODE_CONNECTOR_eDP) +nouveau_backlight_exit (dev); +kfree (nv_connector->edid);drm_sysfs_connector_remove (drm_connector);drm_connector_cleanup (drm_connector);
@@ -894,6 +898,11 @@ nouveau_connector_create(struct drm_device *dev, int index)nouveau_connector_set_polling (connector);drm_sysfs_connector_add (connector); + +if (connector->connector_type ==DRM_MODE_CONNECTOR_LVDS || + connector->connector_type == DRM_MODE_CONNECTOR_eDP) +nouveau_backlight_init (connector); + dcb->drm = connector;return dcb->drm;
drivers/gpu/drm/nouveau/nouveau_drv.h +2 -2
@@ -933,10 +933,10 @@ static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector/* nouveau_backlight.c */ #ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT -extern int nouveau_backlight_init (struct drm_device *); +extern int nouveau_backlight_init (struct drm_connector *);extern void nouveau_backlight_exit (struct drm_device *);#else -static inline int nouveau_backlight_init (struct drm_device *dev) +static inline int nouveau_backlight_init (struct drm_connector *dev) {return 0 ; }
Signature · 1 line
1.7.3.2
PATCH 5/5 ACPI: Tie ACPI backlight devices to PCI devices if possible
In reply to Matthew GarrettDual-GPU machines may provide more than one ACPI backlight interface. Tie the backlight device to the GPU in order to allow userspace to identify the correct interface.
--- drivers/acpi/video.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)
drivers/acpi/video.c +14 -1
@@ -843,6 +843,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)if (acpi_video_backlight_support ()) {struct backlight_properties props; +struct pci_dev *pdev; +acpi_handle acpi_parent; +struct device *parent =NULL ;int result;static int count =0 ;char *name;
@@ -855,10 +858,20 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)return ; count++; +acpi_get_parent (device->dev->handle, &acpi_parent); + + pdev =acpi_get_pci_dev (acpi_parent); +if (pdev) { + parent = &pdev->dev; +pci_dev_put (pdev); + } +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, + device->backlight =backlight_device_register (name, + parent, + device, &acpi_backlight_ops, &props);kfree (name);
Signature · 1 line
1.7.3.2
Quoted 7 lines · On Fri, 19 Nov 2010 10:53:52 -0500 Matthew Garrett <[email protected]> wrote:
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.
...
60 files changed, 102 insertions(+), 0 deletions(-)
This patch has a pretty short half-life.
Quoted 19 lines
...
include/linux/backlight.h +6
-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 ;
include/linux/backlight.h struct backlight_properties { · line 75
Quoted 8 lines
include/linux/backlight.h +2
-0@@ -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;
And if/when the half-life expires, we'll have drivers in-tree which forget to set backlight_properties.type. I haven't checked, but if we're lucky they will default to "0".
What will be the runtime effects upon such unconverted drivers? Ideally we'd like them to continue to work OK, and to emit a runtime warning. In which case you'll need BACKLIGHT_RAW=1 so the unconverted driver can be detected, warned about and fixed up by the core code.
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Fri, 19 Nov 2010 10:53:52 -0500 Matthew Garrett <[email protected]> wrote:
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.
Quoted 5 lines
Quoted 3 lines
...
60 files changed, 102 insertions(+), 0 deletions(-)This patch has a pretty short half-life.
Well, ideally it would have landed in the backlight tree when I sent it months ago. Then we'd have the opportunity to ensure that everything was fixed up before it went in in the merge window.
Quoted 5 lines
Quoted 5 lines
include/linux/backlight.h +1
-0@@ -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 */
Quoted 8 lines
include/linux/backlight.h struct backlight_properties { · line 75
Quoted 4 lines
include/linux/backlight.h +1
-0+enum backlight_type type;/* Flags used to signal drivers of state changes */ /* Upper 4 bits are reserved for driver internal use */ unsigned int state;And if/when the half-life expires, we'll have drivers in-tree which forget to set backlight_properties.type. I haven't checked, but if we're lucky they will default to "0".
Depends entirely on whether they kzalloc the structure or not before calling backlight_device_register().
Quoted 4 lines
What will be the runtime effects upon such unconverted drivers? Ideally we'd like them to continue to work OK, and to emit a runtime warning. In which case you'll need BACKLIGHT_RAW=1 so the unconverted driver can be detected, warned about and fixed up by the core code.
The worst case I can think of is that we walk off the array - I guess there's an argument for sanity checking that in backlight_show_type().
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 10 lines · On Fri, 19 Nov 2010 20:25:59 +0000 Matthew Garrett <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Fri, 19 Nov 2010 10:53:52 -0500 Matthew Garrett <[email protected]> wrote:
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.
...
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
60 files changed, 102 insertions(+), 0 deletions(-)This patch has a pretty short half-life.
Well, ideally it would have landed in the backlight tree when I sent it months ago. Then we'd have the opportunity to ensure that everything was fixed up before it went in in the merge window.
Richard got distracted. At present I'm grabbing the leds and backlight patches and Richard is reviewing them as they fly past.
I don't see there's much point in me merging this patch series so if it survives review, I'd suggest that you put it into an mjg tree and thence into linux-next and mainline?
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
include/linux/backlight.h +1
-0@@ -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 */ Quoted 8 lines
include/linux/backlight.h struct backlight_properties { · line 75
Quoted 4 lines
include/linux/backlight.h +1
-0+enum backlight_type type;/* Flags used to signal drivers of state changes */ /* Upper 4 bits are reserved for driver internal use */ unsigned int state;And if/when the half-life expires, we'll have drivers in-tree which forget to set backlight_properties.type. I haven't checked, but if we're lucky they will default to "0".
Quoted 2 lines
Depends entirely on whether they kzalloc the structure or not before calling
backlight_device_register().
Well. Even if it's uninitialised, the chances of the value being 1, 2 or 3 for all users are pretty small, so we'll still get to hear about it if the runtime check is appropriately implemented.
Quoted 7 lines
Quoted 4 lines
What will be the runtime effects upon such unconverted drivers? Ideally we'd like them to continue to work OK, and to emit a runtime warning. In which case you'll need BACKLIGHT_RAW=1 so the unconverted driver can be detected, warned about and fixed up by the core code.
The worst case I can think of is that we walk off the array - I guess there's an argument for sanity checking that in
backlight_show_type().
OK, well please have a think about it, see what you can do to handle unconverted (and possibly out-of-tree) drivers in a friendly fashion.
Quoted 35 lines · Matthew Garrett
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Fri, 19 Nov 2010 10:53:52 -0500 Matthew Garrett <[email protected]> wrote:
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.
Quoted 5 lines
Quoted 3 lines
...
60 files changed, 102 insertions(+), 0 deletions(-)This patch has a pretty short half-life.
Well, ideally it would have landed in the backlight tree when I sent it months ago. Then we'd have the opportunity to ensure that everything was fixed up before it went in in the merge window.
Quoted 5 lines
Quoted 5 lines
include/linux/backlight.h +1
-0@@ -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 */ Quoted 8 lines
include/linux/backlight.h struct backlight_properties { · line 75
Quoted 4 lines
include/linux/backlight.h +1
-0+enum backlight_type type;/* Flags used to signal drivers of state changes */ /* Upper 4 bits are reserved for driver internal use */ unsigned int state;And if/when the half-life expires, we'll have drivers in-tree which forget to set backlight_properties.type. I haven't checked, but if we're lucky they will default to "0".
Depends entirely on whether they kzalloc the structure or not before calling
backlight_device_register().
Quoted 7 lines
Quoted 4 lines
What will be the runtime effects upon such unconverted drivers? Ideally we'd like them to continue to work OK, and to emit a runtime warning. In which case you'll need BACKLIGHT_RAW=1 so the unconverted driver can be detected, warned about and fixed up by the core code.
The worst case I can think of is that we walk off the array - I guess there's an argument for sanity checking that in
backlight_show_type().
I think adding a BACKLIGHT_TYPEUNKNOWN as the first item in the enum, sanity checking the array bounds and printing a warning if type is not one of the defined values would be good.
I also want to make sure you think this patch is going to scale with multiple GPU output machines? Thats the main reason I've held off any patch like this as it doesn't help solve that problem as far as I can tell. Yes, we have the device parent information and I see later in the patch series you ensure the backlight is registered against the connector which is good. If you have an ACPI "firmware" control that you say should always be preferred, how do we know which connector device that corresponds to in the multiple output case? From that point of view this model falls apart?
What I really want to avoid is a new interface which just papers over cracks, only to have everything crumble anyway.
Cheers,
Richard
Quoted 9 lines · Richard Purdie
I also want to make sure you think this patch is going to scale with multiple GPU output machines? Thats the main reason I've held off any patch like this as it doesn't help solve that problem as far as I can tell. Yes, we have the device parent information and I see later in the patch series you ensure the backlight is registered against the connector which is good. If you have an ACPI "firmware" control that you say should always be preferred, how do we know which connector device that corresponds to in the multiple output case? From that point of view this model falls apart?
The ACPI device will point at the correct PCI device. Associating it with the appropriate connector is theoretically possible in the case of open drivers, but I hadn't seen it as a high priority since (in practice) there's no situations where an ACPI interface will be able to control more than one backlight.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 12 lines · Matthew Garrett
Quoted 9 lines · Richard Purdie
I also want to make sure you think this patch is going to scale with multiple GPU output machines? Thats the main reason I've held off any patch like this as it doesn't help solve that problem as far as I can tell. Yes, we have the device parent information and I see later in the patch series you ensure the backlight is registered against the connector which is good. If you have an ACPI "firmware" control that you say should always be preferred, how do we know which connector device that corresponds to in the multiple output case? From that point of view this model falls apart?
Quoted 5 lines
The ACPI device will point at the correct PCI device. Associating it with the appropriate connector is theoretically possible in the case of open drivers, but I hadn't seen it as a high priority since (in practice) there's no situations where an ACPI interface will be able to control more than one backlight.
Its the reverse situation I worry about. Are there situations where there are multiple connectors on the PCI device and the ACPI interface just controls one of them but controls for the other connectors may exist?
I'm typing this with an external monitor plugged into my laptop with i915 graphics...
Cheers,
Richard
Quoted 4 lines · Richard Purdie
Its the reverse situation I worry about. Are there situations where there are multiple connectors on the PCI device and the ACPI interface just controls one of them but controls for the other connectors may exist?
Yes, that's certainly possible and it'd be desirable to fix this up, but the same problem also applies to platform interfaces and it's typically unfixable there. My userspace implementation looks at the connector type to determine the best approach - if it's not LVDS or eDP it ignores the firmware and platform interfaces, so you'll fall back to the raw interface if it can provide support for your connector (presumably via ddcci, although we don't have this implemented yet)
Signature · 1 line
Matthew Garrett | [email protected]