<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - xbacklight does not work properly after modifying PWM modulation frequency"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=76217">76217</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>chris@chris-wilson.co.uk
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>xbacklight does not work properly after modifying PWM modulation frequency
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-gfx-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>janus@rtfm.org.ar
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver/intel
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>xorg
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=95875" name="attach_95875" title="Output of lspci, uname, xrandr, and package versions">attachment 95875</a> <a href="attachment.cgi?id=95875&action=edit" title="Output of lspci, uname, xrandr, and package versions">[details]</a></span>
Output of lspci, uname, xrandr, and package versions

I have a LED panel with a intel graphic card using the i915 module.

In this model, to avoid flickering of the screen, the Arch wiki[1] recommends
to change the PWM modulation frequency, following this calculator [2].

In my case, I had to change the register 0xC8254 from its original value
0xD9C0D9C to 0x5730573 in order to have a PWM frequency of 700 Hz.

After I do the change, through the command
intel_reg_write 0xC8254 0x5730573
(part of the Intel GPU tools [3])
xbacklight start to behave wrong.

For example:
$ xbacklight -get
20.005741
$ xbacklight -set 30
$ xbacklight -get
11.997704
$ xbacklight -set 100
$ xbacklight -get
40.040184

The bight is modifyied according to the -set parameter, but then it detects
that 40.040184 is the 100% (you can see that 30% of this value is aproximately
the 11.997704 that I get before, and so on).

In addition, -inc and -dec do not work properly.
For examle:
$ xbacklight -get
20.005741
$ xbacklight -inc 10
$ xbacklight -get
11.997704
(and the bight when down).

I tried also by echoing directly to
/sys/class/backlight/intel_backlight/brightness, with similar results:
 # cat /sys/class/backlight/intel_backlight/max_brightness
3484
# echo 3484 > /sys/class/backlight/intel_backlight/brightness
# cat /sys/class/backlight/intel_backlight/brightness
1395
# echo 2000 > /sys/class/backlight/intel_backlight/brightness
 # cat /sys/class/backlight/intel_backlight/brightness
800

I attach the output of some commands to identify my hardware. I am on an
up-to-date Arch Linux, and the computer is an HP 9470m.

References:
[1]
<a href="https://wiki.archlinux.org/index.php/backlight#Backlight_PWM_modulation_frequency_.28Intel_i915_only.29">https://wiki.archlinux.org/index.php/backlight#Backlight_PWM_modulation_frequency_.28Intel_i915_only.29</a>
[2]
<a href="http://devbraindom.blogspot.fr/2013/03/eliminate-led-screen-flicker-with-intel.html">http://devbraindom.blogspot.fr/2013/03/eliminate-led-screen-flicker-with-intel.html</a>
[3] <a href="http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/">http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>