[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201116135435.GF28313@b29397-desktop>
Date: Mon, 16 Nov 2020 13:55:04 +0000
From: Peter Chen <peter.chen@....com>
To: Wesley Cheng <wcheng@...eaurora.org>
CC: "balbi@...nel.org" <balbi@...nel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"jackp@...eaurora.org" <jackp@...eaurora.org>
Subject: Re: [PATCH 3/3] usb: gadget: configfs: Add a specific configFS reset
callback
On 20-11-14 00:12:47, Wesley Cheng wrote:
> In order for configFS based USB gadgets to set the proper charge current
> for bus reset scenarios, expose a separate reset callback to set the
> current to 100mA based on the USB battery charging specification.
>
> Signed-off-by: Wesley Cheng <wcheng@...eaurora.org>
Reviewed-by: Peter Chen <peter.chen@....com>
> ---
> drivers/usb/gadget/configfs.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
> index 56051bb97349..80ca7ff2fb97 100644
> --- a/drivers/usb/gadget/configfs.c
> +++ b/drivers/usb/gadget/configfs.c
> @@ -1481,6 +1481,28 @@ static void configfs_composite_disconnect(struct usb_gadget *gadget)
> spin_unlock_irqrestore(&gi->spinlock, flags);
> }
>
> +static void configfs_composite_reset(struct usb_gadget *gadget)
> +{
> + struct usb_composite_dev *cdev;
> + struct gadget_info *gi;
> + unsigned long flags;
> +
> + cdev = get_gadget_data(gadget);
> + if (!cdev)
> + return;
> +
> + gi = container_of(cdev, struct gadget_info, cdev);
> + spin_lock_irqsave(&gi->spinlock, flags);
> + cdev = get_gadget_data(gadget);
> + if (!cdev || gi->unbind) {
> + spin_unlock_irqrestore(&gi->spinlock, flags);
> + return;
> + }
> +
> + composite_reset(gadget);
> + spin_unlock_irqrestore(&gi->spinlock, flags);
> +}
> +
> static void configfs_composite_suspend(struct usb_gadget *gadget)
> {
> struct usb_composite_dev *cdev;
> @@ -1530,7 +1552,7 @@ static const struct usb_gadget_driver configfs_driver_template = {
> .unbind = configfs_composite_unbind,
>
> .setup = configfs_composite_setup,
> - .reset = configfs_composite_disconnect,
> + .reset = configfs_composite_reset,
> .disconnect = configfs_composite_disconnect,
>
> .suspend = configfs_composite_suspend,
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
--
Thanks,
Peter Chen
Powered by blists - more mailing lists