mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiangxu Yin <quic_xiangxuy@quicinc.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Rob Herring <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	"Kuogee Hsieh" <quic_khsieh@quicinc.com>,
	Vinod Koul <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>, <quic_lliu6@quicinc.com>,
	<quic_fangez@quicinc.com>
Cc: <linux-arm-msm@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>,
	<freedreno@lists.freedesktop.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-phy@lists.infradead.org>,
	<linux-gpio@vger.kernel.org>
Subject: Re: [PATCH 3/8] phy: qcom: qmp-usbc: Add DP phy mode support on QCS615
Date: Mon, 2 Dec 2024 18:31:44 +0800	[thread overview]
Message-ID: <22600892-3b0d-4b0f-9c46-e74241960dda@quicinc.com> (raw)
In-Reply-To: <b310587f-c6c3-41dd-83bf-6affbcc65730@kernel.org>



On 11/29/2024 4:18 PM, Krzysztof Kozlowski wrote:
> On 29/11/2024 08:57, Xiangxu Yin wrote:
>> Extended DP support for QCS615 USB or DP phy. Differentiated between
>> USBC and DP PHY using the match table’s type, dynamically generating
>> different types of cfg and layout attributes during initialization based
>> on this type. Static variables are stored in cfg, while parsed values
>> are organized into the layout structure.
>>
>> Signed-off-by: Xiangxu Yin <quic_xiangxuy@quicinc.com>
>> ---
>>  drivers/phy/qualcomm/phy-qcom-qmp-dp-phy.h |    1 +
>>  drivers/phy/qualcomm/phy-qcom-qmp-usbc.c   | 1453 ++++++++++++++++++++++++----
>>  2 files changed, 1254 insertions(+), 200 deletions(-)
> 
> 
> 
> ...
> 
>> +	/* program default setting first */
>> +	writel(0x2A, tx + QSERDES_V3_TX_TX_DRV_LVL);
>> +	writel(0x20, tx + QSERDES_V3_TX_TX_EMP_POST1_LVL);
>> +	writel(0x2A, tx2 + QSERDES_V3_TX_TX_DRV_LVL);
>> +	writel(0x20, tx2 + QSERDES_V3_TX_TX_EMP_POST1_LVL);
>> +
>> +	writel(voltage_swing_cfg, tx + QSERDES_V3_TX_TX_DRV_LVL);
>> +	writel(pre_emphasis_cfg, tx + QSERDES_V3_TX_TX_EMP_POST1_LVL);
>> +	writel(voltage_swing_cfg, tx2 + QSERDES_V3_TX_TX_DRV_LVL);
>> +	writel(pre_emphasis_cfg, tx2 + QSERDES_V3_TX_TX_EMP_POST1_LVL);
>> +
>> +	return 0;
>> +}
>> +
>> +static int qcs615_qmp_configure_dp_phy(struct qmp_usbc *qmp)
>> +{
>> +	struct qmp_phy_dp_layout *layout = to_dp_layout(qmp);
>> +	u32 status;
>> +
>> +	writel(0x01, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +	writel(0x05, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +	writel(0x01, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +	writel(0x09, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +
>> +	writel(0x20, layout->dp_serdes + QSERDES_COM_RESETSM_CNTRL);
>> +
>> +	// C_READY
> 
> Use Linux coding style.
> 
> Anyway, drop all useless comments. Say something useful or don't say
> anything.
> 
Ok, will update in next seperated patches.
>> +	if (readl_poll_timeout(layout->dp_serdes + QSERDES_COM_C_READY_STATUS,
>> +			status,
>> +			((status & BIT(0)) > 0),
>> +			500,
>> +			10000)) {
>> +		dev_err(qmp->dev, "C_READY not ready\n");
>> +		return -ETIMEDOUT;
>> +	}
>> +
>> +	// FREQ_DONE
>> +	if (readl_poll_timeout(layout->dp_serdes + QSERDES_COM_CMN_STATUS,
>> +			status,
>> +			((status & BIT(0)) > 0),
>> +			500,
>> +			10000)){
>> +		dev_err(qmp->dev, "FREQ_DONE not ready\n");
>> +		return -ETIMEDOUT;
>> +	}
>> +
>> +	// PLL_LOCKED
>> +	if (readl_poll_timeout(layout->dp_serdes + QSERDES_COM_CMN_STATUS,
>> +			status,
>> +			((status & BIT(1)) > 0),
>> +			500,
>> +			10000)){
>> +		dev_err(qmp->dev, "PLL_LOCKED not ready\n");
>> +		return -ETIMEDOUT;
>> +	}
>> +
>> +	writel(0x19, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +	udelay(10);
>> +
>> +	// TSYNC_DONE
>> +	if (readl_poll_timeout(layout->dp_phy + QSERDES_V3_DP_PHY_STATUS,
>> +			status,
>> +			((status & BIT(0)) > 0),
>> +			500,
>> +			10000)){
>> +		dev_err(qmp->dev, "TSYNC_DONE not ready\n");
>> +		return -ETIMEDOUT;
>> +	}
>> +
>> +	// PHY_READY
>> +	if (readl_poll_timeout(layout->dp_phy + QSERDES_V3_DP_PHY_STATUS,
>> +			status,
>> +			((status & BIT(1)) > 0),
>> +			500,
>> +			10000)){
>> +		dev_err(qmp->dev, "PHY_READY not ready\n");
>> +		return -ETIMEDOUT;
>> +	}
>> +
>> +	writel(0x3f, layout->dp_tx + QSERDES_V3_TX_TRANSCEIVER_BIAS_EN);
>> +	writel(0x10, layout->dp_tx + QSERDES_V3_TX_HIGHZ_DRVR_EN);
>> +	writel(0x0a, layout->dp_tx + QSERDES_V3_TX_TX_POL_INV);
>> +	writel(0x3f, layout->dp_tx2 + QSERDES_V3_TX_TRANSCEIVER_BIAS_EN);
>> +	writel(0x10, layout->dp_tx2 + QSERDES_V3_TX_HIGHZ_DRVR_EN);
>> +	writel(0x0a, layout->dp_tx2 + QSERDES_V3_TX_TX_POL_INV);
>> +
>> +	writel(0x18, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +	writel(0x19, layout->dp_phy + QSERDES_DP_PHY_CFG);
>> +
>> +	if (readl_poll_timeout(layout->dp_phy + QSERDES_V3_DP_PHY_STATUS,
>> +			status,
>> +			((status & BIT(1)) > 0),
>> +			500,
>> +			10000)){
>> +		dev_err(qmp->dev, "PHY_READY not ready\n");
>> +		return -ETIMEDOUT;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int qcs615_qmp_calibrate_dp_phy(struct qmp_usbc *qmp)
>> +{
>> +	static const u8 cfg1_settings[] = {0x13, 0x23, 0x1d};
>> +	struct qmp_phy_dp_layout *layout = to_dp_layout(qmp);
>> +	u8 val;
>> +
>> +	layout->dp_aux_cfg++;
>> +	layout->dp_aux_cfg %= ARRAY_SIZE(cfg1_settings);
>> +	val = cfg1_settings[layout->dp_aux_cfg];
>> +
>> +	writel(val, layout->dp_phy + QSERDES_DP_PHY_AUX_CFG1);
>> +
>> +	qmp_usbc_check_dp_phy(qmp, "pos_calibrate");
>> +
>> +	return 0;
>> +}
>> +
>> +static int qmp_usbc_com_init(struct phy *phy)
>>  {
>>  	struct qmp_usbc *qmp = phy_get_drvdata(phy);
>> -	const struct qmp_phy_cfg *cfg = qmp->cfg;
>> -	void __iomem *pcs = qmp->pcs;
>> +	int num_vregs;
>>  	u32 val = 0;
>>  	int ret;
>> +	unsigned int reg_pwr_dn;
>>  
>> -	ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
>> +	if (qmp->type == QMP_PHY_USBC_USB) {
> 
> 
> Sorry, all this code is unreviewable. Organize your changes in logical,
> reviewable chunks.
> 
Will create new patch list and seperate patchsets.
>> +		struct qmp_phy_usb_cfg *cfg = to_usb_cfg(qmp);
>> +
>> +		num_vregs = cfg->num_vregs;
>> +		reg_pwr_dn = cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL];
>> +	} else {
> 
> ...
> 
>> +		.compatible = "qcom,qcs615-qmp-dp-phy",
>> +		.data =  &(struct dev_cfg) {
>> +			.type = QMP_PHY_USBC_DP,
>> +			.cfg = &qcs615_dpphy_cfg,
>> +		},
>>  	}, {
>>  		.compatible = "qcom,sdm660-qmp-usb3-phy",
>> -		.data = &sdm660_usb3phy_cfg,
>> +		.data =  &(struct dev_cfg) {
>> +			.type = QMP_PHY_USBC_USB,
>> +			.cfg = &sdm660_usb3phy_cfg,
>> +		},
>>  	}, {
>>  		.compatible = "qcom,sm6115-qmp-usb3-phy",
>> -		.data = &qcm2290_usb3phy_cfg,
>> +		.data =  &(struct dev_cfg) {
>> +			.type = QMP_PHY_USBC_USB,
>> +			.cfg = &qcm2290_usb3phy_cfg,
>> +		},
>>  	},
>>  	{ },
>>  };
>> +
> 
> 
> You make some random changes all over this file. No, clean it up.
> 
>>  MODULE_DEVICE_TABLE(of, qmp_usbc_of_match_table);
>>  
>>  static struct platform_driver qmp_usbc_driver = {
>>
> 
> 
> Best regards,
> Krzysztof


  reply	other threads:[~2024-12-02 10:32 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-29  7:57 [PATCH 0/8] Add DisplayPort support for QCS615 platform Xiangxu Yin
2024-11-29  7:57 ` [PATCH 1/8] dt-bindings: display/msm: Document DP on QCS615 Xiangxu Yin
2024-11-29  8:11   ` Krzysztof Kozlowski
2024-11-29  7:57 ` [PATCH 2/8] dt-bindings: phy: qcom,msm8998-qmp-usb3-phy: Add DP support for QCS615 Xiangxu Yin
2024-11-29  8:14   ` Krzysztof Kozlowski
2024-11-29  7:57 ` [PATCH 3/8] phy: qcom: qmp-usbc: Add DP phy mode support on QCS615 Xiangxu Yin
2024-11-29  8:18   ` Krzysztof Kozlowski
2024-12-02 10:31     ` Xiangxu Yin [this message]
2024-12-02 15:48       ` Dmitry Baryshkov
2024-11-29 12:12   ` kernel test robot
2024-11-29 14:33   ` Dmitry Baryshkov
2024-12-05 13:26     ` Xiangxu Yin
2024-12-05 18:31       ` Dmitry Baryshkov
2024-12-10 15:09         ` Dmitry Baryshkov
2024-12-11  0:46           ` Xiangxu Yin
2024-12-11  9:46             ` Dmitry Baryshkov
2024-12-11 12:50               ` Xiangxu Yin
2024-12-11 19:15                 ` Dmitry Baryshkov
2024-12-18 12:55                   ` Xiangxu Yin
2024-12-19 21:38                     ` Dmitry Baryshkov
2024-12-20  0:01                     ` Dmitry Baryshkov
2025-03-05 10:20                       ` Xiangxu Yin
2025-03-05 21:25                         ` Dmitry Baryshkov
2025-03-21 10:17                           ` Xiangxu Yin
2025-03-21 12:19                             ` Dmitry Baryshkov
2024-11-29  7:57 ` [PATCH 4/8] drm/msm/dp: Add DisplayPort support for QCS615 Xiangxu Yin
2024-11-29 13:54   ` Dmitry Baryshkov
2024-11-29  7:57 ` [PATCH 5/8] drm/msm/dp: Add support for lane mapping configuration Xiangxu Yin
2024-11-29 13:50   ` Dmitry Baryshkov
2024-12-02  8:40     ` Xiangxu Yin
2024-12-02 10:46       ` Dmitry Baryshkov
2024-12-05 11:28         ` Xiangxu Yin
2024-12-05 11:40           ` Dmitry Baryshkov
2024-12-19 10:36             ` Xiangxu Yin
2024-12-19 21:45               ` Dmitry Baryshkov
2025-03-05 10:16                 ` Xiangxu Yin
2025-03-05 21:14                   ` Dmitry Baryshkov
2025-05-19  8:20                     ` Xiangxu Yin
2025-05-19  9:58                       ` Dmitry Baryshkov
2024-11-29  7:57 ` [PATCH 6/8] drm/msm/dp: Add maximum width limitation for modes Xiangxu Yin
2024-11-29 13:52   ` Dmitry Baryshkov
2024-12-02  9:05     ` Xiangxu Yin
2024-12-02  9:32       ` Dmitry Baryshkov
2024-12-03  7:41         ` Xiangxu Yin
2024-12-03 13:58           ` Dmitry Baryshkov
2024-12-06 20:13             ` Abhinav Kumar
2024-12-09  1:57               ` Xiangxu Yin
2024-12-09 20:18                 ` Abhinav Kumar
2024-11-29  7:57 ` [PATCH 7/8] drm/msm/dp: Retry Link Training 2 with lower pattern Xiangxu Yin
2024-11-29 13:53   ` Dmitry Baryshkov
2024-12-03  8:13     ` Xiangxu Yin
2024-12-03 14:07       ` Dmitry Baryshkov
2025-05-27 20:49         ` Konrad Dybcio
2025-07-09  9:16           ` Xiangxu Yin
2025-07-19  9:43             ` Dmitry Baryshkov
2025-07-21  4:18               ` Xiangxu Yin
2024-11-29  7:57 ` [PATCH 8/8] drm/msm/dp: Support external GPIO HPD with 3rd pinctrl chip Xiangxu Yin
2024-11-29  8:21   ` Krzysztof Kozlowski
2024-11-29 13:45   ` Dmitry Baryshkov
2024-11-29 13:54   ` neil.armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22600892-3b0d-4b0f-9c46-e74241960dda@quicinc.com \
    --to=quic_xiangxuy@quicinc.com \
    --cc=airlied@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=kishon@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_fangez@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=quic_lliu6@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=robh@kernel.org \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®