mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Prashanth K <quic_prashk@quicinc.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
	"Jakob Koschel" <jakobkoschel@gmail.com>,
	"Jó Ágila Bitsch" <jgilab@gmail.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Pratham Pratap" <quic_ppratap@quicinc.com>,
	"Jack Pham" <quic_jackp@quicinc.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/2] usb: dwc3: gadget: Change condition for processing suspend event
Date: Thu, 23 Feb 2023 20:03:04 +0000	[thread overview]
Message-ID: <20230223200300.pnn3vadcqw3olwbk@synopsys.com> (raw)
In-Reply-To: <1677156121-30364-2-git-send-email-quic_prashk@quicinc.com>

On Thu, Feb 23, 2023, Prashanth K wrote:
> Currently we process the suspend interrupt event only if the
> device is in configured state. Consider a case where device
> is not configured and got suspend interrupt, in that case our
> gadget will still use 100mA as composite_suspend didn't happen.
> But battery charging specification (BC1.2) expects a downstream
> device to draw less than 2.5mA when unconnected OR suspended.
> 
> Fix this by removing the condition for processing suspend event,
> and thus composite_resume would set vbus draw to 2.
> 
> Fixes: 72704f876f50 ("dwc3: gadget: Implement the suspend entry event handler")
> Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
> ---
>  drivers/usb/dwc3/gadget.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 89dcfac..a83f34e 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -4241,15 +4241,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
>  		break;
>  	case DWC3_DEVICE_EVENT_SUSPEND:
>  		/* It changed to be suspend event for version 2.30a and above */
> -		if (!DWC3_VER_IS_PRIOR(DWC3, 230A)) {
> -			/*
> -			 * Ignore suspend event until the gadget enters into
> -			 * USB_STATE_CONFIGURED state.
> -			 */
> -			if (dwc->gadget->state >= USB_STATE_CONFIGURED)
> -				dwc3_gadget_suspend_interrupt(dwc,
> -						event->event_info);
> -		}
> +		if (!DWC3_VER_IS_PRIOR(DWC3, 230A))
> +			dwc3_gadget_suspend_interrupt(dwc, event->event_info);
>  		break;
>  	case DWC3_DEVICE_EVENT_SOF:
>  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> -- 
> 2.7.4
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

  reply	other threads:[~2023-02-23 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 12:41 [PATCH v3 0/2] Fix vbus draw of dwc3 gadget Prashanth K
2023-02-23 12:42 ` [PATCH v3 1/2] usb: dwc3: gadget: Change condition for processing suspend event Prashanth K
2023-02-23 20:03   ` Thinh Nguyen [this message]
2023-02-23 12:42 ` [PATCH v3 2/2] usb: gadget: composite: Draw 100mA current if not configured Prashanth K
2023-02-23 20:10   ` Thinh Nguyen
2023-02-24  4:57     ` Prashanth K
2023-02-24 18:38       ` Thinh Nguyen
2023-02-25  6:35         ` Prashanth K
2023-02-27 19:38           ` Thinh Nguyen

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=20230223200300.pnn3vadcqw3olwbk@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jakobkoschel@gmail.com \
    --cc=jgilab@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_ppratap@quicinc.com \
    --cc=quic_prashk@quicinc.com \
    --cc=stern@rowland.harvard.edu \
    /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®