mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Utkarsh Patel <utkarsh.h.patel@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	rajmohan.mani@intel.com, azhar.shaikh@intel.com
Subject: Re: [PATCH] usb: typec: intel_pmc_mux: Use correct response message bits
Date: Tue, 8 Dec 2020 11:38:41 +0200	[thread overview]
Message-ID: <20201208093841.GE680328@kuha.fi.intel.com> (raw)
In-Reply-To: <20201203220813.16281-1-utkarsh.h.patel@intel.com>

On Thu, Dec 03, 2020 at 02:08:13PM -0800, Utkarsh Patel wrote:
> When Intel PMC Mux agent driver receives the response message from PMC, it
> checks for the same response bits for all the mux states.
> Corrected it by checking correct response message bits, Bit 8 & 9 for the
> SAFE Mode and Alternate Modes and Bit 16 & 17 for the Connect and
> Disconnect Modes.
> 
> Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/mux/intel_pmc_mux.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index aa3211f1c4c3..e58ae8a7fefb 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -176,6 +176,7 @@ static int hsl_orientation(struct pmc_usb_port *port)
>  static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
>  {
>  	u8 response[4];
> +	u8 status_res;
>  	int ret;
>  
>  	/*
> @@ -189,9 +190,13 @@ static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
>  	if (ret)
>  		return ret;
>  
> -	if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
> -		if (response[2] & PMC_USB_RESP_STATUS_FATAL)
> +	status_res = (msg[0] & 0xf) < PMC_USB_SAFE_MODE ?
> +		     response[2] : response[1];
> +
> +	if (status_res & PMC_USB_RESP_STATUS_FAILURE) {
> +		if (status_res & PMC_USB_RESP_STATUS_FATAL)
>  			return -EIO;
> +
>  		return -EBUSY;
>  	}
>  
> -- 
> 2.17.1

thanks,

-- 
heikki

      reply	other threads:[~2020-12-08  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 22:08 Utkarsh Patel
2020-12-08  9:38 ` Heikki Krogerus [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=20201208093841.GE680328@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=azhar.shaikh@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rajmohan.mani@intel.com \
    --cc=utkarsh.h.patel@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

all inboxes | Powered by JetHome®