Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Greg KH <greg@kroah.com>
To: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Cc: linux-bluetooth@vger.kernel.org, linux-usb@vger.kernel.org,
	dianders@chromium.org, Johan Hedberg <johan.hedberg@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Bluetooth: btusb: Reset realtek devices on user suspend
Date: Fri, 4 Oct 2019 13:59:57 +0200
Message-ID: <20191004115957.GB339043@kroah.com> (raw)
In-Reply-To: <20190917212702.35747-3-abhishekpandit@chromium.org>

On Tue, Sep 17, 2019 at 02:27:02PM -0700, Abhishek Pandit-Subedi wrote:
> Reset realtek devices on user suspend if not configured as a wakeup source.
> 
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> ---
> 
>  drivers/bluetooth/btusb.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index a9c35ebb30f8..ce3a10642f4e 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -493,6 +493,8 @@ struct btusb_data {
>  
>  	int oob_wake_irq;   /* irq for out-of-band wake-on-bt */
>  	unsigned cmd_timeout_cnt;
> +
> +	bool reset_on_suspend; /* reset on suspend if not a wakeup source */
>  };
>  
>  
> @@ -3818,6 +3820,8 @@ static int btusb_probe(struct usb_interface *intf,
>  		 * (DEVICE_REMOTE_WAKEUP)
>  		 */
>  		set_bit(BTUSB_WAKEUP_DISABLE, &data->flags);
> +		/* We'll explicitly reset the device around user suspend too. */
> +		data->reset_on_suspend = true;
>  	}
>  #endif
>  
> @@ -4007,6 +4011,22 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
>  	return 0;
>  }
>  
> +static int btusb_suspend_noirq(struct usb_interface *intf, pm_message_t message)
> +{
> +	struct btusb_data *data = usb_get_intfdata(intf);
> +
> +	BT_DBG("suspend_noirq %p", intf);
> +
> +	/* Only reset if not configured for wakeup */
> +	if (!device_may_wakeup(&data->udev->dev) &&
> +	    data->reset_on_suspend && data->reset_gpio) {
> +		BT_DBG("resetting in suspend_noirq\n");
> +		gpiod_set_value_cansleep(data->reset_gpio, 1);

That's a totally out-of-band message for a USB driver to do.  Why can it
suddenly set a GPIO pin and not talk to the USB device here?

If this is a GPIO driver, then why not get the suspend message from that
subsystem?


greg k-h

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 21:27 [PATCH 0/2] Reset realtek bluetooth devices during " Abhishek Pandit-Subedi
2019-09-17 21:27 ` [PATCH 1/2] usb: support suspend_noirq Abhishek Pandit-Subedi
2019-10-04 11:58   ` Greg Kroah-Hartman
2019-09-17 21:27 ` [PATCH 2/2] Bluetooth: btusb: Reset realtek devices on user suspend Abhishek Pandit-Subedi
2019-10-04 11:59   ` Greg KH [this message]
2019-09-18 14:23 ` [PATCH 0/2] Reset realtek bluetooth devices during " Alan Stern
2019-09-18 17:19   ` Abhishek Pandit-Subedi
2019-09-18 18:51     ` Alan Stern
2019-09-26 20:51       ` Abhishek Pandit-Subedi
2019-09-18 14:41 ` Oliver Neukum

Reply instructions:

You may reply publically 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=20191004115957.GB339043@kroah.com \
    --to=greg@kroah.com \
    --cc=abhishekpandit@chromium.org \
    --cc=dianders@chromium.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marcel@holtmann.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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git