| 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 |
#include <soc/regulator.h> |
| 10 |
|
| 11 |
#include "gpio.h" |
| 12 |
#include "panel.h" |
| 13 |
|
| 14 |
static void bridge_ps8640_power_on(void) |
| 15 |
{ |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
mainboard_set_regulator_voltage(MTK_REGULATOR_VRF12, 1200000); |
| 33 |
udelay(100); |
| 34 |
mainboard_set_regulator_voltage(MTK_REGULATOR_VCN33, 3300000); |
| 35 |
udelay(200); |
| 36 |
|
| 37 |
|
| 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); |
| 46 |
} |
| 47 |
|
| 48 |
static void panel_power_on(void) |
| 49 |
{ |
| 50 |
|
| 51 |
gpio_output(GPIO_EN_PP3300_DISP_X, 1); |
| 52 |
bridge_ps8640_power_on(); |
| 53 |
} |
| 54 |
|
| 55 |
static int bridge_ps8640_get_edid(struct edid *edid) |
| 56 |
{ |
| 57 |
const u8 chip = 0x8; |
| 58 |
|
| 59 |
if (ps8640_init(BRIDGE_I2C, chip) < 0) { |
| 60 |
printk(BIOS_ERR, "%s: Can't init PS8640 bridge\n", __func__); |
| 61 |
return -1; |
| 62 |
} |
| 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; |
| 66 |
} |
| 67 |
return 0; |
| 68 |
} |
| 69 |
|
| 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, |
| 76 |
}; |
| 77 |
|
| 78 |
struct panel_description *get_ps8640_description(void) |
| 79 |
{ |
| 80 |
mtk_i2c_bus_init(BRIDGE_I2C, I2C_SPEED_FAST); |
| 81 |
return &ps8640_bridge; |
| 82 |
} |