All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Jack Pham <jackp@codeaurora.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, Jack Pham <jackp@codeaurora.org>,
	Ronak Vijay Raheja <rraheja@codeaurora.org>
Subject: Re: [PATCH] usb: gadget: composite: Allow bMaxPower=0 if self-powered
Date: Tue, 20 Jul 2021 12:31:56 +0300	[thread overview]
Message-ID: <87y2a1xreb.fsf@kernel.org> (raw)
In-Reply-To: <20210720080907.30292-1-jackp@codeaurora.org>

[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]

Jack Pham <jackp@codeaurora.org> writes:

> Currently the composite driver encodes the MaxPower field of
> the configuration descriptor by reading the c->MaxPower of the
> usb_configuration only if it is non-zero, otherwise it falls back
> to using the value hard-coded in CONFIG_USB_GADGET_VBUS_DRAW.
> However, there are cases when a configuration must explicitly set
> bMaxPower to 0, particularly if its bmAttributes also has the
> Self-Powered bit set, which is a valid combination.
>
> This is specifically called out in the USB PD specification section
> 9.1, in which a PDUSB device "shall report zero in the bMaxPower
> field after negotiating a mutually agreeable Contract", and also
> verified by the USB Type-C Functional Test TD.4.10.2 Sink Power
> Precedence Test.
>
> The fix allows the c->MaxPower to be used for encoding the bMaxPower
> even if it is 0, if the self-powered bit is also set.  An example
> usage of this would be for a ConfigFS gadget to be dynamically
> updated by userspace when the Type-C connection is determined to be
> operating in Power Delivery mode.
>
> Co-developed-by: Ronak Vijay Raheja <rraheja@codeaurora.org>
> Signed-off-by: Ronak Vijay Raheja <rraheja@codeaurora.org>
> Signed-off-by: Jack Pham <jackp@codeaurora.org>

Nice catch!

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

      reply	other threads:[~2021-07-20  9:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  8:09 [PATCH] usb: gadget: composite: Allow bMaxPower=0 if self-powered Jack Pham
2021-07-20  9:31 ` Felipe Balbi [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=87y2a1xreb.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rraheja@codeaurora.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 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.