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
>
5
#include <
drivers/parade/ps8640/ps8640.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 */
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);
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
46
struct
panel_description
*
get_panel_description
(
int
panel_id
)
47
{
48
/* To read panel EDID, we have to first power on PS8640. */
49
power_on_ps8640
();
50
51
u8
i2c_bus
= 4, i2c_addr = 0x08;
52
mtk_i2c_bus_init
(
i2c_bus
);
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
@ LB_FB_ORIENTATION_NORMAL
Definition:
coreboot_tables.h:266
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
delay.h
mdelay
void mdelay(unsigned int msecs)
Definition:
delay.c:2
GPIO
@ GPIO
Definition:
chip.h:84
gpio_output
void gpio_output(gpio_t gpio, int value)
Definition:
gpio.c:194
PANEL_END
#define PANEL_END
Definition:
panel.h:53
BIOS_ERR
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition:
loglevel.h:72
panel.h
GPIO_PP3300_LCM_EN
#define GPIO_PP3300_LCM_EN
Definition:
panel.h:29
GPIO_PP1200_MIPIBRDG_EN
#define GPIO_PP1200_MIPIBRDG_EN
Definition:
panel.h:27
GPIO_VDDIO_MIPIBRDG_EN
#define GPIO_VDDIO_MIPIBRDG_EN
Definition:
panel.h:32
GPIO_MIPIBRDG_RST_L_1V8
#define GPIO_MIPIBRDG_RST_L_1V8
Definition:
panel.h:26
GPIO_MIPIBRDG_PWRDN_L_1V8
#define GPIO_MIPIBRDG_PWRDN_L_1V8
Definition:
panel.h:25
panel_id
static uint8_t panel_id(void)
Definition:
boardid.c:45
ps8640_panel
static struct panel_description ps8640_panel
Definition:
panel_ps8640.c:40
ps8640_data
static struct panel_serializable_data ps8640_data
Definition:
panel_ps8640.c:36
power_on_ps8640
static void power_on_ps8640(void)
Definition:
panel_ps8640.c:12
get_panel_description
struct panel_description * get_panel_description(int panel_id)
Definition:
panel_ps8640.c:46
dummy_power_on
static void dummy_power_on(void)
Definition:
panel_ps8640.c:29
ps8640_init
int ps8640_init(uint8_t bus, uint8_t chip)
Definition:
ps8640.c:45
ps8640_get_edid
int ps8640_get_edid(uint8_t bus, uint8_t chip, struct edid *out)
Definition:
ps8640.c:11
ps8640.h
mtk_i2c_bus_init
void mtk_i2c_bus_init(uint8_t bus)
Definition:
i2c.c:65
gpio.h
NULL
#define NULL
Definition:
stddef.h:19
u8
uint8_t u8
Definition:
stdint.h:45
edid
Definition:
edid.h:49
i2c_bus
Definition:
i2c.c:65
panel_description
Definition:
panel.h:9
panel_description::s
struct panel_serializable_data * s
Definition:
panel.h:11
panel_serializable_data
Definition:
panel.h:29
panel_serializable_data::edid
struct edid edid
Definition:
panel.h:30
panel_serializable_data::init
u8 init[]
Definition:
panel.h:31
src
mainboard
google
kukui
panel_ps8640.c
Generated by
1.9.1