From 65e589cc440f7e273be0d95e8b051041679670e3 Mon Sep 17 00:00:00 2001 From: zhongnuo-tang Date: Fri, 22 Nov 2024 09:17:04 +0800 Subject: [PATCH] os/board/rtl8730e/src: disable unnecessary IRQ when backlight power OFF 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 --- os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c b/os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c index a21a5110bc..0ecd52b0ed 100644 --- a/os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c +++ b/os/board/rtl8730e/src/rtl8730e_mipi_lcdc.c @@ -81,6 +81,7 @@ struct irq { u32 num; u32 data; u32 priority; + bool disable_isr; }; LCDC_TypeDef *pLCDC = LCDC; @@ -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; @@ -206,6 +208,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 }