From bca876849ac643512e3ffd6a3df57c59644588d2 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Thu, 2 Oct 2025 21:14:26 +0800 Subject: [PATCH] soc/mediatek/common: Add enable parameter for configure_backlight This change refactors `configure_backlight` function to accept a boolean 'enable' parameter. This provides more explicit control over the backlight state. BUG=b:319511268,b:319511268 TEST=emerge-rauru coreboot Change-Id: Ia713dc792186a9a8080fd9d7ee02738fd372f531 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/89409 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/mainboard/google/cherry/mainboard.c | 7 +++---- src/mainboard/google/corsola/panel.c | 7 +++---- src/mainboard/google/corsola/panel.h | 3 ++- src/mainboard/google/geralt/panel.c | 6 +++--- src/mainboard/google/geralt/panel.h | 3 ++- src/mainboard/google/rauru/panel.c | 7 +++---- src/mainboard/google/skywalker/panel.c | 7 +++---- src/mainboard/google/skywalker/panel.h | 3 ++- src/soc/mediatek/common/display.c | 3 ++- src/soc/mediatek/common/include/soc/display.h | 3 ++- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/mainboard/google/cherry/mainboard.c b/src/mainboard/google/cherry/mainboard.c index 16eabbac37..a0d5f80990 100644 --- a/src/mainboard/google/cherry/mainboard.c +++ b/src/mainboard/google/cherry/mainboard.c @@ -53,11 +53,10 @@ bool mainboard_needs_pcie_init(void) return false; } -/* Set up backlight control pins as output pin and power-off by default */ -static void configure_backlight(void) +static void configure_backlight(bool enable) { - gpio_output(GPIO_AP_EDP_BKLTEN, 0); - gpio_output(GPIO_BL_PWM_1V8, 0); + gpio_output(GPIO_AP_EDP_BKLTEN, enable); + gpio_output(GPIO_BL_PWM_1V8, enable); } static void power_on_panel(void) diff --git a/src/mainboard/google/corsola/panel.c b/src/mainboard/google/corsola/panel.c index e77cb97989..5e773e3a1f 100644 --- a/src/mainboard/google/corsola/panel.c +++ b/src/mainboard/google/corsola/panel.c @@ -28,11 +28,10 @@ bool is_pmic_aw37503(unsigned int bus) 0x04, &vendor_id, 0x0F, 0) && vendor_id == 0x01); } -void backlight_control(void) +void backlight_control(bool enable) { - /* Set up backlight control pins as output pin and power-off by default */ - gpio_output(GPIO_AP_EDP_BKLTEN, 0); - gpio_output(GPIO_BL_PWM_1V8, 0); + gpio_output(GPIO_AP_EDP_BKLTEN, enable); + gpio_output(GPIO_BL_PWM_1V8, enable); } struct panel_description *get_active_panel(void) diff --git a/src/mainboard/google/corsola/panel.h b/src/mainboard/google/corsola/panel.h index 01606f4dab..9190a23782 100644 --- a/src/mainboard/google/corsola/panel.h +++ b/src/mainboard/google/corsola/panel.h @@ -6,6 +6,7 @@ #include #include #include +#include #define BRIDGE_I2C I2C0 #define PMIC_AW37503_SLAVE 0x3E @@ -14,7 +15,7 @@ void aw37503_init(unsigned int bus); bool is_pmic_aw37503(unsigned int bus); uint32_t panel_id(void); -void backlight_control(void); +void backlight_control(bool enable); void tps65132s_power_on(struct tps65132s_cfg *config); /* Return the mipi panel description from given panel id */ diff --git a/src/mainboard/google/geralt/panel.c b/src/mainboard/google/geralt/panel.c index 82f49ab09e..6168a42acc 100644 --- a/src/mainboard/google/geralt/panel.c +++ b/src/mainboard/google/geralt/panel.c @@ -27,10 +27,10 @@ struct panel_description *get_active_panel(void) return get_panel_description(active_panel_id); } -void configure_mipi_pwm_backlight(void) +void configure_mipi_pwm_backlight(bool enable) { - gpio_output(GPIO_AP_DISP_BKLTEN, 0); - gpio_output(GPIO_MIPI_BL_PWM_1V8, 0); + gpio_output(GPIO_AP_DISP_BKLTEN, enable); + gpio_output(GPIO_MIPI_BL_PWM_1V8, enable); } void fill_lp_backlight_gpios(struct lb_gpios *gpios) diff --git a/src/mainboard/google/geralt/panel.h b/src/mainboard/google/geralt/panel.h index 7e07fb1684..381de0d3a7 100644 --- a/src/mainboard/google/geralt/panel.h +++ b/src/mainboard/google/geralt/panel.h @@ -5,8 +5,9 @@ #include #include +#include -void configure_mipi_pwm_backlight(void); +void configure_mipi_pwm_backlight(bool enable); void fill_lp_backlight_gpios(struct lb_gpios *gpios); void power_on_mipi_panel(const struct tps65132s_cfg *cfg); uint32_t panel_id(void); diff --git a/src/mainboard/google/rauru/panel.c b/src/mainboard/google/rauru/panel.c index cb7042ae3c..60afca61bb 100644 --- a/src/mainboard/google/rauru/panel.c +++ b/src/mainboard/google/rauru/panel.c @@ -9,11 +9,10 @@ #include "gpio.h" #include "panel.h" -/* Set up backlight control pins as output pin and power-off by default */ -static void configure_backlight(void) +static void configure_backlight(bool enable) { - gpio_output(GPIO_AP_EDP_BKLTEN, 0); - gpio_output(GPIO_BL_PWM_1V8, 0); + gpio_output(GPIO_AP_EDP_BKLTEN, enable); + gpio_output(GPIO_BL_PWM_1V8, enable); } static void power_on_panel(void) diff --git a/src/mainboard/google/skywalker/panel.c b/src/mainboard/google/skywalker/panel.c index deb392f281..bd4ef3374f 100644 --- a/src/mainboard/google/skywalker/panel.c +++ b/src/mainboard/google/skywalker/panel.c @@ -27,11 +27,10 @@ static bool is_pmic_aw37503(unsigned int bus) 0x04, &vendor_id, 0x0F, 0) && vendor_id == 0x01); } -/* Set up backlight control pins as output pins, and set them to power off by default */ -void panel_configure_backlight(void) +void panel_configure_backlight(bool enable) { - gpio_output(GPIO_EDP_BL_EN_1V8, 0); - gpio_output(GPIO_BL_PWM_1V8, 0); + gpio_output(GPIO_EDP_BL_EN_1V8, enable); + gpio_output(GPIO_BL_PWM_1V8, enable); } static void power_on_panel(void) diff --git a/src/mainboard/google/skywalker/panel.h b/src/mainboard/google/skywalker/panel.h index 77c8aed5e5..f38f50404d 100644 --- a/src/mainboard/google/skywalker/panel.h +++ b/src/mainboard/google/skywalker/panel.h @@ -6,6 +6,7 @@ #include #include #include +#include #define PMIC_AW37503_SLAVE 0x3E #define PMIC_I2C_BUS I2C6 @@ -17,7 +18,7 @@ struct aw37503_config { uint8_t panel_id(void); -void panel_configure_backlight(void); +void panel_configure_backlight(bool enable); void mipi_panel_power_on(void); /* Return the mipi panel description */ diff --git a/src/soc/mediatek/common/display.c b/src/soc/mediatek/common/display.c index c805c6d664..84981f059e 100644 --- a/src/soc/mediatek/common/display.c +++ b/src/soc/mediatek/common/display.c @@ -81,8 +81,9 @@ int mtk_display_init(void) mtcmos_display_power_on(); mtcmos_protect_display_bus(); + /* Set up backlight control pins as output pin and turn-off the backlight */ if (panel->configure_backlight) - panel->configure_backlight(); + panel->configure_backlight(false); if (panel->power_on) panel->power_on(); diff --git a/src/soc/mediatek/common/include/soc/display.h b/src/soc/mediatek/common/include/soc/display.h index 0d06a3cd2c..a874412aff 100644 --- a/src/soc/mediatek/common/include/soc/display.h +++ b/src/soc/mediatek/common/include/soc/display.h @@ -5,6 +5,7 @@ #include #include +#include enum disp_path_sel { DISP_PATH_NONE = 0, @@ -16,7 +17,7 @@ enum disp_path_sel { struct panel_description { const char *name; - void (*configure_backlight)(void); + void (*configure_backlight)(bool enable); void (*power_on)(void); int (*get_edid)(struct edid *edid); int (*post_power_on)(const struct edid *edid);