From: Enric Balletbo i Serra <hidden> Date: 2017-07-17 21:28:28
Before this patch the enable signal was set before the PWM signal and
vice-versa on power off. I guess that this sequence is wrong, at least,
it is on the different panels datasheets that I checked, so I inverted
the sequence to follow the specs.
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Changes since v2:
- Add this as a separate patch (Thierry Reding)
Changes since v1:
- None
drivers/video/backlight/pwm_bl.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
@@ -54,10 +54,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness)if(err<0)dev_err(pb->dev,"failed to enable power supply\n");+pwm_enable(pb->pwm);+if(pb->enable_gpio)gpiod_set_value_cansleep(pb->enable_gpio,1);-pwm_enable(pb->pwm);pb->enabled=true;}
From: Enric Balletbo i Serra <hidden> Date: 2017-07-17 21:28:31
Hardware needs a delay between setting an initial (non-zero) PWM and
enabling the backlight using GPIO. The post-pwm-on-delay-us specifies
this delay in micro seconds. Hardware also needs a delay between disabing
the backlight using GPIO and setting PWM value to 0. The pwm-off-delay-us
is this delay in micro seconds.
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Based on the original Huang Lin [off-list ref] work.
Changes since v2:
- Use separate properties (Rob Herring)
Changes since v1:
- As suggested by Daniel Thompson
- Do not assume power-on delay and power-off delay will be the same
Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt | 6 ++++++
1 file changed, 6 insertions(+)
@@ -17,6 +17,10 @@ Optional properties: "pwms" property (see PWM binding[0]) - enable-gpios: contains a single GPIO specifier for the GPIO which enables and disables the backlight (see GPIO binding[1])+ - post-pwm-on-delay-us: Delay in us between setting an initial (non-zero) PWM+ and enabling the backlight using GPIO.+ - pwm-off-delay-us: Delay in us between disabling the backlight using GPIO+ and setting PWM value to 0. [0]: Documentation/devicetree/bindings/pwm/pwm.txt [1]: Documentation/devicetree/bindings/gpio/gpio.txt
From: Enric Balletbo i Serra <hidden> Date: 2017-07-17 21:28:34
Some panels (i.e. N116BGE-L41), in their power sequence specifications,
request a delay between set the PWM signal and enable the backlight and
between clear the PWM signal and disable the backlight. Add support for
the new post-pwm-on-delay-us and pwm-off-delay-us proprieties to meet
the timings.
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Changes since v2:
- Move the pwm/enable sequence to another patch (Thierry Reding)
Changes since v1:
- As suggested by Daniel Thompson
- Do not assume power-on delay and power-off delay will be the same
- Move the check of dt property to the parse dt function.
drivers/video/backlight/pwm_bl.c | 17 +++++++++++++++++
include/linux/pwm_backlight.h | 1 +
2 files changed, 18 insertions(+)
@@ -13,6 +13,7 @@ struct platform_pwm_backlight_data {unsignedintlth_brightness;unsignedintpwm_period_ns;unsignedint*levels;+unsignedintpwm_delay[2];/* TODO remove once all users are switched to gpiod_* API */intenable_gpio;int(*init)(structdevice*dev);
From: Enric Balletbo i Serra <hidden> Date: 2017-07-17 21:28:40
For veyron the binding should provide both PWM timings, the delay between
you enable the PWM and set the enable signal, and the delay between you
disable the PWM signal and clear the enable signal. Update the binding
accordingly, in this case the panels connected to the veyron boards have
a symmetric power sequence, hence the same value is used.
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Changes since v2:
- Use new names for proprieties.
Changes since v1:
- Add this new patch to fix current binding on veyron.
arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Enric Balletbo i Serra <hidden> Date: 2017-07-17 21:28:53
The minnie devices comes with an AUO B101EAN01 panel which is different
from default veyron devices, thus the power on/off timing sequence is
slightly different. The datasheet specifies a pwm delay of 200 ms, so
update the PMW delay proprieties accordingly.
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Heiko,
I'm not able to test this patch in a minnie device because I don't have
one, so could you do a quick try, please?
Changes since v2:
- Use new names for proprieties.
Changes since v1:
- Add this new patch as minnie has differents timings
arch/arm/boot/dts/rk3288-veyron-minnie.dts | 2 ++
1 file changed, 2 insertions(+)
From: Daniel Thompson <hidden> Date: 2017-07-18 09:34:20
On 17/07/17 22:28, Enric Balletbo i Serra wrote:
Before this patch the enable signal was set before the PWM signal and
vice-versa on power off. I guess that this sequence is wrong, at least,
it is on the different panels datasheets that I checked, so I inverted
the sequence to follow the specs.
Could you list the part numbers for the panels you checked? Getting that
in the git history would be really helpful for future archaeologists
(including me).
Also whilst changing the header I'd also say that "I guess that" does
not inspire much confidence. It sounds like you have done some homework
here... surely you've moved past guess work!
Daniel.
quoted hunk
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Changes since v2:
- Add this as a separate patch (Thierry Reding)
Changes since v1:
- None
drivers/video/backlight/pwm_bl.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
@@ -54,10 +54,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness)if(err<0)dev_err(pb->dev,"failed to enable power supply\n");+pwm_enable(pb->pwm);+if(pb->enable_gpio)gpiod_set_value_cansleep(pb->enable_gpio,1);-pwm_enable(pb->pwm);pb->enabled=true;}
From: Daniel Thompson <hidden> Date: 2017-07-18 09:38:27
On 17/07/17 22:28, Enric Balletbo i Serra wrote:
quoted hunk
Some panels (i.e. N116BGE-L41), in their power sequence specifications,
request a delay between set the PWM signal and enable the backlight and
between clear the PWM signal and disable the backlight. Add support for
the new post-pwm-on-delay-us and pwm-off-delay-us proprieties to meet
the timings.
Signed-off-by: Enric Balletbo i Serra <redacted>
---
Changes since v2:
- Move the pwm/enable sequence to another patch (Thierry Reding)
Changes since v1:
- As suggested by Daniel Thompson
- Do not assume power-on delay and power-off delay will be the same
- Move the check of dt property to the parse dt function.
drivers/video/backlight/pwm_bl.c | 17 +++++++++++++++++
include/linux/pwm_backlight.h | 1 +
2 files changed, 18 insertions(+)
@@ -175,6 +183,14 @@ static int pwm_backlight_parse_dt(struct device *dev, data->max_brightness--; }+ /*+ * These values are optional and set as 0 by default, the out values+ * are modified only if a valid u32 value can be decoded.+ */+ of_property_read_u32(node, "post-pwm-on-delay-us",+ &data->pwm_delay[0]);+ of_property_read_u32(node, "pwm-off-delay-us", &data->pwm_delay[1]);+ data->enable_gpio = -EINVAL; return 0; }
@@ -13,6 +13,7 @@ struct platform_pwm_backlight_data {unsignedintlth_brightness;unsignedintpwm_period_ns;unsignedint*levels;+unsignedintpwm_delay[2];/* TODO remove once all users are switched to gpiod_* API */intenable_gpio;int(*init)(structdevice*dev);
From: Pavel Machek <hidden> Date: 2017-07-20 08:04:37
On Mon 2017-07-17 23:28:08, Enric Balletbo i Serra wrote:
Hardware needs a delay between setting an initial (non-zero) PWM and
enabling the backlight using GPIO. The post-pwm-on-delay-us specifies
this delay in micro seconds. Hardware also needs a delay between disabing
the backlight using GPIO and setting PWM value to 0. The pwm-off-delay-us
is this delay in micro seconds.
Signed-off-by: Enric Balletbo i Serra <redacted>
From: Pavel Machek <hidden> Date: 2017-07-20 08:10:47
On Mon 2017-07-17 23:28:11, Enric Balletbo i Serra wrote:
The minnie devices comes with an AUO B101EAN01 panel which is different
from default veyron devices, thus the power on/off timing sequence is
slightly different. The datasheet specifies a pwm delay of 200 ms, so
update the PMW delay proprieties accordingly.
-us = <20 000>;
This is not 200 msec.
Plus, it is quite anti-social to do udelay(200 000).
Plus, it is very anti-socifal to use udelay_range(200msec,
400msec).
Whoever told you udelay_range is good thing to use -- it is not, and
it is certainly not worth making user wait 200msec more!
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Pavel,
2017-07-20 10:10 GMT+02:00 Pavel Machek [off-list ref]:
On Mon 2017-07-17 23:28:11, Enric Balletbo i Serra wrote:
quoted
The minnie devices comes with an AUO B101EAN01 panel which is different
from default veyron devices, thus the power on/off timing sequence is
slightly different. The datasheet specifies a pwm delay of 200 ms, so
update the PMW delay proprieties accordingly.
Plus, it is quite anti-social to do udelay(200 000).
Plus, it is very anti-socifal to use udelay_range(200msec,
400msec).
Whoever told you udelay_range is good thing to use -- it is not, and
it is certainly not worth making user wait 200msec more!
From: Pavel Machek <hidden> Date: 2017-07-20 10:13:51
Hi!
2017-07-20 10:10 GMT+02:00 Pavel Machek [off-list ref]:
quoted
On Mon 2017-07-17 23:28:11, Enric Balletbo i Serra wrote:
quoted
The minnie devices comes with an AUO B101EAN01 panel which is different
from default veyron devices, thus the power on/off timing sequence is
slightly different. The datasheet specifies a pwm delay of 200 ms, so
update the PMW delay proprieties accordingly.
Plus, it is quite anti-social to do udelay(200 000).
Plus, it is very anti-socifal to use udelay_range(200msec,
400msec).
Whoever told you udelay_range is good thing to use -- it is not, and
it is certainly not worth making user wait 200msec more!
Two named members would be better here (eliminating the "magic" 0
and 1).
My thought, too.
quoted
quoted
@@ -56,6 +58,9 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) pwm_enable(pb->pwm);+ if (pb->pwm_delay[0])+ usleep_range(pb->pwm_delay[0], pb->pwm_delay[0] * 2);
Plus I'd just do the delay unconditionally :-).
... does this still apply if this code is switched to msleep()?
msleep() has no wait avoidance[1] and if lots of drivers are reckless
about sleeping for 10ms it soon starts to show up in the boot time
(especially optimized ones).
Daniel.
[1] As it happens I can't see that many early bail out paths in
usleep_range() either.
Two named members would be better here (eliminating the "magic" 0
and 1).
My thought, too.
quoted
quoted
@@ -56,6 +58,9 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) pwm_enable(pb->pwm);+ if (pb->pwm_delay[0])+ usleep_range(pb->pwm_delay[0], pb->pwm_delay[0] * 2);
Plus I'd just do the delay unconditionally :-).
... does this still apply if this code is switched to msleep()?
msleep() has no wait avoidance[1] and if lots of drivers are reckless about
sleeping for 10ms it soon starts to show up in the boot time (especially
optimized ones).
Two named members would be better here (eliminating the "magic" 0
and 1).
My thought, too.
quoted
quoted
@@ -56,6 +58,9 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) pwm_enable(pb->pwm);+ if (pb->pwm_delay[0])+ usleep_range(pb->pwm_delay[0], pb->pwm_delay[0] * 2);
Plus I'd just do the delay unconditionally :-).
... does this still apply if this code is switched to msleep()?
No.
msleep() has no wait avoidance[1] and if lots of drivers are reckless about
sleeping for 10ms it soon starts to show up in the boot time (especially
optimized ones).
...
[1] As it happens I can't see that many early bail out paths in
usleep_range() either.