diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-09-02 16:12:04 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2022-09-02 16:12:04 +0000 |
commit | a0048b5c193943708c00dbbd0f5e9fed8c71e515 (patch) | |
tree | d9fe45e4e3bfcd05a5a350d694c8187cefe9e5a5 /sys/src/9 | |
parent | a194f52c9377e010c31612d6484cbd43df6d5e24 (diff) |
imx8/lcd: disable the bridge output on blank
Disabling LCDIF often produces flickering output at the top
of the LCD panel (timings going wrong?). Instead, just disable the
output on the bridge, which is much simpler, doesn't seem to cause
any issues, and saves enough power just as well.
Diffstat (limited to 'sys/src/9')
-rw-r--r-- | sys/src/9/imx8/lcd.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/sys/src/9/imx8/lcd.c b/sys/src/9/imx8/lcd.c index 89726a2da..3ec065d0e 100644 --- a/sys/src/9/imx8/lcd.c +++ b/sys/src/9/imx8/lcd.c @@ -356,11 +356,6 @@ static u32int *dphy = (u32int*)(VIRTIO + 0xA00300); static u32int *lcdif = (u32int*)(VIRTIO + 0x320000); -static struct { - Lock; - int blank; -}lcdifirq; - /* shift and mask */ static u32int sm(u32int v, u32int m) @@ -469,8 +464,7 @@ lcdifinit(struct video_mode *mode) /* enable underflow recovery to fix image shift */ wr(lcdif, LCDIF_CTRL1, sm(7, CTRL1_BYTE_PACKING_FORMAT) | - CTRL1_RECOVER_ON_UNDERFLOW | - CTRL1_CUR_FRAME_DONE_IRQ_EN); + CTRL1_RECOVER_ON_UNDERFLOW); wr(lcdif, LCDIF_CTRL, CTRL_BYPASS_COUNT | @@ -834,35 +828,15 @@ backlighton(void) gpioout(GPIO_PIN(1, 10), 1); } -static void -lcdifinterrupt(Ureg *, void *) -{ - wr(lcdif, LCDIF_CTRL1_CLR, CTRL1_CUR_FRAME_DONE_IRQ); - ilock(&lcdifirq); - if(lcdifirq.blank){ - /* turn off dotclk */ - wr(lcdif, LCDIF_CTRL_CLR, CTRL_DOTCLK_MODE); - /* wait for the fifo to empty */ - while(rr(lcdif, LCDIF_CTRL) & CTRL_RUN) - ; - lcdifirq.blank = 0; - } - iunlock(&lcdifirq); -} - void blankscreen(int blank) { - ilock(&lcdifirq); - lcdifirq.blank = blank; - if(blank == 0) /* restart lcdif */ - wr(lcdif, LCDIF_CTRL_SET, CTRL_DOTCLK_MODE | CTRL_RUN); - iunlock(&lcdifirq); - - /* toggle panel backlight */ + /* panel backlight */ gpioout(GPIO_PIN(1, 10), blank == 0); - /* toggle PWM2 */ + /* PWM2 */ mr(pwm2, PWMCR, (blank == 0)*CR_EN, CR_EN); + /* bridge output */ + i2cwritebyte(i2cdev(i2cbus("i2c4"), 0x2c), 0x5a, blank == 0 ? 0x0d : 0x05); } static void @@ -922,8 +896,6 @@ lcdinit(void) lcdifreset(); - intrenable(IRQlcdif, lcdifinterrupt, nil, BUSUNKNOWN, "lcdif"); - setclkrate("mipi.core", "system_pll1_div3", 266*Mhz); setclkrate("mipi.CLKREF", "system_pll2_clk", 25*Mhz); setclkrate("mipi.RxClkEsc", "system_pll1_clk", 80*Mhz); |