build/patch/u-boot/u-boot-sunxi/board_pinebook-a64/pinebook-add-rare-panel-support.patch

137 lines
3.6 KiB
Diff
Raw Normal View History

$NetBSD$
--- a/drivers/video/bridge/anx6345.c
+++ b/drivers/video/bridge/anx6345.c
@@ -3,6 +3,8 @@
* Copyright (C) 2017 Vasily Khoruzhick <anarsoul@gmail.com>
*/
+#define DEBUG
+
#include <common.h>
#include <dm.h>
#include <errno.h>
@@ -248,13 +250,77 @@ static int anx6345_read_dpcd(struct udev
return 0;
}
+static u8 pinebook14_edid[] = {
+ /* Header */
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+ /* ID Manufacturer Name */
+ 0x09, 0xe5,
+ /* ID Product Code */
+ 0x37, 0x00,
+ /* 32-bit serial No. */
+ 0x00, 0x00, 0x00, 0x00,
+ /* Week of manufacture */
+ 0x01,
+ /* Year of manufacture */
+ 0x16,
+ /* EDID Structure Ver. */
+ 0x01,
+ /* EDID revision # */
+ 0x04,
+ /* Video input definition */
+ 0x80,
+ /* Max H image size */
+ 0x1f,
+ /* Max V image size */
+ 0x11,
+ /* Display Gamma */
+ 0x78,
+ /* Feature support */
+ 0x0a,
+ /* Color bits */
+ 0xb0, 0x90, 0x97, 0x58, 0x54, 0x92, 0x26, 0x1d, 0x50, 0x54,
+ /* Established timings */
+ 0x00, 0x00, 0x00,
+ /* Standard timings */
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ 0x01, 0x01,
+ /* Detailed timing/monitor descriptor #1 */
+ 0x3e, 0x1c, 0x56, 0xa0, 0x50, 0x00, 0x16, 0x30,
+ 0x30, 0x20, 0x36, 0x00, 0x35, 0xad, 0x10, 0x00,
+ 0x00, 0x1a,
+ /* Detailed timing/monitor descriptor #2 */
+ 0x3e, 0x1c, 0x56, 0xa0, 0x50, 0x00, 0x16, 0x30,
+ 0x30, 0x20, 0x36, 0x00, 0x35, 0xad, 0x10, 0x00,
+ 0x00, 0x1a,
+ /* Detailed timing/monitor descriptor #3 */
+ 0x00, 0x00, 0x00, 0xfe, 0x00, 0x42, 0x4f, 0x45,
+ 0x20, 0x48, 0x46, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x20, 0x20,
+ /* Detailed timing/monitor descriptor #4 */
+ 0x00, 0x00, 0x00, 0xfe, 0x00, 0x48, 0x42, 0x31,
+ 0x34, 0x30, 0x57, 0x58, 0x31, 0x2d, 0x35, 0x30,
+ 0x31, 0x0a,
+ /* Extension flag */
+ 0x00,
+ /* Checksum */
+ 0x81
+};
+
static int anx6345_read_edid(struct udevice *dev, u8 *buf, int size)
{
- struct anx6345_priv *priv = dev_get_priv(dev);
-
if (size > EDID_SIZE)
size = EDID_SIZE;
- memcpy(buf, priv->edid, size);
+
+ if (anx6345_read_aux_i2c(dev, 0x50, 0x0, size, buf) != 0) {
+ debug("%s: EDID read failed, using static EDID\n", __func__);
+ memcpy(buf, pinebook14_edid, size);
+ }
return size;
}
@@ -268,7 +334,7 @@ static int anx6345_attach(struct udevice
static int anx6345_enable(struct udevice *dev)
{
u8 chipid, colordepth, lanes, data_rate, c;
- int ret, i, bpp;
+ int ret, i;
struct display_timing timing;
struct anx6345_priv *priv = dev_get_priv(dev);
@@ -336,27 +402,19 @@ static int anx6345_enable(struct udevice
anx6345_write_r0(dev, ANX9804_HDCP_CONTROL_0_REG, 0x00);
anx6345_write_r0(dev, 0xa7, 0x00);
- anx6345_read_aux_i2c(dev, 0x50, 0x0, EDID_SIZE, priv->edid);
- if (edid_get_timing(priv->edid, EDID_SIZE, &timing, &bpp) != 0) {
- debug("Failed to parse EDID\n");
- return -EIO;
- }
- debug("%s: panel found: %dx%d, bpp %d\n", __func__,
- timing.hactive.typ, timing.vactive.typ, bpp);
- if (bpp == 6)
- colordepth = 0x00; /* 6 bit */
- else
- colordepth = 0x10; /* 8 bit */
+ /* XXXJDM hard-coded for HB140WX1-501 14" TFT-LCD */
+ colordepth = 0x00; /* 6 bit */
+
anx6345_write_r1(dev, ANX9804_VID_CTRL2_REG, colordepth);
if (anx6345_read_dpcd(dev, DP_MAX_LINK_RATE, &data_rate)) {
debug("%s: Failed to DP_MAX_LINK_RATE\n", __func__);
- return -EIO;
+ data_rate = 10;
}
debug("%s: data_rate: %d\n", __func__, (int)data_rate);
if (anx6345_read_dpcd(dev, DP_MAX_LANE_COUNT, &lanes)) {
debug("%s: Failed to read DP_MAX_LANE_COUNT\n", __func__);
- return -EIO;
+ lanes = 1;
}
lanes &= DP_MAX_LANE_COUNT_MASK;
debug("%s: lanes: %d\n", __func__, (int)lanes);