From: Ritesh Kumar <[email protected]>

Nord requires different TX voltage-swing and pre-emphasis levels for
both eDP and DP modes.  Add four pairs of 4x4 tables covering RBR/HBR
and HBR2/HBR3 for each mode, sourced from HPG Tables 2-2, 2-4, 2-6-a
and 2-6-b, and wrap them in qcom_edp_swing_pre_emph_cfg descriptors.

Signed-off-by: Ritesh Kumar <[email protected]>
Signed-off-by: Nabige Aala <[email protected]>
---
 drivers/phy/qualcomm/phy-qcom-edp.c | 85 +++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c 
b/drivers/phy/qualcomm/phy-qcom-edp.c
index ee0d7f1a90fe..64878398f43c 100644
--- a/drivers/phy/qualcomm/phy-qcom-edp.c
+++ b/drivers/phy/qualcomm/phy-qcom-edp.c
@@ -1527,6 +1527,91 @@ static const u8 edp_phy_vco_div_cfg_nord[4] = {
 };
 
 
+/*
+ * nord eDP swing/pre-emphasis tables (eDP mode, low HBR: RBR/HBR).
+ * From HPG Table 2-2: LDO ON 550mV (0x51).
+ * Rates: 1.62/2.16/2.43/2.7 Gbps
+ */
+static const u8 nord_edp_swing_hbr_rbr[4][4] = {
+       { 0x07, 0x0f, 0x16, 0x1f },
+       { 0x0d, 0x16, 0x1e, 0xff },
+       { 0x11, 0x1b, 0xff, 0xff },
+       { 0x16, 0xff, 0xff, 0xff },
+};
+
+static const u8 nord_edp_pre_emp_hbr_rbr[4][4] = {
+       { 0x05, 0x11, 0x17, 0x1d },
+       { 0x05, 0x11, 0x18, 0xff },
+       { 0x06, 0x11, 0xff, 0xff },
+       { 0x00, 0xff, 0xff, 0xff },
+};
+
+/*
+ * nord eDP swing/pre-emphasis tables (eDP mode, high HBR: HBR2/HBR3).
+ * From HPG Table 2-4: LDO ON 660mV (0x91).
+ * Rates: 3.24/4.32/5.4/5.94/8.1 Gbps
+ */
+static const u8 nord_edp_swing_hbr2_hbr3[4][4] = {
+       { 0x0b, 0x11, 0x17, 0x1c },
+       { 0x10, 0x19, 0x1f, 0xff },
+       { 0x19, 0x1f, 0xff, 0xff },
+       { 0x1f, 0xff, 0xff, 0xff },
+};
+
+static const u8 nord_edp_pre_emp_hbr2_hbr3[4][4] = {
+       { 0x0c, 0x15, 0x19, 0x1e },
+       { 0x0b, 0x15, 0x19, 0xff },
+       { 0x0e, 0x14, 0xff, 0xff },
+       { 0x0d, 0xff, 0xff, 0xff },
+};
+
+static const struct qcom_edp_swing_pre_emph_cfg nord_edp_swing_pre_emph_cfg = {
+       .swing_hbr_rbr          = &nord_edp_swing_hbr_rbr,
+       .swing_hbr3_hbr2        = &nord_edp_swing_hbr2_hbr3,
+       .pre_emphasis_hbr_rbr   = &nord_edp_pre_emp_hbr_rbr,
+       .pre_emphasis_hbr3_hbr2 = &nord_edp_pre_emp_hbr2_hbr3,
+};
+
+/*
+ * nord DP swing/pre-emphasis tables (DP mode, COMBO_PHYS TypeC).
+ * From HPG Table 2-6-a (HBR3/HBR2) and Table 2-6-b (HBR/RBR).
+ */
+static const u8 nord_dp_swing_hbr2_hbr3[4][4] = {
+       { 0x02, 0x12, 0x16, 0x1a },
+       { 0x09, 0x19, 0x1f, 0xff },
+       { 0x10, 0x1f, 0xff, 0xff },
+       { 0x1f, 0xff, 0xff, 0xff },
+};
+
+static const u8 nord_dp_pre_emp_hbr2_hbr3[4][4] = {
+       { 0x00, 0x0c, 0x15, 0x1b },
+       { 0x02, 0x0e, 0x16, 0xff },
+       { 0x02, 0x11, 0xff, 0xff },
+       { 0x04, 0xff, 0xff, 0xff },
+};
+
+static const u8 nord_dp_swing_hbr_rbr[4][4] = {
+       { 0x07, 0x0f, 0x16, 0x1f },
+       { 0x11, 0x1e, 0x1f, 0xff },
+       { 0x16, 0x1f, 0xff, 0xff },
+       { 0x1f, 0xff, 0xff, 0xff },
+};
+
+static const u8 nord_dp_pre_emp_hbr_rbr[4][4] = {
+       { 0x00, 0x0e, 0x15, 0x1a },
+       { 0x00, 0x0e, 0x15, 0xff },
+       { 0x00, 0x0e, 0xff, 0xff },
+       { 0x02, 0xff, 0xff, 0xff },
+};
+
+static const struct qcom_edp_swing_pre_emph_cfg nord_dp_swing_pre_emph_cfg = {
+       .swing_hbr_rbr          = &nord_dp_swing_hbr_rbr,
+       .swing_hbr3_hbr2        = &nord_dp_swing_hbr2_hbr3,
+       .pre_emphasis_hbr_rbr   = &nord_dp_pre_emp_hbr_rbr,
+       .pre_emphasis_hbr3_hbr2 = &nord_dp_pre_emp_hbr2_hbr3,
+};
+
+
 static const struct of_device_id qcom_edp_phy_match_table[] = {
        { .compatible = "qcom,glymur-dp-phy", .data = &glymur_phy_cfg, },
        { .compatible = "qcom,sa8775p-edp-phy", .data = &sa8775p_dp_phy_cfg, },

-- 
2.34.1

Reply via email to