dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: Jose Abreu <Jose.Abreu@synopsys.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Mark Yao <mark.yao@rock-chips.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Carlos Palminha <CARLOS.PALMINHA@synopsys.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Carlo Caione <carlo@caione.org>
Subject: Re: [PATCH v5 07/10] drm/bridge/synopsys: dw-hdmi: Use bridge->mode_valid() callback
Date: Tue, 30 May 2017 15:54:46 +0530	[thread overview]
Message-ID: <49c4273c-eb14-da5d-f85d-a3a944f8f9cd@codeaurora.org> (raw)
In-Reply-To: <3d8d449e4d13d2535fa292c75f5fa931de4a4fa8.1495720737.git.joabreu@synopsys.com>

Hi,

On 05/25/2017 07:49 PM, Jose Abreu wrote:
> Now that we have a callback to check if bridge supports a given mode
> we can use it in Synopsys Designware HDMI bridge so that we restrict
> the number of probbed modes to the ones we can actually display.
>
> Also, there is no need to use mode_fixup() callback as mode_valid()
> will handle the mode validation.
>
> NOTE: Only compile tested
> NOTE 2: I also had to change the pdata declaration of mode_valid
> custom callback so that the passed modes are const. I also changed
> in the platforms I found. Not even compiled it though.

This compiles fine and has been tested on Meson by Neil.

Since this also touches rockchip/imx drm driver files, can I get an
OK from the maintainers to pull the changes via drm-misc?

Thanks,
Archit

