| 1 |
|
| 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 |
|
| 15 |
gpio_output(GPIO(PERIPHERAL_EN13), 0); |
| 16 |
gpio_output(GPIO(DISP_PWM), 0); |
| 17 |
|
| 18 |
|
| 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 |
|
| 32 |
|
| 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 |
|
| 49 |
power_on_ps8640(); |
| 50 |
|
| 51 |
u8 i2c_bus = 4, i2c_addr = 0x08; |
| 52 |
mtk_i2c_bus_init(i2c_bus, I2C_SPEED_FAST); |
| 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 |
} |