mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Rob Clark <robdclark@gmail.com>,
	Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	Simona Vetter <simona@ffwll.ch>,
	Simona Vetter <simona.vetter@ffwll.ch>,
	<dri-devel@lists.freedesktop.org>,
	<linux-arm-msm@vger.kernel.org>,
	<freedreno@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 2/7] drm/msm/hdmi: program HDMI timings during atomic_pre_enable
Date: Fri, 7 Feb 2025 12:11:55 -0800	[thread overview]
Message-ID: <b7561a2c-653b-4c56-8bef-3ae76a729d7c@quicinc.com> (raw)
In-Reply-To: <fgzcd4gm4uriqbpslh7arfyxjvzyxrck3f2uuv4mhkvcbkdmvm@b2pz5vmmqs3l>



On 2/6/2025 5:19 PM, Dmitry Baryshkov wrote:
> On Thu, Feb 06, 2025 at 12:41:30PM -0800, Abhinav Kumar wrote:
>>
>>
>> On 2/3/2025 4:59 PM, Dmitry Baryshkov wrote:
>>> On Mon, Feb 03, 2025 at 11:34:00AM -0800, Abhinav Kumar wrote:
>>>>
>>>>
>>>> On 1/24/2025 1:47 PM, Dmitry Baryshkov wrote:
>>>>> The mode_set callback is deprecated, it doesn't get the
>>>>> drm_bridge_state, just mode-related argumetns. Also Abhinav pointed out
>>>>> that HDMI timings should be programmed after setting up HDMI PHY and
>>>>> PLL. Rework the code to program HDMI timings at the end of
>>>>> atomic_pre_enable().
>>>>>
>>>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>>>> ---
>>>>>     drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 23 +++++++++++++++--------
>>>>>     1 file changed, 15 insertions(+), 8 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
>>>>> index d839c71091dcdc3b020fcbba8d698d58ee7fc749..d5ab1f74c0e6f47dc59872c016104e9a84d85e9e 100644
>>>>> --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
>>>>> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
>>>>> @@ -126,15 +126,26 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi)
>>>>>     	hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val);
>>>>>     }
>>>>> +static void msm_hdmi_bridge_atomic_set_timings(struct hdmi *hdmi,
>>>>> +					       const struct drm_display_mode *mode);
>>>>>     static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>>>>>     					      struct drm_bridge_state *old_bridge_state)
>>>>>     {
>>>>> +	struct drm_atomic_state *state = old_bridge_state->base.state;
>>>>>     	struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
>>>>>     	struct hdmi *hdmi = hdmi_bridge->hdmi;
>>>>>     	struct hdmi_phy *phy = hdmi->phy;
>>>>> +	struct drm_encoder *encoder = bridge->encoder;
>>>>> +	struct drm_connector *connector;
>>>>> +	struct drm_connector_state *conn_state;
>>>>> +	struct drm_crtc_state *crtc_state;
>>>>>     	DBG("power up");
>>>>> +	connector = drm_atomic_get_new_connector_for_encoder(state, encoder);
>>>>> +	conn_state = drm_atomic_get_new_connector_state(state, connector);
>>>>> +	crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
>>>>> +
>>>>>     	if (!hdmi->power_on) {
>>>>>     		msm_hdmi_phy_resource_enable(phy);
>>>>>     		msm_hdmi_power_on(bridge);
>>>>> @@ -151,6 +162,8 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>>>>>     	if (hdmi->hdcp_ctrl)
>>>>>     		msm_hdmi_hdcp_on(hdmi->hdcp_ctrl);
>>>>> +
>>>>> +	msm_hdmi_bridge_atomic_set_timings(hdmi, &crtc_state->adjusted_mode);
>>>>>     }
>>>>
>>>> This addresses my comment about setting up the HDMI timing registers before
>>>> setting up the timing engine registers.
>>>>
>>>> But prior to this change, mode_set was doing the same thing as
>>>> msm_hdmi_bridge_atomic_set_timings() which means
>>>> msm_hdmi_bridge_atomic_set_timings() should be called at the beginning of
>>>> pre_enable()?
>>>>
>>>> The controller is enabled in msm_hdmi_set_mode(). So this should be done
>>>> before that.
>>>
>>> In [1] you provided the following order:
>>>
>>> 1) setup HDMI PHY and PLL
>>> 2) setup HDMI video path correctly (HDMI timing registers)
>>> 3) setup timing generator to match the HDMI video in (2)
>>> 4) Enable timing engine
>>>
>>> This means htat msm_hdmi_bridge_atomic_set_timings() should come at the
>>> end of msm_hdmi_bridge_atomic_pre_enable(), not in the beginning /
>>> middle of it.
>>>
>>> [1] https://lore.kernel.org/dri-devel/8dd4a43e-d83c-1f36-21ff-61e13ff751e7@quicinc.com/
>>>
>>
>> Sequence given is correct and is exactly what is given in the docs. What is
>> somewhat not clear in the docs is the location of the enable of the HDMI
>> controller. This is not there in the above 4 steps. I am referring to the
>> enable bit being programmed in msm_hdmi_set_mode(). Ideally till we enable
>> the timing engine, it should be okay but what I wanted to do was to keep the
>> msm_hdmi_set_mode() as the last call in this function that way we program
>> everything and then enable the controller.
>>
>> This can be done in either way, move it to the beginning of the function or
>> move it right before msm_hdmi_set_mode(). I had suggested beginning because
>> thats how it was when things were still in mode_set.
> 
> Well.. following your description it might be better to put it after PHY
> init. What do you think?
> 

Are you referring to after msm_hdmi_phy_powerup()? Yes, thats fine too.


  reply	other threads:[~2025-02-07 20:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24 21:47 [PATCH v6 0/7] drm/msm: make use of the HDMI connector infrastructure Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 1/7] drm/msm/hdmi: switch to atomic bridge callbacks Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 2/7] drm/msm/hdmi: program HDMI timings during atomic_pre_enable Dmitry Baryshkov
2025-01-26 16:41   ` Maxime Ripard
2025-02-03 19:34   ` Abhinav Kumar
2025-02-04  0:59     ` Dmitry Baryshkov
2025-02-06 20:41       ` Abhinav Kumar
2025-02-07  1:19         ` Dmitry Baryshkov
2025-02-07 20:11           ` Abhinav Kumar [this message]
2025-02-07 22:07             ` Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 3/7] drm/msm/hdmi: make use of the drm_connector_hdmi framework Dmitry Baryshkov
2025-02-04  0:25   ` Abhinav Kumar
2025-02-04  1:30     ` Dmitry Baryshkov
2025-02-07 21:34       ` Abhinav Kumar
2025-02-07 22:03         ` Dmitry Baryshkov
2025-02-07 22:27           ` Abhinav Kumar
2025-02-07 23:43             ` Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 4/7] drm/msm/hdmi: get rid of hdmi_mode Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 5/7] drm/msm/hdmi: update HDMI_GEN_PKT_CTRL_GENERIC0_UPDATE definition Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 6/7] drm/msm/hdmi: also send the SPD and HDMI Vendor Specific InfoFrames Dmitry Baryshkov
2025-01-24 21:47 ` [PATCH v6 7/7] drm/msm/hdmi: use DRM HDMI Audio framework Dmitry Baryshkov
2025-01-27 10:10   ` Maxime Ripard

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=b7561a2c-653b-4c56-8bef-3ae76a729d7c@quicinc.com \
    --to=quic_abhinavk@quicinc.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=simona.vetter@ffwll.ch \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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®