<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 12/11/2015 09:28, Shih-Yuan Lee
      (FourDollars) wrote:<br>
    </div>
    <blockquote
cite="mid:CAAT15mPviNa88YBLWLX=2NEeiniKxAaTzt_VHU0ksUB2tC9Xnw@mail.gmail.com"
      type="cite">
      <div dir="ltr">I think the first step is to identify which
        backlight interface is able to actually change the brightness.
        <div>Usually there are two backlight interfaces under
          /sys/class/backlight/, i.e. /sys/class/backlight/acpi_video0
          and /sys/class/backlight/intel_backlight.</div>
        <div>However you may see other different backlight interfaces
          under /sys/class/backlight/. It depends on what hardware you
          are using.</div>
        <div>Executing `cat max_brightness` under those folders can see
          the max brightness and then you can execute `echo $(($(cat
          max_brightness)/2)) | sudo tee brightness` to adjust it to
          about 50% brightness.</div>
      </div>
      <div class="gmail_extra"><br>
      </div>
    </blockquote>
    only /sys/class/backlight/intel_backlight is present.<br>
    max_brightness is 937<br>
    <br>
    these commands have no effect on display brightness:<br>
    echo 0 >brightness<br>
    echo 468 >brightness<br>
    echo 937 >brightness<br>
    <br>
    Regards,<br>
    Steph<br>
    <br>
    <br>
    <blockquote