>
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>
> Acked-by: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Carlos Palminha <palminha@synopsys.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Archit Taneja <architt@codeaurora.org>
> Cc: Andrzej Hajda <a.hajda@samsung.com>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Carlo Caione <carlo@caione.org>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: Mark Yao <mark.yao@rock-chips.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c   | 40 +++++++++--------------------
>  drivers/gpu/drm/imx/dw_hdmi-imx.c           |  4 +--
>  drivers/gpu/drm/meson/meson_dw_hdmi.c       |  2 +-
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  2 +-
>  include/drm/bridge/dw_hdmi.h                |  2 +-
>  5 files changed, 17 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 8737de8..038dc43 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1907,24 +1907,6 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
>  	return ret;
>  }
>
> -static enum drm_mode_status
> -dw_hdmi_connector_mode_valid(struct drm_connector *connector,
> -			     struct drm_display_mode *mode)
> -{
> -	struct dw_hdmi *hdmi = container_of(connector,
> -					   struct dw_hdmi, connector);
> -	enum drm_mode_status mode_status = MODE_OK;
> -
> -	/* We don't support double-clocked modes */
> -	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
> -		return MODE_BAD;
> -
> -	if (hdmi->plat_data->mode_valid)
> -		mode_status = hdmi->plat_data->mode_valid(connector, mode);
> -
> -	return mode_status;
> -}
> -
>  static void dw_hdmi_connector_force(struct drm_connector *connector)
>  {
>  	struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
> @@ -1950,7 +1932,6 @@ static void dw_hdmi_connector_force(struct drm_connector *connector)
>
>  static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
>  	.get_modes = dw_hdmi_connector_get_modes,
> -	.mode_valid = dw_hdmi_connector_mode_valid,
>  	.best_encoder = drm_atomic_helper_best_encoder,
>  };
>
> @@ -1973,18 +1954,21 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge)
>  	return 0;
>  }
>
> -static bool dw_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
> -				      const struct drm_display_mode *orig_mode,
> -				      struct drm_display_mode *mode)
> +static enum drm_mode_status dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
> +						      const struct drm_display_mode *mode)
>  {
>  	struct dw_hdmi *hdmi = bridge->driver_private;
>  	struct drm_connector *connector = &hdmi->connector;
> -	enum drm_mode_status status;
> +	enum drm_mode_status mode_status = MODE_OK;
>
> -	status = dw_hdmi_connector_mode_valid(connector, mode);
> -	if (status != MODE_OK)
> -		return false;
> -	return true;
> +	/* We don't support double-clocked modes */
> +	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
> +		return MODE_BAD;
> +
> +	if (hdmi->plat_data->mode_valid)
> +		mode_status = hdmi->plat_data->mode_valid(connector, mode);
> +
> +	return mode_status;
>  }
>
>  static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
> @@ -2028,7 +2012,7 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
>  	.enable = dw_hdmi_bridge_enable,
>  	.disable = dw_hdmi_bridge_disable,
>  	.mode_set = dw_hdmi_bridge_mode_set,
> -	.mode_fixup = dw_hdmi_bridge_mode_fixup,
> +	.mode_valid = dw_hdmi_bridge_mode_valid,
>  };
>
>  static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi)
> diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> index f039641..5f561c8 100644
> --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
> +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
> @@ -148,7 +148,7 @@ static int dw_hdmi_imx_atomic_check(struct drm_encoder *encoder,
>  };
>
>  static enum drm_mode_status imx6q_hdmi_mode_valid(struct drm_connector *con,
> -						  struct drm_display_mode *mode)
> +						  const struct drm_display_mode *mode)
>  {
>  	if (mode->clock < 13500)
>  		return MODE_CLOCK_LOW;
> @@ -160,7 +160,7 @@ static enum drm_mode_status imx6q_hdmi_mode_valid(struct drm_connector *con,
>  }
>
>  static enum drm_mode_status imx6dl_hdmi_mode_valid(struct drm_connector *con,
> -						   struct drm_display_mode *mode)
> +						   const struct drm_display_mode *mode)
>  {
>  	if (mode->clock < 13500)
>  		return MODE_CLOCK_LOW;
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 7b86eb7..f043904 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -537,7 +537,7 @@ static irqreturn_t dw_hdmi_top_thread_irq(int irq, void *dev_id)
>
>  /* TOFIX Enable support for non-vic modes */
>  static enum drm_mode_status dw_hdmi_mode_valid(struct drm_connector *connector,
> -					       struct drm_display_mode *mode)
> +					       const struct drm_display_mode *mode)
>  {
>  	unsigned int vclk_freq;
>  	unsigned int venc_freq;
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> index 63dab6f..f820848 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> @@ -155,7 +155,7 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
>
>  static enum drm_mode_status
>  dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
> -			    struct drm_display_mode *mode)
> +			    const struct drm_display_mode *mode)
>  {
>  	const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
>  	int pclk = mode->clock * 1000;
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> index ed599be..4c8d4c8 100644
> --- a/include/drm/bridge/dw_hdmi.h
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -125,7 +125,7 @@ struct dw_hdmi_phy_ops {
>  struct dw_hdmi_plat_data {
>  	struct regmap *regm;
>  	enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
> -					   struct drm_display_mode *mode);
> +					   const struct drm_display_mode *mode);
>  	unsigned long input_bus_format;
>  	unsigned long input_bus_encoding;
>
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-05-30 10:24 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 14:19 [PATCH v5 00/10] Introduce new mode validation callbacks Jose Abreu
2017-05-25 14:19 ` [PATCH v5 01/10] drm: Add drm_{crtc/encoder/connector}_mode_valid() Jose Abreu
2017-05-30  6:38   ` Daniel Vetter
2017-05-30  7:26   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 02/10] drm: Introduce drm_bridge_mode_valid() Jose Abreu
2017-05-26  4:25   ` Archit Taneja
2017-05-30  7:27   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 03/10] drm: Use new mode_valid() helpers in connector probe helper Jose Abreu
2017-05-30  7:27   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 04/10] drm: Use mode_valid() in atomic modeset Jose Abreu
2017-05-29 19:38   ` Daniel Vetter
2017-05-30  7:27   ` Neil Armstrong
2017-05-25 14:19 ` [PATCH v5 05/10] drm: arcpgu: Use crtc->mode_valid() callback Jose Abreu
2017-05-30  7:28   ` Neil Armstrong
2017-06-21  9:38   ` Jose Abreu
2017-06-22  8:46     ` Daniel Vetter
2017-05-25 14:19 ` [PATCH v5 06/10] drm/bridge: analogix-anx78xx: Use bridge->mode_valid() callback Jose Abreu
2017-05-26  4:27   ` Archit Taneja
2017-05-30  7:28   ` Neil Armstrong
2017-05-30 10:35     ` Archit Taneja
2017-05-25 14:19 ` [PATCH v5 07/10] drm/bridge/synopsys: dw-hdmi: " Jose Abreu
2017-05-29  9:45   ` Neil Armstrong
2017-05-30 10:24   ` Archit Taneja [this message]
2017-05-30 10:29     ` Philipp Zabel
2017-06-05  7:53       ` Archit Taneja
2017-05-25 14:19 ` [PATCH v5 08/10] drm/arm: malidp: Use crtc->mode_valid() callback Jose Abreu
2017-05-30  7:29   ` Neil Armstrong
2017-05-30  9:37     ` Liviu Dudau
2017-05-31  8:20       ` Daniel Vetter
2017-05-31 10:48         ` Liviu Dudau
2017-05-31 10:56           ` Daniel Vetter
2017-05-31 11:09             ` Liviu Dudau
2017-05-25 14:19 ` [PATCH v5 09/10] drm/atmel-hlcdc: " Jose Abreu
2017-05-30  7:30   ` Neil Armstrong
2017-06-02  9:35   ` Boris Brezillon
2017-05-25 14:19 ` [PATCH v5 10/10] drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks Jose Abreu
2017-05-30  7:30   ` Neil Armstrong
2017-06-02 20:10   ` Eric Anholt
2017-06-20  8:47     ` Daniel Vetter

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=49c4273c-eb14-da5d-f85d-a3a944f8f9cd@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=CARLOS.PALMINHA@synopsys.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=carlo@caione.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=khilman@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.yao@rock-chips.com \
    --cc=p.zabel@pengutronix.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;
as well as URLs for NNTP newsgroup(s).