Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 09/13] drm/i915/sdvo: Initialize the encoder ealier
Date: Thu, 06 Jul 2023 11:28:09 +0300	[thread overview]
Message-ID: <871qhlzbom.fsf@intel.com> (raw)
In-Reply-To: <20230705202122.17915-10-ville.syrjala@linux.intel.com>

On Wed, 05 Jul 2023, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Call drm_encoder_init() earlier so that we don't have to keep passing
> the i915/dev_priv around separately.

*earlier in the subject.

>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_sdvo.c | 35 +++++++++++------------
>  1 file changed, 17 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index 29762716a067..e6c558416a6b 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -2613,9 +2613,9 @@ intel_sdvo_guess_ddc_bus(struct intel_sdvo *sdvo)
>   * outputs, then LVDS outputs.
>   */
>  static void
> -intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv,
> -			  struct intel_sdvo *sdvo)
> +intel_sdvo_select_ddc_bus(struct intel_sdvo *sdvo)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(sdvo->base.base.dev);
>  	struct sdvo_device_mapping *mapping;
>  
>  	if (sdvo->port == PORT_B)
> @@ -2630,9 +2630,9 @@ intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv,
>  }
>  
>  static void
> -intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
> -			  struct intel_sdvo *sdvo)
> +intel_sdvo_select_i2c_bus(struct intel_sdvo *sdvo)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(sdvo->base.base.dev);
>  	struct sdvo_device_mapping *mapping;
>  	u8 pin;
>  
> @@ -2671,9 +2671,9 @@ intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo)
>  }
>  
>  static u8
> -intel_sdvo_get_slave_addr(struct drm_i915_private *dev_priv,
> -			  struct intel_sdvo *sdvo)
> +intel_sdvo_get_slave_addr(struct intel_sdvo *sdvo)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(sdvo->base.base.dev);
>  	struct sdvo_device_mapping *my_mapping, *other_mapping;
>  
>  	if (sdvo->port == PORT_B) {
> @@ -2994,7 +2994,6 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo)
>  		SDVO_OUTPUT_LVDS0,
>  		SDVO_OUTPUT_LVDS1,
>  	};
> -	struct drm_i915_private *i915 = to_i915(intel_sdvo->base.base.dev);
>  	u16 flags;
>  	int i;
>  
> @@ -3008,7 +3007,7 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo)
>  
>  	intel_sdvo->controlled_output = flags;
>  
> -	intel_sdvo_select_ddc_bus(i915, intel_sdvo);
> +	intel_sdvo_select_ddc_bus(intel_sdvo);
>  
>  	for (i = 0; i < ARRAY_SIZE(probe_order); i++) {
>  		u16 type = flags & probe_order[i];
> @@ -3309,9 +3308,9 @@ static const struct i2c_lock_operations proxy_lock_ops = {
>  };
>  
>  static bool
> -intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo,
> -			  struct drm_i915_private *dev_priv)
> +intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(sdvo->base.base.dev);
>  	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
>  
>  	sdvo->ddc.owner = THIS_MODULE;
> @@ -3357,23 +3356,23 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,
>  	if (!intel_sdvo)
>  		return false;
>  
> -	intel_sdvo->sdvo_reg = sdvo_reg;
> -	intel_sdvo->port = port;
> -	intel_sdvo->slave_addr =
> -		intel_sdvo_get_slave_addr(dev_priv, intel_sdvo) >> 1;
> -	intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo);
> -	if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev_priv))
> -		goto err_i2c_bus;
> -
>  	/* encoder type will be decided later */
>  	intel_encoder = &intel_sdvo->base;
>  	intel_encoder->type = INTEL_OUTPUT_SDVO;
>  	intel_encoder->power_domain = POWER_DOMAIN_PORT_OTHER;
>  	intel_encoder->port = port;
> +
>  	drm_encoder_init(&dev_priv->drm, &intel_encoder->base,
>  			 &intel_sdvo_enc_funcs, 0,
>  			 "SDVO %c", port_name(port));
>  
> +	intel_sdvo->sdvo_reg = sdvo_reg;
> +	intel_sdvo->port = port;
> +	intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(intel_sdvo) >> 1;
> +	intel_sdvo_select_i2c_bus(intel_sdvo);
> +	if (!intel_sdvo_init_ddc_proxy(intel_sdvo))
> +		goto err_i2c_bus;

drm_encoder_cleanup() in the error path?

Other than that,

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> +
>  	/* Read the regs to test if we can talk to the device */
>  	for (i = 0; i < 0x40; i++) {
>  		u8 byte;

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-07-06  8:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 20:21 [Intel-gfx] [PATCH 00/13] drm/i915/sdvo: DDC rework and fixes Ville Syrjala
2023-07-05 20:21 ` [Intel-gfx] [PATCH 01/13] drm/i915/sdvo: Issue SetTargetOutput prior ot GetAttachedDisplays Ville Syrjala
2023-07-06  7:20   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 02/13] drm/i915/sdvo: Protect macro args Ville Syrjala
2023-07-06  7:20   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 03/13] drm/i915/sdvo: s/sdvo_inputs_mask/sdvo_num_inputs/ Ville Syrjala
2023-07-06  7:24   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 04/13] drm/i915: Don't warn about zero N/P in *_calc_dpll_params() Ville Syrjala
2023-07-06  8:17   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 05/13] drm/i915: Fully populate crtc_state->dpll Ville Syrjala
2023-07-06  8:41   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 06/13] drm/i915/sdvo: Pick the TV dotclock from adjusted_mode Ville Syrjala
2023-07-06  8:22   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 07/13] drm/i915/sdvo: Fail gracefully if the TV dotclock is out of range Ville Syrjala
2023-07-06  8:22   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 08/13] drm/i915/sdvo: Nuke attached_output tracking Ville Syrjala
2023-07-06  8:24   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 09/13] drm/i915/sdvo: Initialize the encoder ealier Ville Syrjala
2023-07-06  8:28   ` Jani Nikula [this message]
2023-07-05 20:21 ` [Intel-gfx] [PATCH 10/13] drm/i915/sdvo: Nuke the duplicate sdvo->port Ville Syrjala
2023-07-06  8:29   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 11/13] drm/i915/sdvo: Get rid of the per-connector i2c symlink Ville Syrjala
2023-07-06  8:30   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 12/13] drm/i915/sdvo: Rework DDC bus handling Ville Syrjala
2023-07-06  8:38   ` Jani Nikula
2023-07-05 20:21 ` [Intel-gfx] [PATCH 13/13] drm/i915/sdvo: Print out the i2c pin and slave address Ville Syrjala
2023-07-06  8:38   ` Jani Nikula
2023-07-05 21:24 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/sdvo: DDC rework and fixes Patchwork
2023-07-05 21:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-06  1:17 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2023-07-06  8:45 ` [Intel-gfx] [PATCH 00/13] " Jani Nikula

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=871qhlzbom.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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