linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] PWM backlight interpolation adjustments
@ 2020-10-22  5:04 Alexandru Stan
  2020-10-22  5:04 ` [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels Alexandru Stan
  2020-11-01 15:33 ` [PATCH v3 0/3] PWM backlight interpolation adjustments Heiko Stuebner
  0 siblings, 2 replies; 5+ messages in thread
From: Alexandru Stan @ 2020-10-22  5:04 UTC (permalink / raw)
  To: Heiko Stuebner, Rob Herring, Andy Gross, Bjorn Andersson,
	Thierry Reding, Uwe Kleine-König, Lee Jones,
	Daniel Thompson, Jingoo Han, Bartlomiej Zolnierkiewicz
  Cc: Douglas Anderson, Matthias Kaehlcke, Enric Balletbo i Serra,
	Alexandru Stan, devicetree, dri-devel, linux-arm-kernel,
	linux-arm-msm, linux-fbdev, linux-kernel, linux-pwm,
	linux-rockchip

I was trying to adjust the brightness-levels for the trogdor boards:
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2291209
Like on a lot of panels, trogdor's low end needs to be cropped,
and now that we have the interpolation stuff I wanted to make use of it
and bake in even the curve that's customary to have on chromebooks.

I found the current behavior of the pwm_bl driver a little unintuitive
and non-linear. See patch 1 for a suggested fix for this.

A few veyron dts files were relying on this (perhaps weird) behavior.
Those devices also want a minimum brightness like trogdor, so changed
them to use the new way.

Finally, given that trogdor's dts is part of linux-next now, add the
brightness-levels to it, since that's the original reason I was looking at
this.

Changes in v3:
- Reordered patches, since both dts changes will work just fine
  even before the driver change.
- Rewrote a bit of the commit message to describe the new policy,
  as Daniel suggested.
- Removed redundant s64 for something that's always positive

Changes in v2:
- Fixed type promotion in the driver
- Removed "backlight: pwm_bl: Artificially add 0% during interpolation",
  userspace works just fine without it because it already knows how to use
  bl_power for turning off the display.
- Added brightness-levels to trogdor as well, now the dts is upstream.


Alexandru Stan (3):
  ARM: dts: rockchip: veyron: Remove 0 point from brightness-levels
  arm64: dts: qcom: trogdor: Add brightness-levels
  backlight: pwm_bl: Fix interpolation

 arch/arm/boot/dts/rk3288-veyron-jaq.dts      |  2 +-
 arch/arm/boot/dts/rk3288-veyron-minnie.dts   |  2 +-
 arch/arm/boot/dts/rk3288-veyron-tiger.dts    |  2 +-
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi |  9 +++
 drivers/video/backlight/pwm_bl.c             | 70 +++++++++-----------
 5 files changed, 43 insertions(+), 42 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels
  2020-10-22  5:04 [PATCH v3 0/3] PWM backlight interpolation adjustments Alexandru Stan
@ 2020-10-22  5:04 ` Alexandru Stan
  2020-10-22 23:07   ` Doug Anderson
  2020-10-28 14:56   ` Daniel Thompson
  2020-11-01 15:33 ` [PATCH v3 0/3] PWM backlight interpolation adjustments Heiko Stuebner
  1 sibling, 2 replies; 5+ messages in thread
From: Alexandru Stan @ 2020-10-22  5:04 UTC (permalink / raw)
  To: Heiko Stuebner, Rob Herring, Andy Gross, Bjorn Andersson,
	Thierry Reding, Uwe Kleine-König, Lee Jones,
	Daniel Thompson, Jingoo Han, Bartlomiej Zolnierkiewicz
  Cc: Douglas Anderson, Matthias Kaehlcke, Enric Balletbo i Serra,
	Alexandru Stan, devicetree, linux-arm-msm, linux-kernel

We want userspace to represent the human perceived brightness.
Since the led drivers and the leds themselves don't have a
linear response to the value we give them in terms of perceived
brightness, we'll bake the curve into the dts.

The panel also doesn't have a good response under 5%, so we'll avoid
sending it anything lower than that.

Note: Ideally this patch should be coupled with the driver change from
"backlight: pwm_bl: Fix interpolation", but it can work without it,
without looking too ugly.

