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> |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 4 | #include <console/console.h> |
| 5 | #include <delay.h> |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 6 | #include <gpio.h> |
| 7 | #include <soc/gpio_common.h> |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 8 | #include <soc/i2c.h> |
| 9 | #include <soc/regulator.h> |
Ruihai Zhou | 4a60418 | 2023-05-29 20:27:06 +0800 | [diff] [blame] | 10 | #include <soc/tps65132s.h> |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 11 | #include <soc/pmif.h> |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 12 | #include <string.h> |
| 13 | |
| 14 | #include "gpio.h" |
| 15 | #include "panel.h" |
| 16 | |
Ruihai Zhou | 4a60418 | 2023-05-29 20:27:06 +0800 | [diff] [blame] | 17 | #define PMIC_TPS65132_I2C I2C3 |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 18 | |
Bo-Chen Chen | 817c6a7 | 2023-01-10 15:59:05 +0800 | [diff] [blame] | 19 | static void power_on_mipi_boe_tv110c9m_ll0(void) |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 20 | { |
Ruihai Zhou | 4a60418 | 2023-05-29 20:27:06 +0800 | [diff] [blame] | 21 | const struct tps65132s_reg_setting reg_settings[] = { |
| 22 | { PMIC_TPS65132_VPOS, 0x11, 0x1f }, |
| 23 | { PMIC_TPS65132_VNEG, 0x11, 0x1f }, |
| 24 | { PMIC_TPS65132_DLYX, 0x95, 0xff }, |
| 25 | { PMIC_TPS65132_ASSDD, 0x5b, 0xff }, |
| 26 | }; |
| 27 | const struct tps65132s_cfg cfg = { |
| 28 | .i2c_bus = PMIC_TPS65132_I2C, |
| 29 | .en = GPIO_EN_PPVAR_MIPI_DISP, |
| 30 | .sync = GPIO_EN_PPVAR_MIPI_DISP_150MA, |
| 31 | .settings = reg_settings, |
| 32 | .setting_counts = ARRAY_SIZE(reg_settings), |
| 33 | }; |
yangcong | 6538464 | 2023-03-02 20:59:30 +0800 | [diff] [blame] | 34 | |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 35 | /* Enable VM18V */ |
| 36 | mainboard_enable_regulator(MTK_REGULATOR_VDD18, true); |
Ruihai Zhou | ffe2ced | 2023-07-07 16:48:24 +0800 | [diff] [blame] | 37 | mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST); |
| 38 | mdelay(10); |
Ruihai Zhou | 4a60418 | 2023-05-29 20:27:06 +0800 | [diff] [blame] | 39 | if (tps65132s_setup(&cfg) != CB_SUCCESS) |
| 40 | printk(BIOS_ERR, "Failed to set up voltage regulator tps65132s\n"); |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 41 | gpio_output(GPIO_DISP_RST_1V8_L, 0); |
| 42 | mdelay(1); |
Rex-BC Chen | d7b7460 | 2023-01-17 11:04:58 +0800 | [diff] [blame] | 43 | gpio_output(GPIO_DISP_RST_1V8_L, 1); |
| 44 | mdelay(1); |
| 45 | gpio_output(GPIO_DISP_RST_1V8_L, 0); |
| 46 | mdelay(1); |
| 47 | gpio_output(GPIO_DISP_RST_1V8_L, 1); |
| 48 | mdelay(6); |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | static struct panel_description panels[] = { |
| 52 | [1] = { |
Bo-Chen Chen | 817c6a7 | 2023-01-10 15:59:05 +0800 | [diff] [blame] | 53 | .name = "BOE_TV110C9M_LL0", |
| 54 | .power_on = power_on_mipi_boe_tv110c9m_ll0, |
Yidi Lin | ba604b5 | 2024-01-03 16:07:24 +0800 | [diff] [blame] | 55 | .configure_backlight = configure_mipi_pwm_backlight, |
| 56 | .orientation = LB_FB_ORIENTATION_BOTTOM_UP, |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 57 | .disp_path = DISP_PATH_MIPI, |
Bo-Chen Chen | f57155b | 2022-12-07 19:09:57 +0800 | [diff] [blame] | 58 | .pwm_ctrl_gpio = true, |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 59 | }, |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | struct panel_description *get_panel_description(uint32_t panel_id) |
| 63 | { |
Yidi Lin | 0b192d3 | 2023-03-20 17:40:31 +0800 | [diff] [blame] | 64 | /* Only PANEL_ID_LOW_CHANNEL value is valid for the reference board. */ |
| 65 | uint32_t id = panel_id & 0xF; |
| 66 | |
| 67 | if (id >= ARRAY_SIZE(panels)) |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 68 | return NULL; |
| 69 | |
Yidi Lin | 0b192d3 | 2023-03-20 17:40:31 +0800 | [diff] [blame] | 70 | return &panels[id]; |
Bo-Chen Chen | 4946516 | 2022-11-30 14:47:41 +0800 | [diff] [blame] | 71 | } |