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

Commit b81d6c59 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

gpio-usbdetect: Register interrupt handler after getting gpio value



Currently driver is first getting irq number and then registering
interrupt handler with kernel. After that driver is getting gpio value
from dts. If interrupt gets fired right after interrupt handler
registration, it could lead to XPU violation as gpio value is zero, whose
TLMM register might not have access from kernel.

Change-Id: Iff864c1263f45ab6ed58238532e5003716732a99
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 28c1f5d2
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -227,23 +227,6 @@ static int gpio_usbdetect_probe(struct platform_device *pdev)
	if (rc)
		return rc;

	usb->vbus_det_irq = platform_get_irq_byname(pdev, "vbus_det_irq");
	if (usb->vbus_det_irq < 0) {
		dev_err(&pdev->dev, "vbus_det_irq failed\n");
		rc = usb->vbus_det_irq;
		goto disable_ldo;
	}

	rc = devm_request_irq(&pdev->dev, usb->vbus_det_irq,
			      gpio_usbdetect_vbus_irq,
			      IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			      "vbus_det_irq", usb);
	if (rc) {
		dev_err(&pdev->dev, "request for vbus_det_irq failed: %d\n",
			rc);
		goto disable_ldo;
	}

	usb->gpio_usbdetect = of_get_named_gpio(pdev->dev.of_node,
					"qcom,gpio-mode-sel", 0);

@@ -263,6 +246,23 @@ static int gpio_usbdetect_probe(struct platform_device *pdev)
		}
	}

	usb->vbus_det_irq = platform_get_irq_byname(pdev, "vbus_det_irq");
	if (usb->vbus_det_irq < 0) {
		dev_err(&pdev->dev, "vbus_det_irq failed\n");
		rc = usb->vbus_det_irq;
		goto disable_ldo;
	}

	rc = devm_request_irq(&pdev->dev, usb->vbus_det_irq,
			      gpio_usbdetect_vbus_irq,
			      IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
			      "vbus_det_irq", usb);
	if (rc) {
		dev_err(&pdev->dev, "request for vbus_det_irq failed: %d\n",
			rc);
		goto disable_ldo;
	}

	device_init_wakeup(&pdev->dev, 1);

	enable_irq_wake(usb->vbus_det_irq);