[Intel-gfx] [PATCH v7] drm/i915: A better backlight class brightness range.

Shih-Yuan Lee (FourDollars) sylee at canonical.com
Thu Nov 12 19:50:28 PST 2015


Since v3.17-rc1, it contains
============================

commit 6dda730e55f412a6dfb181cae6784822ba463847
Author: Jani Nikula <jani.nikula at intel.com>
Date:   Tue Jun 24 18:27:40 2014 +0300

    drm/i915: respect the VBT minimum backlight brightness

The backlight class 0 brightness means the PWM min and it does not turn
off the backlight. However there is a little problem that some values of
backlight class brightness are mapped to the same PWM value.

Taking VBT min 10 and PWD max 937 as an example.

The corresponding PWM min will be 37 because of round(10 * 937 / 255).

But

sysfs : PWM
-----------
   0 ->  37
   1 ->  38
     ...
  12 ->  49
  13 ->  49
     ...
 924 -> 925
 925 -> 925

You can see there are some duplicates due to the backlight class brighness
range is larger than the valid PWM brightness range.

I prepare a python script to calculate the complete list.
https://gist.github.com/fourdollars/e99c4e03c7dab0110ae7

Since v3.18-rc1, it contains
============================

commit e6755fb78e8f20ecadf2a4080084121336624ad9
Author: Jani Nikula <jani.nikula at intel.com>
Date:   Tue Aug 12 17:11:42 2014 +0300

    drm/i915: switch off backlight for backlight class 0 brightness

The status becomes worse because it uses the backlight class 0 brightness to
turn off the backlight and the corresponding PWM min is gone.

sysfs : PWM
-----------
   0 ->   0
   1 ->  38
     ...
  12 ->  49
  13 ->  49
     ...
 924 -> 925
 925 -> 925

Since v3.18-rc5, it contains
============================

commit e1c412e75754ab7b7002f3e18a2652d999c40d4b
Author: Jani Nikula <jani.nikula at intel.com>
Date:   Wed Nov 5 14:46:31 2014 +0200

    drm/i915: safeguard against too high minimum brightness

It is for the corner case https://bugzilla.kernel.org/show_bug.cgi?id=86551.
But what if it is on purpose, maybe the hardware vendor just wants to on and
off the backlight and there is no intermediate stage.

Taking VBT min 255 and PWD max 937 as an example.

Currenly 255 will be forcely changed to 64 so the corresponding PWM min will
be 235 because of round(64 * 937 / 255), and it becomes

sysfs : PWM
-----------
   0 ->   0 (off)
   1 -> 236 (probably off)
     ...
 934 -> 935 (probably off)
 935 -> 936 (probably off)
 936 -> 936 (probably off)
 937 -> 937 (on)

But it doesn't make sense if 0~936 are all used to disable the backlight and
only 937 is used to turn on the backlight.


This patch can solve all problems above.
========================================

Taking VBT min 10 and PWD max 937 as an example.

The corresponding PWM min will be 37 because of round(10 * 937 / 255).

sysfs : PWM
-----------
   0 ->   0 (off)
   1 ->  37
     ...
 900 -> 936
 901 -> 937

There is no duplicate and 37 matched the corresponding PWM min by VBT min.

Taking VBT min 255 and PWD max 937 as an example.

The corresponding PWM min will be 937 because of round(255 * 937 / 255).

sysfs : PWM
-----------
   0 ->   0 (off)
   1 -> 937

Even for the corner case, it still works well.

Shih-Yuan Lee (FourDollars) (1):
  drm/i915: A better backlight class brightness range.

 drivers/gpu/drm/i915/intel_panel.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

-- 
1.9.1



More information about the Intel-gfx mailing list