public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Souza, Jose" <jose.souza@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Bowman, Casey G" <casey.g.bowman@intel.com>
Cc: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] lib/igt_psr: Changed psr_set logic to account for older kernels
Date: Thu, 18 Oct 2018 21:12:08 +0000	[thread overview]
Message-ID: <ff6f3cb0df018d14dd28b5a710d35a6cc38defaf.camel@intel.com> (raw)
In-Reply-To: <20181017212658.113049-1-casey.g.bowman@intel.com>

On Wed, 2018-10-17 at 14:26 -0700, Casey Bowman wrote:
> Only EINVAL was being used to account for older kernels,
> but on legacy kernels that don't use i915_edp_psr_debug,
> the ENOENT error will be thrown. This changes the logic
> to set PSR via the module parameter if a problem occurs
> when attempting to set PSR via the debugfs_fd.
> 

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>
> ---
>  lib/igt_psr.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_psr.c b/lib/igt_psr.c
> index 0ddfb64f..6904393c 100644
> --- a/lib/igt_psr.c
> +++ b/lib/igt_psr.c
> @@ -61,6 +61,8 @@ static int has_psr_debugfs(int debugfs_fd)
>  	 * Check if new PSR debugfs api is usable by writing an invalid
> value.
>  	 * Legacy mode will return OK here, debugfs api will return
> -EINVAL.
>  	 * -ENODEV is returned when PSR is unavailable.
> +	 * -ENOENT is returned when PSR debugfs api doesn't exist (i.e.
> using
> +	 * an older kernel).
>  	 */
>  	ret = psr_write(debugfs_fd, "0xf");
>  	if (ret == -EINVAL)
> @@ -103,11 +105,11 @@ static bool psr_set(int debugfs_fd, bool
> enable)
>  		return false;
>  	}
>  
> -	if (ret == -EINVAL) {
> -		ret = psr_modparam_set(enable);
> -	} else {
> +	if (ret == 0) {
>  		ret = psr_write(debugfs_fd, enable ? "0x3" : "0x1");
>  		igt_assert(ret > 0);
> +	} else {
> +		ret = psr_modparam_set(enable);
>  	}
>  
>  	/* Restore original value on exit */
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2018-10-18 21:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 21:26 [igt-dev] [PATCH i-g-t] lib/igt_psr: Changed psr_set logic to account for older kernels Casey Bowman
2018-10-17 21:54 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-10-17 22:54 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-10-18 21:12 ` Souza, Jose [this message]

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=ff6f3cb0df018d14dd28b5a710d35a6cc38defaf.camel@intel.com \
    --to=jose.souza@intel.com \
    --cc=casey.g.bowman@intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=igt-dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox