From: Jani Nikula <jani.nikula@linux.intel.com>
To: Shashank Sharma <shashank.sharma@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm: Add retries for lspcon status check
Date: Tue, 22 Aug 2017 18:27:09 +0300 [thread overview]
Message-ID: <87fucj4o8i.fsf@nikula.org> (raw)
In-Reply-To: <1503413631-18438-2-git-send-email-shashank.sharma@intel.com>
On Tue, 22 Aug 2017, Shashank Sharma <shashank.sharma@intel.com> wrote:
> It's an observation during some CI tests that few LSPCON chips
> respond slow while system is under load, and need some delay
> while reading current mode status using i2c-over-aux channel.
>
> This patch:
> - Adds few retries and delays before declaring a read
> failure from LSPCON hardware.
> - Changes the debug level of the print from ERROR->DEBUG
> whereas another patch in I915 will add an ERROR message
> from the caller when we have timed out all our limits.
>
> V2: addressed review comments from Imre, and added r-b
> - use int instead of u8 for counter
> - use for loop instead of do...while();
> V3: Rebase
>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
>
> Reviewed-by: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
> ---
> drivers/gpu/drm/drm_dp_dual_mode_helper.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> index 80e62f6..fc8c7ac 100644
> --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> @@ -409,6 +409,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
> enum drm_lspcon_mode *mode)
> {
> u8 data;
> + int retry;
> int ret = 0;
>
> if (!mode) {
> @@ -417,10 +418,17 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
> }
>
> /* Read Status: i2c over aux */
> - ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
> - &data, sizeof(data));
> + for (retry = 5; ; retry--) {
> + ret = drm_dp_dual_mode_read(adapter,
> + DP_DUAL_MODE_LSPCON_CURRENT_MODE,
> + &data, sizeof(data));
> + if (!ret || !retry)
> + break;
> + usleep_range(500, 1000);
> + }
Sorry, but that looks like a programming quiz to me. At most how many
time does drm_dp_dual_mode_read() get called?
With this, for example, the C programmer's spine tells you "six times"
for the paradigm for loop before you even really stop to think about it:
for (try = 0; try < 6; try++) {
if (try)
usleep_range(500, 1000);
ret = drm_dp_dual_mode_read();
if (!ret)
break;
}
BR,
Jani.
PS. I'm left wondering if "retry = 5" was there to emphasize that
there's one try and five *retries*.
> +
> if (ret < 0) {
> - DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
> + DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n");
> return -EFAULT;
> }
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-08-22 15:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 14:53 [PATCH 0/3] Add retries for DP dual mode devices Shashank Sharma
2017-08-22 14:53 ` [PATCH 1/3] drm: Add retries for lspcon status check Shashank Sharma
2017-08-22 14:54 ` Imre Deak
2017-08-22 15:05 ` Sharma, Shashank
2017-08-22 15:27 ` Jani Nikula [this message]
2017-08-22 15:40 ` Sharma, Shashank
2017-08-22 14:53 ` [PATCH 2/3] drm/i915: Don't give up waiting on INVALID_MODE Shashank Sharma
2017-08-22 14:53 ` [PATCH 3/3] drm: Add retries for dp dual mode read Shashank Sharma
2017-08-22 15:10 ` ✓ Fi.CI.BAT: success for Add retries for DP dual mode devices 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=87fucj4o8i.fsf@nikula.org \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shashank.sharma@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 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.