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 <yidilin@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89409
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Yidi Lin 2025-10-02 21:14:26 +08:00
commit bca876849a
10 changed files with 25 additions and 24 deletions

View file

@ -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)

View file

@ -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)

View file

@ -6,6 +6,7 @@
#include <soc/display.h>
#include <soc/i2c.h>
#include <soc/tps65132s.h>
#include <stdbool.h>
#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 */

View file

@ -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)

View file

@ -5,8 +5,9 @@
#include <soc/display.h>
#include <soc/tps65132s.h>
#include <stdbool.h>
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);

View file

@ -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)

View file

@ -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)

View file

@ -6,6 +6,7 @@
#include <gpio.h>
#include <soc/display.h>
#include <soc/i2c.h>
#include <stdbool.h>
#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 */

View file

@ -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();

View file

@ -5,6 +5,7 @@
#include <commonlib/coreboot_tables.h>
#include <mipi/panel.h>
#include <stdbool.h>
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);