Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Dmitry Baryshkov <lumag@kernel.org>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Rob Clark" <robdclark@gmail.com>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Sean Paul" <sean@poorly.run>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
	"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>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/vc4: use new helper to get ACR values
Date: Mon, 10 Mar 2025 15:51:53 +0100	[thread overview]
Message-ID: <20250310-invisible-married-firefly-945c84@houat> (raw)
In-Reply-To: <20250309-drm-hdmi-acr-v1-3-bb9c242f4d4b@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]

On Sun, Mar 09, 2025 at 10:13:58AM +0200, Dmitry Baryshkov wrote:
> From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> Use drm_hdmi_acr_get_n_cts() helper instead of calculating N and CTS
> values in the VC4 driver.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++-------
>  drivers/gpu/drm/vc4/vc4_hdmi.h |  7 +++++++
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 37238a12baa58a06a5d6f40d1ab64abc7fac60d7..f24bcc2f3a2ac39aaea061b809940978341472f4 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -1637,6 +1637,7 @@ static void vc4_hdmi_encoder_atomic_mode_set(struct drm_encoder *encoder,
>  		      &crtc_state->adjusted_mode);
>  	vc4_hdmi->output_bpc = conn_state->hdmi.output_bpc;
>  	vc4_hdmi->output_format = conn_state->hdmi.output_format;
> +	vc4_hdmi->tmds_char_rate = conn_state->hdmi.tmds_char_rate;
>  	mutex_unlock(&vc4_hdmi->mutex);
>  }
>  
> @@ -1829,17 +1830,12 @@ static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi,
>  
>  static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate)
>  {
> -	const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode;
> -	u32 n, cts;
> -	u64 tmp;
> +	unsigned int n, cts;
>  
>  	lockdep_assert_held(&vc4_hdmi->mutex);
>  	lockdep_assert_held(&vc4_hdmi->hw_lock);
>  
> -	n = 128 * samplerate / 1000;
> -	tmp = (u64)(mode->clock * 1000) * n;
> -	do_div(tmp, 128 * samplerate);
> -	cts = tmp;
> +	drm_hdmi_acr_get_n_cts(vc4_hdmi->tmds_char_rate, samplerate, &n, &cts);
>  
>  	HDMI_WRITE(HDMI_CRP_CFG,
>  		   VC4_HDMI_CRP_CFG_EXTERNAL_CTS_EN |
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
> index e3d989ca302b72533c374dfa3fd0d5bd7fe64a82..0a775dbfe99d45521f3d0a2016555aefa81d7934 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.h
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
> @@ -211,6 +211,13 @@ struct vc4_hdmi {
>  	 * KMS hooks. Protected by @mutex.
>  	 */
>  	enum hdmi_colorspace output_format;
> +
> +	/**
> +	 * @tmds_char_rate: Copy of
> +	 * @drm_connector_state.hdmi.tmds_char_rate for use outside of
> +	 * KMS hooks. Protected by @mutex.
> +	 */
> +	unsigned long long tmds_char_rate;
>  };

This should be in drm_connector_hdmi if it's useful

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-03-10 14:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09  8:13 [PATCH 0/4] drm/display: hdmi: provide common code to get Audio Clock Recovery params Dmitry Baryshkov
2025-03-09  8:13 ` [PATCH 1/4] drm/display: hdmi: provide central data authority for ACR params Dmitry Baryshkov
2025-03-10 14:46   ` Maxime Ripard
2025-03-10 20:14     ` Dmitry Baryshkov
2025-03-11  7:59       ` Maxime Ripard
2025-03-11 16:24         ` Dmitry Baryshkov
2025-03-09  8:13 ` [PATCH 2/4] drm/msm/hdmi: use new helper for ACR tables Dmitry Baryshkov
2025-03-09 23:57   ` kernel test robot
2025-03-09  8:13 ` [PATCH 3/4] drm/vc4: use new helper to get ACR values Dmitry Baryshkov
2025-03-10 14:51   ` Maxime Ripard [this message]
2025-03-10 20:18     ` Dmitry Baryshkov
2025-03-11  8:07       ` Maxime Ripard
2025-03-11 16:28         ` Dmitry Baryshkov
2025-03-14 13:46           ` Maxime Ripard
2025-03-14 16:09             ` Dmitry Baryshkov
2025-03-09  8:13 ` [PATCH 4/4] drm: bridge: dw-hdmi: " Dmitry Baryshkov
2025-03-09 21:55   ` kernel test robot

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=20250310-invisible-married-firefly-945c84@houat \
    --to=mripard@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kernel-list@raspberrypi.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mcanal@igalia.com \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=rfoss@kernel.org \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --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