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