/* Intel Cherryview/VLV display-engine panel backlight. * * The internal panel's PWM lives in the graphics MMIO BAR, not on the * Chrome EC: BLC_PWM_CTL2 enables it and BLC_PWM_CTL holds the period and * duty cycle. The HP Chromebook 11 G5 (google/setzer, Braswell) VBT * declares PWM controller 0, 200 Hz, active high. */ #ifndef BACKLIGHT_H #define BACKLIGHT_H struct backlight_status { int present; int level; /* percent, 5..100 */ int enabled; unsigned int pipe; /* 0 = A, 1 = B */ unsigned int period; /* raw PWM period from BLC_PWM_CTL */ unsigned int duty; /* raw duty from BLC_PWM_CTL */ unsigned int bar; /* graphics MMIO BAR0 base */ unsigned int ctl2[2]; /* raw BLC_PWM_CTL2 for pipes A and B */ unsigned int ctl[2]; /* raw BLC_PWM_CTL for pipes A and B */ }; /* Called from gpu_init() for the active Intel adapter; no-op elsewhere. */ void backlight_init(unsigned int bus, unsigned int dev, unsigned int device_id); int backlight_present(void); /* Current brightness in percent, or -1 when no panel PWM was found. */ int backlight_percent(void); /* Monotonic change counter, bumped by every successful set/step. The WM * uses it to pop the brightness OSD without polling the registers. */ unsigned int backlight_seq(void); /* Clamped to 5..100. */ void backlight_set_percent(int percent); /* Step by 10 percent; dir > 0 is brighter. */ void backlight_step(int dir); /* Fill the status snapshot used by the `backlight` command. */ int backlight_status(struct backlight_status *out); #endif