Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Algea Cao <algea.cao@rock-chips.com>,
	a.hajda@samsung.com, kuankuan.y@gmail.com, hjc@rock-chips.com,
	tzimmermann@suse.de, dri-devel@lists.freedesktop.org,
	sam@ravnborg.org, airlied@linux.ie, heiko@sntech.de,
	jernej.skrabec@siol.net, Laurent.pinchart@ideasonboard.com,
	laurent.pinchart+renesas@ideasonboard.com, jonas@kwiboo.se,
	mripard@kernel.org, darekm@google.com,
	linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, cychiang@chromium.org,
	linux-kernel@vger.kernel.org, jbrunet@baylibre.com,
	maarten.lankhorst@linux.intel.com, daniel@ffwll.ch
Subject: Re: [PATCH 3/6] drm: bridge: dw-hdmi: Introduce previous_pixelclock/previous_tmdsclock
Date: Mon, 24 Aug 2020 11:53:30 +0200	[thread overview]
Message-ID: <fd42150f-45fc-1664-eeab-7b8e9e99ed60@baylibre.com> (raw)
In-Reply-To: <20200812083459.989-1-algea.cao@rock-chips.com>

On 12/08/2020 10:34, Algea Cao wrote:
> Introduce previous_pixelclock/previous_tmdsclock to
> determine whether PHY needs initialization. If phy is power off,
> or mpixelclock/mtmdsclock is different to previous value, phy is
> neet to be reinitialized.
> 
> Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
> ---
> 
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 50 +++++++++++++++++++----
>  1 file changed, 43 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index a1a81fc768c2..1eb4736b9b59 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -101,6 +101,8 @@ static const u16 csc_coeff_rgb_full_to_rgb_limited[3][4] = {
>  struct hdmi_vmode {
>  	bool mdataenablepolarity;
>  
> +	unsigned int previous_pixelclock;
> +	unsigned int previous_tmdsclock;
>  	unsigned int mpixelclock;
>  	unsigned int mpixelrepetitioninput;
>  	unsigned int mpixelrepetitionoutput;
> @@ -890,6 +892,32 @@ static int hdmi_bus_fmt_color_depth(unsigned int bus_format)
>  	}
>  }
>  
> +static unsigned int
> +hdmi_get_tmdsclock(struct dw_hdmi *hdmi, unsigned long mpixelclock)
> +{
> +	unsigned int tmdsclock = mpixelclock;
> +	unsigned int depth =
> +		hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format);
> +
> +	if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) {
> +		switch (depth) {
> +		case 16:
> +			tmdsclock = mpixelclock * 2;
> +			break;
> +		case 12:
> +			tmdsclock = mpixelclock * 3 / 2;
> +			break;
> +		case 10:
> +			tmdsclock = mpixelclock * 5 / 4;
> +			break;
> +		default:
> +			break;
> +		}
> +	}


Where does this come from ? Please introduce this on another patch.

Neil

> +
> +	return tmdsclock;
> +}
> +
>  /*
>   * this submodule is responsible for the video data synchronization.
>   * for example, for RGB 4:4:4 input, the data map is defined as
> @@ -1861,11 +1889,13 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
>  	int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len;
>  	unsigned int vdisplay, hdisplay;
>  
> +	vmode->previous_pixelclock = vmode->mpixelclock;
>  	vmode->mpixelclock = mode->clock * 1000;
>  
>  	dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock);
>  
> -	vmode->mtmdsclock = vmode->mpixelclock;
> +	vmode->previous_tmdsclock = vmode->mtmdsclock;
> +	vmode->mtmdsclock = hdmi_get_tmdsclock(hdmi, vmode->mpixelclock);
>  
>  	if (!hdmi_bus_fmt_is_yuv422(hdmi->hdmi_data.enc_out_bus_format)) {
>  		switch (hdmi_bus_fmt_color_depth(
> @@ -2172,12 +2202,18 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi,
>  	hdmi_av_composer(hdmi, &connector->display_info, mode);
>  
>  	/* HDMI Initializateion Step B.2 */
> -	ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data,
> -				  &connector->display_info,
> -				  &hdmi->previous_mode);
> -	if (ret)
> -		return ret;
> -	hdmi->phy.enabled = true;
> +	if (!hdmi->phy.enabled ||
> +	    hdmi->hdmi_data.video_mode.previous_pixelclock !=
> +	    hdmi->hdmi_data.video_mode.mpixelclock ||
> +	    hdmi->hdmi_data.video_mode.previous_tmdsclock !=
> +	    hdmi->hdmi_data.video_mode.mtmdsclock) {
> +		ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data,
> +					  &connector->display_info,
> +					  &hdmi->previous_mode);
> +		if (ret)
> +			return ret;
> +		hdmi->phy.enabled = true;
> +	}
>  
>  	/* HDMI Initialization Step B.3 */
>  	dw_hdmi_enable_video_path(hdmi);
> 


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2020-08-24  9:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12  8:31 [PATCH 0/6] Support change dw-hdmi output color Algea Cao
2020-08-12  8:34 ` [PATCH 1/6] drm: Add connector atomic_begin/atomic_flush Algea Cao
2020-08-12  9:26   ` Laurent Pinchart
2020-08-12  8:34 ` [PATCH 2/6] drm: bridge: dw-hdmi: Implement " Algea Cao
2020-08-12  9:22   ` Laurent Pinchart
2020-08-12  8:34 ` [PATCH 3/6] drm: bridge: dw-hdmi: Introduce previous_pixelclock/previous_tmdsclock Algea Cao
2020-08-24  9:53   ` Neil Armstrong [this message]
2020-08-12  8:35 ` [PATCH 4/6] drm/rockchip: dw_hdmi: Add vendor hdmi properties Algea Cao
2020-08-12  9:33   ` Laurent Pinchart
     [not found]     ` <52cca26d-b2b3-22b2-f371-a8086f2e6336@rock-chips.com>
2020-08-12 13:30       ` Laurent Pinchart
2020-08-13  7:42         ` Pekka Paalanen
2020-08-13 10:45           ` Laurent Pinchart
2020-08-14  8:23             ` Pekka Paalanen
2020-08-12  8:36 ` [PATCH 5/6] drm/rockchip: dw_hdmi: Add get_output_bus_format Algea Cao
2020-08-12  8:36 ` [PATCH 6/6] drm: bridge: dw-hdmi: Get output bus format when dw-hdmi is the only bridge Algea Cao
2020-08-24  9:50   ` Neil Armstrong

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=fd42150f-45fc-1664-eeab-7b8e9e99ed60@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=algea.cao@rock-chips.com \
    --cc=cychiang@chromium.org \
    --cc=daniel@ffwll.ch \
    --cc=darekm@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jbrunet@baylibre.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kuankuan.y@gmail.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --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