Re: [PATCH v2 4/8] phy: qcom-qmp-combo: Introduce orientation variable

From: Johan Hovold
Date: Fri May 12 2023 - 05:22:08 EST


On Tue, May 09, 2023 at 08:19:26PM -0700, Bjorn Andersson wrote:
> In multiple places throughout the driver code has been written in
> prepration for handling of orientation switching.
>
> Introduce a typec_orientation in qmp_combo and fill out the various
> "placeholders" with the associated logic. By initializing the
> orientation to "normal" this change has no functional impact, but
> reduces the size of the upcoming introduction of dynamic orientation
> switching.
>
> Signed-off-by: Bjorn Andersson <quic_bjorande@xxxxxxxxxxx>
> Reviewed-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx>
> Tested-by: Abel Vesa <abel.vesa@xxxxxxxxxx>
> Tested-by: Steev Klimaszewski <steev@xxxxxxxx>
> Tested-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx> # on HDK8450
> Tested-by: Johan Hovold <johan+linaro@xxxxxxxxxx> # X13s
> ---
>
> Changes since v1:
> - X-mas in qmp_combo_configure_dp_mode()
>
> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 54 +++++++++++++----------
> 1 file changed, 30 insertions(+), 24 deletions(-)

> static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp)
> {
> + bool reverse = qmp->orientation == TYPEC_ORIENTATION_REVERSE;

Nit: I still think parentheses around the right-hand side would improve
readability.

> + const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
> u32 val;
> - bool reverse = false;

> @@ -2235,7 +2236,7 @@ static int qmp_v4_configure_dp_phy(struct qmp_combo *qmp)
> {
> const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts;
> u32 bias0_en, drvr0_en, bias1_en, drvr1_en;
> - bool reverse = false;
> + bool reverse = qmp->orientation == TYPEC_ORIENTATION_REVERSE;

Same here and below.

And maintaining reverse xmas style throughout the driver would be nice
for consistency too.

> u32 status;
> int ret;

Looks good otherwise:

Reviewed-by: Johan Hovold <johan+linaro@xxxxxxxxxx>

Johan