Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14730267 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: ehci-msm-hsic: use work_queue to invoke runtime_pm_allow"

parents da3967d9 ddc9ac65
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ struct msm_hsic_hcd {
	uint32_t		bus_perf_client;
	uint32_t		wakeup_int_cnt;

	struct work_struct	runtime_pm_allow_w;
	struct work_struct	bus_vote_w;
	bool			bus_vote;

@@ -1026,6 +1027,16 @@ skip_phy_resume:
}
#endif

static void ehci_hsic_runtime_pm_allow_w(struct work_struct *w)
{
	struct msm_hsic_hcd *mehci =
		container_of(w, struct msm_hsic_hcd, runtime_pm_allow_w);
	struct usb_hcd *hcd = hsic_to_hcd(mehci);

	pr_debug("enable runtime PM for HSIC rhub\n");
	pm_runtime_allow(&hcd->self.root_hub->dev);
}

static void ehci_hsic_bus_vote_w(struct work_struct *w)
{
	struct msm_hsic_hcd *mehci =
@@ -1118,8 +1129,8 @@ static irqreturn_t msm_hsic_irq(struct usb_hcd *hcd)

	/* Allow RuntimePM if device connected */
	if (!runtime_pm_enabled && (readl_relaxed(USB_PORTSC) & PORT_PE)) {
		pr_debug("enable runtime PM for HSIC rhub\n");
		pm_runtime_allow(&hcd->self.root_hub->dev);
		pr_debug("queue runtime_pm allow work\n");
		queue_work(ehci_wq, &mehci->runtime_pm_allow_w);
		runtime_pm_enabled = true;
	}

@@ -2167,6 +2178,7 @@ static int ehci_hsic_msm_probe(struct platform_device *pdev)
	}

	INIT_WORK(&mehci->bus_vote_w, ehci_hsic_bus_vote_w);
	INIT_WORK(&mehci->runtime_pm_allow_w, ehci_hsic_runtime_pm_allow_w);

	ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
	if (ret) {
@@ -2317,6 +2329,8 @@ static int ehci_hsic_msm_remove(struct platform_device *pdev)
	if (pdata && pdata->consider_ipa_handshake)
		msm_bam_set_hsic_host_dev(NULL);

	cancel_work_sync(&mehci->runtime_pm_allow_w);

	/* If the device was removed no need to call pm_runtime_disable */
	if (pdev->dev.power.power_state.event != PM_EVENT_INVALID)
		pm_runtime_disable(&pdev->dev);