Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6728673rwr; Tue, 2 May 2023 04:56:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5SMzFEC6ImIDNbiCKrqtBpRSgi31xmCnK4M/M4xWRoot9HIPtKZtU7bg/ud2vxPZ2MKScI X-Received: by 2002:a17:902:9a48:b0:19a:b754:4053 with SMTP id x8-20020a1709029a4800b0019ab7544053mr18125236plv.26.1683028590808; Tue, 02 May 2023 04:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683028590; cv=none; d=google.com; s=arc-20160816; b=alv9tKiwEWZp0DfC/ZhQNw+V5mP/CbSHWZwOUITIjGelMcNnOaFtaPxBB1oGyyzUSe /pX/TDDqTfAoQnkI8YUoFbZbjUiMCVXB8rxs8zGbW8hsO3xLn9/Eoq8VR556lLer4ucl qMy1Lmbj5snHZOwpgOZBFapOlLwo24W5XgFNl4P6YBv6kXKso4+TT2mjVOPHzZupv6nL fYwZcF9+nCUtpX93qAKOavW3tDUFwI3F/cCgY8xArwEisx46O7yIlSY1KaFJf7HPaDL/ 3rJ5gLySMmyhQzmNWtJ/bAh9BwhE4oy+yhmqe09T/APd5oYA8+8FpxBFy1ytI18dSAGI h7nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=20ncOcUi1v+jCw58AnVndbREESl5oL1I/Lu6wfJp6I0=; b=QdRF1Tr+CsDVMsFEmLLuno7jx9lk4HO/zzE/AVX/UwW6iEomQ+eJg+lRPu0kyEVKez mOuQfCE7Ocp0Ej63aQJ4SVcc4ugs0FhNK2Bxhp+E8rimuz5XOeHO+0A/KC80P6jPNoD8 qGDwAQEl4Im99SU4s2+kcC1du9m9/8Cj42G6B9oU48lqTuqs9EyUw+ii+IIUIhDiSfLW ML4zTyO8MjGm8HCoLBk2Ssku5rTzrEyDnAkMfhjhBuGsFtL7QFgNcQfs/rPWegYIFMcV mMVz4wBQaa6WA2siS/38iglKuC29l45cMZ9PV30WfktuGWPTVe5cKFZ4r92mFRfMsezc VbFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4PZdjU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx18-20020a17090b229200b00242bface51csi10811305pjb.108.2023.05.02.04.56.16; Tue, 02 May 2023 04:56:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4PZdjU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233890AbjEBLsR (ORCPT + 99 others); Tue, 2 May 2023 07:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233842AbjEBLsQ (ORCPT ); Tue, 2 May 2023 07:48:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4119983; Tue, 2 May 2023 04:48:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4A14616C9; Tue, 2 May 2023 11:48:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25A35C433D2; Tue, 2 May 2023 11:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683028094; bh=3kyH1W+UzFVD6G6EyaZ+boLKcJ0HvmBDVvQXrP6u1dg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E4PZdjU1vyAVpd+DGdFRNTTtGZLknQ4SkJwkn/sjSZ8ngE17xYpB0aNFeBDOq99fD 5syZ65V0u9ik07QFAhmBux9DIbzu1lVaU99X/grjm5fV0vk6DpjUZvbutkmN02cSqE pIquQjFycnjQIDnwfydJM31XPSKe4Ah963n3mqePywHueWP0lyPh5anIh3YE8ZYsKV tLTy5zCcIPSvF4wRc+pVCUQn5VxZup4HfE/8nqOKvhJDoAbM3/vkSDbqwZp2O+G+Ky SI+wWfNM+G1TYObsVNyfTtn8hJ8Bh+u0L9+2HoPfuDOteUH+i0J8LOqJ5stHGHwQKr N3E/e0U9EtTYQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1ptoUS-0003WC-Tz; Tue, 02 May 2023 13:48:16 +0200 Date: Tue, 2 May 2023 13:48:16 +0200 From: Johan Hovold To: Bjorn Andersson Cc: Vinod Koul , Kishon Vijay Abraham I , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/7] phy: qcom-qmp-combo: Introduce orientation variable Message-ID: References: <20230425034010.3789376-1-quic_bjorande@quicinc.com> <20230425034010.3789376-4-quic_bjorande@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230425034010.3789376-4-quic_bjorande@quicinc.com> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 24, 2023 at 08:40:06PM -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 > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 54 +++++++++++++---------- > 1 file changed, 30 insertions(+), 24 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > index 7280f7141961..6748f31da7a3 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > > #include > > @@ -63,6 +64,10 @@ > /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ > #define CLAMP_EN BIT(0) /* enables i/o clamp_n */ > > +/* QPHY_V3_DP_COM_TYPEC_CTRL register bits */ > +#define SW_PORTSELECT_VAL BIT(0) > +#define SW_PORTSELECT_MUX BIT(1) > + > #define PHY_INIT_COMPLETE_TIMEOUT 10000 > > struct qmp_phy_init_tbl { > @@ -1323,6 +1328,8 @@ struct qmp_combo { > struct clk_fixed_rate pipe_clk_fixed; > struct clk_hw dp_link_hw; > struct clk_hw dp_pixel_hw; > + > + enum typec_orientation orientation; > }; > > static void qmp_v3_dp_aux_init(struct qmp_combo *qmp); > @@ -1955,29 +1962,23 @@ static void qmp_v3_configure_dp_tx(struct qmp_combo *qmp) > static bool qmp_combo_configure_dp_mode(struct qmp_combo *qmp) > { > u32 val; > - bool reverse = false; > + bool reverse = qmp->orientation == TYPEC_ORIENTATION_REVERSE; Adding parentheses around the right-hand side should make this a little easier to parse. It also looks like these callbacks end up being called without holding the qmp->phy_mutex via phy->power_on(). Perhaps there is no risk for a concurrent switch notification and dp phy power-on but it's not that obvious. > + const struct phy_configure_opts_dp *dp_opts = &qmp->dp_opts; Also could you add these before u32 val to maintain an approximation of reverse xmas style? And similar below. Johan