Skip to contentSkip to conversation

backlight: Nuke unused backlight.props.state states

PATCH In review Daniel Vetter 5 participants 17 messages Apr 25, 2018 – Apr 30, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 backlight: Nuke unused backlight.props.state states

The backlight power state handling is supremely confusing. We have:
- props.power, using FB_BLANK_* defines
- props.fb_blank, using the same, but deprecated int favour of props.state
- props.state, using the BL_CORE_* defines
- and finally a bunch of backlight drivers treat brightness == 0 as off. But of course not all of them.

This is way too much confusion to fix in a simple patch, but at least prevent more hilarity from spreading by removing the unused BL_CORE_* defines. I have no idea why exactly anyone would need that.

Wrt the ideal state, we really just want a boolean state. The 4 power saving states that the fbdev subsystem uses are overkill in todays hw (this was only relevant for VGA and similar analog circuits like TV-out), the new drm atomic modeset api simplified even the uapi to a simple bool. And there was never a valid technical reason to have the intermediate fbdev power states for backlights (those really only can be either off or on).

Cleanup motivated by Meghana's questions about all this.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Meghana Madhyastha <[email protected]>
---
 include/linux/backlight.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/backlight.h +0 -3
index 2baab6f3861d..1db67662bfcb 100644
@@ -84,9 +84,6 @@ struct backlight_properties {
 
 #define BL_CORE_SUSPENDED	(1 << 0)	/* backlight is suspended */
 #define BL_CORE_FBBLANK		(1 << 1)	/* backlight is under an fb blank event */
-#define BL_CORE_DRIVER4		(1 << 28)	/* reserved for driver specific use */
-#define BL_CORE_DRIVER3		(1 << 29)	/* reserved for driver specific use */
-#define BL_CORE_DRIVER2		(1 << 30)	/* reserved for driver specific use */
 #define BL_CORE_DRIVER1		(1 << 31)	/* reserved for driver specific use */
 
 };
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/6 backlight/generic-bl: remove DRIVER1 state

Nothing in the entire tree ever sets this, which means this is dead code. Remove it.

---
 drivers/video/backlight/generic_bl.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/video/backlight/generic_bl.c +0 -5
index 67dfb939a514..4dea91acea13 100644
@@ -21,9 +21,6 @@ static int genericbl_intensity;
 static struct backlight_device *generic_backlight_device;
 static struct generic_bl_info *bl_machinfo;
 
