Yidi Lin | cb7c4fd | 2024-01-02 17:33:00 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <boardid.h> |
| 4 | #include <cbfs.h> |
Yidi Lin | cb7c4fd | 2024-01-02 17:33:00 +0800 | [diff] [blame] | 5 | #include <device/i2c_simple.h> |
Yidi Lin | cb7c4fd | 2024-01-02 17:33:00 +0800 | [diff] [blame] | 6 | #include <gpio.h> |
| 7 | #include <soc/ddp.h> |
| 8 | #include <soc/dsi.h> |
| 9 | #include <soc/gpio_common.h> |
| 10 | #include <soc/mtcmos.h> |
| 11 | |
| 12 | #include "gpio.h" |
| 13 | #include "panel.h" |
| 14 | |
| 15 | void aw37503_init(unsigned int bus) |
| 16 | { |
| 17 | i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x00, 0x14, 0x1F, 0); |
| 18 | i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x01, 0x14, 0x1F, 0); |
| 19 | i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x21, 0x4C, 0xFF, 0); |
| 20 | i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x03, 0x43, 0xFF, 0); |
| 21 | i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x21, 0x00, 0xFF, 0); |
| 22 | } |
| 23 | |
| 24 | bool is_pmic_aw37503(unsigned int bus) |
| 25 | { |
| 26 | u8 vendor_id; |
| 27 | return (!i2c_read_field(bus, PMIC_AW37503_SLAVE, |
| 28 | 0x04, &vendor_id, 0x0F, 0) && vendor_id == 0x01); |
| 29 | } |
| 30 | |
| 31 | void backlight_control(void) |
| 32 | { |
| 33 | /* Set up backlight control pins as output pin and power-off by default */ |
| 34 | gpio_output(GPIO_AP_EDP_BKLTEN, 0); |
| 35 | gpio_output(GPIO_BL_PWM_1V8, 0); |
| 36 | } |
| 37 | |
| 38 | struct panel_description *get_active_panel(void) |
| 39 | { |
| 40 | /* Board-specific exceptions */ |
| 41 | if (CONFIG(BOARD_GOOGLE_STEELIX) && board_id() < 2) /* Early builds use PS8640 */ |
| 42 | return get_ps8640_description(); |
| 43 | |
| 44 | if (CONFIG(DRIVER_ANALOGIX_ANX7625)) |
| 45 | return get_anx7625_description(); |
| 46 | |
| 47 | if (CONFIG(DRIVER_PARADE_PS8640)) |
| 48 | return get_ps8640_description(); |
| 49 | |
| 50 | /* MIPI panels */ |
| 51 | return get_panel_description(); |
| 52 | } |