From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915/lspcon: Separate function to set expected mode
Date: Mon, 25 Mar 2024 17:17:49 +0200 [thread overview]
Message-ID: <87bk72ibmq.fsf@intel.com> (raw)
In-Reply-To: <20240322121832.4170061-2-ankit.k.nautiyal@intel.com>
On Fri, 22 Mar 2024, Ankit Nautiyal <ankit.k.nautiyal@intel.com> wrote:
> LSPCON can be configured to LS or PCON mode.
> Separate the function to set the expected mode from the lspcon probe
> function during lspcon init.
>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_lspcon.c | 47 ++++++++++++++-------
> 1 file changed, 31 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
> index 1d048fa98561..62159d3ead56 100644
> --- a/drivers/gpu/drm/i915/display/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
> @@ -240,18 +240,40 @@ static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon)
> return true;
> }
>
> -static bool lspcon_probe(struct intel_lspcon *lspcon)
> +static bool lspcon_set_expected_mode(struct intel_lspcon *lspcon)
> {
> - int retry;
> - enum drm_dp_dual_mode_type adaptor_type;
> struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon);
> struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> - struct i2c_adapter *ddc = &intel_dp->aux.ddc;
> enum drm_lspcon_mode expected_mode;
>
> expected_mode = lspcon_wake_native_aux_ch(lspcon) ?
> DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
You always need to consider the functional changes when aiming to make
non-functional refactoring. This postpones lspcon_wake_native_aux_ch()
until after the probe. But the name has "wake" in it, and you're no
longer waking up as the first thing. Smells fishy.
Git blame leads to f2b667b658f9 ("drm/i915/lspcon: Ensure AUX CH is
awake while in DP Sleep state"). You should read the commit message.
BR,
Jani.
>
> + lspcon->mode = lspcon_wait_mode(lspcon, expected_mode);
> +
> + /*
> + * In the SW state machine, lets Put LSPCON in PCON mode only.
> + * In this way, it will work with both HDMI 1.4 sinks as well as HDMI
> + * 2.0 sinks.
> + */
> + if (lspcon->mode != DRM_LSPCON_MODE_PCON) {
> + if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) {
> + drm_err(&i915->drm, "LSPCON mode change to PCON failed\n");
> + return false;
> + }
> + }
> +
> + return true;
> +}
> +
> +static bool lspcon_probe(struct intel_lspcon *lspcon)
> +{
> + int retry;
> + enum drm_dp_dual_mode_type adaptor_type;
> + struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon);
> + struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> + struct i2c_adapter *ddc = &intel_dp->aux.ddc;
> +
> /* Lets probe the adaptor and check its type */
> for (retry = 0; retry < 6; retry++) {
> if (retry)
> @@ -270,19 +292,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
>
> /* Yay ... got a LSPCON device */
> drm_dbg_kms(&i915->drm, "LSPCON detected\n");
> - lspcon->mode = lspcon_wait_mode(lspcon, expected_mode);
>
> - /*
> - * In the SW state machine, lets Put LSPCON in PCON mode only.
> - * In this way, it will work with both HDMI 1.4 sinks as well as HDMI
> - * 2.0 sinks.
> - */
> - if (lspcon->mode != DRM_LSPCON_MODE_PCON) {
> - if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) {
> - drm_err(&i915->drm, "LSPCON mode change to PCON failed\n");
> - return false;
> - }
> - }
> return true;
> }
>
> @@ -671,6 +681,11 @@ bool lspcon_init(struct intel_digital_port *dig_port)
> return false;
> }
>
> + if (!lspcon_set_expected_mode(lspcon)) {
> + drm_err(&i915->drm, "LSPCON Set expected Mode failed\n");
> + return false;
> + }
> +
> if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd) != 0) {
> drm_err(&i915->drm, "LSPCON DPCD read failed\n");
> return false;
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-03-25 15:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 12:18 [PATCH 0/2] Avoid unwanted lspcon init and probe warnings Ankit Nautiyal
2024-03-22 12:18 ` [PATCH 1/2] drm/i915/lspcon: Separate function to set expected mode Ankit Nautiyal
2024-03-25 15:17 ` Jani Nikula [this message]
2024-03-26 4:12 ` Nautiyal, Ankit K
2024-03-22 12:18 ` [PATCH 2/2] drm/i915/lspcon: Separate lspcon probe and lspcon init Ankit Nautiyal
2024-03-25 15:18 ` Jani Nikula
2024-03-26 4:26 ` Nautiyal, Ankit K
2024-03-26 6:56 ` Jani Nikula
2024-03-26 8:29 ` Nautiyal, Ankit K
2024-03-22 20:10 ` ✓ Fi.CI.BAT: success for Avoid unwanted lspcon init and probe warnings Patchwork
2024-03-23 21:40 ` ✗ Fi.CI.IGT: failure " Patchwork
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=87bk72ibmq.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=intel-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.