From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: tanveer1.alam@intel.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, abhijeet.rao@intel.com
Subject: Re: [PATCH] usb: typec: mux: intel_pmc_mux: Add retry logic to a PMC command
Date: Fri, 1 Apr 2022 16:53:31 +0300 [thread overview]
Message-ID: <YkcD25gTJ07h7XDK@kuha.fi.intel.com> (raw)
In-Reply-To: <20220328105137.6223-1-tanveer1.alam@intel.com>
On Mon, Mar 28, 2022 at 04:21:37PM +0530, tanveer1.alam@intel.com wrote:
> From: Tanveer Alam <tanveer1.alam@intel.com>
>
> There are few scenerio when PMC reports 'busy condition' and command
> fail.
>
> If PMC receives a high priority command while servicing a low priority
> command then it discards the low priority command and start servicing
> the high priority command. The lower priority command fail and driver
> returns error. If the same command resend to the PMC then PMC latches
> the command and service it accordingly.
>
> Thus adds the retry logic for the PMC command.
>
> Signed-off-by: Tanveer Alam <tanveer1.alam@intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/mux/intel_pmc_mux.c | 21 +++++++++++++++++++--
> 1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
> index 2cdd22130834..da6b381ddf00 100644
> --- a/drivers/usb/typec/mux/intel_pmc_mux.c
> +++ b/drivers/usb/typec/mux/intel_pmc_mux.c
> @@ -173,7 +173,7 @@ static int hsl_orientation(struct pmc_usb_port *port)
> return port->orientation - 1;
> }
>
> -static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
> +static int pmc_usb_send_command(struct intel_scu_ipc_dev *ipc, u8 *msg, u32 len)
> {
> u8 response[4];
> u8 status_res;
> @@ -184,7 +184,7 @@ static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
> * Status can be checked from the response message if the
> * function intel_scu_ipc_dev_command succeeds.
> */
> - ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
> + ret = intel_scu_ipc_dev_command(ipc, PMC_USBC_CMD, 0, msg,
> len, response, sizeof(response));
>
> if (ret)
> @@ -203,6 +203,23 @@ static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
> return 0;
> }
>
> +static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
> +{
> + int retry_count = 3;
> + int ret;
> +
> + /*
> + * If PMC is busy then retry the command once again
> + */
> + while (retry_count--) {
> + ret = pmc_usb_send_command(port->pmc->ipc, msg, len);
> + if (ret != -EBUSY)
> + break;
> + }
> +
> + return ret;
> +}
> +
> static int
> pmc_usb_mux_dp_hpd(struct pmc_usb_port *port, struct typec_displayport_data *dp)
> {
thanks,
--
heikki
next prev parent reply other threads:[~2022-04-01 13:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-28 10:51 tanveer1.alam
2022-04-01 13:53 ` Heikki Krogerus [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-03-28 10:44 tanveer1.alam
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=YkcD25gTJ07h7XDK@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=abhijeet.rao@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tanveer1.alam@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®