linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 18/27] drm: bridge: dw-hdmi: Pass drm_display_info to dw_hdmi_support_scdc()
Date: Tue, 26 May 2020 11:48:45 +0200	[thread overview]
Message-ID: <a1d9dc96-d889-8172-e411-922dd7d2c3b9@baylibre.com> (raw)
In-Reply-To: <20200526011505.31884-19-laurent.pinchart+renesas@ideasonboard.com>

On 26/05/2020 03:14, Laurent Pinchart wrote:
> To prepare for making connector creation optional in the driver, pass
> the drm_display_info explicitly to dw_hdmi_support_scdc(). The pointer
> is passed to the callers where required, particularly to the
> dw_hdmi_phy_ops .init() function.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c   | 32 ++++++++++++---------
>  drivers/gpu/drm/meson/meson_dw_hdmi.c       |  3 +-
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  1 +
>  drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c      |  1 +
>  include/drm/bridge/dw_hdmi.h                |  4 ++-
>  5 files changed, 26 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 5b5f07a23400..a18794cce0d8 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1241,10 +1241,9 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data,
>  EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write);
>  
>  /* Filter out invalid setups to avoid configuring SCDC and scrambling */
> -static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
> +static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi,
> +				 const struct drm_display_info *display)
>  {
> -	struct drm_display_info *display = &hdmi->connector.display_info;
> -
>  	/* Completely disable SCDC support for older controllers */
>  	if (hdmi->version < 0x200a)
>  		return false;
> @@ -1282,12 +1281,13 @@ static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
>   * helper should called right before enabling the TMDS Clock and Data in
>   * the PHY configuration callback.
>   */
> -void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi)
> +void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
> +				       const struct drm_display_info *display)
>  {
>  	unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock;
>  
>  	/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
> -	if (dw_hdmi_support_scdc(hdmi)) {
> +	if (dw_hdmi_support_scdc(hdmi, display)) {
>  		if (mtmdsclock > HDMI14_MAX_TMDSCLK)
>  			drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1);
>  		else
> @@ -1490,7 +1490,8 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi,
>  	return 0;
>  }
>  
> -static int hdmi_phy_configure(struct dw_hdmi *hdmi)
> +static int hdmi_phy_configure(struct dw_hdmi *hdmi,
> +			      const struct drm_display_info *display)
>  {
>  	const struct dw_hdmi_phy_data *phy = hdmi->phy.data;
>  	const struct dw_hdmi_plat_data *pdata = hdmi->plat_data;
> @@ -1500,7 +1501,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi)
>  
>  	dw_hdmi_phy_power_off(hdmi);
>  
> -	dw_hdmi_set_high_tmds_clock_ratio(hdmi);
> +	dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
>  
>  	/* Leave low power consumption mode by asserting SVSRET. */
>  	if (phy->has_svsret)
> @@ -1531,6 +1532,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi)
>  }
>  
>  static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
> +			    const struct drm_display_info *display,
>  			    const struct drm_display_mode *mode)
>  {
>  	int i, ret;
> @@ -1540,7 +1542,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
>  		dw_hdmi_phy_sel_data_en_pol(hdmi, 1);
>  		dw_hdmi_phy_sel_interface_control(hdmi, 0);
>  
> -		ret = hdmi_phy_configure(hdmi);
> +		ret = hdmi_phy_configure(hdmi, display);
>  		if (ret)
>  			return ret;
>  	}
> @@ -1846,10 +1848,11 @@ static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi)
>  }
>  
>  static void hdmi_av_composer(struct dw_hdmi *hdmi,
> +			     const struct drm_display_info *display,
>  			     const struct drm_display_mode *mode)
>  {
>  	u8 inv_val, bytes;
> -	struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi;
> +	const struct drm_hdmi_info *hdmi_info = &display->hdmi;
>  	struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode;
>  	int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len;
>  	unsigned int vdisplay, hdisplay;
> @@ -1882,7 +1885,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
>  
>  	/* Set up HDMI_FC_INVIDCONF */
>  	inv_val = (hdmi->hdmi_data.hdcp_enable ||
> -		   (dw_hdmi_support_scdc(hdmi) &&
> +		   (dw_hdmi_support_scdc(hdmi, display) &&
>  		    (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
>  		     hdmi_info->scdc.scrambling.low_rates)) ?
>  		HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE :
> @@ -1950,7 +1953,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
>  	}
>  
>  	/* Scrambling Control */
> -	if (dw_hdmi_support_scdc(hdmi)) {
> +	if (dw_hdmi_support_scdc(hdmi, display)) {
>  		if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
>  		    hdmi_info->scdc.scrambling.low_rates) {
>  			/*
> @@ -2116,6 +2119,7 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi)
>  static int dw_hdmi_setup(struct dw_hdmi *hdmi,
>  			 const struct drm_display_mode *mode)
>  {
> +	struct drm_connector *connector = &hdmi->connector;
>  	int ret;
>  
>  	hdmi_disable_overflow_interrupts(hdmi);
> @@ -2161,10 +2165,12 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi,
>  	hdmi->hdmi_data.video_mode.mdataenablepolarity = true;
>  
>  	/* HDMI Initialization Step B.1 */
> -	hdmi_av_composer(hdmi, mode);
> +	hdmi_av_composer(hdmi, &connector->display_info, mode);
>  
>  	/* HDMI Initializateion Step B.2 */
> -	ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, &hdmi->previous_mode);
> +	ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data,
> +				  &connector->display_info,
> +				  &hdmi->previous_mode);
>  	if (ret)
>  		return ret;
>  	hdmi->phy.enabled = true;
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 757c17fbb29f..15e62f327894 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -427,6 +427,7 @@ static void dw_hdmi_set_vclk(struct meson_dw_hdmi *dw_hdmi,
>  }
>  
>  static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
> +			    const struct drm_display_info *display,
>  			    const struct drm_display_mode *mode)
>  {
>  	struct meson_dw_hdmi *dw_hdmi = (struct meson_dw_hdmi *)data;
> @@ -496,7 +497,7 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
>  	/* Disable clock, fifo, fifo_wr */
>  	regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
>  
> -	dw_hdmi_set_high_tmds_clock_ratio(hdmi);
> +	dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
>  
>  	msleep(100);
>  
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> index 10e210f6455d..23de359a1dec 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> @@ -312,6 +312,7 @@ static const struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_fun
>  };
>  
>  static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data,
> +					const struct drm_display_info *display,
>  					const struct drm_display_mode *mode)
>  {
>  	struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data;
> diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
> index 8e078cacf063..156d00e5165b 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
> @@ -341,6 +341,7 @@ static int sun8i_hdmi_phy_config_h3(struct dw_hdmi *hdmi,
>  }
>  
>  static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data,
> +				 const struct drm_display_info *display,
>  				 const struct drm_display_mode *mode)
>  {
>  	struct sun8i_hdmi_phy *phy = (struct sun8i_hdmi_phy *)data;
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index f930d218cc6b..ea34ca146b82 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -114,6 +114,7 @@ struct dw_hdmi_phy_config {
>  
>  struct dw_hdmi_phy_ops {
>  	int (*init)(struct dw_hdmi *hdmi, void *data,
> +		    const struct drm_display_info *display,
>  		    const struct drm_display_mode *mode);
>  	void (*disable)(struct dw_hdmi *hdmi, void *data);
>  	enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data);
> @@ -174,7 +175,8 @@ void dw_hdmi_set_channel_status(struct dw_hdmi *hdmi, u8 *channel_status);
>  void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca);
>  void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
>  void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
> -void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi);
> +void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
> +				       const struct drm_display_info *display);
>  
>  /* PHY configuration */
>  void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address);
> 

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

  reply	other threads:[~2020-05-26  9:48 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  1:14 [PATCH 00/27] Converter R-Car DU to the DRM bridge connector helper Laurent Pinchart
2020-05-26  1:14 ` [PATCH 01/27] drm: bridge: adv7511: Split EDID read to a separate function Laurent Pinchart
2020-05-26  1:14 ` [PATCH 02/27] drm: bridge: adv7511: Split connector creation " Laurent Pinchart
2020-05-26  1:14 ` [PATCH 03/27] drm: bridge: adv7511: Implement bridge connector operations Laurent Pinchart
2020-06-21  8:25   ` Sam Ravnborg
2020-05-26  1:14 ` [PATCH 04/27] drm: bridge: adv7511: Make connector creation optional Laurent Pinchart
2020-05-26  1:14 ` [PATCH 05/27] drm: bridge: Return NULL on error from drm_bridge_get_edid() Laurent Pinchart
2020-06-21  8:26   ` Sam Ravnborg
2020-05-26  1:14 ` [PATCH 06/27] drm: bridge: simple-bridge: Delegate operations to next bridge Laurent Pinchart
2020-05-26  1:14 ` [PATCH 07/27] drm: bridge: simple-bridge: Make connector creation optional Laurent Pinchart
2020-05-26  1:14 ` [PATCH 08/27] drm: rcar-du: lvds: Convert to DRM panel bridge helper Laurent Pinchart
2020-05-26  1:14 ` [PATCH 09/27] drm: edid: Constify connector argument to infoframe functions Laurent Pinchart
2020-06-21  8:27   ` Sam Ravnborg
2020-05-26  1:14 ` [PATCH 10/27] drm: bridge: Pass drm_display_info to drm_bridge_funcs .mode_valid() Laurent Pinchart
2020-05-26 12:51   ` Neil Armstrong
2020-05-26 12:59   ` Boris Brezillon
2020-05-26 14:05   ` Guido Günther
2020-05-26  1:14 ` [PATCH 11/27] drm: bridge: dw-hdmi: Pass private data pointer to .mode_valid() Laurent Pinchart
2020-05-26  9:44   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 12/27] drm: bridge: dw-hdmi: Pass private data pointer to .configure_phy() Laurent Pinchart
2020-05-26  9:45   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 13/27] drm: bridge: dw-hdmi: Remove unused field from dw_hdmi_plat_data Laurent Pinchart
2020-05-26  9:45   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 14/27] drm: meson: dw-hdmi: Use dw_hdmi context to replace hack Laurent Pinchart
2020-05-26 12:32   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 15/27] drm: bridge: dw-hdmi: Pass drm_display_info to .mode_valid() Laurent Pinchart
2020-05-26  9:46   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 16/27] drm: bridge: dw-hdmi: Constify mode argument to dw_hdmi_phy_ops .init() Laurent Pinchart
2020-05-26  9:46   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 17/27] drm: bridge: dw-hdmi: Constify mode argument to internal functions Laurent Pinchart
2020-05-26  9:46   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 18/27] drm: bridge: dw-hdmi: Pass drm_display_info to dw_hdmi_support_scdc() Laurent Pinchart
2020-05-26  9:48   ` Neil Armstrong [this message]
2020-05-26  1:14 ` [PATCH 19/27] drm: bridge: dw-hdmi: Split connector creation to a separate function Laurent Pinchart
2020-05-26  9:49   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 20/27] drm: bridge: dw-hdmi: Store current connector in struct dw_hdmi Laurent Pinchart
2020-05-26 12:29   ` Neil Armstrong
2020-05-26  1:14 ` [PATCH 21/27] drm: bridge: dw-hdmi: Pass drm_connector to internal functions as needed Laurent Pinchart
2020-05-26 12:29   ` Neil Armstrong
2020-05-26  1:15 ` [PATCH 22/27] drm: bridge: dw-hdmi: Make connector creation optional Laurent Pinchart
2020-05-26 12:35   ` Neil Armstrong
2020-06-07  1:19     ` Laurent Pinchart
2020-05-26  1:15 ` [PATCH 23/27] drm: bridge: dw-hdmi: Attach to next bridge if available Laurent Pinchart
2020-05-26 12:50   ` Neil Armstrong
2020-05-26 14:23     ` Jonas Karlman
2020-06-07  1:24       ` Laurent Pinchart
2020-06-07  1:22     ` Laurent Pinchart
2020-05-26  1:15 ` [PATCH 24/27] drm: rcar-du: dw-hdmi: Set output port number Laurent Pinchart
2020-05-26  1:15 ` [PATCH 25/27] drm: rcar-du: Fix error handling in rcar_du_encoder_init() Laurent Pinchart
2020-05-26  1:15 ` [PATCH 26/27] drm: rcar-du: Use drm_bridge_connector_init() helper Laurent Pinchart
2020-05-26  1:15 ` [PATCH 27/27] drm: Add default modes for connectors in unknown state Laurent Pinchart
2020-06-21  8:40   ` Sam Ravnborg
2020-06-24  1:12     ` Laurent Pinchart
2020-06-24  7:23       ` Daniel Vetter
2020-06-24 15:24         ` Alex Deucher
2020-06-24 19:31           ` Daniel Vetter
2020-06-24 19:40             ` Alex Deucher
2020-06-25  7:56               ` Daniel Vetter
2020-06-25  7:57                 ` Daniel Vetter
2020-06-25 10:31                   ` Pekka Paalanen
2020-06-25 10:44                     ` Daniel Vetter
2020-06-26  8:59                       ` Pekka Paalanen
2020-06-26  9:25                         ` Daniel Stone
2020-06-26 13:35                           ` Daniel Vetter
2020-06-24 22:47         ` Laurent Pinchart
2020-06-23 18:55 ` [PATCH 00/27] Converter R-Car DU to the DRM bridge connector helper Sam Ravnborg
2020-06-25  8:48   ` Liu Ying
2020-06-27 19:55     ` Sam Ravnborg
2020-06-28  8:28       ` Laurent Pinchart

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=a1d9dc96-d889-8172-e411-922dd7d2c3b9@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=wens@csie.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 NNTP newsgroup(s).