Re: [PATCH 2/2] Bluetooth: btusb: Reset realtek devices on user suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> ---
> 
>  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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux