Re: [PATCH v3] phy: qcom-qmp: add support for display port voltage and pre-emphasis swing

From: Stephen Boyd
Date: Mon Sep 13 2021 - 16:06:41 EST


Quoting Kuogee Hsieh (2021-09-09 14:31:05)
> @@ -3757,16 +3796,14 @@ static void qcom_qmp_v4_phy_dp_aux_init(struct qmp_phy *qphy)
>
> static void qcom_qmp_v4_phy_configure_dp_tx(struct qmp_phy *qphy)
> {
> - /* Program default values before writing proper values */
> - writel(0x27, qphy->tx + QSERDES_V4_TX_TX_DRV_LVL);
> - writel(0x27, qphy->tx2 + QSERDES_V4_TX_TX_DRV_LVL);
> -
> - writel(0x20, qphy->tx + QSERDES_V4_TX_TX_EMP_POST1_LVL);
> - writel(0x20, qphy->tx2 + QSERDES_V4_TX_TX_EMP_POST1_LVL);
> -
> - qcom_qmp_phy_configure_dp_swing(qphy,
> + if (__qcom_qmp_phy_configure_dp_swing(qphy,
> QSERDES_V4_TX_TX_DRV_LVL,
> - QSERDES_V4_TX_TX_EMP_POST1_LVL);
> + QSERDES_V4_TX_TX_EMP_POST1_LVL,
> + (const u8 *)qmp_dp_v4_voltage_swing_hbr_rbr,

Surely we can pass a 2d-array to a function in C? We know the size of
the array is always a 4x4 so we could enforce that in the type so the
compiler complains if we try to pass something else.

> + (const u8 *)qmp_dp_v4_pre_emphasis_hbr_rbr,
> + (const u8 *)qmp_dp_v4_voltage_swing_hbr3_hbr2,
> + (const u8 *)qmp_dp_v4_pre_emphasis_hbr3_hbr2) < 0)
> + return;

It's void and this is the end of the function. Why is there an if
condition and a return?

> }
>
> static int qcom_qmp_v4_phy_configure_dp_phy(struct qmp_phy *qphy)