[coreboot-gerrit] New patch to review for coreboot: 601af96 tegra124: Add tegra_dc_i2c_aux_read to allow reading EDID.

Marc Jones (marc.jones@se-eng.com) gerrit at coreboot.org
Tue Dec 9 23:07:15 CET 2014


Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7735

-gerrit

commit 601af967cec7435156a29c257726e999d6d7b4ca
Author: Hung-Te Lin <hungte at chromium.org>
Date:   Wed Mar 5 21:09:58 2014 +0800

    tegra124: Add tegra_dc_i2c_aux_read to allow reading EDID.
    
    To read EDID, we need to access I2C via DP AUX channel.
    
    BRANCH=none
    BUG=chrome-os-partner:25933
    TEST=emerge-nyan coreboot chromeos-bootimage
    
    Original-Change-Id: I2666b5d46843485b79265a537f19bd8eab5e1a26
    Original-Signed-off-by: Hung-Te Lin <hungte at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/188858
    Original-Reviewed-by: Gabe Black <gabeblack at chromium.org>
    Original-Commit-Queue: Gabe Black <gabeblack at chromium.org>
    (cherry picked from commit 8f8e98ff5038b57f89332aee75573095c3933dd2)
    Signed-off-by: Marc Jones <marc.jones at se-eng.com>
    
    Change-Id: I5b1b6ab2940c8265483059fd94a2c4db2a41144a
---
 src/soc/nvidia/tegra124/dp.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/soc/nvidia/tegra124/dp.c b/src/soc/nvidia/tegra124/dp.c
index a9da269..e5c0632 100644
--- a/src/soc/nvidia/tegra124/dp.c
+++ b/src/soc/nvidia/tegra124/dp.c
@@ -2,6 +2,7 @@
  * drivers/video/tegra/dc/dp.c
  *
  * Copyright (c) 2011-2013, NVIDIA Corporation.
+ * Copyright 2014 Google Inc.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -322,6 +323,46 @@ static int tegra_dc_dp_dpcd_write(struct tegra_dc_dp_data *dp, u32 cmd,
 	return ret;
 }
 
+/* TODO(hungte) Change this to static when EDID parsing functions are ready. */
+int tegra_dc_i2c_aux_read(struct tegra_dc_dp_data *dp, u32 i2c_addr,
+			  u8 addr, u8 *data, u32 *size, u32 *aux_stat);
+int tegra_dc_i2c_aux_read(struct tegra_dc_dp_data *dp, u32 i2c_addr,
+			  u8 addr, u8 *data, u32 *size, u32 *aux_stat)
+{
+	u32 finished = 0;
+	int ret = 0;
+
+	do {
+		u32 cur_size = MIN(DP_AUX_MAX_BYTES, *size - finished);
+
+		u32 len = 1;
+		ret = tegra_dc_dpaux_write_chunk(
+				dp, DPAUX_DP_AUXCTL_CMD_I2CWR, i2c_addr,
+				&addr, &len, aux_stat);
+		if (ret) {
+			printk(BIOS_ERR, "%s: error sending address to read.\n",
+			       __func__);
+			break;
+		}
+
+		ret = tegra_dc_dpaux_read_chunk(
+				dp, DPAUX_DP_AUXCTL_CMD_I2CRD, i2c_addr,
+				data, &cur_size, aux_stat);
+		if (ret) {
+			printk(BIOS_ERR, "%s: error reading data.\n", __func__);
+			break;
+		}
+
+		/* cur_size should be the real size returned */
+		addr += cur_size;
+		data += cur_size;
+		finished += cur_size;
+	} while (*size > finished);
+
+	*size = finished;
+	return ret;
+}
+
 static void tegra_dc_dpaux_enable(struct tegra_dc_dp_data *dp)
 {
 	/* clear interrupt */



More information about the coreboot-gerrit mailing list