backlight: Introduce power-state constants
Subsystems (5)
v2 cover backlight: Introduce power-state constants
The backlight code currently uses fbdev's FB_BLANK_ constants to represent power states UNBLANK and POWERDOWN. Introduce dedicated backlight constants to remove this dependency on fbdev.
Patch 1 introduces BACKLIGHT_POWER_ON and BACKLIGHT_POWER_OFF, which replace constants from fbdev. There's also BACKLIGHT_POWER_REDUCED, which is required by a few drivers that appear to use incorrect or uncommon blanking semantics.
The rest of the patchset converts backlight drivers. The new constants' values are identical to the old ones, so the driver conversion can be done one-by-one.
There are many more backlight drivers in other subsystems. These can later be converted when the new constants have been merged. Once merged, several include statements for <linux/fb.h> can be removed (specifically under drivers/platform/x86/).
This patchset is part of a larger effort to implement the backlight code without depending on fbdev and ultimatively remove fbdev dependencies from the kernel.
v2:
- rename BL_CORE_ power constants to BACKLIGHT_POWER_ (Sam)
- fix documentation
Thomas Zimmermann (17):
backlight: Add BACKLIGHT_POWER_ constants for power states
backlight: aat2870-backlight: Use blacklight power constants
backlight: ams369fb06: Use backlight power constants
backlight: corgi-lcd: Use backlight power constants
backlight: gpio-backlight: Use backlight power constants
backlight: ipaq-micro-backlight: Use backlight power constants
backlight: journada_bl: Use backlight power constants
backlight: kb3886-bl: Use backlight power constants
backlight: ktd253-backlight: Use backlight power constants
backlight: led-backlight: Use backlight power constants
backlight: lm3533-backlight: Use backlight power constants
backlight: mp3309c: Use backlight power constants
backlight: pandora-backlight: Use backlight power constants
backlight: pcf50633-backlight: Use backlight power constants
backlight: pwm-backlight: Use backlight power constants
backlight: rave-sp-backlight: Use backlight power constants
backlight: sky81452-backlight: Use backlight power constants
.../ABI/stable/sysfs-class-backlight | 7 +++--- drivers/video/backlight/aat2870_bl.c | 4 ++-- drivers/video/backlight/ams369fg06.c | 23 +++++++++---------- drivers/video/backlight/corgi_lcd.c | 4 ++-- drivers/video/backlight/gpio_backlight.c | 9 ++++---- drivers/video/backlight/ipaq_micro_bl.c | 3 +-- drivers/video/backlight/jornada720_bl.c | 3 +-- drivers/video/backlight/kb3886_bl.c | 4 ++-- drivers/video/backlight/ktd253-backlight.c | 5 ++-- drivers/video/backlight/led_bl.c | 4 ++-- drivers/video/backlight/lm3533_bl.c | 3 +-- drivers/video/backlight/mp3309c.c | 4 ++-- drivers/video/backlight/pandora_bl.c | 3 +-- drivers/video/backlight/pcf50633-backlight.c | 5 ++-- drivers/video/backlight/pwm_bl.c | 4 ++-- drivers/video/backlight/rave-sp-backlight.c | 2 +- drivers/video/backlight/sky81452-backlight.c | 2 +- include/linux/backlight.h | 20 +++++++++------- 18 files changed, 53 insertions(+), 56 deletions(-)
Signature · 1 line
2.45.2
PATCH v2 1/17 backlight: Add BACKLIGHT_POWER_ constants for power states
Duplicate FB_BLANK_ constants as BACKLIGHT_POWER__ constants in the backlight header file. Allows backlight drivers to avoid including the fbdev header file and removes a compile-time dependency between the two subsystems.
The new BACKLIGHT_POWER_ constants have the same values as their FB_BLANK_ counterparts. Hence UAPI and internal semantics do not change. The backlight drivers can be converted one by one. Each instance of FB_BLANK_UNBLANK becomes BACKLIGHT_POWER_ON, each of FB_BLANK_POWERDOWN becomes BACKLIGHT_POWER_OFF, and FB_BLANK_NORMAL becomes BACKLIGHT_POWER_REDUCED.
Backlight code or drivers do not use FB_BLANK_VSYNC_SUSPEND and FB_BLANK_HSYNC_SUSPEND, so no new constants for these are being added.
The semantics of FB_BLANK_NORMAL appear inconsistent. In fbdev, NORMAL means display off with sync enabled. In backlight code, this translates to turn the backlight off, but some drivers interpret it as backlight on. So we keep the current code as is, but mark BACKLIGHT_POWER_REDUCED as deprecated. Drivers should be fixed and the constant removed. This affects ams369fg06 and a few DRM panel drivers.
v2:
- rename BL_CORE_ power constants to BACKLIGHT_POWER_ (Sam)
- fix documentation
--- .../ABI/stable/sysfs-class-backlight | 7 ++++--- include/linux/backlight.h | 20 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-)
Documentation/ABI/stable/sysfs-class-backlight +4 -3
@@ -3,10 +3,11 @@ Date: April 2005 KernelVersion: 2.6.12 Contact: Richard Purdie <[email protected]> Description: - Control BACKLIGHT power, values are FB_BLANK_* from fb.h + Control BACKLIGHT power, values are compatible with + FB_BLANK_* from fb.h - - FB_BLANK_UNBLANK (0) : power on. - - FB_BLANK_POWERDOWN (4) : power off + - 0 (FB_BLANK_UNBLANK) : power on. + - 4 (FB_BLANK_POWERDOWN) : power off Users: HAL What: /sys/class/backlight/<backlight>/brightness
include/linux/backlight.h +12 -8
@@ -209,15 +209,19 @@ struct backlight_properties {* attribute: /sys/class/backlight/<backlight>/bl_power * When the power property is updated update_status() is called. * -* The possible values are: (0: full on, 1 to 3: power saving -* modes; 4: full off), see FB_BLANK_XXX. +* The possible values are: (0: full on, 4: full off), see +* BACKLIGHT_POWER constants. * -* When the backlight device is enabled @power is set -* to FB_BLANK_UNBLANK. When the backlight device is disabled -* @power is set to FB_BLANK_POWERDOWN. +* When the backlight device is enabled, @power is set to +* BACKLIGHT_POWER_ON. When the backlight device is disabled, +* @power is set to BACKLIGHT_POWER_OFF. */ int power; +#define BACKLIGHT_POWER_ON (0) +#define BACKLIGHT_POWER_OFF (4) +#define BACKLIGHT_POWER_REDUCED (1) // deprecated; don't use in new code +/** * @type: The type of backlight supported. *
@@ -346,7 +350,7 @@ static inline int backlight_enable(struct backlight_device *bd)if (!bd)return 0 ; - bd->props.power =FB_BLANK_UNBLANK ; + bd->props.power =BACKLIGHT_POWER_ON ; bd->props.state &= ~BL_CORE_FBBLANK ;return backlight_update_status (bd);
@@ -361,7 +365,7 @@ static inline int backlight_disable(struct backlight_device *bd)if (!bd)return 0 ; - bd->props.power =FB_BLANK_POWERDOWN ; + bd->props.power =BACKLIGHT_POWER_OFF ; bd->props.state |=BL_CORE_FBBLANK ;return backlight_update_status (bd);
@@ -380,7 +384,7 @@ static inline int backlight_disable(struct backlight_device *bd)*/ static inline bool backlight_is_blank (const struct backlight_device *bd) { -return bd->props.power !=FB_BLANK_UNBLANK || +return bd->props.power !=BACKLIGHT_POWER_ON || bd->props.state & (BL_CORE_SUSPENDED |BL_CORE_FBBLANK ); }
Signature · 1 line
2.45.2
PATCH v2 2/17 backlight: aat2870-backlight: Use blacklight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/aat2870_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/aat2870_bl.c +2 -2
@@ -156,7 +156,7 @@ static int aat2870_bl_probe(struct platform_device *pdev) bd->props.max_brightness =255 ; aat2870_bl->brightness =0 ; - bd->props.power =FB_BLANK_UNBLANK ; + bd->props.power =BACKLIGHT_POWER_ON ; bd->props.brightness = bd->props.max_brightness; ret =aat2870_bl_update_status (bd);
@@ -176,7 +176,7 @@ static void aat2870_bl_remove(struct platform_device *pdev)struct aat2870_bl_driver_data *aat2870_bl =platform_get_drvdata (pdev);struct backlight_device *bd = aat2870_bl->bd; - bd->props.power =FB_BLANK_POWERDOWN ; + bd->props.power =BACKLIGHT_POWER_OFF ; bd->props.brightness =0 ;backlight_update_status (bd); }
Signature · 1 line
2.45.2
PATCH v2 3/17 backlight: ams369fb06: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/ams369fg06.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/video/backlight/ams369fg06.c +11 -12
@@ -10,7 +10,6 @@#include <linux/backlight.h> #include <linux/delay.h> -#include <linux/fb.h> #include <linux/lcd.h> #include <linux/module.h> #include <linux/spi/spi.h>
@@ -300,7 +299,7 @@ static int ams369fg06_ldi_disable(struct ams369fg06 *lcd)static int ams369fg06_power_is_on (int power) { -return power <=FB_BLANK_NORMAL ; +return power <=BACKLIGHT_POWER_REDUCED ; }static int ams369fg06_power_on (struct ams369fg06 *lcd)
@@ -396,8 +395,8 @@ static int ams369fg06_set_power(struct lcd_device *ld, int power) {struct ams369fg06 *lcd =lcd_get_data (ld); -if (power !=FB_BLANK_UNBLANK && power !=FB_BLANK_POWERDOWN && - power !=FB_BLANK_NORMAL ) { +if (power !=BACKLIGHT_POWER_ON && power !=BACKLIGHT_POWER_OFF && + power !=BACKLIGHT_POWER_REDUCED ) {dev_err (lcd->dev,"power value should be 0, 1 or 4.\n" );return -EINVAL ; }
@@ -492,11 +491,11 @@ static int ams369fg06_probe(struct spi_device *spi)* current lcd status is powerdown and then * it enables lcd panel. */ - lcd->power =FB_BLANK_POWERDOWN ; + lcd->power =BACKLIGHT_POWER_OFF ; -ams369fg06_power (lcd,FB_BLANK_UNBLANK ); +ams369fg06_power (lcd,BACKLIGHT_POWER_ON ); }else { - lcd->power =FB_BLANK_UNBLANK ; + lcd->power =BACKLIGHT_POWER_ON ; }spi_set_drvdata (spi, lcd);
@@ -510,7 +509,7 @@ static void ams369fg06_remove(struct spi_device *spi) {struct ams369fg06 *lcd =spi_get_drvdata (spi); -ams369fg06_power (lcd,FB_BLANK_POWERDOWN ); +ams369fg06_power (lcd,BACKLIGHT_POWER_OFF ); }#ifdef CONFIG_PM_SLEEP
@@ -524,16 +523,16 @@ static int ams369fg06_suspend(struct device *dev)* when lcd panel is suspend, lcd panel becomes off * regardless of status. */ - return ams369fg06_power(lcd, FB_BLANK_POWERDOWN); + return ams369fg06_power(lcd, BACKLIGHT_POWER_OFF); }static int ams369fg06_resume (struct device *dev) {struct ams369fg06 *lcd =dev_get_drvdata (dev); - lcd->power =FB_BLANK_POWERDOWN ; + lcd->power =BACKLIGHT_POWER_OFF ; -return ams369fg06_power (lcd,FB_BLANK_UNBLANK ); +return ams369fg06_power (lcd,BACKLIGHT_POWER_ON ); }#endif
@@ -544,7 +543,7 @@ static void ams369fg06_shutdown(struct spi_device *spi) {struct ams369fg06 *lcd =spi_get_drvdata (spi); -ams369fg06_power (lcd,FB_BLANK_POWERDOWN ); +ams369fg06_power (lcd,BACKLIGHT_POWER_OFF ); }static struct spi_driver ams369fg06_driver = {
Signature · 1 line
2.45.2
PATCH v2 4/17 backlight: corgi-lcd: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
Only change the driver's backlight device, but leave the LCD device as-is.
--- drivers/video/backlight/corgi_lcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/corgi_lcd.c +2 -2
@@ -526,7 +526,7 @@ static int corgi_lcd_probe(struct spi_device *spi)return PTR_ERR (lcd->bl_dev); lcd->bl_dev->props.brightness = pdata->default_intensity; - lcd->bl_dev->props.power =FB_BLANK_UNBLANK ; + lcd->bl_dev->props.power =BACKLIGHT_POWER_ON ; ret =setup_gpio_backlight (lcd, pdata);if (ret)
@@ -547,7 +547,7 @@ static void corgi_lcd_remove(struct spi_device *spi) {struct corgi_lcd *lcd =spi_get_drvdata (spi); - lcd->bl_dev->props.power =FB_BLANK_UNBLANK ; + lcd->bl_dev->props.power =BACKLIGHT_POWER_ON ; lcd->bl_dev->props.brightness =0 ;backlight_update_status (lcd->bl_dev);corgi_lcd_set_power (lcd->lcd_dev,FB_BLANK_POWERDOWN );
Signature · 1 line
2.45.2
PATCH v2 5/17 backlight: gpio-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/gpio_backlight.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/video/backlight/gpio_backlight.c +4 -5
@@ -5,7 +5,6 @@#include <linux/backlight.h> #include <linux/err.h> -#include <linux/fb.h> #include <linux/gpio/consumer.h> #include <linux/init.h> #include <linux/kernel.h>
@@ -81,12 +80,12 @@ static int gpio_backlight_probe(struct platform_device *pdev)/* Set the initial power state */ if (!of_node || !of_node->phandle)/* Not booted with device tree or no phandle link to the node */ - bl->props.power = def_value ?FB_BLANK_UNBLANK - :FB_BLANK_POWERDOWN ; + bl->props.power = def_value ?BACKLIGHT_POWER_ON + :BACKLIGHT_POWER_OFF ;else if (gpiod_get_value_cansleep (gbl->gpiod) ==0 ) - bl->props.power =FB_BLANK_POWERDOWN ; + bl->props.power =BACKLIGHT_POWER_OFF ;else - bl->props.power =FB_BLANK_UNBLANK ; + bl->props.power =BACKLIGHT_POWER_ON ; bl->props.brightness =1 ;
Signature · 1 line
2.45.2
Re: [PATCH v2 05/17] backlight: gpio-backlight: Use backlight power constants
Quoted 5 lines · Thomas Zimmermann
Replace
FB_BLANK_constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.Signed-off-by Thomas Zimmermann <[email protected]>
Yours,
Linus Walleij
PATCH v2 6/17 backlight: ipaq-micro-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/ipaq_micro_bl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/ipaq_micro_bl.c +1 -2
@@ -7,7 +7,6 @@#include <linux/backlight.h> #include <linux/err.h> -#include <linux/fb.h> #include <linux/init.h> #include <linux/mfd/ipaq-micro.h> #include <linux/module.h>
@@ -42,7 +41,7 @@ static const struct backlight_ops micro_bl_ops = {static const struct backlight_properties micro_bl_props = { .type =BACKLIGHT_RAW , .max_brightness =255 , - .power =FB_BLANK_UNBLANK , + .power =BACKLIGHT_POWER_ON , .brightness =64 , };
Signature · 1 line
2.45.2
Re: [PATCH v2 06/17] backlight: ipaq-micro-backlight: Use backlight power constants
Quoted 5 lines · Thomas Zimmermann
Replace
FB_BLANK_constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.Signed-off-by Thomas Zimmermann <[email protected]>
Yours,
Linus Walleij
PATCH v2 7/17 backlight: journada_bl: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/jornada720_bl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/jornada720_bl.c +1 -2
@@ -7,7 +7,6 @@#include <linux/backlight.h> #include <linux/device.h> -#include <linux/fb.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h>
@@ -121,7 +120,7 @@ static int jornada_bl_probe(struct platform_device *pdev)return ret; } - bd->props.power =FB_BLANK_UNBLANK ; + bd->props.power =BACKLIGHT_POWER_ON ; bd->props.brightness =BL_DEF_BRIGHT ;/* * note. make sure max brightness is set otherwise
Signature · 1 line
2.45.2
PATCH v2 8/17 backlight: kb3886-bl: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/kb3886_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/kb3886_bl.c +2 -2
@@ -10,9 +10,9 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/io.h> #include <linux/platform_device.h> #include <linux/mutex.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/delay.h> #include <linux/dmi.h>
@@ -151,7 +151,7 @@ static int kb3886bl_probe(struct platform_device *pdev)platform_set_drvdata (pdev, kb3886_backlight_device); - kb3886_backlight_device->props.power =FB_BLANK_UNBLANK ; + kb3886_backlight_device->props.power =BACKLIGHT_POWER_ON ; kb3886_backlight_device->props.brightness = machinfo->default_intensity;backlight_update_status (kb3886_backlight_device);
Signature · 1 line
2.45.2
PATCH v2 9/17 backlight: ktd253-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/ktd253-backlight.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/video/backlight/ktd253-backlight.c +2 -3
@@ -7,7 +7,6 @@#include <linux/backlight.h> #include <linux/delay.h> #include <linux/err.h> -#include <linux/fb.h> #include <linux/gpio/consumer.h> #include <linux/init.h> #include <linux/kernel.h>
@@ -190,10 +189,10 @@ static int ktd253_backlight_probe(struct platform_device *pdev)/* When we just enable the GPIO line we set max brightness */ if (brightness) { bl->props.brightness = brightness; - bl->props.power =FB_BLANK_UNBLANK ; + bl->props.power =BACKLIGHT_POWER_ON ; }else { bl->props.brightness =0 ; - bl->props.power =FB_BLANK_POWERDOWN ; + bl->props.power =BACKLIGHT_POWER_OFF ; } ktd253->bl = bl;
Signature · 1 line
2.45.2
PATCH v2 10/17 backlight: led-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/led_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/led_bl.c +2 -2
@@ -200,8 +200,8 @@ static int led_bl_probe(struct platform_device *pdev) props.type =BACKLIGHT_RAW ; props.max_brightness = priv->max_brightness; props.brightness = priv->default_brightness; - props.power = (priv->default_brightness >0 ) ?FB_BLANK_POWERDOWN : -FB_BLANK_UNBLANK ; + props.power = (priv->default_brightness >0 ) ?BACKLIGHT_POWER_OFF : +BACKLIGHT_POWER_ON ; priv->bl_dev =backlight_device_register (dev_name (&pdev->dev), &pdev->dev, priv, &led_bl_ops, &props);if (IS_ERR (priv->bl_dev)) {
Signature · 1 line
2.45.2
PATCH v2 11/17 backlight: lm3533-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/lm3533_bl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/lm3533_bl.c +1 -2
@@ -11,7 +11,6 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/backlight.h> -#include <linux/fb.h> #include <linux/slab.h> #include <linux/mfd/lm3533.h>
@@ -344,7 +343,7 @@ static void lm3533_bl_remove(struct platform_device *pdev)dev_dbg (&bd->dev,"%s\n" , __func__); - bd->props.power =FB_BLANK_POWERDOWN ; + bd->props.power =BACKLIGHT_POWER_OFF ; bd->props.brightness =0 ;lm3533_ctrlbank_disable (&bl->cb);
Signature · 1 line
2.45.2
PATCH v2 12/17 backlight: mp3309c: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/mp3309c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/mp3309c.c +2 -2
@@ -358,7 +358,7 @@ static int mp3309c_probe(struct i2c_client *client) props.max_brightness = pdata->max_brightness; props.scale =BACKLIGHT_SCALE_LINEAR ; props.type =BACKLIGHT_RAW ; - props.power =FB_BLANK_UNBLANK ; + props.power =BACKLIGHT_POWER_ON ; chip->bl =devm_backlight_device_register (dev,"mp3309c" , dev, chip, &mp3309c_bl_ops, &props);if (IS_ERR (chip->bl))
@@ -388,7 +388,7 @@ static void mp3309c_remove(struct i2c_client *client)struct mp3309c_chip *chip =i2c_get_clientdata (client);struct backlight_device *bl = chip->bl; - bl->props.power =FB_BLANK_POWERDOWN ; + bl->props.power =BACKLIGHT_POWER_OFF ; bl->props.brightness =0 ;backlight_update_status (chip->bl); }
Signature · 1 line
2.45.2
PATCH v2 13/17 backlight: pandora-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/pandora_bl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/pandora_bl.c +1 -2
@@ -11,7 +11,6 @@#include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/delay.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/mfd/twl.h> #include <linux/err.h>
@@ -43,7 +42,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)struct pandora_private *priv =bl_get_data (bl);u8 r; -if (bl->props.power !=FB_BLANK_UNBLANK ) +if (bl->props.power !=BACKLIGHT_POWER_ON ) brightness =0 ;if (bl->props.state &BL_CORE_FBBLANK ) brightness =0 ;
Signature · 1 line
2.45.2
PATCH v2 14/17 backlight: pcf50633-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/pcf50633-backlight.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/video/backlight/pcf50633-backlight.c +2 -3
@@ -10,7 +10,6 @@#include <linux/platform_device.h> #include <linux/backlight.h> -#include <linux/fb.h> #include <linux/mfd/pcf50633/core.h> #include <linux/mfd/pcf50633/backlight.h>
@@ -53,7 +52,7 @@ static int pcf50633_bl_update_status(struct backlight_device *bl)if (bl->props.state & (BL_CORE_SUSPENDED |BL_CORE_FBBLANK ) || - bl->props.power !=FB_BLANK_UNBLANK ) + bl->props.power !=BACKLIGHT_POWER_ON ) new_brightness =0 ;else if (bl->props.brightness < pcf_bl->brightness_limit) new_brightness = bl->props.brightness;
@@ -106,7 +105,7 @@ static int pcf50633_bl_probe(struct platform_device *pdev)memset (&bl_props,0 ,sizeof (bl_props)); bl_props.type =BACKLIGHT_RAW ; bl_props.max_brightness =0x3f ; - bl_props.power =FB_BLANK_UNBLANK ; + bl_props.power =BACKLIGHT_POWER_ON ;if (pdata) { bl_props.brightness = pdata->default_brightness;
Signature · 1 line
2.45.2
PATCH v2 15/17 backlight: pwm-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/pwm_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/pwm_bl.c +2 -2
@@ -426,7 +426,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)/* Not booted with device tree or no phandle link to the node */ if (!node || !node->phandle) -return FB_BLANK_UNBLANK ; +return BACKLIGHT_POWER_ON ;/* * If the driver is probed from the device tree and there is a
@@ -434,7 +434,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)* assume that another driver will enable the backlight at the * appropriate time. Therefore, if it is disabled, keep it so. */ -return active ?FB_BLANK_UNBLANK :FB_BLANK_POWERDOWN ; +return active ?BACKLIGHT_POWER_ON :BACKLIGHT_POWER_OFF ; }static int pwm_backlight_probe (struct platform_device *pdev)
Signature · 1 line
2.45.2
PATCH v2 16/17 backlight: rave-sp-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/rave-sp-backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/rave-sp-backlight.c +1 -1
@@ -19,7 +19,7 @@ static int rave_sp_backlight_update_status(struct backlight_device *bd) {const struct backlight_properties *p = &bd->props;const u8 intensity = - (p->power ==FB_BLANK_UNBLANK ) ? p->brightness :0 ; + (p->power ==BACKLIGHT_POWER_ON ) ? p->brightness :0 ;struct rave_sp *sp =dev_get_drvdata (&bd->dev);u8 cmd[] = { [0 ] =RAVE_SP_CMD_SET_BACKLIGHT ,
Signature · 1 line
2.45.2
PATCH v2 17/17 backlight: sky81452-backlight: Use backlight power constants
In reply to Thomas ZimmermannReplace FB_BLANK_ constants with their counterparts from the backlight subsystem. The values are identical, so there's no change in functionality.
--- drivers/video/backlight/sky81452-backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/sky81452-backlight.c +1 -1
@@ -315,7 +315,7 @@ static void sky81452_bl_remove(struct platform_device *pdev)sysfs_remove_group (&bd->dev.kobj, &sky81452_bl_attr_group); - bd->props.power =FB_BLANK_UNBLANK ; + bd->props.power =BACKLIGHT_POWER_ON ; bd->props.brightness =0 ;backlight_update_status (bd);
Signature · 1 line
2.45.2
Quoted 36 lines · Thomas Zimmermann
The backlight code currently uses fbdev's
FB_BLANK_constants to represent power states UNBLANK and POWERDOWN. Introduce dedicated backlight constants to remove this dependency on fbdev.Patch 1 introduces
BACKLIGHT_POWER_ONandBACKLIGHT_POWER_OFF, which replace constants from fbdev. There's alsoBACKLIGHT_POWER_REDUCED, which is required by a few drivers that appear to use incorrect or uncommon blanking semantics.The rest of the patchset converts backlight drivers. The new constants' values are identical to the old ones, so the driver conversion can be done one-by-one.
There are many more backlight drivers in other subsystems. These can later be converted when the new constants have been merged. Once merged, several include statements for <
linux/fb.h> can be removed (specifically underdrivers/platform/x86/).This patchset is part of a larger effort to implement the backlight code without depending on fbdev and ultimatively remove fbdev dependencies from the kernel.
v2:
- renameBL_CORE_power constants toBACKLIGHT_POWER_(Sam)
- fix documentationThomas Zimmermann (17):
backlight: AddBACKLIGHT_POWER_constants for power states
backlight: aat2870-backlight: Use blacklight power constants
backlight: ams369fb06: Use backlight power constants
backlight: corgi-lcd: Use backlight power constants
backlight: gpio-backlight: Use backlight power constants
backlight: ipaq-micro-backlight: Use backlight power constants
backlight:journada_bl: Use backlight power constants
backlight: kb3886-bl: Use backlight power constants
backlight: ktd253-backlight: Use backlight power constants
Quoted 8 lines
backlight: led-backlight: Use backlight power constants
backlight: lm3533-backlight: Use backlight power constants
backlight: mp3309c: Use backlight power constants
backlight: pandora-backlight: Use backlight power constants
backlight: pcf50633-backlight: Use backlight power constants
backlight: pwm-backlight: Use backlight power constants
backlight: rave-sp-backlight: Use backlight power constants
backlight: sky81452-backlight: Use backlight power constants
Daniel.
Quoted 10 lines · Thomas Zimmermann
The backlight code currently uses fbdev's
FB_BLANK_constants to represent power states UNBLANK and POWERDOWN. Introduce dedicated backlight constants to remove this dependency on fbdev.Patch 1 introduces
BACKLIGHT_POWER_ONandBACKLIGHT_POWER_OFF, which replace constants from fbdev. There's alsoBACKLIGHT_POWER_REDUCED, which is required by a few drivers that appear to use incorrect or uncommon blanking semantics.[...]
Applied, thanks!
[01/17] backlight: Add BACKLIGHT_POWER_ constants for power states
commit: a1cacb8a8e70c38ec0c78910c668abda99fcb780
[02/17] backlight: aat2870-backlight: Use blacklight power constants
commit: 26dcf62333f1c1ec33a469339a287ab8eecfb06e
[03/17] backlight: ams369fb06: Use backlight power constants
commit: 1adf98242e0ec33f15c4f7a1e86ad76abf209665
[04/17] backlight: corgi-lcd: Use backlight power constants
commit: e263c051910190feba884179aef15e548273a7aa
[05/17] backlight: gpio-backlight: Use backlight power constants
commit: ef51815c5f970b228a775ceb3bb06ce46fe9ff86
[06/17] backlight: ipaq-micro-backlight: Use backlight power constants
commit: b6675c59473a26dec33281e4e872cf09f6321523
[07/17] backlight: journada_bl: Use backlight power constants
commit: 6910d19bb861db0721a171f4e351c290a40f1d19
[08/17] backlight: kb3886-bl: Use backlight power constants
commit: cebc25971f7f988dfd4d6c7269deea4c1ca5898e
[09/17] backlight: ktd253-backlight: Use backlight power constants
commit: def5831f09db8937218be50fc652d20c0a68e417
[10/17] backlight: led-backlight: Use backlight power constants
commit: 814d3e820039348f1467ada9a8a812c0b80733de
[11/17] backlight: lm3533-backlight: Use backlight power constants
commit: 761c83910b3d10e731b03438b883d271c295a9a5
[12/17] backlight: mp3309c: Use backlight power constants
commit: c2d9c4934bf4e12b531312bbf02a8543f6a23aae
[13/17] backlight: pandora-backlight: Use backlight power constants
commit: d4db2f193490415386ee13f714a0940943cbb149
[14/17] backlight: pcf50633-backlight: Use backlight power constants
commit: eca6b3ddfc554a9a51795cf035ccd60f2d842074
[15/17] backlight: pwm-backlight: Use backlight power constants
commit: eb1c4b6ddde6867498ead8d4b92d6abb5f736a7d
[16/17] backlight: rave-sp-backlight: Use backlight power constants
commit: 22f8a85ef0c563ba7e53d9ece39c1f2dc99f53ed
[17/17] backlight: sky81452-backlight: Use backlight power constants
commit: 1df5aa3754cac2045998ca505edb84d994786c67--
Lee Jones [李琼斯]