Saturday, 23 March 2013

Eliminate LED screen flicker with Intel i915

Step-by-step solution

Actions described here may cause damage to your hardware. Do at your own risk.
  1. Install Intel GPU tools
  2. Read reference clock value with command
    # intel_reg_read 0xC6204
    and put the value in the box below
  3. Type desired PWM frequency in the box below
  4. Click
  5. In your terminal execute
    # intel_reg_write 0xC8254 0x7a107a1
Finally, to make things permanent, run this command on system startup. I use systemd so here is what I have
Description=LED PWM frequency 

ExecStart=/usr/bin/intel_reg_write 0xc8254 %I

Enable service on startup
# systemctl enable pwmfrequency@0x7a107a1


PWM modulation frequency of LED backlight in laptops with Intel i915 GPU may be controlled by GPU itself (sometimes it is not the case though). So adjustment of PWM modulation frequency becomes possible by write to special HW register.

In i915 (at least, in Sandy Bridge) PWM modulation frequency is controlled by value of the 4 upper bytes of the register 0xC8254. According to the Intel HD Graphics programmer's reference manual the value of these 4 bytes
represents the period of the PWM stream in PCH display raw clocks multiplied by 128.
PCH display raw clock frequency is held in another register 0xC6204 and by default it equals to 125 MHz (0x7D).
Resulting PWM modulation frequency can be calculated by formula
fPWM = regC6204 / 128 / regC8254{7:4}
For example, for reference clock frequency equal to 125 MHz and value of the regC8254 equal to 0x12281228 (default on my Thinkpad X220) PWM modulation frequency will be equal to approximately 200 Hz.

