Re: [PATCH v16 01/10] video: backlight: Add helpers to enable and disable backlight

From: Noralf TrÃnnes
Date: Wed Jan 17 2018 - 17:03:43 EST



Den 17.01.2018 18.00, skrev Daniel Thompson:


On 16/01/18 10:31, Meghana Madhyastha wrote:
Add helper functions backlight_enable and backlight_disable to
enable/disable a backlight device. These helper functions can
then be used by different drm and tinydrm drivers to avoid
repetition of code and also to enforce a uniform and consistent
way to enable/disable a backlight device.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@xxxxxxxxx>

To be clear I don't disagree with anthing Daniel V. said about the horribly confused (and confusing) power states for backlight.

Nevertheless I don't recall seeing any response (positive or negative) to this post from v13:
https://www.spinics.net/lists/dri-devel/msg154459.html


I see that Daniel V has answered while I was chasing this down, but anyways:

A grep suggests that omap1_bl is the only driver that only checks fb_blank.
All the other drivers check both fb_blank and power, a few check state. The
backlight fbdev notifier callback doesn't set power, but sets fb_blank and
state.

fb_blank was marked 'Due to be removed' 9 years ago, so it hasn't been
high priority.

So for completeness I guess it makes sense to set fb_blank.

Noralf.

$ grep -r -C10 "props\.fb_blank" .
./drivers/video/backlight/corgi_lcd.c-Â if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/corgi_lcd.c-ÂÂÂÂÂÂÂÂÂ intensity = 0;
./drivers/video/backlight/corgi_lcd.c-
./drivers/video/backlight/corgi_lcd.c:Â if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/corgi_lcd.c-ÂÂÂÂÂÂÂÂÂ intensity = 0;
--
./drivers/video/backlight/adp8860_bl.c- if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/adp8860_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/adp8860_bl.c-
./drivers/video/backlight/adp8860_bl.c: if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/adp8860_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/hp680_bl.c-ÂÂ if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/hp680_bl.c-ÂÂÂÂÂÂÂÂÂÂ intensity = 0;
./drivers/video/backlight/hp680_bl.c:ÂÂ if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/hp680_bl.c-ÂÂÂÂÂÂÂÂÂÂ intensity = 0;
--
./drivers/video/backlight/cr_bllcd.c-static int cr_backlight_set_intensity(struct backlight_device *bd)
./drivers/video/backlight/cr_bllcd.c-{
./drivers/video/backlight/cr_bllcd.c-ÂÂ int intensity = bd->props.brightness;
./drivers/video/backlight/cr_bllcd.c-ÂÂ u32 addr = gpio_bar + CRVML_PANEL_PORT;
./drivers/video/backlight/cr_bllcd.c-ÂÂ u32 cur = inl(addr);
./drivers/video/backlight/cr_bllcd.c-
./drivers/video/backlight/cr_bllcd.c-ÂÂ if (bd->props.power == FB_BLANK_UNBLANK)
./drivers/video/backlight/cr_bllcd.c-ÂÂÂÂÂÂÂÂÂÂ intensity = FB_BLANK_UNBLANK;
./drivers/video/backlight/cr_bllcd.c:ÂÂ if (bd->props.fb_blank == FB_BLANK_UNBLANK)
./drivers/video/backlight/cr_bllcd.c-ÂÂÂÂÂÂÂÂÂÂ intensity = FB_BLANK_UNBLANK;
./drivers/video/backlight/cr_bllcd.c-ÂÂ if (bd->props.power == FB_BLANK_POWERDOWN)
./drivers/video/backlight/cr_bllcd.c-ÂÂÂÂÂÂÂÂÂÂ intensity = FB_BLANK_POWERDOWN;
./drivers/video/backlight/cr_bllcd.c:ÂÂ if (bd->props.fb_blank == FB_BLANK_POWERDOWN)
./drivers/video/backlight/cr_bllcd.c-ÂÂÂÂÂÂÂÂÂÂ intensity = FB_BLANK_POWERDOWN;
--
./drivers/video/backlight/max8925_bl.c- if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/max8925_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/max8925_bl.c-
./drivers/video/backlight/max8925_bl.c: if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/max8925_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/max8925_bl.c-
./drivers/video/backlight/max8925_bl.c- if (bl->props.state & BL_CORE_SUSPENDED)
./drivers/video/backlight/max8925_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/lv5207lp.c-ÂÂ if (backlight->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/lv5207lp.c: backlight->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/backlight/lv5207lp.c- backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
./drivers/video/backlight/lv5207lp.c-ÂÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/lm3533_bl.c-Â if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/lm3533_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/lm3533_bl.c:Â if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/lm3533_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/omap1_bl.c-static int omapbl_update_status(struct backlight_device *dev)
./drivers/video/backlight/omap1_bl.c-{
./drivers/video/backlight/omap1_bl.c-ÂÂ struct omap_backlight *bl = bl_get_data(dev);
./drivers/video/backlight/omap1_bl.c-
./drivers/video/backlight/omap1_bl.c-ÂÂ if (bl->current_intensity != dev->props.brightness) {
./drivers/video/backlight/omap1_bl.c-ÂÂÂÂÂÂÂÂÂÂ if (bl->powermode == FB_BLANK_UNBLANK)
./drivers/video/backlight/omap1_bl.c- omapbl_send_intensity(dev->props.brightness);
./drivers/video/backlight/omap1_bl.c- bl->current_intensity = dev->props.brightness;
./drivers/video/backlight/omap1_bl.c-ÂÂ }
./drivers/video/backlight/omap1_bl.c-
./drivers/video/backlight/omap1_bl.c:ÂÂ if (dev->props.fb_blank != bl->powermode)
./drivers/video/backlight/omap1_bl.c: omapbl_set_power(dev, dev->props.fb_blank);
./drivers/video/backlight/omap1_bl.c-
./drivers/video/backlight/omap1_bl.c-ÂÂ return 0;
./drivers/video/backlight/omap1_bl.c-}
./drivers/video/backlight/omap1_bl.c-
--
./drivers/video/backlight/kb3886_bl.c-Â if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/kb3886_bl.c-ÂÂÂÂÂÂÂÂÂ intensity = 0;
./drivers/video/backlight/kb3886_bl.c:Â if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/kb3886_bl.c-ÂÂÂÂÂÂÂÂÂ intensity = 0;
--
./drivers/video/backlight/pwm_bl.c-ÂÂÂÂ if (bl->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/pwm_bl.c:ÂÂÂÂÂÂÂÂ bl->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/backlight/pwm_bl.c-ÂÂÂÂÂÂÂÂ bl->props.state & BL_CORE_FBBLANK)
./drivers/video/backlight/pwm_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/pm8941-wled.c-ÂÂÂÂÂÂÂ if (bl->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/pm8941-wled.c: bl->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/backlight/pm8941-wled.c- bl->props.state & BL_CORE_FBBLANK)
./drivers/video/backlight/pm8941-wled.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ val = 0;
--
./drivers/video/backlight/adp8870_bl.c- if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/adp8870_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/adp8870_bl.c-
./drivers/video/backlight/adp8870_bl.c: if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/adp8870_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/as3711_bl.c-Â if (bl->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/as3711_bl.c:ÂÂÂÂÂ bl->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/backlight/as3711_bl.c-ÂÂÂÂÂ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
./drivers/video/backlight/as3711_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/88pm860x_bl.c-ÂÂÂÂÂÂÂ if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/88pm860x_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/88pm860x_bl.c-
./drivers/video/backlight/88pm860x_bl.c:ÂÂÂÂÂÂÂ if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/88pm860x_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/88pm860x_bl.c-
./drivers/video/backlight/88pm860x_bl.c-ÂÂÂÂÂÂÂ if (bl->props.state & BL_CORE_SUSPENDED)
./drivers/video/backlight/88pm860x_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/tps65217_bl.c-ÂÂÂÂÂÂÂ if (bl->props.state & BL_CORE_SUSPENDED)
./drivers/video/backlight/tps65217_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/tps65217_bl.c-
./drivers/video/backlight/tps65217_bl.c-ÂÂÂÂÂÂÂ if ((bl->props.power != FB_BLANK_UNBLANK) ||
./drivers/video/backlight/tps65217_bl.c: (bl->props.fb_blank != FB_BLANK_UNBLANK))
./drivers/video/backlight/tps65217_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ /* framebuffer in low power mode or blanking active */
./drivers/video/backlight/tps65217_bl.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/adp5520_bl.c- if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/adp5520_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/adp5520_bl.c-
./drivers/video/backlight/adp5520_bl.c: if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/adp5520_bl.c-ÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/wm831x_bl.c-Â if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/wm831x_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/wm831x_bl.c-
./drivers/video/backlight/wm831x_bl.c:Â if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/wm831x_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/wm831x_bl.c-
./drivers/video/backlight/wm831x_bl.c-Â if (bl->props.state & BL_CORE_SUSPENDED)
./drivers/video/backlight/wm831x_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/gpio_backlight.c-ÂÂÂÂ if (bl->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/gpio_backlight.c: bl->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/backlight/gpio_backlight.c- bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
./drivers/video/backlight/gpio_backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/da903x_bl.c-Â if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/da903x_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/da903x_bl.c-
./drivers/video/backlight/da903x_bl.c:Â if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/da903x_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/backlight/da903x_bl.c-
./drivers/video/backlight/da903x_bl.c-Â if (bl->props.state & BL_CORE_SUSPENDED)
./drivers/video/backlight/da903x_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/locomolcd.c-Â if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/video/backlight/locomolcd.c-ÂÂÂÂÂÂÂÂÂ intensity = 0;
./drivers/video/backlight/locomolcd.c:Â if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/locomolcd.c-ÂÂÂÂÂÂÂÂÂ intensity = 0;
--
./drivers/video/backlight/bd6107.c-ÂÂÂÂ if (backlight->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/bd6107.c: backlight->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/backlight/bd6107.c- backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
./drivers/video/backlight/bd6107.c-ÂÂÂÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (fb_blank == FB_BLANK_UNBLANK &&
./drivers/video/backlight/backlight.c- !bd->fb_bl_on[node]) {
./drivers/video/backlight/backlight.c- bd->fb_bl_on[node] = true;
./drivers/video/backlight/backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (!bd->use_count++) {
./drivers/video/backlight/backlight.c- bd->props.state &= ~BL_CORE_FBBLANK;
./drivers/video/backlight/backlight.c: bd->props.fb_blank = FB_BLANK_UNBLANK;
./drivers/video/backlight/backlight.c- backlight_update_status(bd);
./drivers/video/backlight/backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ }
./drivers/video/backlight/backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ } else if (fb_blank != FB_BLANK_UNBLANK &&
./drivers/video/backlight/backlight.c- bd->fb_bl_on[node]) {
./drivers/video/backlight/backlight.c- bd->fb_bl_on[node] = false;
./drivers/video/backlight/backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ if (!(--bd->use_count)) {
./drivers/video/backlight/backlight.c- bd->props.state |= BL_CORE_FBBLANK;
./drivers/video/backlight/backlight.c: bd->props.fb_blank = fb_blank;
./drivers/video/backlight/backlight.c- backlight_update_status(bd);
--
./drivers/video/backlight/ep93xx_bl.c-Â if (bl->props.power != FB_BLANK_UNBLANK ||
./drivers/video/backlight/ep93xx_bl.c:ÂÂÂÂÂ bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/backlight/ep93xx_bl.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/backlight/jornada720_bl.c:ÂÂÂÂÂ if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) {
--
./drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c:ÂÂÂÂ if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
./drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c- dev->props.power == FB_BLANK_UNBLANK)
./drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c- level = dev->props.brightness;
./drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c-ÂÂÂÂ else
./drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c- level = 0;
--
./drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c: if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
./drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c- dev->props.power == FB_BLANK_UNBLANK)
./drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c- level = dev->props.brightness;
./drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c- else
./drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c- level = 0;
--
./drivers/video/fbdev/aty/atyfb_base.c- if (bd->props.power != FB_BLANK_UNBLANK ||
./drivers/video/fbdev/aty/atyfb_base.c:ÂÂÂÂ bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/fbdev/aty/atyfb_base.c-ÂÂÂÂÂÂÂÂ level = 0;
./drivers/video/fbdev/aty/atyfb_base.c- else
./drivers/video/fbdev/aty/atyfb_base.c-ÂÂÂÂÂÂÂÂ level = bd->props.brightness;
--
./drivers/video/fbdev/aty/aty128fb.c-ÂÂ if (bd->props.power != FB_BLANK_UNBLANK ||
./drivers/video/fbdev/aty/aty128fb.c:ÂÂÂÂÂÂ bd->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/video/fbdev/aty/aty128fb.c-ÂÂÂÂÂÂ !par->lcd_on)
./drivers/video/fbdev/aty/aty128fb.c-ÂÂÂÂÂÂÂÂÂÂ level = 0;
./drivers/video/fbdev/aty/aty128fb.c-ÂÂ else
./drivers/video/fbdev/aty/aty128fb.c-ÂÂÂÂÂÂÂÂÂÂ level = bd->props.brightness;
--
./drivers/video/fbdev/aty/radeon_backlight.c-ÂÂÂÂÂÂÂ if (bd->props.power != FB_BLANK_UNBLANK ||
./drivers/video/fbdev/aty/radeon_backlight.c: bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/fbdev/aty/radeon_backlight.c-ÂÂÂÂÂÂÂÂÂÂ level = 0;
./drivers/video/fbdev/aty/radeon_backlight.c-ÂÂ else
./drivers/video/fbdev/aty/radeon_backlight.c-ÂÂÂÂÂÂÂÂÂÂ level = bd->props.brightness;
--
./drivers/video/fbdev/mx3fb.c-Â if (bl->props.power != FB_BLANK_UNBLANK)
./drivers/video/fbdev/mx3fb.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/video/fbdev/mx3fb.c:Â if (bl->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/fbdev/mx3fb.c-ÂÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/video/fbdev/riva/fbdev.c-ÂÂÂÂ if (bd->props.power != FB_BLANK_UNBLANK ||
./drivers/video/fbdev/riva/fbdev.c:ÂÂÂÂÂÂÂÂ bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/fbdev/riva/fbdev.c-ÂÂÂÂÂÂÂÂÂÂÂÂ level = 0;
./drivers/video/fbdev/riva/fbdev.c-ÂÂÂÂ else
./drivers/video/fbdev/riva/fbdev.c-ÂÂÂÂÂÂÂÂÂÂÂÂ level = bd->props.brightness;
--
./drivers/video/fbdev/atmel_lcdfb.c:ÂÂÂ if (bl->props.fb_blank != sinfo->bl_power)
./drivers/video/fbdev/atmel_lcdfb.c:ÂÂÂÂÂÂÂÂÂÂÂ power = bl->props.fb_blank;
./drivers/video/fbdev/atmel_lcdfb.c-ÂÂÂ else if (bl->props.power != sinfo->bl_power)
./drivers/video/fbdev/atmel_lcdfb.c-ÂÂÂÂÂÂÂÂÂÂÂ power = bl->props.power;
--
./drivers/video/fbdev/nvidia/nv_backlight.c-ÂÂÂ if (bd->props.power != FB_BLANK_UNBLANK ||
./drivers/video/fbdev/nvidia/nv_backlight.c: bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/video/fbdev/nvidia/nv_backlight.c-ÂÂÂÂÂÂÂÂÂÂÂ level = 0;
./drivers/video/fbdev/nvidia/nv_backlight.c-ÂÂÂ else
./drivers/video/fbdev/nvidia/nv_backlight.c-ÂÂÂÂÂÂÂÂÂÂÂ level = bd->props.brightness;
--
./drivers/macintosh/via-pmu-backlight.c-ÂÂÂÂÂÂÂ if (bd->props.power != FB_BLANK_UNBLANK ||
./drivers/macintosh/via-pmu-backlight.c: bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/macintosh/via-pmu-backlight.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ level = 0;
--
./drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c:ÂÂÂÂÂ if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
./drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c- dev->props.power == FB_BLANK_UNBLANK)
./drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c- level = dev->props.brightness;
./drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c-ÂÂÂÂÂ else
./drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c- level = 0;
--
./drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c:ÂÂÂÂÂ if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
./drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c- dev->props.power == FB_BLANK_UNBLANK)
./drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c- level = dev->props.brightness;
./drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c-ÂÂÂÂÂ else
./drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c- level = 0;
--
./drivers/staging/fbtft/fb_ssd1351.c-ÂÂ on = (bd->props.power == FB_BLANK_UNBLANK) &&
./drivers/staging/fbtft/fb_ssd1351.c:ÂÂÂÂÂÂÂ (bd->props.fb_blank == FB_BLANK_UNBLANK);
--
./drivers/staging/fbtft/fbtft-core.c-ÂÂ if ((bd->props.power == FB_BLANK_UNBLANK) &&
./drivers/staging/fbtft/fbtft-core.c:ÂÂÂÂÂÂ (bd->props.fb_blank == FB_BLANK_UNBLANK))
--
./drivers/staging/fbtft/fb_watterott.c- if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/staging/fbtft/fb_watterott.c-ÂÂÂÂÂÂÂÂ brightness = 0;
./drivers/staging/fbtft/fb_watterott.c-
./drivers/staging/fbtft/fb_watterott.c: if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/staging/fbtft/fb_watterott.c-ÂÂÂÂÂÂÂÂ brightness = 0;
--
./drivers/auxdisplay/ht16k33.c- if (bl->props.power != FB_BLANK_UNBLANK ||
./drivers/auxdisplay/ht16k33.c:ÂÂÂÂ bl->props.fb_blank != FB_BLANK_UNBLANK ||
./drivers/auxdisplay/ht16k33.c-ÂÂÂÂ bl->props.state & BL_CORE_FBBLANK || brightness == 0) {
./drivers/auxdisplay/ht16k33.c-ÂÂÂÂÂÂÂÂ return ht16k33_display_off(priv);
--
./drivers/platform/x86/thinkpad_acpi.c: (bd->props.fb_blank == FB_BLANK_UNBLANK &&
./drivers/platform/x86/thinkpad_acpi.c-ÂÂÂÂÂÂÂÂÂ bd->props.power == FB_BLANK_UNBLANK) ?
./drivers/platform/x86/thinkpad_acpi.c- bd->props.brightness : 0;
--
./drivers/platform/x86/acer-wmi.c-ÂÂÂÂÂ if (bd->props.power != FB_BLANK_UNBLANK)
./drivers/platform/x86/acer-wmi.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂ intensity = 0;
./drivers/platform/x86/acer-wmi.c:ÂÂÂÂÂ if (bd->props.fb_blank != FB_BLANK_UNBLANK)
./drivers/platform/x86/acer-wmi.c-ÂÂÂÂÂÂÂÂÂÂÂÂÂ intensity = 0;


Daniel.


---
 include/linux/backlight.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index af7003548..7b6a9a2a3 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -130,6 +130,36 @@ static inline int backlight_update_status(struct backlight_device *bd)
ÂÂÂÂÂ return ret;
 }
 +/**
+Â * backlight_enable - Enable backlight
+Â * @bd: the backlight device to enable
+Â */
+static inline int backlight_enable(struct backlight_device *bd)
+{
+ÂÂÂ if (!bd)
+ÂÂÂÂÂÂÂ return 0;
+
+ÂÂÂ bd->props.power = FB_BLANK_UNBLANK;
+ÂÂÂ bd->props.state &= ~BL_CORE_FBBLANK;
+
+ÂÂÂ return backlight_update_status(bd);
+}
+
+/**
+Â * backlight_disable - Disable backlight
+Â * @bd: the backlight device to disable
+Â */
+static inline int backlight_disable(struct backlight_device *bd)
+{
+ÂÂÂ if (!bd)
+ÂÂÂÂÂÂÂ return 0;
+
+ÂÂÂ bd->props.power = FB_BLANK_POWERDOWN;
+ÂÂÂ bd->props.state |= BL_CORE_FBBLANK;
+
+ÂÂÂ return backlight_update_status(bd);
+}
+
 extern struct backlight_device *backlight_device_register(const char *name,
ÂÂÂÂÂ struct device *dev, void *devdata, const struct backlight_ops *ops,
ÂÂÂÂÂ const struct backlight_properties *props);