Skip to content

Commit

Permalink
os/board/rtl8730e/src: disable unnecessary IRQ when backlight power OFF
Browse files Browse the repository at this point in the history
1. LCDC irq can be disabled when backlight power OFF
2. MIPI irq cannot be disabled because it is required to send cmd to turn backlight power ON, eg: ioctl(fd, LCDDEVIO_SETPOWER, x) where x >0
3. add error handling at lcd_put_area to prevent hang if irq is disabled but put area is called due to timing issue.
  • Loading branch information
zhongnuo-tang committed Dec 2, 2024
1 parent 84f4252 commit 414c3f9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct irq {
u32 num;
u32 data;
u32 priority;
bool disable_isr;
};

LCDC_TypeDef *pLCDC = LCDC;
Expand All @@ -93,6 +94,7 @@ struct irq lcdc_irq_info = {
.num = LCDC_IRQ,
.data = (u32) LCDC,
.priority = INT_PRI_HIGH,
.disable_isr = 0,
};

extern struct irq mipi_irq_info;
Expand Down Expand Up @@ -161,6 +163,10 @@ static void rtl8730e_lcd_layer_enable(int layer, bool enable)
static void rtl8730e_lcd_put_area(u8 *lcd_img_buffer, u32 x_start, u32 y_start, u32 x_end, u32 y_end)
{
irqstate_t flags;
/*to prevent hang due to timing issue, if lcd irq is disabled but put_area is called again*/
if (lcdc_irq_info.disable_isr) {
return;
}
#ifdef CONFIG_PM
bsp_pm_domain_control(BSP_MIPI_DRV, 1);
#endif
Expand Down Expand Up @@ -206,6 +212,13 @@ static void rtl8730e_control_backlight(uint8_t level)
lcdvdbg("level :%d , pwm level:%f\n", level, pwm_level);
#if defined(CONFIG_LCD_ST7785) || defined(CONFIG_LCD_ST7701SN)
pwmout_write(&g_rtl8730e_config_dev_s.pwm_led, 1.0-pwm_level);
if (level == 0 && !(lcdc_irq_info.disable_isr)) {
InterruptDis(lcdc_irq_info.num);
lcdc_irq_info.disable_isr = 1;
} else if (level != 0 && lcdc_irq_info.disable_isr) {
InterruptEn(lcdc_irq_info.num, lcdc_irq_info.priority);
lcdc_irq_info.disable_isr = 0;
}
#endif
}

Expand Down

0 comments on commit 414c3f9

Please sign in to comment.