[RFC PATCH 3/4] usb: xhci-mtk: add support runtime pm

CK Hu ck.hu at mediatek.com
Fri Sep 4 03:11:12 EDT 2020


Hi, Chunfeng:

On Thu, 2020-09-03 at 11:34 +0800, Chunfeng Yun wrote:
> From: CK Hu <ck.hu at mediatek.com>
> 
> add support runtime pm feature
> 
> Signed-off-by: Zhanyong Wang <zhanyong.wang at mediatek.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun at mediatek.com>
> ---
>  drivers/usb/host/xhci-mtk.c | 446 +++++++++++++++++++++++++++++++++++++++++++-
>  drivers/usb/host/xhci-mtk.h |  14 ++
>  2 files changed, 455 insertions(+), 5 deletions(-)
>  mode change 100644 => 100755 drivers/usb/host/xhci-mtk.h
> 

[snip]

> @@ -562,6 +794,31 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto dealloc_usb2_hcd;
>  
> +	INIT_DELAYED_WORK(&mtk->seal, xhci_mtk_seal_work);
> +	snprintf(mtk->seal_descr, sizeof(mtk->seal_descr), "seal%s:usb%d",
> +		 hcd->driver->description, hcd->self.busnum);
> +	ret = devm_request_irq(mtk->seal_irq, &xhci_mtk_seal_irq,
> +			  IRQF_TRIGGER_FALLING,	mtk->seal_descr, mtk);

In interrupt.h [1], devm_request_irq() need 6 parameters:

static inline int __must_check
devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t
handler,
		 unsigned long irqflags, const char *devname, void *dev_id)
{
	return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
					 devname, dev_id);
}


[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/interrupt.h?h=v5.9-rc1

Regards,
CK

> +	if (ret != 0) {
> +		dev_err(dev, "seal request interrupt %d failed\n",
> +			mtk->seal_irq);
> +		goto dealloc_usb2_hcd;
> +	}
> +	xhci_mtk_seal_wakeup_enable(mtk, false);
> +
> +	device_enable_async_suspend(dev);
> +	xhci_mtk_runtime_ready = 1;
> +
> +	ret = add_power_attributes(dev);
> +	if (ret)
> +		goto dealloc_usb2_hcd;
> +
> +	pm_runtime_mark_last_busy(dev);
> +	pm_runtime_put_autosuspend(dev);
> +
> +	dev_dbg(dev, "%s: xhci_mtk_runtime_ready %i",
> +		 __func__, xhci_mtk_runtime_ready);
> +
>  	return 0;
>  
>  dealloc_usb2_hcd:
> @@ -584,7 +841,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>  	xhci_mtk_ldos_disable(mtk);
>  
>  disable_pm:
> -	pm_runtime_put_sync(dev);
> +	pm_runtime_put_sync_autosuspend(dev);
>  	pm_runtime_disable(dev);
>  	return ret;
>  }




More information about the linux-arm-kernel mailing list