|
@@ -310,30 +310,26 @@ static int sirf_probe(struct serdev_device *serdev)
|
|
|
ret = -ENODEV;
|
|
ret = -ENODEV;
|
|
|
goto err_put_device;
|
|
goto err_put_device;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ ret = regulator_enable(data->vcc);
|
|
|
|
|
+ if (ret)
|
|
|
|
|
+ goto err_put_device;
|
|
|
|
|
+
|
|
|
|
|
+ /* Wait for chip to boot into hibernate mode. */
|
|
|
|
|
+ msleep(SIRF_BOOT_DELAY);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (data->wakeup) {
|
|
if (data->wakeup) {
|
|
|
ret = gpiod_to_irq(data->wakeup);
|
|
ret = gpiod_to_irq(data->wakeup);
|
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
|
- goto err_put_device;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ goto err_disable_vcc;
|
|
|
data->irq = ret;
|
|
data->irq = ret;
|
|
|
|
|
|
|
|
- ret = devm_request_threaded_irq(dev, data->irq, NULL,
|
|
|
|
|
- sirf_wakeup_handler,
|
|
|
|
|
|
|
+ ret = request_threaded_irq(data->irq, NULL, sirf_wakeup_handler,
|
|
|
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
|
|
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
|
|
|
"wakeup", data);
|
|
"wakeup", data);
|
|
|
if (ret)
|
|
if (ret)
|
|
|
- goto err_put_device;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (data->on_off) {
|
|
|
|
|
- ret = regulator_enable(data->vcc);
|
|
|
|
|
- if (ret)
|
|
|
|
|
- goto err_put_device;
|
|
|
|
|
-
|
|
|
|
|
- /* Wait for chip to boot into hibernate mode */
|
|
|
|
|
- msleep(SIRF_BOOT_DELAY);
|
|
|
|
|
|
|
+ goto err_disable_vcc;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_PM)) {
|
|
if (IS_ENABLED(CONFIG_PM)) {
|
|
@@ -342,7 +338,7 @@ static int sirf_probe(struct serdev_device *serdev)
|
|
|
} else {
|
|
} else {
|
|
|
ret = sirf_runtime_resume(dev);
|
|
ret = sirf_runtime_resume(dev);
|
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
|
- goto err_disable_vcc;
|
|
|
|
|
|
|
+ goto err_free_irq;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ret = gnss_register_device(gdev);
|
|
ret = gnss_register_device(gdev);
|
|
@@ -356,6 +352,9 @@ err_disable_rpm:
|
|
|
pm_runtime_disable(dev);
|
|
pm_runtime_disable(dev);
|
|
|
else
|
|
else
|
|
|
sirf_runtime_suspend(dev);
|
|
sirf_runtime_suspend(dev);
|
|
|
|
|
+err_free_irq:
|
|
|
|
|
+ if (data->wakeup)
|
|
|
|
|
+ free_irq(data->irq, data);
|
|
|
err_disable_vcc:
|
|
err_disable_vcc:
|
|
|
if (data->on_off)
|
|
if (data->on_off)
|
|
|
regulator_disable(data->vcc);
|
|
regulator_disable(data->vcc);
|
|
@@ -376,6 +375,9 @@ static void sirf_remove(struct serdev_device *serdev)
|
|
|
else
|
|
else
|
|
|
sirf_runtime_suspend(&serdev->dev);
|
|
sirf_runtime_suspend(&serdev->dev);
|
|
|
|
|
|
|
|
|
|
+ if (data->wakeup)
|
|
|
|
|
+ free_irq(data->irq, data);
|
|
|
|
|
+
|
|
|
if (data->on_off)
|
|
if (data->on_off)
|
|
|
regulator_disable(data->vcc);
|
|
regulator_disable(data->vcc);
|
|
|
|
|
|