cite="mid:CAAT15mPviNa88YBLWLX=2NEeiniKxAaTzt_VHU0ksUB2tC9Xnw@mail.gmail.com"
      type="cite">
      <div class="gmail_extra">
        <div class="gmail_quote">On Thu, Nov 12, 2015 at 4:08 PM,
          Stéphane ANCELOT <span dir="ltr"><<a
              moz-do-not-send="true" href="mailto:sancelot@free.fr"
              target="_blank">sancelot@free.fr</a>></span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
            I have seen you were working on brightness. Right, but this
            is useful only if many worlwide users would be able to
            activate it.<br>
            I have never been able to make it working on my intel
            systemes (core i5 - 4300u , core i3 ...)<br>
            Very difficult to check where the problem is coming from,
            altough you have either an intel_backlight or acpi_backlight
            folder in the sys directory<br>
            Regarding many many posts on the web, this sounds tricky and
            difficult to know why it has not worked, or simply the
            documentation is lacking ....<br>
            <br>
            Regards,<br>
            S.Ancelot
            <div>
              <div class="h5"><br>
                <br>
                On 12/11/2015 06:43, Shih-Yuan Lee (FourDollars) wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  There was a wonderful period after<br>
                  <br>
                  commit 6dda730e55f412a6dfb181cae6784822ba463847<br>
                  Author: Jani Nikula <jani.nikula at <a
                    moz-do-not-send="true" href="http://intel.com"
                    rel="noreferrer" target="_blank">intel.com</a>><br>
                  Date:   Tue Jun 24 18:27:40 2014 +0300<br>
                  <br>
                       drm/i915: respect the VBT minimum backlight
                  brightness<br>
                  <br>
                  The backlight class 0 brightness means the PWM min and
                  it does not turn<br>
                  off the backlight. After kernel 3.18, the backlight
                  class 0 brightness<br>
                  is used to turn off the backlight and the PWM min is
                  missing.<br>
                  <br>
                  Because of<br>
                  <br>
                  commit e6755fb78e8f20ecadf2a4080084121336624ad9<br>
                  Author: Jani Nikula <jani.nikula at <a
                    moz-do-not-send="true" href="http://intel.com"
                    rel="noreferrer" target="_blank">intel.com</a>><br>
                  Date:   Tue Aug 12 17:11:42 2014 +0300<br>
                  <br>
                       drm/i915: switch off backlight for backlight
                  class 0 brightness<br>
                  <br>
                  Use "VBT backlight PWM modulation frequency 200 Hz,
                  active high, min<br>
                  brightness 10, level 255" as an example. It means the
                  VBT min is 10<br>
                  out of [0..255] and the PWM max is 937 from other
                  place so the<br>
                  corresponding PWM min should be 37 (10 * 937 / 255).<br>
                  <br>
                  When we set backlight class 0 brightness, the
                  backlight is turned off.<br>
                  Althought the PWM value is 37 when the backlight is
                  off but it is<br>
                  useless. When we set set backlight class 1 brightness,
                  the backlight is<br>
                  on but the PWM value is 38 and it doesn't match the
                  corresponding PWM<br>
                  min of the VBT minimum backlight.<br>
                  <br>
                  And it has another minor issue that there are some
                  backlight class<br>
                  brightness values are mapped to the same PWM value
                  because the backlight<br>
                  class brightness range is larger than the valid PWM
                  brightness range.<br>
                  <br>
                  The backlight class brightness range [0..937]<br>
                  The valid PWM brightness range [37..937]<br>
                  <br>
                  This commit makes that backlight class 1 brightness
                  means the PWM min<br>
                  and backlight class max_brightness means the PWM max,
                  and the ranges<br>
                  become<br>
                  <br>
                  The backlight class brightness range [0..901]<br>
                  The valid PWM brightness range [36..937]<br>
                  <br>
                  That's no backlight class brightness value mapped to
                  the same PWM value.<br>
                  <br>
                  Signed-off-by: Shih-Yuan Lee (FourDollars) <<a
                    moz-do-not-send="true"
                    href="mailto:sylee@canonical.com" target="_blank">sylee@canonical.com</a>><br>
                  ---<br>
                    drivers/gpu/drm/i915/intel_panel.c | 26
                  ++++++++++++++++++--------<br>
                    1 file changed, 18 insertions(+), 8 deletions(-)<br>
                  <br>
                  diff --git a/drivers/gpu/drm/i915/intel_panel.c
                  b/drivers/gpu/drm/i915/intel_panel.c<br>
                  index b05c6d9..8efa199 100644<br>
                  --- a/drivers/gpu/drm/i915/intel_panel.c<br>
                  +++ b/drivers/gpu/drm/i915/intel_panel.c<br>
                  @@ -1194,10 +1194,9 @@ static int
                  intel_backlight_device_register(struct intel_connector
                  *connector)<br>
                          props.type = BACKLIGHT_RAW;<br>
                          /*<br>
                  -        * Note: Everything should work even if the
                  backlight device max<br>
                  -        * presented to the userspace is arbitrarily
                  chosen.<br>
                  +        * Expose the whole valid PWM brightness range
                  to the backlight class.<br>
                           */<br>
                  -       props.max_brightness =
                  panel->backlight.max;<br>
                  +       props.max_brightness = panel->backlight.max
                  - panel->backlight.min;<br>
                          props.brightness = scale_hw_to_user(connector,<br>
                                                             
                  panel->backlight.level,<br>
                                                             
                  props.max_brightness);<br>
                  @@ -1400,7 +1399,8 @@ static u32
                  get_backlight_min_vbt(struct intel_connector
                  *connector)<br>
                          struct drm_device *dev =
                  connector->base.dev;<br>
                          struct drm_i915_private *dev_priv =
                  dev->dev_private;<br>
                          struct intel_panel *panel =
                  &connector->panel;<br>
                  -       int min;<br>
                  +       int vbt_min;<br>
                  +       u32 pwm_min;<br>
                          WARN_ON(panel->backlight.max == 0);<br>
                    @@ -1411,14 +1411,24 @@ static u32
                  get_backlight_min_vbt(struct intel_connector
                  *connector)<br>
                           * against this by letting the minimum be at
                  most (arbitrarily chosen)<br>
                           * 25% of the max.<br>
                           */<br>
                  -       min = clamp_t(int,
                  dev_priv->vbt.backlight.min_brightness, 0, 64);<br>
                  -       if (min !=
                  dev_priv->vbt.backlight.min_brightness) {<br>
                  +       vbt_min = clamp_t(int,
                  dev_priv->vbt.backlight.min_brightness, 0, 64);<br>
                  +       if (vbt_min !=
                  dev_priv->vbt.backlight.min_brightness) {<br>
                                  DRM_DEBUG_KMS("clamping VBT min
                  backlight %d/255 to %d/255\n",<br>
                  -                           
                   dev_priv->vbt.backlight.min_brightness, min);<br>
                  +                           
                   dev_priv->vbt.backlight.min_brightness, vbt_min);<br>
                          }<br>
                          /* vbt value is a coefficient in range
                  [0..255] */<br>
                  -       return scale(min, 0, 255, 0,
                  panel->backlight.max);<br>
                  +       pwm_min = scale(vbt_min, 0, 255, 0,
                  panel->backlight.max);<br>
                  +<br>
                  +       /*<br>
                  +        * Because backlight class brightness 0 is
                  used to turn off the backlight, we<br>
                  +        * need to step down a little bit here to make
                  backlight class brightness 1<br>
                  +        * match the real PWM min.<br>
                  +        */<br>
                  +       if (pwm_min > 0)<br>
                  +               return pwm_min - 1;<br>
                  +       else<br>
                  +               return 0;<br>
                    }<br>
                      static int lpt_setup_backlight(struct
                  intel_connector *connector, enum pipe unused)<br>
                </blockquote>
                <br>
              </div>
            </div>
            _______________________________________________<br>
            Intel-gfx mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Intel-gfx@lists.freedesktop.org"
              target="_blank">Intel-gfx@lists.freedesktop.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.freedesktop.org/mailman/listinfo/intel-gfx"
              rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>