Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3293176pxt; Mon, 9 Aug 2021 23:30:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4wmKrYol89A94wgWnnrlsKaUCtTTMLQvgiFg19caOx9wq0oXtsgj2vf2u0BqnKs66GIfY X-Received: by 2002:a17:906:2497:: with SMTP id e23mr26193837ejb.194.1628577007816; Mon, 09 Aug 2021 23:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628577007; cv=none; d=google.com; s=arc-20160816; b=menOLtXJjVfvSooy24iO++WmETQdghyDzVBqhbkpIr7HVvT44kcVTYopk6NtLtibXU /mcetmRYoYWFdfRDnYMvLju7sesfwkPP9+IqMCIaFSfIax+tLrPV2Y34BTlj3JhIJ0or ldVTs+RsnltF6YfTt4DSM8bv/XGsFNaT3Sz9YnZr3ZQq+PNIzrbyn/qgaDYDRQN0awHr NX3/83B7ad6VNYie9apo7joRqjY9v5WHc7ueLzq+kE5yTyXe/JcRQTO8gnhoNOjfFsf3 J8g2IKfnXQK2w7OJ3NFZYdmuO9qTEKcjSYeEkcubGk5rjLM9Ozo1FZxAs7vLWGVbyOCV 12Uw== 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=eTjxoRBCQf02cbggSfOkoEwcbBOIkEA4E5gk33oPnVc=; b=qr841qtTWcQXTjT/zTUjZmzpTWS9ZpVVkQAbIZ0dMt141qWFLtzJ3HLVFNO6x3ajRE jNws5J4LQDOR5QjMPjrpq2yTWNnbOxG71kdHylr+T6EjhMuAmzTmOmQQ97iA72oZYbFE Vpi8O8JKMuxZwp8lP2Y0Rdvd+8hIQfL70r/pZePvoFBb+IIvUJdCNgJL/vHydqUSP2ZO 0ZPaqcmAagjkl9d6e0h98IwqNQ0ujjV35MQkysjcniF12iDk2AZUU4rmO4t1fN/CV4Oy 1bcFSc2zjvxqRljcM+/O/73CtI6PZk4EwD9J1Kssy3s4QgK4XQD7TzegbiaB4bsDeBxN yPuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HI+OeeQM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si23071026ejv.170.2021.08.09.23.29.44; Mon, 09 Aug 2021 23:30:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HI+OeeQM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230095AbhHJDhV (ORCPT + 99 others); Mon, 9 Aug 2021 23:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233700AbhHJDhU (ORCPT ); Mon, 9 Aug 2021 23:37:20 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA78C061798 for ; Mon, 9 Aug 2021 20:36:59 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id w6so26943176oiv.11 for ; Mon, 09 Aug 2021 20:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eTjxoRBCQf02cbggSfOkoEwcbBOIkEA4E5gk33oPnVc=; b=HI+OeeQMtFnPj3845sY6EwA1BoQN7PnMqX4s0kBeaQEy962s9e+m/V8O1/tsu5xs1I bddJOLO4l8wk5180sqxqoxp62aRFAM2baGVKrC4P/y3KRBVhjdJRsymDBL+60PrfM4Ja mZIbL1Hu1/uDpQ5c/qYcIY5bH3moOyO6Eyg7LR2+0Jzww+2RQTzDxHIXLs0JFhhYGXUo FxdLENJvCsVPWKnMc6mS+kE8iycdYnVrPjbprWb54i23OVLalKrDeRipM776pBngwAQI 5BhyJuiinLxKB70SapQTYKjtAFtKvneJrzJ2kIVAnoqeKEAFIixrGJ8oewiMS+7WHN6f DNhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eTjxoRBCQf02cbggSfOkoEwcbBOIkEA4E5gk33oPnVc=; b=IzvTjPcdvDuGsBbd4TX2Vf7iSp8XaavcI1/HqmyXDC6A2PfgHyzuEUFj5CoNHdJ8qb /Qi1sE0Sp1ei2ISIudwN0akqdD1tLX9PLhBF1S3RA00coe7q2Tv59QNDlWUq9ScKxnmG 2cUo2Hhd8e5O28Unicmk5QYec0C2SSNWbwC+lqHNG+Rtg+RrV1uGp5Y6M+dW1BzkEnzj 5GvvibXCWHdTOjMwZHOiIyPZfUJ6QTigFrjDUe9HEbcd4pduJcYHN2A5UHuZfYKBYMNT nU+/y0hI2UxcJLyHFzovczDSkIq/IxhKNVn6Mc1TfmApfGd/Q6RbqTVou27NUHCJp9+8 QFjA== X-Gm-Message-State: AOAM530XaPSmfP9Kl982oUp7jBoDZOjM7NmuQaYOrRr3KcnCdFlmQa/n 2BBNUkd7FISpOXuLNr0XwigS0BTdxpI43g== X-Received: by 2002:a05:6808:4a:: with SMTP id v10mr11504245oic.171.1628566618843; Mon, 09 Aug 2021 20:36:58 -0700 (PDT) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id n67sm3466362oib.44.2021.08.09.20.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 20:36:58 -0700 (PDT) Date: Mon, 9 Aug 2021 22:36:56 -0500 From: Bjorn Andersson To: sbillaka@codeaurora.org Cc: Andy Gross , Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Rob Clark , Dmitry Baryshkov , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kalyan_t@codeaurora.org, abhinavk@codeaurora.org Subject: Re: [PATCH 2/2] phy: qcom: Introduce new eDP PHY driver Message-ID: References: <20210511041930.592483-1-bjorn.andersson@linaro.org> <20210511041930.592483-2-bjorn.andersson@linaro.org> <7708925ad4d973b4e5f291cdcbdbe406@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7708925ad4d973b4e5f291cdcbdbe406@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 09 Aug 22:15 CDT 2021, sbillaka@codeaurora.org wrote: > On 2021-05-11 09:49, Bjorn Andersson wrote: > > diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c [..] > > +#define DP_PHY_AUX_CFG0 0x0020 > > +#define DP_PHY_AUX_CFG1 0x0024 > > +#define DP_PHY_AUX_CFG2 0x0028 > > +#define DP_PHY_AUX_CFG3 0x002c > > +#define DP_PHY_AUX_CFG4 0x0030 > > +#define DP_PHY_AUX_CFG5 0x0034 > > +#define DP_PHY_AUX_CFG6 0x0038 > > +#define DP_PHY_AUX_CFG7 0x003c > > +#define DP_PHY_AUX_CFG8 0x0040 > > +#define DP_PHY_AUX_CFG9 0x0044 > > The DP_PHY_AUX_CFG0 offset for sc8180x eDP phy is 0x0024. > Some of the eDP PHY offset addresses are shifted by 4 address locations, > compared to the DP QMP PHY offset addresses for sc8180x. > The DP_PHY_AUX_CFG* offsets for this eDP phy driver are as below: > > #define DP_PHY_AUX_CFG0 0x0024 > #define DP_PHY_AUX_CFG1 0x0028 > #define DP_PHY_AUX_CFG2 0x002c > #define DP_PHY_AUX_CFG3 0x0030 > #define DP_PHY_AUX_CFG4 0x0034 > #define DP_PHY_AUX_CFG5 0x0038 > #define DP_PHY_AUX_CFG6 0x003c > #define DP_PHY_AUX_CFG7 0x0040 > #define DP_PHY_AUX_CFG8 0x0044 > #define DP_PHY_AUX_CFG9 0x0048 > I noticed this as well. During development I just used the numbers directly in the code and I must have screwed up as I replaced them with defined - and somehow missed this in the testing before posting. Sorry about that. [..] > > +static int qcom_edp_phy_init(struct phy *phy) > > +{ > > + struct qcom_edp *edp = phy_get_drvdata(phy); > > + int ret; > > + > > + ret = regulator_bulk_enable(ARRAY_SIZE(edp->supplies), edp->supplies); > > + if (ret) > > + return ret; > > + > > + ret = clk_bulk_prepare_enable(ARRAY_SIZE(edp->clks), edp->clks); > > + if (ret) > > + goto out_disable_supplies; > > I think the number of clk and regulator resources can vary based on > platform. > If that's the case we should replace the ARRAY_SIZE() with an integer. But I prefer to wait with that until the number actually is variable. [..] > > +static int qcom_edp_phy_probe(struct platform_device *pdev) > > +{ > > + struct phy_provider *phy_provider; > > + struct device *dev = &pdev->dev; > > + struct qcom_edp *edp; > > + int ret; > > + > > + edp = devm_kzalloc(dev, sizeof(*edp), GFP_KERNEL); > > + if (!edp) > > + return -ENOMEM; > > + > > + edp->dev = dev; > > + > > + edp->edp = devm_platform_ioremap_resource(pdev, 0); > > + if (IS_ERR(edp->edp)) > > + return PTR_ERR(edp->edp); > > + > > + edp->tx0 = devm_platform_ioremap_resource(pdev, 1); > > + if (IS_ERR(edp->tx0)) > > + return PTR_ERR(edp->tx0); > > + > > + edp->tx1 = devm_platform_ioremap_resource(pdev, 2); > > + if (IS_ERR(edp->tx1)) > > + return PTR_ERR(edp->tx1); > > + > > + edp->pll = devm_platform_ioremap_resource(pdev, 3); > > + if (IS_ERR(edp->pll)) > > + return PTR_ERR(edp->pll); > > + > > + edp->clks[0].id = "aux"; > > + edp->clks[1].id = "cfg_ahb"; > > + ret = devm_clk_bulk_get(dev, ARRAY_SIZE(edp->clks), edp->clks); > > + if (ret) > > + return ret; > > + > > + edp->supplies[0].supply = "vdda-phy"; > > + edp->supplies[1].supply = "vdda-pll"; > > + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(edp->supplies), > > edp->supplies); > > + if (ret) > > + return ret; > > I believe, the combination of the number of regulator and clk resources may > vary based on the platform. > I think we should not fail probe if all these resources are not present in > the device tree file. > I think, these resources can be optional. We can get these resources if they > are present in the device tree file and enable them as required. > It's quite helpful to the DTS writer to actually encode in the driver which resources the driver expects and provide useful error messages when these expectations aren't met - so I think in line with most other drivers this should be decided based on the compatible. What clocks and regulators do you have on sc7280? Thanks for the feedback, I see that I have a few more pieces of feedback from others that I need to incorporate. I'll make sure to do that and repost this patch shortly. Regards, Bjorn