cpu/x86/smm/pci_resource_store: Store DEV/VEN ID
[coreboot2.git] / src / mainboard / google / corsola / panel_ps8640.c
blob94bf47d3128d14125618ccd344ddd0d5d83023ac
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <delay.h>
5 #include <drivers/parade/ps8640/ps8640.h>
6 #include <edid.h>
7 #include <gpio.h>
8 #include <soc/i2c.h>
9 #include <soc/regulator.h>
11 #include "gpio.h"
12 #include "panel.h"
14 static void bridge_ps8640_power_on(void)
17 * PS8640 power-on sequence is described in chapter 14, PS8640_DS_V1.4_20200210.docx
18 * - set VDD12 to be 1.2V
19 * - delay 100us
20 * - set VDD33 to be 3.3V
21 * - pull hign PD#
22 * - pull down RST#
23 * - delay 2ms
24 * - pull high RST#
25 * - delay more than 50ms (55ms for margin)
26 * - pull down RST#
27 * - delay more than 50ms (55ms for margin)
28 * - pull high RST#
31 /* Set VRF12 to 1.2V and VCN33 to 3.3V */
32 mainboard_set_regulator_voltage(MTK_REGULATOR_VRF12, 1200000);
33 udelay(100);
34 mainboard_set_regulator_voltage(MTK_REGULATOR_VCN33, 3300000);
35 udelay(200);
37 /* Turn on bridge */
38 gpio_output(GPIO_EDPBRDG_PWREN, 1);
39 gpio_output(GPIO_EDPBRDG_RST_L, 0);
40 mdelay(2);
41 gpio_output(GPIO_EDPBRDG_RST_L, 1);
42 mdelay(55);
43 gpio_output(GPIO_EDPBRDG_RST_L, 0);
44 mdelay(55);
45 gpio_output(GPIO_EDPBRDG_RST_L, 1);
48 static void panel_power_on(void)
50 /* Turn on the panel */
51 gpio_output(GPIO_EN_PP3300_DISP_X, 1);
52 bridge_ps8640_power_on();
55 static int bridge_ps8640_get_edid(struct edid *edid)
57 const u8 chip = 0x8;
59 if (ps8640_init(BRIDGE_I2C, chip) < 0) {
60 printk(BIOS_ERR, "%s: Can't init PS8640 bridge\n", __func__);
61 return -1;
63 if (ps8640_get_edid(BRIDGE_I2C, chip, edid) < 0) {
64 printk(BIOS_ERR, "%s: Can't get panel's edid\n", __func__);
65 return -1;
67 return 0;
70 static struct panel_description ps8640_bridge = {
71 .configure_backlight = backlight_control,
72 .power_on = panel_power_on,
73 .get_edid = bridge_ps8640_get_edid,
74 .disp_path = DISP_PATH_MIPI,
75 .orientation = LB_FB_ORIENTATION_NORMAL,
78 struct panel_description *get_ps8640_description(void)
80 mtk_i2c_bus_init(BRIDGE_I2C, I2C_SPEED_FAST);
81 return &ps8640_bridge;