Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <boardid.h> |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 4 | #include <boot/coreboot_tables.h> |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 5 | #include <gpio.h> |
| 6 | #include <soc/gpio_common.h> |
| 7 | #include <string.h> |
| 8 | |
| 9 | #include "gpio.h" |
| 10 | #include "panel.h" |
| 11 | |
| 12 | static void configure_mipi_pwm_backlight(void) |
| 13 | { |
| 14 | gpio_output(GPIO_AP_DISP_BKLTEN, 0); |
Liju-Clr Chen | 26a8dea | 2022-12-15 13:40:41 +0800 | [diff] [blame^] | 15 | gpio_output(GPIO_MIPI_BL_PWM_1V8, 0); |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 16 | } |
| 17 | |
Bo-Chen Chen | c07ccd9 | 2022-11-30 18:34:54 +0800 | [diff] [blame] | 18 | static void configure_edp_aux_backlight(void) |
| 19 | { |
| 20 | /* TODO: Add edp aux backlight for MUTTO_B152731E1 when we get MUTTO_B152731E1 */ |
| 21 | } |
| 22 | |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 23 | static void power_on_mipi_boe_nv110c9m_l60(void) |
| 24 | { |
| 25 | /* TODO: Add the poweron for BOE_NV110C9M_L60 when we get BOE_NV110C9M_L60 */ |
| 26 | } |
| 27 | |
Bo-Chen Chen | c07ccd9 | 2022-11-30 18:34:54 +0800 | [diff] [blame] | 28 | static void power_on_edp_mutto_b152731e1(void) |
| 29 | { |
| 30 | /* TODO: Add the poweron for MUTTO_B152731E1 when we get MUTTO_B152731E1 */ |
| 31 | } |
| 32 | |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 33 | static struct panel_description panels[] = { |
| 34 | [1] = { |
| 35 | .name = "BOE_NV110C9M_L60", |
| 36 | .power_on = power_on_mipi_boe_nv110c9m_l60, |
| 37 | .configure_panel_backlight = configure_mipi_pwm_backlight, |
| 38 | .disp_path = DISP_PATH_MIPI, |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 39 | .pwm_ctrl_gpio = true, |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 40 | }, |
Bo-Chen Chen | c07ccd9 | 2022-11-30 18:34:54 +0800 | [diff] [blame] | 41 | [11] = { |
| 42 | .name = "MUTTO_B152731E1", |
| 43 | .power_on = power_on_edp_mutto_b152731e1, |
| 44 | .configure_panel_backlight = configure_edp_aux_backlight, |
| 45 | .disp_path = DISP_PATH_EDP, |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 46 | .pwm_ctrl_gpio = false, |
Bo-Chen Chen | c07ccd9 | 2022-11-30 18:34:54 +0800 | [diff] [blame] | 47 | }, |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | struct panel_description *get_panel_description(uint32_t panel_id) |
| 51 | { |
| 52 | if (panel_id >= ARRAY_SIZE(panels)) |
| 53 | return NULL; |
| 54 | |
| 55 | return &panels[panel_id]; |
| 56 | } |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 57 | |
| 58 | void fill_lp_backlight_gpios(struct lb_gpios *gpios) |
| 59 | { |
| 60 | struct panel_description *panel = get_active_panel(); |
| 61 | if (!panel || panel->disp_path == DISP_PATH_NONE) |
| 62 | return; |
| 63 | |
| 64 | struct lb_gpio mipi_pwm_gpios[] = { |
Liju-Clr Chen | 26a8dea | 2022-12-15 13:40:41 +0800 | [diff] [blame^] | 65 | {GPIO_MIPI_BL_PWM_1V8.id, ACTIVE_HIGH, -1, "PWM control"}, |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | struct lb_gpio edp_pwm_gpios[] = { |
| 69 | {GPIO_EDP_BL_PWM_1V8.id, ACTIVE_HIGH, -1, "PWM control"}, |
| 70 | }; |
| 71 | |
| 72 | if (panel->pwm_ctrl_gpio) { |
| 73 | /* PWM control for typical eDP and MIPI panels */ |
| 74 | if (panel->disp_path == DISP_PATH_MIPI) |
| 75 | lb_add_gpios(gpios, mipi_pwm_gpios, ARRAY_SIZE(mipi_pwm_gpios)); |
| 76 | else |
| 77 | lb_add_gpios(gpios, edp_pwm_gpios, ARRAY_SIZE(edp_pwm_gpios)); |
| 78 | } |
| 79 | |
| 80 | struct lb_gpio backlight_gpios[] = { |
| 81 | {GPIO_AP_DISP_BKLTEN.id, ACTIVE_HIGH, -1, "backlight enable"}, |
| 82 | }; |
| 83 | |
| 84 | lb_add_gpios(gpios, backlight_gpios, ARRAY_SIZE(backlight_gpios)); |
| 85 | } |