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 domain lock when backlight is > 0 (ON), and only release the lock when backlight == 0 (OFF).
  • Loading branch information
zhongnuo-tang committed Nov 14, 2024
1 parent 84f4252 commit 4eff61a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#define GPIO_PIN_BACKLIGHT
#define MIPI_GPIO_RESET_PIN PA_14
#endif

static volatile bool pm_lock_status = 0;
struct rtl8730e_lcdc_info_s {
struct mipi_lcd_config_s lcd_config;
pwmout_t pwm_led;
Expand Down 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 @@ -205,7 +207,23 @@ static void rtl8730e_control_backlight(uint8_t level)
float pwm_level = level/100.0;
lcdvdbg("level :%d , pwm level:%f\n", level, pwm_level);
#if defined(CONFIG_LCD_ST7785) || defined(CONFIG_LCD_ST7701SN)
#ifdef CONFIG_PM
if (level != 0 && !pm_lock_status) { /* backlight ON, we should lock domain */
bsp_pm_domain_control(BSP_MIPI_DRV, 1);
pm_lock_status = 1;
} else if (level == 0 && pm_lock_status) { /* backlight OFF, we should release lock*/
bsp_pm_domain_control(BSP_MIPI_DRV, 0);
pm_lock_status = 0;
}
#endif
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 4eff61a

Please sign in to comment.