Re: [PATCH] usb: xilinx: Add suspend resume support

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

 



Hi,

Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxxxxx> writes:

> Add suspend resume support. In the suspend udc is disconnected
> and it is set to ready at resume for it to be functional.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxxxxx>
> ---
>  drivers/usb/gadget/udc/udc-xilinx.c | 52 +++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
> index f5ca670776a3..1369792f195a 100644
> --- a/drivers/usb/gadget/udc/udc-xilinx.c
> +++ b/drivers/usb/gadget/udc/udc-xilinx.c
> @@ -2176,6 +2176,57 @@ static int xudc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
> +static int xudc_suspend(struct device *dev)
> +{
> +	struct xusb_udc *udc;
> +	u32 crtlreg;
> +	unsigned long flags;
> +
> +	udc = dev_get_drvdata(dev);
> +
> +	spin_lock_irqsave(&udc->lock, flags);
> +
> +	crtlreg = udc->read_fn(udc->addr + XUSB_CONTROL_OFFSET);
> +	crtlreg &= ~XUSB_CONTROL_USB_READY_MASK;
> +
> +	udc->write_fn(udc->addr, XUSB_CONTROL_OFFSET, crtlreg);
> +
> +	spin_unlock_irqrestore(&udc->lock, flags);
> +	if (udc->driver && udc->driver->disconnect)
> +		udc->driver->disconnect(&udc->gadget);

Why disconnect? Seems like you should call ->suspend() instead, no?

-- 
balbi



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

  Powered by Linux