aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/i2c/ptn3460/ptn3460.h
diff options
context:
space:
mode:
authorUwe Poeche <uwe.poeche@siemens.com>2019-10-28 11:28:50 +0100
committerPatrick Georgi <pgeorgi@google.com>2019-11-12 18:24:19 +0000
commit11a34ec4c230ab9a6a825eae57eb848aa052a6ed (patch)
tree9f6c0d3ac9002115836aab6c2b96df83d6ff428d /src/drivers/i2c/ptn3460/ptn3460.h
parentc484da1a98610d783131a3a3998c0a999b97f9f5 (diff)
drivers/i2c/ptn3460: Provide chip driver for PTN3460
This patch provides a chip driver for the DP-2-LVDS bridge PTN3460. The bridge is configured via I2C. As the mainboard has all the information regarding the attached LCD type, there are three hooks into mainboard code to get the information like EDID data and PTN config. TEST=Display is working on Siemens mainboards (e.g. mc_tcu3, mc_apl1, ...). Change-Id: Ie4c8176cd16836fa5b8fd2f72faf7a55723b82f6 Signed-off-by: Uwe Poeche <uwe.poeche@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36642 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Diffstat (limited to 'src/drivers/i2c/ptn3460/ptn3460.h')
-rw-r--r--src/drivers/i2c/ptn3460/ptn3460.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/drivers/i2c/ptn3460/ptn3460.h b/src/drivers/i2c/ptn3460/ptn3460.h
new file mode 100644
index 0000000000..4b9834eb9d
--- /dev/null
+++ b/src/drivers/i2c/ptn3460/ptn3460.h
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Siemens AG
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _I2C_PTN3460_H_
+#define _I2C_PTN3460_H_
+
+#include <stdint.h>
+
+#define PTN_EDID_OFF 0x00
+#define PTN_EDID_LEN 0x80
+#define PTN_CONFIG_OFF 0x80
+#define PTN_CONFIG_LEN 0x19
+#define PTN_FLASH_CFG_OFF 0xE8
+#define PTN_FLASH_CFG_LEN 0x04
+#define PTN_MAX_EDID_NUM 6
+#define PTN_ENABLE_EMULATION (1 << 0)
+
+/* Define some error codes that can be used */
+#define PTN_SUCCESS 0x00000000
+#define PTN_CFG_MODIFIED 0x00000001
+#define PTN_BUS_ERROR 0x10000000
+#define PTN_INVALID_EDID 0x20000000
+#define PTN_INVALID_EDID_BLOCK 0x30000000
+#define PTN_ERROR 0x40000000
+
+struct ptn_3460_config {
+ u8 dp_interface_ctrl; /* DisplayPort interface control */
+ u8 lvds_interface_ctrl1; /* LVDS interface control register 1 */
+ u8 lvds_interface_ctrl2; /* LVDS interface control register 2 */
+ u8 lvds_interface_ctrl3; /* LVDS interface control register 3 */
+ u8 edid_rom_emulation; /* select which EDID-block is emulated */
+ u8 edid_rom_access_ctrl; /* select which EDID block to map to 0..0x7F */
+ u8 pwm_min[3]; /* smallest PWM frequency for back light */
+ u8 pwm_max[3]; /* biggest PWM frequency for back light */
+ u8 fast_link_ctrl; /* Fast link training control register */
+ u8 pin_cfg_ctrl1; /* Pin configuration control register 1 */
+ u8 pin_cfg_ctrl2; /* Pin configuration control register 2 */
+ u8 pwm_default; /* Default PWM bit count in DPCD register */
+ u16 pwm_value; /* Current PWM bit count in DPCD register */
+ u8 pwm_default_freq; /* Default PWM frequency in DPCD register */
+ u8 t3_timing; /* Panel T3 timing value */
+ u8 t12_timing; /* Panel T12 timing value */
+ u8 backlight_ctrl; /* Back light control register */
+ u8 t2_delay; /* Panel T2 delay */
+ u8 t4_timing; /* Panel T4 timing value */
+ u8 t5_delay; /* Panel T5 delay */
+} __packed;
+
+struct ptn_3460_flash {
+ u8 cmd; /* Flash command (erase or erase and flash) */
+ u16 magic; /* Magic number needed by the flash algorithm */
+ u8 trigger; /* Trigger for starting flash operation */
+} __packed;
+
+/* We need functions which we can call to get mainboard specific data */
+/* These functions can be implemented somewhere else but must exist. */
+extern enum cb_err mb_get_edid(uint8_t edid_data[0x80]);
+extern uint8_t mb_select_edid_table(void);
+extern int mb_adjust_cfg(struct ptn_3460_config *cfg_ptr);
+
+#endif /* _I2C_PTN3460_H_ */