coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
panel_ps8640.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <delay.h>
6 #include <edid.h>
7 #include <gpio.h>
8 #include <soc/i2c.h>
9 
10 #include "panel.h"
11 
12 static void power_on_ps8640(void)
13 {
14  /* Disable backlight before turning on bridge */
15  gpio_output(GPIO(PERIPHERAL_EN13), 0);
16  gpio_output(GPIO(DISP_PWM), 0);
17 
18  /* Turn on bridge */
22  mdelay(2);
24  mdelay(2);
27 }
28 
29 static void dummy_power_on(void)
30 {
31  /* The panel has been already powered on when getting panel information
32  * so we should do nothing here.
33  */
34 }
35 
36 static struct panel_serializable_data ps8640_data = {
37  .init = { PANEL_END },
38 };
39 
40 static struct panel_description ps8640_panel = {
41  .s = &ps8640_data,
42  .orientation = LB_FB_ORIENTATION_NORMAL,
43  .power_on = dummy_power_on,
44 };
45 
47 {
48  /* To read panel EDID, we have to first power on PS8640. */
50 
51  u8 i2c_bus = 4, i2c_addr = 0x08;
53 
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;
59  }
60  return &ps8640_panel;
61 }
@ LB_FB_ORIENTATION_NORMAL
#define printk(level,...)
Definition: stdlib.h:16
void mdelay(unsigned int msecs)
Definition: delay.c:2
@ GPIO
Definition: chip.h:84
void gpio_output(gpio_t gpio, int value)
Definition: gpio.c:194
#define PANEL_END
Definition: panel.h:53
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
#define GPIO_PP3300_LCM_EN
Definition: panel.h:29
#define GPIO_PP1200_MIPIBRDG_EN
Definition: panel.h:27
#define GPIO_VDDIO_MIPIBRDG_EN
Definition: panel.h:32
#define GPIO_MIPIBRDG_RST_L_1V8
Definition: panel.h:26
#define GPIO_MIPIBRDG_PWRDN_L_1V8
Definition: panel.h:25
static uint8_t panel_id(void)
Definition: boardid.c:45
static struct panel_description ps8640_panel
Definition: panel_ps8640.c:40
static struct panel_serializable_data ps8640_data
Definition: panel_ps8640.c:36
static void power_on_ps8640(void)
Definition: panel_ps8640.c:12
struct panel_description * get_panel_description(int panel_id)
Definition: panel_ps8640.c:46
static void dummy_power_on(void)
Definition: panel_ps8640.c:29
int ps8640_init(uint8_t bus, uint8_t chip)
Definition: ps8640.c:45
int ps8640_get_edid(uint8_t bus, uint8_t chip, struct edid *out)
Definition: ps8640.c:11
void mtk_i2c_bus_init(uint8_t bus)
Definition: i2c.c:65
#define NULL
Definition: stddef.h:19
uint8_t u8
Definition: stdint.h:45
Definition: edid.h:49
Definition: i2c.c:65
struct panel_serializable_data * s
Definition: panel.h:11
struct edid edid
Definition: panel.h:30