Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any outlook on i915 backlight support #84

Closed
neelchauhan opened this issue Sep 8, 2016 · 14 comments
Closed

Any outlook on i915 backlight support #84

neelchauhan opened this issue Sep 8, 2016 · 14 comments

Comments

@neelchauhan
Copy link

A month ago, you committed 620b889 and 50d21cc to add i915 backlight support, but since then, no progress has been made (from what I know) this.

On TrueOS 2016-08-31 (which uses drm-next-4.7), there is no way to set the amount of backlight on the Dell Inspiron 7352 (which unlike ThinkPad models, handles brightness through the GPU).

So is there any outlook on finishing the i915 backlight support (eg. add the acpi_video bits)?

@mattmacy
Copy link
Member

mattmacy commented Sep 8, 2016

So is there any outlook on finishing the i915 backlight support (eg. add the acpi_video bits)?

Yes, it's just taken a backseat to stability and image corruption issues.

@abishai
Copy link

abishai commented Sep 10, 2016

Maybe this port can set backlight?
http://www.freshports.org/graphics/intel-backlight/

@neelchauhan
Copy link
Author

neelchauhan commented Sep 10, 2016

It does not work on my laptop. Looking at the source, it only works up to Intel Haswell.

Update: I have also tried this, without success. Looks like my laptop will be running Arch for a bit longer.

@yanko-yankulov
Copy link

Here is a quick patch to make intel_backlight work on my skylake system

If you are interested give it a try. There should be no dependency on the drm code.

diff -u intel_backlight_fbsd-93e1fe4/intel_backlight.c intel_backlight-patched/intel_backlight.c
--- intel_backlight_fbsd-93e1fe4/intel_backlight.c      2015-07-06 01:32:27.000000000 +0300
+++ intel_backlight-patched/intel_backlight.c   2017-01-21 12:32:30.000000000 +0200
@@ -69,12 +69,29 @@
 int main(int argc, char** argv)
 {
        uint32_t current, max, min;
+       uint32_t currentReg, maxReg;
        int result;
-
+       
        intel_get_mmio(intel_get_pci_device());
-
-       current = reg_read(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
-       max = reg_read(BLC_PWM_PCH_CTL2) >> 16;
+       intel_check_pch();
+       
+       switch( pch )
+       {
+           case PCH_LPT:
+           case PCH_SPT:
+           case PCH_KBP:
+               currentReg = 0xc8254;
+               maxReg = 0xc8254;
+               break;
+               
+           default:
+               currentReg = BLC_PWM_CPU_CTL;
+               maxReg = BLC_PWM_PCH_CTL2;
+               break;
+       }
+       
+       current = reg_read(currentReg) & BACKLIGHT_DUTY_CYCLE_MASK;
+       max = reg_read(maxReg) >> 16;
 
        min = 0.5 + 0.5 * max / 100.0;  // 0.5%
        /*
@@ -99,9 +116,9 @@
                        v = min;
                else if (v > max)
                        v = max;
-               reg_write(BLC_PWM_CPU_CTL,
-                         (reg_read(BLC_PWM_CPU_CTL) &~ BACKLIGHT_DUTY_CYCLE_MASK) | v);
-               (void) reg_read(BLC_PWM_CPU_CTL);
+               reg_write(currentReg,
+                         (reg_read(currentReg) &~ BACKLIGHT_DUTY_CYCLE_MASK) | v);
+               (void) reg_read(currentReg);
                result = 0.5 + v * 100.0 / max;
                printf ("set backlight to %d%% (%d/%d)\n", result, v, max);
        }
diff -u intel_backlight_fbsd-93e1fe4/intel_gpu_tools.h intel_backlight-patched/intel_gpu_tools.h
--- intel_backlight_fbsd-93e1fe4/intel_gpu_tools.h      2015-07-06 01:32:27.000000000 +0300
+++ intel_backlight-patched/intel_gpu_tools.h   2017-01-21 12:28:13.000000000 +0200
@@ -103,6 +103,8 @@
        PCH_IBX,
        PCH_CPT,
        PCH_LPT,
+       PCH_SPT,
+       PCH_KBP,
 };
 
 extern enum pch_type pch;
diff -u intel_backlight_fbsd-93e1fe4/intel_pci.c intel_backlight-patched/intel_pci.c
--- intel_backlight_fbsd-93e1fe4/intel_pci.c    2015-07-06 01:32:27.000000000 +0300
+++ intel_backlight-patched/intel_pci.c 2017-01-21 12:29:09.000000000 +0200
@@ -115,6 +115,13 @@
        case 0x9c00:
                pch = PCH_LPT;
                break;
+       case 0xA100:
+       case 0x9D00:
+               pch = PCH_SPT;
+               break;
+       case 0xA200:
+               pch = PCH_KBP;
+               break;
        default:
                pch = PCH_NONE;
                return;

@neelchauhan
Copy link
Author

I don't know if it will work on Broadwell, but since I posted this I switched to an IvyBridge HP EliteBook 2570p.

@yanko-yankulov
Copy link

Honestly I dont know either. However if someome is willing to test it I might be able to help in case it fails. The proper way would deffinitely be to handle it in the driver, as there are multiple cases in the code. However the intel-backlight seems to do it most of the time.

@trombonehero
Copy link

trombonehero commented Jan 21, 2017 via email

@grahamperrin
Copy link

Might #84 (comment) work where KMS is used for Intel graphics?

@yanko-yankulov
Copy link

Yes. I am using it with kms

@martin-beran
Copy link

Your patch works perfectly on my Lenovo ThinkPad E460 with Skylake running FreeBSD 11.0. With acpi_ibm kernel module and a call of intel_backlight from /etc/devd.conf, I am even able to use brightness control buttons. Could you please propagate your patch to the graphics/intel-backlight port?

Martin Beran

@johalun
Copy link
Member

johalun commented Jul 5, 2017

We need to update the port to use this repo instead https://github.com/FreeBSDDesktop/intel_backlight_fbsd

It's fixed for newer systems and added some argument validation checks.

@mattmacy
Copy link
Member

@johalun please close this if resolved

@johalun
Copy link
Member

johalun commented Aug 31, 2017

Still need to update the port to use our repo.

@mattmacy
Copy link
Member

@johalun That's a bug that should be filed with the port maintainer. Not us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants