payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / google / kukui / panel_ps8640.c
blobc4e90ea81c88ed30923eddb59f0be041ef74a300
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>
10 #include "panel.h"
12 static void power_on_ps8640(void)
14 /* Disable backlight before turning on bridge */
15 gpio_output(GPIO(PERIPHERAL_EN13), 0);
16 gpio_output(GPIO(DISP_PWM), 0);
18 /* Turn on bridge */
19 gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 0);
20 gpio_output(GPIO_PP1200_MIPIBRDG_EN, 1);
21 gpio_output(GPIO_VDDIO_MIPIBRDG_EN, 1);
22 mdelay(2);
23 gpio_output(GPIO_MIPIBRDG_PWRDN_L_1V8, 1);
24 mdelay(2);
25 gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 1);
26 gpio_output(GPIO_PP3300_LCM_EN, 1);
29 static void dummy_power_on(void)
31 /* The panel has been already powered on when getting panel information
32 * so we should do nothing here.
36 static struct panel_serializable_data ps8640_data = {
37 .init = { PANEL_END },
40 static struct panel_description ps8640_panel = {
41 .s = &ps8640_data,
42 .orientation = LB_FB_ORIENTATION_NORMAL,
43 .power_on = dummy_power_on,
46 struct panel_description *get_panel_description(int panel_id)
48 /* To read panel EDID, we have to first power on PS8640. */
49 power_on_ps8640();
51 u8 i2c_bus = 4, i2c_addr = 0x08;
52 mtk_i2c_bus_init(i2c_bus);
54 ps8640_init(i2c_bus, i2c_addr);
55 struct edid *edid = &ps8640_data.edid;
56 if (ps8640_get_edid(i2c_bus, i2c_addr, edid)) {
57 printk(BIOS_ERR, "Can't get panel's edid\n");
58 return NULL;
60 return &ps8640_panel;