Signed-off-by: Alexandru Stan <amstan@chromium.org>
---

 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index bf875589d364..ccdabc6c4994 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -179,6 +179,15 @@ pp3300_fp_tp: pp3300-fp-tp-regulator {
 	backlight: backlight {
 		compatible = "pwm-backlight";
 
+		/* The panels don't seem to like anything below ~ 5% */
+		brightness-levels = <
+			196 256 324 400 484 576 676 784 900 1024 1156 1296
+			1444 1600 1764 1936 2116 2304 2500 2704 2916 3136
+			3364 3600 3844 4096
+		>;
+		num-interpolated-steps = <64>;
+		default-brightness-level = <951>;
+
 		pwms = <&cros_ec_pwm 1>;
 		enable-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
 		power-supply = <&ppvar_sys>;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels
  2020-10-22  5:04 ` [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels Alexandru Stan
@ 2020-10-22 23:07   ` Doug Anderson
  2020-10-28 14:56   ` Daniel Thompson
  1 sibling, 0 replies; 5+ messages in thread
From: Doug Anderson @ 2020-10-22 23:07 UTC (permalink / raw)
  To: Alexandru Stan
  Cc: Heiko Stuebner, Rob Herring, Andy Gross, Bjorn Andersson,
	Thierry Reding, Uwe Kleine-König, Lee Jones,
	Daniel Thompson, Jingoo Han, Bartlomiej Zolnierkiewicz,
	Matthias Kaehlcke, Enric Balletbo i Serra,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-arm-msm, LKML

Hi,

On Wed, Oct 21, 2020 at 10:05 PM Alexandru Stan <amstan@chromium.org> wrote:
>
> We want userspace to represent the human perceived brightness.
> Since the led drivers and the leds themselves don't have a
> linear response to the value we give them in terms of perceived
> brightness, we'll bake the curve into the dts.
>
> The panel also doesn't have a good response under 5%, so we'll avoid
> sending it anything lower than that.
>
> Note: Ideally this patch should be coupled with the driver change from
> "backlight: pwm_bl: Fix interpolation", but it can work without it,
> without looking too ugly.
>
> Signed-off-by: Alexandru Stan <amstan@chromium.org>
> ---
>
>  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels
  2020-10-22  5:04 ` [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels Alexandru Stan
  2020-10-22 23:07   ` Doug Anderson
@ 2020-10-28 14:56   ` Daniel Thompson
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Thompson @ 2020-10-28 14:56 UTC (permalink / raw)
  To: Alexandru Stan
  Cc: Heiko Stuebner, Rob Herring, Andy Gross, Bjorn Andersson,
	Thierry Reding, Uwe Kleine-König, Lee Jones, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Douglas Anderson, Matthias Kaehlcke,
	Enric Balletbo i Serra, devicetree, linux-arm-msm, linux-kernel

On Wed, Oct 21, 2020 at 10:04:44PM -0700, Alexandru Stan wrote:
> We want userspace to represent the human perceived brightness.
> Since the led drivers and the leds themselves don't have a
> linear response to the value we give them in terms of perceived
> brightness, we'll bake the curve into the dts.
> 
> The panel also doesn't have a good response under 5%, so we'll avoid
> sending it anything lower than that.
> 
> Note: Ideally this patch should be coupled with the driver change from
> "backlight: pwm_bl: Fix interpolation", but it can work without it,
> without looking too ugly.
> 
> Signed-off-by: Alexandru Stan <amstan@chromium.org>

Acked-by: Daniel Thompson <daniel.thompson@linaro.org>



> ---
> 
>  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
> index bf875589d364..ccdabc6c4994 100644
> --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
> @@ -179,6 +179,15 @@ pp3300_fp_tp: pp3300-fp-tp-regulator {
>  	backlight: backlight {
>  		compatible = "pwm-backlight";
>  
> +		/* The panels don't seem to like anything below ~ 5% */
> +		brightness-levels = <
> +			196 256 324 400 484 576 676 784 900 1024 1156 1296
> +			1444 1600 1764 1936 2116 2304 2500 2704 2916 3136
> +			3364 3600 3844 4096
> +		>;
> +		num-interpolated-steps = <64>;
> +		default-brightness-level = <951>;
> +
>  		pwms = <&cros_ec_pwm 1>;
>  		enable-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
>  		power-supply = <&ppvar_sys>;
> -- 
> 2.28.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/3] PWM backlight interpolation adjustments
  2020-10-22  5:04 [PATCH v3 0/3] PWM backlight interpolation adjustments Alexandru Stan
  2020-10-22  5:04 ` [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels Alexandru Stan
@ 2020-11-01 15:33 ` Heiko Stuebner
  1 sibling, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2020-11-01 15:33 UTC (permalink / raw)
  To: Alexandru Stan, Lee Jones, Daniel Thompson, Jingoo Han,
	Andy Gross, Uwe Kleine-König, Bjorn Andersson,
	Thierry Reding, Rob Herring, Bartlomiej Zolnierkiewicz
  Cc: Heiko Stuebner, linux-pwm, dri-devel, devicetree,
	Douglas Anderson, Enric Balletbo i Serra, linux-kernel,
	linux-fbdev, linux-rockchip, Matthias Kaehlcke, linux-arm-msm,
	linux-arm-kernel

On Wed, 21 Oct 2020 22:04:42 -0700, Alexandru Stan wrote:
> I was trying to adjust the brightness-levels for the trogdor boards:
> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2291209
> Like on a lot of panels, trogdor's low end needs to be cropped,
> and now that we have the interpolation stuff I wanted to make use of it
> and bake in even the curve that's customary to have on chromebooks.
> 
> I found the current behavior of the pwm_bl driver a little unintuitive
> and non-linear. See patch 1 for a suggested fix for this.
> 
> [...]

Applied, thanks!

[1/1] ARM: dts: rockchip: Remove 0 point from brightness-levels on rk3288-veyron
      commit: 225c59b9235a421cdb219be5fbc13126a49714a6

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-01 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22  5:04 [PATCH v3 0/3] PWM backlight interpolation adjustments Alexandru Stan
2020-10-22  5:04 ` [PATCH v3 2/3] arm64: dts: qcom: trogdor: Add brightness-levels Alexandru Stan
2020-10-22 23:07   ` Doug Anderson
2020-10-28 14:56   ` Daniel Thompson
2020-11-01 15:33 ` [PATCH v3 0/3] PWM backlight interpolation adjustments Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).