• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <delay.h>
5 #include <drivers/analogix/anx7625/anx7625.h>
6 #include <edid.h>
7 #include <gpio.h>
8 #include <soc/i2c.h>
9 
10 #include "gpio.h"
11 #include "panel.h"
12 
bridge_anx7625_power_on(void)13 static void bridge_anx7625_power_on(void)
14 {
15 	/* Turn on bridge */
16 	gpio_output(GPIO_EDPBRDG_RST_L, 0);
17 	gpio_output(GPIO_EN_PP1000_EDPBRDG, 1);
18 	gpio_output(GPIO_EN_PP1800_EDPBRDG, 1);
19 	gpio_output(GPIO_EN_PP3300_EDPBRDG, 1);
20 	mdelay(14);
21 	gpio_output(GPIO_EDPBRDG_PWREN, 1);
22 	mdelay(80);
23 	gpio_output(GPIO_EDPBRDG_RST_L, 1);
24 }
25 
bridge_anx7625_get_edid(struct edid * edid)26 static int bridge_anx7625_get_edid(struct edid *edid)
27 {
28 	if (anx7625_init(BRIDGE_I2C) < 0) {
29 		printk(BIOS_ERR, "%s: Can't init ANX7625 bridge\n", __func__);
30 		return -1;
31 	}
32 	if (anx7625_dp_get_edid(BRIDGE_I2C, edid) < 0) {
33 		printk(BIOS_ERR, "%s: Can't get panel's edid\n", __func__);
34 		return -1;
35 	}
36 	return 0;
37 }
38 
bridge_anx7625_post_power_on(const struct edid * edid)39 static int bridge_anx7625_post_power_on(const struct edid *edid)
40 {
41 	return anx7625_dp_start(BRIDGE_I2C, edid);
42 }
43 
panel_power_on(void)44 static void panel_power_on(void)
45 {
46 	/* Turn on the panel */
47 	gpio_output(GPIO_EN_PP3300_DISP_X, 1);
48 	bridge_anx7625_power_on();
49 }
50 
51 static struct panel_description anx7625_bridge = {
52 	.configure_backlight = backlight_control,
53 	.power_on = panel_power_on,
54 	.get_edid = bridge_anx7625_get_edid,
55 	.post_power_on = bridge_anx7625_post_power_on,
56 	.disp_path = DISP_PATH_MIPI,
57 	.orientation = LB_FB_ORIENTATION_NORMAL,
58 };
59 
get_anx7625_description(void)60 struct panel_description *get_anx7625_description(void)
61 {
62 	mtk_i2c_bus_init(BRIDGE_I2C, I2C_SPEED_FAST);
63 	return &anx7625_bridge;
64 }
65