See also


  1. This is great. I find I have to push the frequency all the way up to 2000Hz on my Thinkpad X1 Carbon in order to not notice any flicker (using the 'pencil test'). The default frequency is around 220Hz.

    Does anyone have a view on whether this might be dangerous for the screen, reducing it's lifespan?

    What frequencies have people managed to achieve for extended periods of time without any adverse effects?

    1. Hi.
      I believe, this may be dangerous for the screen. Don't know for sure of course.
      I tried 1200 Hz for my X220 — worked well, but there was a constant high-pitch zoom noise.
      Decided to go with 700 Hz. It is still perfectly noticeable with pencil test, though already doesn't cause any strain to my eyes.

  2. This comment has been removed by the author.

  3. Does anybody know what is the limit? I went with 1500 Hz, and it seems really fine. Can I damage my panel with such a high frequency?

    1. No idea. But it would great if you could check back in after a couple of months and let us know if you have any problems!

    2. I did find this comment that BackLight Control values for intel driver should generally be between 200hz and 1000hz. This is on a website for a company that seems to make/work with boards for embedded devices, so it's not a hard and fast rule for a lapttop PC, but I guess it's an indication:

      I also found this link, referring to ATOM CPUs, that describes that an intel processor pin must be router to the display's "PWM-based backlight inverter module". Essentially this is telling me that it's the PWM inverter module that has to be able to cope with the frequency that's being set via the intel driver, and this I'm guessing is likely to be specific to your particular laptop. In an example screenshot here, they set the PWM frequency to 20300! But I don't want to read too much into this, as the document also says the frequency has to be within tolerance for your specific panel.

    3. My laptop is the HP EliteBook 9470m, and I have been using it with the PWM freq at 6000Hz for the last week without problems (yet).

    4. In the comments on this page: xiphmont seems to believe raising the frequency is generally safe, and his main conecern was potential noise that could be made by the inverter switching at rates above 500hz (which was mentioned by edio in the comment above).

      Xiphmont seems to enjoy replacing the backlight for his own thinkpad monitors, so he presumably has some expertise in this area :)

    5. The way to find this information would perhaps be to find which panel your laptop has, then lookup the datasheet for that panel.

      There is mention of PWM min/typical/max frequencies in the datasheet.

      For the W520 FHD panel (B156HW01 V4), it's 100Hz/200Hz/20kHz. (I could be wrong, check it for yourself)

    6. This comment has been removed by the author.

    7. I have ASUS n551jm, working with 2000Hz for a month already. Tried to ask ASUS support about the max PWM frequency, but received just a stupid reply irrelevant to the question.

  4. Happen to know the registers for Haswell?

    1. It should be the same according to (see SBMC_PWM_CTL2 on page 809)

  5. And what if I use init.d? Could someone enter a startup script for debian please? My eyes get hurt from LED display and I'm not very advanced in this stuff. Beside I'm unable to spend much time with my PC due to obvious reasons. Thanks.

  6. If you're using Wheezy, you need to setup a sid chroot first (it doesn't take as long as it sounds):

    The relevant command is:
    debootstrap sid [your-chroot]

    Once you have that, do this:

    for i in /dev /sys /proc; do mount -R $i [your-chroot]$i; done


    chroot [your-chroot]

    apt-get install intel-gpu-tools

    Here's an init.d script (remember to exit the chroot before you install this):


    mount -o bind /sys/ [your-chroot]/sys/
    chroot [your-chroot] /usr/bin/intel_reg_write 0xC8254 [hex-value]

  7. This looks absolutely perfect. All these tiny details are made with lot of background knowledge. I like it a lot.
    lenevo coupon code

  8. Does anyone know what effect increasing the frequency has on the battery life?

    I'll check powertop and see if I can figure something out.

    1. I haven't noticed any difference in real-case scenarios on my X220. If there's any impact on battery life, it is negligible for me.

    2. This comment has been removed by the author.

    3. This comment has been removed by the author.

  9. This comment has been removed by the author.

    1. I'd assume, there is a slight possibility to make some damage to hardware.
      I hear audible noise too which made me worre, so I picked the lowest comfortable frequency.

    2. This comment has been removed by the author.

  10. Hi. In Fedora 22 when my laptop goes in low battery, it changes the frequency and the screen return to flicker, there is something to prevent this behavior? any ideas where I can change the frequency setted from the system when the battery percentace is low? thanks

    1. Update: I noticed that even after I lock the screen the system restore the register value to default

    2. I had this issue too.
      To fix it I created udev rule to reapply settings whenever something with display happens

      KERNEL!="intel_backlight", SUBSYSTEM!="backlight", ACTION!="change", GOTO="backlight_pwm_rules_end"

      TEST=="/tmp/intelpwm.lock", ATTR{brightness}!="0", RUN="/usr/bin/intelpwm", GOTO="backlight_pwm_rules_end"
      ATTR{brightness}=="0", RUN="/usr/bin/touch /tmp/intelpwm.lock"


      See AUR Archlinux package for more details

    3. I'm sorry, maybe I'm not so practical to udev rule. I checked your AUR package, but I'm not sure I can use it in Fedora (I've found this but it could be not necessary maybe?).
      How can I use your work on my PC? I need to install AUR package or maybe I can use some parts of your code? How can I proceed?

      Is enough if I create the intelpwm command like you did in your package (in /usr/bin/ folder) and after that I copy the 99-intelpwn.rules in /usr/lib/udev/rules.d/ ?

      Usually I directly try, but in this case it could be not so safe, I think. Thanks

    4. Gabriele, no need to install AUR on Fedora.

      I'd copy the 99-intelpwm.rule to /etc/udev/rules.d/ (my aur package uses /usr/lib, however by convention /etc should be used if you provide custom configuration manually, it is then easier to locate changes that are not tracked by package manager).

      intelpwm executable can be copied to a location you prefer. Just do not forget to update udev rule correspondingly then.

      When you're done with copying, you'd need to reload udev rules. Simply reboot or in terminal do

      sudo udevadm control --reload-rules

      Hope it helps.

    5. It seems to work fine. Thank you very much!
      There's only another little problem I forgot before and (re)noticed now:
      when I execute the intel_reg_write command the brightness goes to the max value. And if I press only once the + o - button it returns to the level it was before. There's a reason for this? Do you know? Thanks again.

    6. I can't give a technically precise answer, because I haven't investigated, how duty factor is stored. I guess, some of the registers holds some value, which is dependent on frequency, that's why the brightness changes.

      For me, whenever I set a higher frequency, brightness increases.

      If I have free time, I'll check, if it's possible to fix.

    7. I actually don't check if I have that problem too. I will.
      Anyway if you find something interesting that could fix these problems I will very thankful if you could share it here (so maybe I will receive an email notification).

      Thank you very much for your time. Have a nice day

    8. Kudos to edio for digging this and sharing it to us all.

      Based on my observation the brightness depends on the 4 least significant hex digits.
      For example if you have an X220 like edio's you can try
      # intel_reg write 0xC8254 0x07a107a1
      # intel_reg write 0xC8254 0x07a1061a
      # intel_reg write 0xC8254 0x07a10493
      # intel_reg write 0xC8254 0x07a1030d
      # intel_reg write 0xC8254 0x07a10186
      and you'll see the screen going from full brightness to about 20% brightness at 500Hz PWM frequency.

      Note that when you set the 4 last hex to something greater than the first 4 hex it just gives you the full brightness. You can try
      # intel_reg write 0xC8254 0x07a10800

      The + o - buttons on the laptop just change the last 4 hex but somehow they are not aware of the new PWM frequency being used and just assumes the last 4 hex should still go up to 0x1157 go give full brightness (for X220 at the default 220MHZ PWM freq).

  11. just a note from my personal experience

    on Windows 10 64bit I'm using this tool to set PWM frequency (2kHz):

    on Ubuntu I used Redshift tool ( to dim display which saves the screen from flickering (LEDs stay on 100% of the time, so no flickering at all)

    1. Hi, can I ask you your redshift configuration? I'm testing it on Fedora 24 but the screen is still flickering (while not applying registers edit). It's less noticeable but actually not solving the problem.