Skip to contentSkip to conversation

pwm-backlight: Turn off pwm backlight in probe

PATCH New Markus Pargmann 5 participants 8 messages Oct 6, 2014 – Oct 8, 2014

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

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +3 -1
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 		data->dft_brightness = data->max_brightness;
 	}
 
-	bl->props.brightness = data->dft_brightness;
+	bl->props.brightness = 0;
 	backlight_update_status(bl);
 
+	bl->props.brightness = data->dft_brightness;
+
 	platform_set_drvdata(pdev, bl);
 	return 0;
 
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 		data->dft_brightness = data->max_brightness;
 	}

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-	bl->props.brightness = data->dft_brightness;
+	bl->props.brightness = 0;
 	backlight_update_status(bl);
 
+	bl->props.brightness = data->dft_brightness;
+
 	platform_set_drvdata(pdev, bl);
 	return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

Thierry

[0]: https://lkml.org/lkml/2014/7/31/259
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141007/5bd7f432/attachment.sig>

#2 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

Quoted 39 lines · Thierry Reding
Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 		data->dft_brightness = data->max_brightness;
 	}

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-	bl->props.brightness = data->dft_brightness;
+	bl->props.brightness = 0;
 	backlight_update_status(bl);
 
+	bl->props.brightness = data->dft_brightness;
+
 	platform_set_drvdata(pdev, bl);
 	return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

Quoted 4 lines

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

I don't have any experience with this stuff. Jingoo and Bryan are the _real_ reviewers for Backlight. I just maintain the patches. That and I'm already swamped with MFD.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

In reply to Thierry Reding

Hi,

Quoted 39 lines · Thierry Reding
Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 		data->dft_brightness = data->max_brightness;
 	}

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-	bl->props.brightness = data->dft_brightness;
+	bl->props.brightness = 0;
 	backlight_update_status(bl);
 
+	bl->props.brightness = data->dft_brightness;
+
 	platform_set_drvdata(pdev, bl);
 	return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

Quoted 4 lines

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

Yes your proposal looks a lot better to handle the different use cases. The DT-binding is not a hardware description but I don't see any better way of passing that information. So it would be good to get your solution mainline.

Best regards,

Markus

Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141007/6e8c1166/attachment.sig>
#4 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

Quoted 47 lines · Markus Pargmann

Hi,

Quoted 39 lines · Thierry Reding
Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
            data->dft_brightness = data->max_brightness;
    }

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-   bl->props.brightness = data->dft_brightness;
+   bl->props.brightness = 0;
    backlight_update_status(bl);
 
+   bl->props.brightness = data->dft_brightness;
+
    platform_set_drvdata(pdev, bl);
    return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

Quoted 4 lines

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

Quoted 4 lines

Yes your proposal looks a lot better to handle the different use cases. The DT-binding is not a hardware description but I don't see any better way of passing that information. So it would be good to get your solution mainline.

+1
And, I have already tested Thierry's proposal on Exynos5800 peach_pi.

Ajay

#5 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

Quoted 48 lines · Ajay kumar
Quoted 47 lines · Markus Pargmann

Hi,

Quoted 43 lines · Thierry Reding
Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
            data->dft_brightness = data->max_brightness;
    }

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-   bl->props.brightness = data->dft_brightness;
+   bl->props.brightness = 0;
    backlight_update_status(bl);
 
+   bl->props.brightness = data->dft_brightness;
+
    platform_set_drvdata(pdev, bl);
    return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

Quoted 6 lines
Quoted 4 lines

Yes your proposal looks a lot better to handle the different use cases. The DT-binding is not a hardware description but I don't see any better way of passing that information. So it would be good to get your solution mainline.

+1
And, I have already tested Thierry's proposal on Exynos5800 peach_pi.

I also tested Thierry's patch on i.MX6s now and it works fine.

Regards,

Markus

Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141008/62e7787c/attachment.sig>
#6 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

In reply to Thierry Reding
Quoted 39 lines · Thierry Reding
Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 		data->dft_brightness = data->max_brightness;
 	}

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-	bl->props.brightness = data->dft_brightness;
+	bl->props.brightness = 0;
 	backlight_update_status(bl);
 
+	bl->props.brightness = data->dft_brightness;
+
 	platform_set_drvdata(pdev, bl);
 	return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

Quoted 4 lines

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

(+cc Ajay Kumar)

As I said earlier, I agree with this proposal.

Quoted 4 lines

Thierry

[0]: https://lkml.org/lkml/2014/7/31/259

#7 lore raw

PATCH 1/1 pwm-backlight: Turn off pwm backlight in probe

Quoted 40 lines · Jingoo Han
Quoted 39 lines · Thierry Reding
Quoted 16 lines · Markus Pargmann

The backlight will be enabled by the panel again if it is used. So we can save the default brightness and disable the pwm backlight when probing.

---
 drivers/video/backlight/pwm_bl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +0 -0
index 336b83be7e2d..b4f433a6f106 100644
@@ -317,9 +317,11 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 		data->dft_brightness = data->max_brightness;
 	}

drivers/video/backlight/pwm_bl.c static int pwm_backlight_probe(struct platform_device *pdev) · line 327

Quoted 10 lines
drivers/video/backlight/pwm_bl.c +3 -1
 
-	bl->props.brightness = data->dft_brightness;
+	bl->props.brightness = 0;
 	backlight_update_status(bl);
 
+	bl->props.brightness = data->dft_brightness;
+
 	platform_set_drvdata(pdev, bl);
 	return 0;
 

It would be nice if it was that easy. But we can't do this, because it will regress for users of this driver that don't use a panel or DRM. If the PWM backlight driver is used for example in conjunction with a plain fbdev driver it isn't necessarily hooked up with anything and won't be enabled automatically. That's really bad if fbdev is the only output you have since you'd have to blindly type the commands to enable the backlight. Furthermore disabling backlight isn't always what you want to do. For example if the bootloader already turned it on and you hand over from bootloader to kernel in a seamless way, then you absolutely want to keep backlight on all the time.

Quoted 8 lines
Quoted 4 lines

See also[0] for a different proposal to solve the same problem. Back at the time that received only a very few replies, but it would be nice if Lee and Bryan could look at it again and see if we can come up with some way to deal with this situation.

(+cc Ajay Kumar)

As I said earlier, I agree with this proposal.

I'm not sure which proposal exactly. I originally proposed adding a backlight-boot-off property, but that received some pushback from DT people because it isn't strictly hardware information but configuration data.

Perhaps a better solution would be to default to not touching the backlight status on probe at all. But we can't do that for non-DT because of backwards-compatibility. For DT it seems like all users have some form of DRM/KMS driver too, so I'd expect them to turn it off when appropriate.

Should we just go and make that change (no changing backlight state for DT) and see if anybody complains? If so, I'll gladly prepare a patch to do just that.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141008/a4de6db4/attachment.sig>