Linux-PHY Archive mirror
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Abel Vesa <abel.vesa@linaro.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 2/2] phy: qcom: edp: Add set_mode op for configuring eDP/DP submode
Date: Thu, 15 Feb 2024 11:36:09 +0100	[thread overview]
Message-ID: <5f6e505b-78c7-4bb3-ba57-fb7601c80a10@linaro.org> (raw)
In-Reply-To: <Zc3o32p1i0GtmmQj@linaro.org>

On 15.02.2024 11:35, Abel Vesa wrote:
> On 24-01-29 11:40:24, Dmitry Baryshkov wrote:
>> On Mon, 29 Jan 2024 at 10:06, Abel Vesa <abel.vesa@linaro.org> wrote:
>>>
>>> On 24-01-29 06:05:09, Dmitry Baryshkov wrote:
>>>> On Mon, 29 Jan 2024 at 02:26, Abel Vesa <abel.vesa@linaro.org> wrote:
>>>>>
>>>>> Future platforms should not use different compatibles to differentiate
>>>>> between eDP and DP mode. Instead, they should use a single compatible as the
>>>>> IP block is the same. It will be the job of the controller to set the submode
>>>>> of the PHY accordingly.
>>>>>
>>>>> The existing platforms will remain with separate compatibles for each mode.
>>>>>
>>>>> Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
>>>>> ---
>>>>>  drivers/phy/qualcomm/phy-qcom-edp.c | 71 ++++++++++++++++++++++++++-----------
>>>>>  1 file changed, 51 insertions(+), 20 deletions(-)
>>>>>
>>>>> diff --git a/drivers/phy/qualcomm/phy-qcom-edp.c b/drivers/phy/qualcomm/phy-qcom-edp.c
>>>>> index 8e5078304646..af941d6c5588 100644
>>>>> --- a/drivers/phy/qualcomm/phy-qcom-edp.c
>>>>> +++ b/drivers/phy/qualcomm/phy-qcom-edp.c
>>>>> @@ -14,6 +14,7 @@
>>>>>  #include <linux/module.h>
>>>>>  #include <linux/of.h>
>>>>>  #include <linux/phy/phy.h>
>>>>> +#include <linux/phy/phy-dp.h>
>>>>>  #include <linux/platform_device.h>
>>>>>  #include <linux/regulator/consumer.h>
>>>>>  #include <linux/reset.h>
>>>>> @@ -68,19 +69,21 @@
>>>>>
>>>>>  #define TXn_TRAN_DRVR_EMP_EN                    0x0078
>>>>>
>>>>> -struct qcom_edp_cfg {
>>>>> -       bool is_dp;
>>>>> -
>>>>> -       /* DP PHY swing and pre_emphasis tables */
>>>>> +struct qcom_edp_swing_pre_emph_cfg {
>>>>>         const u8 (*swing_hbr_rbr)[4][4];
>>>>>         const u8 (*swing_hbr3_hbr2)[4][4];
>>>>>         const u8 (*pre_emphasis_hbr_rbr)[4][4];
>>>>>         const u8 (*pre_emphasis_hbr3_hbr2)[4][4];
>>>>>  };
>>>>>
>>>>> +struct qcom_edp_phy_cfg {
>>>>> +       bool is_edp;
>>>>> +       const struct qcom_edp_swing_pre_emph_cfg *swing_pre_emph_cfg;
>>>>> +};
>>>>> +
>>>>>  struct qcom_edp {
>>>>>         struct device *dev;
>>>>> -       const struct qcom_edp_cfg *cfg;
>>>>> +       const struct qcom_edp_phy_cfg *cfg;
>>>>>
>>>>>         struct phy *phy;
>>>>>
>>>>> @@ -96,6 +99,8 @@ struct qcom_edp {
>>>>>
>>>>>         struct clk_bulk_data clks[2];
>>>>>         struct regulator_bulk_data supplies[2];
>>>>> +
>>>>> +       bool is_edp;
>>>>>  };
>>>>>
>>>>>  static const u8 dp_swing_hbr_rbr[4][4] = {
>>>>> @@ -126,8 +131,7 @@ static const u8 dp_pre_emp_hbr2_hbr3[4][4] = {
>>>>>         { 0x04, 0xff, 0xff, 0xff }
>>>>>  };
>>>>>
>>>>> -static const struct qcom_edp_cfg dp_phy_cfg = {
>>>>> -       .is_dp = true,
>>>>> +static const struct qcom_edp_swing_pre_emph_cfg dp_phy_swing_pre_emph_cfg = {
>>>>>         .swing_hbr_rbr = &dp_swing_hbr_rbr,
>>>>>         .swing_hbr3_hbr2 = &dp_swing_hbr2_hbr3,
>>>>>         .pre_emphasis_hbr_rbr = &dp_pre_emp_hbr_rbr,
>>>>> @@ -162,18 +166,28 @@ static const u8 edp_pre_emp_hbr2_hbr3[4][4] = {
>>>>>         { 0x00, 0xff, 0xff, 0xff }
>>>>>  };
>>>>>
>>>>> -static const struct qcom_edp_cfg edp_phy_cfg = {
>>>>> -       .is_dp = false,
>>>>> +static const struct qcom_edp_swing_pre_emph_cfg edp_phy_swing_pre_emph_cfg = {
>>>>>         .swing_hbr_rbr = &edp_swing_hbr_rbr,
>>>>>         .swing_hbr3_hbr2 = &edp_swing_hbr2_hbr3,
>>>>>         .pre_emphasis_hbr_rbr = &edp_pre_emp_hbr_rbr,
>>>>>         .pre_emphasis_hbr3_hbr2 = &edp_pre_emp_hbr2_hbr3,
>>>>>  };
>>>>>
>>>>> +static const struct qcom_edp_phy_cfg sc7280_dp_phy_cfg = {
>>>>> +};
>>>>> +
>>>>> +static const struct qcom_edp_phy_cfg sc8280xp_dp_phy_cfg = {
>>>>> +       .swing_pre_emph_cfg = &dp_phy_swing_pre_emph_cfg,
>>>>> +};
>>>>> +
>>>>> +static const struct qcom_edp_phy_cfg sc8280xp_edp_phy_cfg = {
>>>>> +       .is_edp = true,
>>>>> +       .swing_pre_emph_cfg = &edp_phy_swing_pre_emph_cfg,
>>>>> +};
>>>>> +
>>>>>  static int qcom_edp_phy_init(struct phy *phy)
>>>>>  {
>>>>>         struct qcom_edp *edp = phy_get_drvdata(phy);
>>>>> -       const struct qcom_edp_cfg *cfg = edp->cfg;
>>>>>         int ret;
>>>>>         u8 cfg8;
>>>>>
>>>>> @@ -200,7 +214,7 @@ static int qcom_edp_phy_init(struct phy *phy)
>>>>>                DP_PHY_PD_CTL_PLL_PWRDN | DP_PHY_PD_CTL_DP_CLAMP_EN,
>>>>>                edp->edp + DP_PHY_PD_CTL);
>>>>>
>>>>> -       if (cfg && cfg->is_dp)
>>>>> +       if (edp->cfg->swing_pre_emph_cfg && !edp->is_edp)
>>>>
>>>> I think (!edp->is_edp) should be enough here.
>>>
>>> Actually, in case of DP, the cfg8 needs to be 0xb7 for sc8280xp, while for sc7280 it should be 0x37.
>>>
>>> So to differentiate between first and second we check if the config
>>> provides a swing_pre_emph_cfg
>>
>> Using swing_pre_emph_cfg to distinguish between those two cases is a pure hack.
>> Is there any sensible meaning behind those bits? If not, just put
>> those values into the configuration data.
> 
> So the only thing that I was able to find is that this reg has to do
> with some TX and RX zero bits preamble. It seems it needs to be
> different between DP configurations (with or without swing and pre-emph).
> 
> But leaving that aside, unless we add another knob that actually depends
> on swing and pre-emph configuration being available, there is no other
> way around it, for now, at least.

Until we know better, I'd say this hack is fine, but please leave a comment
so that we don't fully forget about it.

Konrad

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      reply	other threads:[~2024-02-15 10:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29  0:25 [PATCH v3 0/2] phy: qcom: edp: Allow eDP/DP configuring via set_mode op Abel Vesa
2024-01-29  0:25 ` [PATCH v3 1/2] phy: Add Embedded DisplayPort and DisplayPort submodes Abel Vesa
2024-01-29  0:25 ` [PATCH v3 2/2] phy: qcom: edp: Add set_mode op for configuring eDP/DP submode Abel Vesa
2024-01-29  4:05   ` Dmitry Baryshkov
2024-01-29  8:06     ` Abel Vesa
2024-01-29  9:40       ` Dmitry Baryshkov
2024-02-15 10:35         ` Abel Vesa
2024-02-15 10:36           ` Konrad Dybcio [this message]

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=5f6e505b-78c7-4bb3-ba57-fb7601c80a10@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=abel.vesa@linaro.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=johan@kernel.org \
    --cc=kishon@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=robh+dt@kernel.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).