-/* Flag to signal when the battery is low */
-#define GENERICBL_BATTLOW       BL_CORE_DRIVER1
-
 static int genericbl_send_intensity(struct backlight_device *bd)
 {
 	int intensity = bd->props.brightness;
@@ -34,8 +31,6 @@ static int genericbl_send_intensity(struct backlight_device *bd)
 		intensity = 0;
 	if (bd->props.state & BL_CORE_SUSPENDED)
 		intensity = 0;
-	if (bd->props.state & GENERICBL_BATTLOW)
-		intensity &= bl_machinfo->limit_mask;
 
 	bl_machinfo->set_bl_intensity(intensity);
 
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/6
#2 lore raw

Re: [PATCH 2/6] backlight/generic-bl: remove DRIVER1 state

Quoted 8 lines · Daniel Vetter

Nothing in the entire tree ever sets this, which means this is dead code. Remove it.

Quoted 26 lines
---
 drivers/video/backlight/generic_bl.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/video/backlight/generic_bl.c +0 -5
index 67dfb939a514..4dea91acea13 100644
@@ -21,9 +21,6 @@ static int genericbl_intensity;
 static struct backlight_device *generic_backlight_device;
 static struct generic_bl_info *bl_machinfo;
 
-/* Flag to signal when the battery is low */
-#define GENERICBL_BATTLOW       BL_CORE_DRIVER1
-
 static int genericbl_send_intensity(struct backlight_device *bd)
 {
 	int intensity = bd->props.brightness;
@@ -34,8 +31,6 @@ static int genericbl_send_intensity(struct backlight_device *bd)
 		intensity = 0;
 	if (bd->props.state & BL_CORE_SUSPENDED)
 		intensity = 0;
-	if (bd->props.state & GENERICBL_BATTLOW)
-		intensity &= bl_machinfo->limit_mask;
 
 	bl_machinfo->set_bl_intensity(intensity);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 3/6 backlight/pandora: Stop using BL_CORE_DRIVER1

In reply to Daniel Vetter

Leaking driver internal tracking into the already massively confusing backlight power tracking is really confusing.

Stop that by allocating a tiny driver private data structure instead.

---
v2:
- Consistently treating PANDORA_WAS_OFF as a non-bitfield
- Drop the kfree that I left behind after switching to devm_kmalloc

---
 drivers/video/backlight/pandora_bl.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
drivers/video/backlight/pandora_bl.c +18 -7
index a186bc677c7d..9618766e3866 100644
@@ -35,11 +35,15 @@
 #define MAX_VALUE 63
 #define MAX_USER_VALUE (MAX_VALUE - MIN_VALUE)
 
-#define PANDORABL_WAS_OFF BL_CORE_DRIVER1
+struct pandora_private {
+	unsigned old_state;
+#define PANDORABL_WAS_OFF 1
+};
 
 static int pandora_backlight_update_status(struct backlight_device *bl)
 {
 	int brightness = bl->props.brightness;
+	struct pandora_private *priv = bl_get_data(bl);
 	u8 r;
 
 	if (bl->props.power != FB_BLANK_UNBLANK)
@@ -53,7 +57,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
 		brightness = MAX_USER_VALUE;
 
 	if (brightness == 0) {
-		if (bl->props.state & PANDORABL_WAS_OFF)
+		if (priv->old_state == PANDORABL_WAS_OFF)
 			goto done;
 
 		/* first disable PWM0 output, then clock */
@@ -66,7 +70,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
 		goto done;
 	}
 
-	if (bl->props.state & PANDORABL_WAS_OFF) {
+	if (priv->old_state == PANDORABL_WAS_OFF) {
 		/*
 		 * set PWM duty cycle to max. TPS61161 seems to use this
 		 * to calibrate it's PWM sensitivity when it starts.
@@ -93,9 +97,9 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
 
 done:
 	if (brightness != 0)
-		bl->props.state &= ~PANDORABL_WAS_OFF;
+		priv->old_state = 0;
 	else
-		bl->props.state |= PANDORABL_WAS_OFF;
+		priv->old_state = PANDORABL_WAS_OFF;
 
 	return 0;
 }
@@ -109,13 +113,20 @@ static int pandora_backlight_probe(struct platform_device *pdev)
 {
 	struct backlight_properties props;
 	struct backlight_device *bl;
+	struct pandora_private *priv;
 	u8 r;
 
+	priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv) {
+		dev_err(&pdev->dev, "failed to allocate driver private data\n");
+		return -ENOMEM;
+	}
+
 	memset(&props, 0, sizeof(props));
 	props.max_brightness = MAX_USER_VALUE;
 	props.type = BACKLIGHT_RAW;
 	bl = devm_backlight_device_register(&pdev->dev, pdev->name, &pdev->dev,
-					NULL, &pandora_backlight_ops, &props);
+					priv, &pandora_backlight_ops, &props);
 	if (IS_ERR(bl)) {
 		dev_err(&pdev->dev, "failed to register backlight\n");
 		return PTR_ERR(bl);
@@ -126,7 +137,7 @@ static int pandora_backlight_probe(struct platform_device *pdev)
 	/* 64 cycle period, ON position 0 */
 	twl_i2c_write_u8(TWL_MODULE_PWM, 0x80, TWL_PWM0_ON);
 
-	bl->props.state |= PANDORABL_WAS_OFF;
+	priv->old_state = PANDORABL_WAS_OFF;
 	bl->props.brightness = MAX_USER_VALUE;
 	backlight_update_status(bl);
 
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 3/6
#4 lore raw

Re: [PATCH 3/6] backlight/pandora: Stop using BL_CORE_DRIVER1

Quoted 10 lines · Daniel Vetter

Leaking driver internal tracking into the already massively confusing backlight power tracking is really confusing.

Stop that by allocating a tiny driver private data structure instead.

Quoted 89 lines

---
v2:
- Consistently treating PANDORA_WAS_OFF as a non-bitfield
- Drop the kfree that I left behind after switching to devm_kmalloc

---
 drivers/video/backlight/pandora_bl.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
drivers/video/backlight/pandora_bl.c +18 -7
index a186bc677c7d..9618766e3866 100644
@@ -35,11 +35,15 @@
 #define MAX_VALUE 63
 #define MAX_USER_VALUE (MAX_VALUE - MIN_VALUE)
 
-#define PANDORABL_WAS_OFF BL_CORE_DRIVER1
+struct pandora_private {
+	unsigned old_state;
+#define PANDORABL_WAS_OFF 1
+};
 
 static int pandora_backlight_update_status(struct backlight_device *bl)
 {
 	int brightness = bl->props.brightness;
+	struct pandora_private *priv = bl_get_data(bl);
 	u8 r;
 
 	if (bl->props.power != FB_BLANK_UNBLANK)
@@ -53,7 +57,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
 		brightness = MAX_USER_VALUE;
 
 	if (brightness == 0) {
-		if (bl->props.state & PANDORABL_WAS_OFF)
+		if (priv->old_state == PANDORABL_WAS_OFF)
 			goto done;
 
 		/* first disable PWM0 output, then clock */
@@ -66,7 +70,7 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
 		goto done;
 	}
 
-	if (bl->props.state & PANDORABL_WAS_OFF) {
+	if (priv->old_state == PANDORABL_WAS_OFF) {
 		/*
 		 * set PWM duty cycle to max. TPS61161 seems to use this
 		 * to calibrate it's PWM sensitivity when it starts.
@@ -93,9 +97,9 @@ static int pandora_backlight_update_status(struct backlight_device *bl)
 
 done:
 	if (brightness != 0)
-		bl->props.state &= ~PANDORABL_WAS_OFF;
+		priv->old_state = 0;
 	else
-		bl->props.state |= PANDORABL_WAS_OFF;
+		priv->old_state = PANDORABL_WAS_OFF;
 
 	return 0;
 }
@@ -109,13 +113,20 @@ static int pandora_backlight_probe(struct platform_device *pdev)
 {
 	struct backlight_properties props;
 	struct backlight_device *bl;
+	struct pandora_private *priv;
 	u8 r;
 
+	priv = devm_kmalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv) {
+		dev_err(&pdev->dev, "failed to allocate driver private data\n");
+		return -ENOMEM;
+	}
+
 	memset(&props, 0, sizeof(props));
 	props.max_brightness = MAX_USER_VALUE;
 	props.type = BACKLIGHT_RAW;
 	bl = devm_backlight_device_register(&pdev->dev, pdev->name, &pdev->dev,
-					NULL, &pandora_backlight_ops, &props);
+					priv, &pandora_backlight_ops, &props);
 	if (IS_ERR(bl)) {
 		dev_err(&pdev->dev, "failed to register backlight\n");
 		return PTR_ERR(bl);
@@ -126,7 +137,7 @@ static int pandora_backlight_probe(struct platform_device *pdev)
 	/* 64 cycle period, ON position 0 */
 	twl_i2c_write_u8(TWL_MODULE_PWM, 0x80, TWL_PWM0_ON);
 
-	bl->props.state |= PANDORABL_WAS_OFF;
+	priv->old_state = PANDORABL_WAS_OFF;
 	bl->props.brightness = MAX_USER_VALUE;
 	backlight_update_status(bl);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

PATCH 4/6 staging/fbtft: Stop using BL_CORE_DRIVER1

In reply to Daniel Vetter

Leaking driver internal tracking into the already massively confusing backlight power tracking is really confusing.

Luckily we have already a drvdata structure, so fixing this is really easy.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 drivers/staging/fbtft/fbtft-core.c | 4 ++--
 drivers/staging/fbtft/fbtft.h      | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-core.c +2 -2
index 0e36b66ae5f7..731e47149af8 100644
@@ -246,7 +246,7 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
 static int fbtft_backlight_update_status(struct backlight_device *bd)
 {
 	struct fbtft_par *par = bl_get_data(bd);
-	bool polarity = !!(bd->props.state & BL_CORE_DRIVER1);
+	bool polarity = par->polarity;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par,
 		"%s: polarity=%d, power=%d, fb_blank=%d\n",
@@ -296,7 +296,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
 	/* Assume backlight is off, get polarity from current state of pin */
 	bl_props.power = FB_BLANK_POWERDOWN;
 	if (!gpio_get_value(par->gpio.led[0]))
-		bl_props.state |= BL_CORE_DRIVER1;
+		par->polarity = true;
 
 	bd = backlight_device_register(dev_driver_string(par->info->device),
 				       par->info->device, par,
drivers/staging/fbtft/fbtft.h +1 -0
index e19e64e0d094..c7cb4a7896f4 100644
@@ -229,6 +229,7 @@ struct fbtft_par {
 	ktime_t update_time;
 	bool bgr;
 	void *extra;
+	bool polarity;
 };
 
 #define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__})/sizeof(int))
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

Re: [PATCH 4/6] staging/fbtft: Stop using BL_CORE_DRIVER1

Greg, Thomas,

Quoted 12 lines · Daniel Vetter

Leaking driver internal tracking into the already massively confusing backlight power tracking is really confusing.

Luckily we have already a drvdata structure, so fixing this is really easy.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Quoted 4 lines
---
 drivers/staging/fbtft/fbtft-core.c | 4 ++--
 drivers/staging/fbtft/fbtft.h      | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

Do you want a pull-request for this patch or can I just take it?

Quoted 34 lines
drivers/staging/fbtft/fbtft-core.c +2 -2
index 0e36b66ae5f7..731e47149af8 100644
@@ -246,7 +246,7 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
 static int fbtft_backlight_update_status(struct backlight_device *bd)
 {
 	struct fbtft_par *par = bl_get_data(bd);
-	bool polarity = !!(bd->props.state & BL_CORE_DRIVER1);
+	bool polarity = par->polarity;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par,
 		"%s: polarity=%d, power=%d, fb_blank=%d\n",
@@ -296,7 +296,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
 	/* Assume backlight is off, get polarity from current state of pin */
 	bl_props.power = FB_BLANK_POWERDOWN;
 	if (!gpio_get_value(par->gpio.led[0]))
-		bl_props.state |= BL_CORE_DRIVER1;
+		par->polarity = true;
 
 	bd = backlight_device_register(dev_driver_string(par->info->device),
 				       par->info->device, par,
drivers/staging/fbtft/fbtft.h +1 -0
index e19e64e0d094..c7cb4a7896f4 100644
@@ -229,6 +229,7 @@ struct fbtft_par {
 	ktime_t update_time;
 	bool bgr;
 	void *extra;
+	bool polarity;
 };
 
 #define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__})/sizeof(int))
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer Acked-by
#7 lore raw

Re: [PATCH 4/6] staging/fbtft: Stop using BL_CORE_DRIVER1

Quoted 20 lines · Lee Jones

Greg, Thomas,

Quoted 12 lines · Daniel Vetter

Leaking driver internal tracking into the already massively confusing backlight power tracking is really confusing.

Luckily we have already a drvdata structure, so fixing this is really easy.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Quoted 4 lines
---
 drivers/staging/fbtft/fbtft-core.c | 4 ++--
 drivers/staging/fbtft/fbtft.h      | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 1 line

Do you want a pull-request for this patch or can I just take it?

Please take it if you need to take the whole series.

Reviewed-by on v1 4/6
#8 lore raw

Re: [PATCH 4/6] staging/fbtft: Stop using BL_CORE_DRIVER1

In reply to Daniel Vetter
Quoted 6 lines · Daniel Vetter

Leaking driver internal tracking into the already massively confusing backlight power tracking is really confusing.

Luckily we have already a drvdata structure, so fixing this is really easy.

Quoted 6 lines
Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Quoted 39 lines
---
 drivers/staging/fbtft/fbtft-core.c | 4 ++--
 drivers/staging/fbtft/fbtft.h      | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-core.c +2 -2
index 0e36b66ae5f7..731e47149af8 100644
@@ -246,7 +246,7 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
 static int fbtft_backlight_update_status(struct backlight_device *bd)
 {
 	struct fbtft_par *par = bl_get_data(bd);
-	bool polarity = !!(bd->props.state & BL_CORE_DRIVER1);
+	bool polarity = par->polarity;
 
 	fbtft_par_dbg(DEBUG_BACKLIGHT, par,
 		"%s: polarity=%d, power=%d, fb_blank=%d\n",
@@ -296,7 +296,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
 	/* Assume backlight is off, get polarity from current state of pin */
 	bl_props.power = FB_BLANK_POWERDOWN;
 	if (!gpio_get_value(par->gpio.led[0]))
-		bl_props.state |= BL_CORE_DRIVER1;
+		par->polarity = true;
 
 	bd = backlight_device_register(dev_driver_string(par->info->device),
 				       par->info->device, par,
drivers/staging/fbtft/fbtft.h +1 -0
index e19e64e0d094..c7cb4a7896f4 100644
@@ -229,6 +229,7 @@ struct fbtft_par {
 	ktime_t update_time;
 	bool bgr;
 	void *extra;
+	bool polarity;
 };
 
 #define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__})/sizeof(int))
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

PATCH 5/6 backlight: Also nuke BL_CORE_DRIVER1

In reply to Daniel Vetter

Now that the 3 drivers using this are cleaned up we can also remove this final bit of confusion of leaking driver internals into the backlight power interface.

The backlight power interface itself is still a massive mess.

---
 include/linux/backlight.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/backlight.h +0 -1
index 1db67662bfcb..7fbf0539e14a 100644
@@ -84,7 +84,6 @@ struct backlight_properties {
 
 #define BL_CORE_SUSPENDED	(1 << 0)	/* backlight is suspended */
 #define BL_CORE_FBBLANK		(1 << 1)	/* backlight is under an fb blank event */
-#define BL_CORE_DRIVER1		(1 << 31)	/* reserved for driver specific use */
 
 };
 
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 5/6
#10 lore raw

Re: [PATCH 5/6] backlight: Also nuke BL_CORE_DRIVER1

Quoted 20 lines · Daniel Vetter

Now that the 3 drivers using this are cleaned up we can also remove this final bit of confusion of leaking driver internals into the backlight power interface.

The backlight power interface itself is still a massive mess.

---
 include/linux/backlight.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/backlight.h +0 -0
index 1db67662bfcb..7fbf0539e14a 100644

include/linux/backlight.h struct backlight_properties { · line 87

Quoted 4 lines
include/linux/backlight.h +0 -1
@@ -84,7 +84,6 @@ struct backlight_properties {
 
 #define BL_CORE_SUSPENDED	(1 << 0)	/* backlight is suspended */
 #define BL_CORE_FBBLANK		(1 << 1)	/* backlight is under an fb blank event */
-#define BL_CORE_DRIVER1		(1 << 31)	/* reserved for driver specific use */

Please also remove the

	/* Upper 4 bits are reserved for driver internal use */

comment a few lines up to not give anyone ideas.

With that,

Quoted 2 lines
include/linux/backlight.h +0 -0
 };
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

Re: [PATCH 5/6] backlight: Also nuke BL_CORE_DRIVER1

Quoted 28 lines · Jani Nikula
Quoted 20 lines · Daniel Vetter

Now that the 3 drivers using this are cleaned up we can also remove this final bit of confusion of leaking driver internals into the backlight power interface.

The backlight power interface itself is still a massive mess.

---
 include/linux/backlight.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/backlight.h +0 -0
index 1db67662bfcb..7fbf0539e14a 100644

include/linux/backlight.h struct backlight_properties { · line 87

Quoted 4 lines
include/linux/backlight.h +0 -1
@@ -84,7 +84,6 @@ struct backlight_properties {
 
 #define BL_CORE_SUSPENDED	(1 << 0)	/* backlight is suspended */
 #define BL_CORE_FBBLANK		(1 << 1)	/* backlight is under an fb blank event */
-#define BL_CORE_DRIVER1		(1 << 31)	/* reserved for driver specific use */

Please also remove the

Quoted 7 lines
	/* Upper 4 bits are reserved for driver internal use */

comment a few lines up to not give anyone ideas.

With that,

I'm merging these patches (with Jani's Acks) now.

Please send this request as a subsequent patch.

Signature · 8 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

PATCH 6/6 MAINTAINERS: add dri-devel for backlight subsystem patches

In reply to Daniel Vetter

For the same reasons we've added dri-devel for all fbdev patches: Most of the actively developed drivers using this infrastructure are in drivers/gpu/. It just makes sense to cross-post patches and keep aligned. And total activity in the backlight subsystem is miniscule compared to drm overall.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index fa72c117bcd5..0f902399a348 100644
@@ -2589,6 +2589,7 @@ BACKLIGHT CLASS/SUBSYSTEM
 M:	Lee Jones <[email protected]>
 M:	Daniel Thompson <[email protected]>
 M:	Jingoo Han <[email protected]>
+L:	[email protected]
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
 S:	Maintained
 F:	drivers/video/backlight/
Signature · 1 line
2.17.0
maintainer Acked-by on v1 6/6
#13 lore raw

Re: [PATCH 6/6] MAINTAINERS: add dri-devel for backlight subsystem patches

Quoted 7 lines · Daniel Vetter

For the same reasons we've added dri-devel for all fbdev patches: Most of the actively developed drivers using this infrastructure are in drivers/gpu/. It just makes sense to cross-post patches and keep aligned. And total activity in the backlight subsystem is miniscule compared to drm overall.

Quoted 6 lines

Best regards,
Jingoo Han

Quoted 17 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -1
index fa72c117bcd5..0f902399a348 100644
@@ -2589,6 +2589,7 @@ BACKLIGHT CLASS/SUBSYSTEM
 M:	Lee Jones <[email protected]>
 M:	Daniel Thompson <[email protected]>
 M:	Jingoo Han <[email protected]>
+L:	[email protected]
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
 S:	Maintained
 F:	drivers/video/backlight/
--
Quoted 1 line

2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Acked-by on v1 1/6
#14 lore raw
In reply to Daniel Vetter
Quoted 21 lines · Daniel Vetter

The backlight power state handling is supremely confusing. We have:
- props.power, using FB_BLANK_* defines
- props.fb_blank, using the same, but deprecated int favour of props.state
- props.state, using the BL_CORE_* defines
- and finally a bunch of backlight drivers treat brightness == 0 as off. But of course not all of them.

This is way too much confusion to fix in a simple patch, but at least prevent more hilarity from spreading by removing the unused BL_CORE_* defines. I have no idea why exactly anyone would need that.

Wrt the ideal state, we really just want a boolean state. The 4 power saving states that the fbdev subsystem uses are overkill in todays hw (this was only relevant for VGA and similar analog circuits like TV-out), the new drm atomic modeset api simplified even the uapi to a simple bool. And there was never a valid technical reason to have the intermediate fbdev power states for backlights (those really only can be either off or on).

Quoted 8 lines

Cleanup motivated by Meghana's questions about all this.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Meghana Madhyastha <[email protected]>

I really love this patch!
Good job!
Thank you.

Best regards,
Jingoo Han

include/linux/backlight.h struct backlight_properties { · line 86

Quoted 12 lines
---
 include/linux/backlight.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/backlight.h +0 -0
index 2baab6f3861d..1db67662bfcb 100644
@@ -84,9 +84,6 @@ struct backlight_properties {
 
 #define BL_CORE_SUSPENDED	(1 << 0)	/* backlight is suspended */
 #define BL_CORE_FBBLANK		(1 << 1)	/* backlight is

under an fb

Quoted 2 lines

blank event */
-#define BL_CORE_DRIVER4 (1 << 28) /* reserved for

driver

Quoted 2 lines

specific use */
-#define BL_CORE_DRIVER3 (1 << 29) /* reserved for

driver

Quoted 2 lines

specific use */
-#define BL_CORE_DRIVER2 (1 << 30) /* reserved for

driver

Quoted 2 lines

specific use */
#define BL_CORE_DRIVER1 (1 << 31) /* reserved for

driver

Quoted 5 lines

specific use */

};
--
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/6
#15 lore raw
In reply to Daniel Vetter
Quoted 20 lines · Daniel Vetter

The backlight power state handling is supremely confusing. We have:
- props.power, using FB_BLANK_* defines
- props.fb_blank, using the same, but deprecated int favour of props.state
- props.state, using the BL_CORE_* defines
- and finally a bunch of backlight drivers treat brightness == 0 as off. But of course not all of them.

This is way too much confusion to fix in a simple patch, but at least prevent more hilarity from spreading by removing the unused BL_CORE_* defines. I have no idea why exactly anyone would need that.

Wrt the ideal state, we really just want a boolean state. The 4 power saving states that the fbdev subsystem uses are overkill in todays hw (this was only relevant for VGA and similar analog circuits like TV-out), the new drm atomic modeset api simplified even the uapi to a simple bool. And there was never a valid technical reason to have the intermediate fbdev power states for backlights (those really only can be either off or on).

Quoted 8 lines

Cleanup motivated by Meghana's questions about all this.

Cc Lee Jones <[email protected]>
Cc Daniel Thompson <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Meghana Madhyastha <[email protected]>
Quoted 18 lines
---
 include/linux/backlight.h | 3 ---
 1 file changed, 3 deletions(-)
include/linux/backlight.h +0 -3
index 2baab6f3861d..1db67662bfcb 100644
@@ -84,9 +84,6 @@ struct backlight_properties {
 
 #define BL_CORE_SUSPENDED	(1 << 0)	/* backlight is suspended */
 #define BL_CORE_FBBLANK		(1 << 1)	/* backlight is under an fb blank event */
-#define BL_CORE_DRIVER4		(1 << 28)	/* reserved for driver specific use */
-#define BL_CORE_DRIVER3		(1 << 29)	/* reserved for driver specific use */
-#define BL_CORE_DRIVER2		(1 << 30)	/* reserved for driver specific use */
 #define BL_CORE_DRIVER1		(1 << 31)	/* reserved for driver specific use */
 
 };
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#16 lore raw
In reply to Daniel Vetter
Quoted 20 lines · Daniel Vetter

The backlight power state handling is supremely confusing. We have:
- props.power, using FB_BLANK_* defines
- props.fb_blank, using the same, but deprecated int favour of props.state
- props.state, using the BL_CORE_* defines
- and finally a bunch of backlight drivers treat brightness == 0 as off. But of course not all of them.

This is way too much confusion to fix in a simple patch, but at least prevent more hilarity from spreading by removing the unused BL_CORE_* defines. I have no idea why exactly anyone would need that.

Wrt the ideal state, we really just want a boolean state. The 4 power saving states that the fbdev subsystem uses are overkill in todays hw (this was only relevant for VGA and similar analog circuits like TV-out), the new drm atomic modeset api simplified even the uapi to a simple bool. And there was never a valid technical reason to have the intermediate fbdev power states for backlights (those really only can be either off or on).

Quoted 1 line

Cleanup motivated by Meghana's questions about all this.

All applied, thanks.

Signature · 8 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel