All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sankeerth Billakanti (QUIC)" <quic_sbillaka@quicinc.com>
To: Doug Anderson <dianders@chromium.org>,
	"Sankeerth Billakanti (QUIC)" <quic_sbillaka@quicinc.com>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	freedreno <freedreno@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>, Rob Clark <robdclark@gmail.com>,
	Sean Paul <seanpaul@chromium.org>,
	Stephen Boyd <swboyd@chromium.org>,
	quic_kalyant <quic_kalyant@quicinc.com>,
	"Abhinav Kumar (QUIC)" <quic_abhinavk@quicinc.com>,
	"Kuogee Hsieh (QUIC)" <quic_khsieh@quicinc.com>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	"dmitry.baryshkov@linaro.org" <dmitry.baryshkov@linaro.org>,
	quic_vproddut <quic_vproddut@quicinc.com>,
	"Aravind Venkateswaran (QUIC)" <quic_aravindh@quicinc.com>,
	Steev Klimaszewski <steev@kali.org>
Subject: RE: [PATCH v8 2/4] drm/msm/dp: Support only IRQ_HPD and REPLUG interrupts for eDP
Date: Thu, 21 Apr 2022 16:38:56 +0000	[thread overview]
Message-ID: <MW4PR02MB71869CCA50E1706926C4B6FAE1F49@MW4PR02MB7186.namprd02.prod.outlook.com> (raw)
In-Reply-To: <CAD=FV=UVmUG0t-8wFXT-NT1-naojeJ_gcd8eEVr96AnMos0m4A@mail.gmail.com>

Hi Doug,

>On Thu, Apr 21, 2022 at 7:37 AM Sankeerth Billakanti
><quic_sbillaka@quicinc.com> wrote:
>>
>> The panel-edp enables the eDP panel power during probe, get_modes and
>> pre-enable. The eDP connect and disconnect interrupts for the eDP/DP
>> controller are directly dependent on panel power. As eDP display can
>> be assumed as always connected, the controller driver can skip the eDP
>> connect and disconnect interrupts. Any disruption in the link status
>> will be indicated via the IRQ_HPD interrupts.
>>
>> So, the eDP controller driver can just enable the IRQ_HPD and replug
>> interrupts. The DP controller driver still needs to enable all the
>> interrupts.
>>
>> Signed-off-by: Sankeerth Billakanti <quic_sbillaka@quicinc.com>
>> ---
>> Changes in v8:
>>   - add comment explaining the interrupt status return
>>
>> Changes in v7:
>>   - reordered the patch in the series
>>   - modified the return statement for isr
>>   - connector check modified to just check for eDP
>>
>>  drivers/gpu/drm/msm/dp/dp_catalog.c | 18 ++++++++++++------
>> drivers/gpu/drm/msm/dp/dp_display.c | 22 +++++++++++++++++++++-
>>  2 files changed, 33 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c
>> b/drivers/gpu/drm/msm/dp/dp_catalog.c
>> index fac815f..3a298e9 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
>> @@ -569,10 +569,6 @@ void dp_catalog_ctrl_hpd_config(struct dp_catalog
>> *dp_catalog)
>>
>>         u32 reftimer = dp_read_aux(catalog, REG_DP_DP_HPD_REFTIMER);
>>
>> -       /* enable HPD plug and unplug interrupts */
>> -       dp_catalog_hpd_config_intr(dp_catalog,
>> -               DP_DP_HPD_PLUG_INT_MASK |
>DP_DP_HPD_UNPLUG_INT_MASK, true);
>> -
>>         /* Configure REFTIMER and enable it */
>>         reftimer |= DP_DP_HPD_REFTIMER_ENABLE;
>>         dp_write_aux(catalog, REG_DP_DP_HPD_REFTIMER, reftimer); @@
>> -599,13 +595,23 @@ u32 dp_catalog_hpd_get_intr_status(struct
>> dp_catalog *dp_catalog)  {
>>         struct dp_catalog_private *catalog = container_of(dp_catalog,
>>                                 struct dp_catalog_private, dp_catalog);
>> -       int isr = 0;
>> +       int isr, mask;
>>
>>         isr = dp_read_aux(catalog, REG_DP_DP_HPD_INT_STATUS);
>>         dp_write_aux(catalog, REG_DP_DP_HPD_INT_ACK,
>>                                  (isr & DP_DP_HPD_INT_MASK));
>> +       mask = dp_read_aux(catalog, REG_DP_DP_HPD_INT_MASK);
>>
>> -       return isr;
>> +       /*
>> +        * REG_DP_DP_HPD_INT_STATUS reports the status of all interrupts
>> +        * irrespective of their masked status. The HW interrupt will not be
>> +        * generated if an interrupt is masked. However, the interrupt status
>> +        * bit in the register will still be set. The eDP controller driver
>> +        * masks the plug and unplug interrupts unlike DP controller which
>> +        * unmasks all the interrupts. So, do not report the status of the
>> +        * masked interrupts.
>> +        */
>> +       return isr & (mask | ~DP_DP_HPD_INT_MASK);
>
>What's still missing in your comments is why you aren't just doing "return isr &
>mask;". In other words, why is the API for HPD bits different from the API for
>non-HPD bits? What code out there wants to know about non-HPD interrupts
>even if they are masked?

The mask register bitfields are different from the INT_STATUS register.
The INT_STATUS register has additional bits [31:28] which indicates the HPD state machine
status and [3:0] indicates the actual generated/set interrupt. The fields [3:0] are similar to
the mask and ack interrupts.

#define DP_DP_HPD_STATE_STATUS_CONNECTED        (0x40000000)
#define DP_DP_HPD_STATE_STATUS_PENDING          (0x20000000)
#define DP_DP_HPD_STATE_STATUS_DISCONNECTED     (0x00000000)
#define DP_DP_HPD_STATE_STATUS_MASK             (0xE0000000)

So, earlier I returned isr & (mask | DP_DP_HPD_STATE_STATUS_MASK);

Actually, there is no reason to do this. We can just do the below:
return isr & mask;

>
>Actually, thinking about this more, my preference would be this:
>
>a) Rename the existing function to dp_catalog_hpd_get_intr_status_raw()
>
>b) Create a new function called dp_catalog_hpd_get_intr_status() whose
>implementation is:
>
>  return dp_catalog_hpd_get_intr_status_raw() & mask;
>
>Then any callers who care about the raw status can be changed to call
>dp_catalog_hpd_get_intr_status_raw(). If no callers need
>dp_catalog_hpd_get_intr_status_raw() then you don't actually need to
>create this function.
>

There is no caller for raw status. All interrupts are unmasked for DP.
While handling the aux interrupts generated during the transfer call from panel probe,
we read that the HPD interrupt status [3:0] bit0 is set and proceed to handle connect like DP.
We experimented to find out that the connect interrupt is not generated but just the status
bit is set.

As the interrupts are generated over a single MDSS line, the controller driver has to read all the
interrupt status registers and handle all the set interrupt bits. So, while handling aux transfer
interrupts, we were proceeding to handle connect interrupt also as a consequence.

>If you make that change then all of a sudden the API isn't weird/wonky and
>you can just get rid of the comment I asked you to add.
>
>
>-Doug

WARNING: multiple messages have this Message-ID (diff)
From: "Sankeerth Billakanti (QUIC)" <quic_sbillaka@quicinc.com>
To: Doug Anderson <dianders@chromium.org>,
	"Sankeerth Billakanti (QUIC)" <quic_sbillaka@quicinc.com>
Cc: quic_kalyant <quic_kalyant@quicinc.com>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
	"Abhinav Kumar \(QUIC\)" <quic_abhinavk@quicinc.com>,
	quic_vproddut <quic_vproddut@quicinc.com>,
	David Airlie <airlied@linux.ie>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Stephen Boyd <swboyd@chromium.org>, Sean Paul <sean@poorly.run>,
	Sean Paul <seanpaul@chromium.org>,
	Steev Klimaszewski <steev@kali.org>,
	"dmitry.baryshkov@linaro.org" <dmitry.baryshkov@linaro.org>,
	"Aravind Venkateswaran \(QUIC\)" <quic_aravindh@quicinc.com>,
	"Kuogee Hsieh \(QUIC\)" <quic_khsieh@quicinc.com>,
	freedreno <freedreno@lists.freedesktop.org>
Subject: RE: [PATCH v8 2/4] drm/msm/dp: Support only IRQ_HPD and REPLUG interrupts for eDP
Date: Thu, 21 Apr 2022 16:38:56 +0000	[thread overview]
Message-ID: <MW4PR02MB71869CCA50E1706926C4B6FAE1F49@MW4PR02MB7186.namprd02.prod.outlook.com> (raw)
In-Reply-To: <CAD=FV=UVmUG0t-8wFXT-NT1-naojeJ_gcd8eEVr96AnMos0m4A@mail.gmail.com>

Hi Doug,

>On Thu, Apr 21, 2022 at 7:37 AM Sankeerth Billakanti
><quic_sbillaka@quicinc.com> wrote:
>>
>> The panel-edp enables the eDP panel power during probe, get_modes and
>> pre-enable. The eDP connect and disconnect interrupts for the eDP/DP
>> controller are directly dependent on panel power. As eDP display can
>> be assumed as always connected, the controller driver can skip the eDP
>> connect and disconnect interrupts. Any disruption in the link status
>> will be indicated via the IRQ_HPD interrupts.
>>
>> So, the eDP controller driver can just enable the IRQ_HPD and replug
>> interrupts. The DP controller driver still needs to enable all the
>> interrupts.
>>
>> Signed-off-by: Sankeerth Billakanti <quic_sbillaka@quicinc.com>
>> ---
>> Changes in v8:
>>   - add comment explaining the interrupt status return
>>
>> Changes in v7:
>>   - reordered the patch in the series
>>   - modified the return statement for isr
>>   - connector check modified to just check for eDP
>>
>>  drivers/gpu/drm/msm/dp/dp_catalog.c | 18 ++++++++++++------
>> drivers/gpu/drm/msm/dp/dp_display.c | 22 +++++++++++++++++++++-
>>  2 files changed, 33 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c
>> b/drivers/gpu/drm/msm/dp/dp_catalog.c
>> index fac815f..3a298e9 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
>> @@ -569,10 +569,6 @@ void dp_catalog_ctrl_hpd_config(struct dp_catalog
>> *dp_catalog)
>>
>>         u32 reftimer = dp_read_aux(catalog, REG_DP_DP_HPD_REFTIMER);
>>
>> -       /* enable HPD plug and unplug interrupts */
>> -       dp_catalog_hpd_config_intr(dp_catalog,
>> -               DP_DP_HPD_PLUG_INT_MASK |
>DP_DP_HPD_UNPLUG_INT_MASK, true);
>> -
>>         /* Configure REFTIMER and enable it */
>>         reftimer |= DP_DP_HPD_REFTIMER_ENABLE;
>>         dp_write_aux(catalog, REG_DP_DP_HPD_REFTIMER, reftimer); @@
>> -599,13 +595,23 @@ u32 dp_catalog_hpd_get_intr_status(struct
>> dp_catalog *dp_catalog)  {
>>         struct dp_catalog_private *catalog = container_of(dp_catalog,
>>                                 struct dp_catalog_private, dp_catalog);
>> -       int isr = 0;
>> +       int isr, mask;
>>
>>         isr = dp_read_aux(catalog, REG_DP_DP_HPD_INT_STATUS);
>>         dp_write_aux(catalog, REG_DP_DP_HPD_INT_ACK,
>>                                  (isr & DP_DP_HPD_INT_MASK));
>> +       mask = dp_read_aux(catalog, REG_DP_DP_HPD_INT_MASK);
>>
>> -       return isr;
>> +       /*
>> +        * REG_DP_DP_HPD_INT_STATUS reports the status of all interrupts
>> +        * irrespective of their masked status. The HW interrupt will not be
>> +        * generated if an interrupt is masked. However, the interrupt status
>> +        * bit in the register will still be set. The eDP controller driver
>> +        * masks the plug and unplug interrupts unlike DP controller which
>> +        * unmasks all the interrupts. So, do not report the status of the
>> +        * masked interrupts.
>> +        */
>> +       return isr & (mask | ~DP_DP_HPD_INT_MASK);
>
>What's still missing in your comments is why you aren't just doing "return isr &
>mask;". In other words, why is the API for HPD bits different from the API for
>non-HPD bits? What code out there wants to know about non-HPD interrupts
>even if they are masked?

The mask register bitfields are different from the INT_STATUS register.
The INT_STATUS register has additional bits [31:28] which indicates the HPD state machine
status and [3:0] indicates the actual generated/set interrupt. The fields [3:0] are similar to
the mask and ack interrupts.

#define DP_DP_HPD_STATE_STATUS_CONNECTED        (0x40000000)
#define DP_DP_HPD_STATE_STATUS_PENDING          (0x20000000)
#define DP_DP_HPD_STATE_STATUS_DISCONNECTED     (0x00000000)
#define DP_DP_HPD_STATE_STATUS_MASK             (0xE0000000)

So, earlier I returned isr & (mask | DP_DP_HPD_STATE_STATUS_MASK);

Actually, there is no reason to do this. We can just do the below:
return isr & mask;

>
>Actually, thinking about this more, my preference would be this:
>
>a) Rename the existing function to dp_catalog_hpd_get_intr_status_raw()
>
>b) Create a new function called dp_catalog_hpd_get_intr_status() whose
>implementation is:
>
>  return dp_catalog_hpd_get_intr_status_raw() & mask;
>
>Then any callers who care about the raw status can be changed to call
>dp_catalog_hpd_get_intr_status_raw(). If no callers need
>dp_catalog_hpd_get_intr_status_raw() then you don't actually need to
>create this function.
>

There is no caller for raw status. All interrupts are unmasked for DP.
While handling the aux interrupts generated during the transfer call from panel probe,
we read that the HPD interrupt status [3:0] bit0 is set and proceed to handle connect like DP.
We experimented to find out that the connect interrupt is not generated but just the status
bit is set.

As the interrupts are generated over a single MDSS line, the controller driver has to read all the
interrupt status registers and handle all the set interrupt bits. So, while handling aux transfer
interrupts, we were proceeding to handle connect interrupt also as a consequence.

>If you make that change then all of a sudden the API isn't weird/wonky and
>you can just get rid of the comment I asked you to add.
>
>
>-Doug

  reply	other threads:[~2022-04-21 16:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 14:36 [PATCH v8 0/4] Add support for the eDP panel over aux_bus Sankeerth Billakanti
2022-04-21 14:36 ` Sankeerth Billakanti
2022-04-21 14:36 ` [PATCH v8 1/4] drm/msm/dp: Add eDP support via aux_bus Sankeerth Billakanti
2022-04-21 14:36   ` Sankeerth Billakanti
2022-04-21 15:23   ` Doug Anderson
2022-04-21 15:23     ` Doug Anderson
2022-04-21 16:00     ` Sankeerth Billakanti (QUIC)
2022-04-21 16:00       ` Sankeerth Billakanti (QUIC)
2022-04-21 16:07       ` Doug Anderson
2022-04-21 16:07         ` Doug Anderson
2022-04-21 14:36 ` [PATCH v8 2/4] drm/msm/dp: Support only IRQ_HPD and REPLUG interrupts for eDP Sankeerth Billakanti
2022-04-21 14:36   ` Sankeerth Billakanti
2022-04-21 15:23   ` Doug Anderson
2022-04-21 15:23     ` Doug Anderson
2022-04-21 16:38     ` Sankeerth Billakanti (QUIC) [this message]
2022-04-21 16:38       ` Sankeerth Billakanti (QUIC)
2022-04-21 17:12       ` Doug Anderson
2022-04-21 17:12         ` Doug Anderson
2022-04-21 14:36 ` [PATCH v8 3/4] drm/msm/dp: wait for hpd high before aux transaction Sankeerth Billakanti
2022-04-21 14:36   ` Sankeerth Billakanti
2022-04-21 14:36 ` [PATCH v8 4/4] drm/msm/dp: Support the eDP modes given by panel Sankeerth Billakanti
2022-04-21 14:36   ` Sankeerth Billakanti

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=MW4PR02MB71869CCA50E1706926C4B6FAE1F49@MW4PR02MB7186.namprd02.prod.outlook.com \
    --to=quic_sbillaka@quicinc.com \
    --cc=airlied@linux.ie \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_aravindh@quicinc.com \
    --cc=quic_kalyant@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=quic_vproddut@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=seanpaul@chromium.org \
    --cc=steev@kali.org \
    --cc=swboyd@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.