blob: e77cb979899bcf8469def511634eadabd88ef95e [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>
Yidi Lincb7c4fd2024-01-02 17:33:00 +08006#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
15void 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
24bool 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
31void 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
38struct 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}