linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Maxime Ripard <maxime.ripard@bootlin.com>, Chen-Yu Tsai <wens@csie.org>
Cc: Sean Paul <seanpaul@chromium.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	linux-arm-kernel@lists.infradead.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/sun4i: Move the panel pointer from the TCON to the encoders
Date: Thu, 07 Mar 2019 14:29:38 +0100	[thread overview]
Message-ID: <4e2df5e00e8231d841e6b85e4f73d8cfd1fe24b7.camel@bootlin.com> (raw)
In-Reply-To: <13288b6b8f27b614a6c9aef348923c34b2803ad4.1551191081.git-series.maxime.ripard@bootlin.com>

Hi,

On Tue, 2019-02-26 at 15:25 +0100, Maxime Ripard wrote:
> The TCON driver used to need the panel pointer in order to configure the
> tcon according to the various parameters of the panel. However, this has
> evolved over time (especially to support bridges), and therefore the panel
> pointer isn't needed anymore by the TCON driver.
> 
> Move that pointer to the LVDS and RGB encoders drivers.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

That definitely makes good sense to me!

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Cheers,

Paul

> ---
>  drivers/gpu/drm/sun4i/sun4i_lvds.c | 29 ++++++++++++-----------------
>  drivers/gpu/drm/sun4i/sun4i_rgb.c  | 27 ++++++++++++---------------
>  drivers/gpu/drm/sun4i/sun4i_tcon.h |  2 --
>  3 files changed, 24 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c
> index e7eb0d1e17be..5696f55db5cd 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_lvds.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c
> @@ -20,7 +20,7 @@ struct sun4i_lvds {
>  	struct drm_connector	connector;
>  	struct drm_encoder	encoder;
>  
> -	struct sun4i_tcon	*tcon;
> +	struct drm_panel	*panel;
>  };
>  
>  static inline struct sun4i_lvds *
> @@ -41,9 +41,8 @@ static int sun4i_lvds_get_modes(struct drm_connector *connector)
>  {
>  	struct sun4i_lvds *lvds =
>  		drm_connector_to_sun4i_lvds(connector);
> -	struct sun4i_tcon *tcon = lvds->tcon;
>  
> -	return drm_panel_get_modes(tcon->panel);
> +	return drm_panel_get_modes(lvds->panel);
>  }
>  
>  static struct drm_connector_helper_funcs sun4i_lvds_con_helper_funcs = {
> @@ -54,9 +53,8 @@ static void
>  sun4i_lvds_connector_destroy(struct drm_connector *connector)
>  {
>  	struct sun4i_lvds *lvds = drm_connector_to_sun4i_lvds(connector);
> -	struct sun4i_tcon *tcon = lvds->tcon;
>  
> -	drm_panel_detach(tcon->panel);
> +	drm_panel_detach(lvds->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -71,26 +69,24 @@ static const struct drm_connector_funcs sun4i_lvds_con_funcs = {
>  static void sun4i_lvds_encoder_enable(struct drm_encoder *encoder)
>  {
>  	struct sun4i_lvds *lvds = drm_encoder_to_sun4i_lvds(encoder);
> -	struct sun4i_tcon *tcon = lvds->tcon;
>  
>  	DRM_DEBUG_DRIVER("Enabling LVDS output\n");
>  
> -	if (tcon->panel) {
> -		drm_panel_prepare(tcon->panel);
> -		drm_panel_enable(tcon->panel);
> +	if (lvds->panel) {
> +		drm_panel_prepare(lvds->panel);
> +		drm_panel_enable(lvds->panel);
>  	}
>  }
>  
>  static void sun4i_lvds_encoder_disable(struct drm_encoder *encoder)
>  {
>  	struct sun4i_lvds *lvds = drm_encoder_to_sun4i_lvds(encoder);
> -	struct sun4i_tcon *tcon = lvds->tcon;
>  
>  	DRM_DEBUG_DRIVER("Disabling LVDS output\n");
>  
> -	if (tcon->panel) {
> -		drm_panel_disable(tcon->panel);
> -		drm_panel_unprepare(tcon->panel);
> +	if (lvds->panel) {
> +		drm_panel_disable(lvds->panel);
> +		drm_panel_unprepare(lvds->panel);
>  	}
>  }
>  
> @@ -113,11 +109,10 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  	lvds = devm_kzalloc(drm->dev, sizeof(*lvds), GFP_KERNEL);
>  	if (!lvds)
>  		return -ENOMEM;
> -	lvds->tcon = tcon;
>  	encoder = &lvds->encoder;
>  
>  	ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
> -					  &tcon->panel, &bridge);
> +					  &lvds->panel, &bridge);
>  	if (ret) {
>  		dev_info(drm->dev, "No panel or bridge found... LVDS output disabled\n");
>  		return 0;
> @@ -138,7 +133,7 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  	/* The LVDS encoder can only work with the TCON channel 0 */
>  	lvds->encoder.possible_crtcs = drm_crtc_mask(&tcon->crtc->crtc);
>  
> -	if (tcon->panel) {
> +	if (lvds->panel) {
>  		drm_connector_helper_add(&lvds->connector,
>  					 &sun4i_lvds_con_helper_funcs);
>  		ret = drm_connector_init(drm, &lvds->connector,
> @@ -152,7 +147,7 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  		drm_connector_attach_encoder(&lvds->connector,
>  						  &lvds->encoder);
>  
> -		ret = drm_panel_attach(tcon->panel, &lvds->connector);
> +		ret = drm_panel_attach(lvds->panel, &lvds->connector);
>  		if (ret) {
>  			dev_err(drm->dev, "Couldn't attach our panel\n");
>  			goto err_cleanup_connector;
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index f4a22689eb54..d181ee399b03 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -27,6 +27,7 @@ struct sun4i_rgb {
>  	struct drm_encoder	encoder;
>  
>  	struct sun4i_tcon	*tcon;
> +	struct drm_panel	*panel;
>  };
>  
>  static inline struct sun4i_rgb *
> @@ -47,9 +48,8 @@ static int sun4i_rgb_get_modes(struct drm_connector *connector)
>  {
>  	struct sun4i_rgb *rgb =
>  		drm_connector_to_sun4i_rgb(connector);
> -	struct sun4i_tcon *tcon = rgb->tcon;
>  
> -	return drm_panel_get_modes(tcon->panel);
> +	return drm_panel_get_modes(rgb->panel);
>  }
>  
>  static enum drm_mode_status sun4i_rgb_mode_valid(struct drm_encoder *crtc,
> @@ -114,9 +114,8 @@ static void
>  sun4i_rgb_connector_destroy(struct drm_connector *connector)
>  {
>  	struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
> -	struct sun4i_tcon *tcon = rgb->tcon;
>  
> -	drm_panel_detach(tcon->panel);
> +	drm_panel_detach(rgb->panel);
>  	drm_connector_cleanup(connector);
>  }
>  
> @@ -131,26 +130,24 @@ static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
>  static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
>  {
>  	struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> -	struct sun4i_tcon *tcon = rgb->tcon;
>  
>  	DRM_DEBUG_DRIVER("Enabling RGB output\n");
>  
> -	if (tcon->panel) {
> -		drm_panel_prepare(tcon->panel);
> -		drm_panel_enable(tcon->panel);
> +	if (rgb->panel) {
> +		drm_panel_prepare(rgb->panel);
> +		drm_panel_enable(rgb->panel);
>  	}
>  }
>  
>  static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
>  {
>  	struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> -	struct sun4i_tcon *tcon = rgb->tcon;
>  
>  	DRM_DEBUG_DRIVER("Disabling RGB output\n");
>  
> -	if (tcon->panel) {
> -		drm_panel_disable(tcon->panel);
> -		drm_panel_unprepare(tcon->panel);
> +	if (rgb->panel) {
> +		drm_panel_disable(rgb->panel);
> +		drm_panel_unprepare(rgb->panel);
>  	}
>  }
>  
> @@ -183,7 +180,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  	encoder = &rgb->encoder;
>  
>  	ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
> -					  &tcon->panel, &bridge);
> +					  &rgb->panel, &bridge);
>  	if (ret) {
>  		dev_info(drm->dev, "No panel or bridge found... RGB output disabled\n");
>  		return 0;
> @@ -204,7 +201,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  	/* The RGB encoder can only work with the TCON channel 0 */
>  	rgb->encoder.possible_crtcs = drm_crtc_mask(&tcon->crtc->crtc);
>  
> -	if (tcon->panel) {
> +	if (rgb->panel) {
>  		drm_connector_helper_add(&rgb->connector,
>  					 &sun4i_rgb_con_helper_funcs);
>  		ret = drm_connector_init(drm, &rgb->connector,
> @@ -218,7 +215,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
>  		drm_connector_attach_encoder(&rgb->connector,
>  						  &rgb->encoder);
>  
> -		ret = drm_panel_attach(tcon->panel, &rgb->connector);
> +		ret = drm_panel_attach(rgb->panel, &rgb->connector);
>  		if (ret) {
>  			dev_err(drm->dev, "Couldn't attach our panel\n");
>  			goto err_cleanup_connector;
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
> index b5214d71610f..84cfb1952ff7 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
> @@ -257,8 +257,6 @@ struct sun4i_tcon {
>  	struct reset_control		*lcd_rst;
>  	struct reset_control		*lvds_rst;
>  
> -	struct drm_panel		*panel;
> -
>  	/* Platform adjustments */
>  	const struct sun4i_tcon_quirks	*quirks;
>  
-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-03-07 13:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 14:25 [PATCH 0/4] drm/sun4i: rgb: Relax the pixel clock check Maxime Ripard
2019-02-26 14:25 ` [PATCH 1/4] drm/sun4i: Move the panel pointer from the TCON to the encoders Maxime Ripard
2019-03-07 13:29   ` Paul Kocialkowski [this message]
2019-02-26 14:25 ` [PATCH 2/4] drm/sun4i: rgb: Store the bridge pointer Maxime Ripard
2019-03-07 13:29   ` Paul Kocialkowski
2019-02-26 14:25 ` [PATCH 3/4] drm/sun4i: Move rate variables to long long Maxime Ripard
2019-03-07 13:30   ` Paul Kocialkowski
2019-02-26 14:25 ` [PATCH 4/4] drm/sun4i: rgb: Change the pixel clock validation check Maxime Ripard
2019-02-27  3:55   ` kbuild test robot
2019-03-07 13:36   ` Paul Kocialkowski
2019-03-06  5:50 ` [PATCH 0/4] drm/sun4i: rgb: Relax the pixel clock check Vasily Khoruzhick
2019-03-07 13:50 ` 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=4e2df5e00e8231d841e6b85e4f73d8cfd1fe24b7.camel@bootlin.com \
    --to=paul.kocialkowski@bootlin.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=seanpaul@chromium.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).