mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
misc: bluedroid_pm: Ensure 'host_wake' is configured
Currently the wakeup source is configured if only the 'ext_wake' is valid. However, the bluedroid_pm_timer and proc interface that are configured when 'ext_wake' is valid, also assumes that 'host_wake' is also valid. Therefore, update the code to only configure the bluedroid_pm_timer and proc interface if both of these are valid. Bug 4958861 Change-Id: I16ef55359c36acc9dc50464f43816ae2ef3c3123 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3397252 (cherry picked from commit b1e18d66aa0ab6d491b88caac5fa9abddb69d0e4) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3462461 Reviewed-by: Brad Griffis <bgriffis@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
432f3748e0
commit
c2fd2c3c66
@@ -438,34 +438,16 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
|
||||
bluedroid_pm->rfkill = rfkill;
|
||||
}
|
||||
|
||||
if (IS_ERR(bluedroid_pm->host_wake))
|
||||
BDP_DBG("gpio_host_wake not registered\n");
|
||||
else
|
||||
if (!IS_ERR(bluedroid_pm->ext_wake) && !IS_ERR(bluedroid_pm->host_wake)) {
|
||||
/* configure host_wake as input */
|
||||
gpiod_direction_input(bluedroid_pm->host_wake);
|
||||
|
||||
if (bluedroid_pm->host_wake_irq > -1) {
|
||||
BDP_DBG("found host_wake irq\n");
|
||||
ret = request_irq(bluedroid_pm->host_wake_irq,
|
||||
bluedroid_pm_hostwake_isr,
|
||||
IRQF_TRIGGER_RISING,
|
||||
"bluetooth hostwake", bluedroid_pm);
|
||||
if (ret) {
|
||||
BDP_ERR("Failed to get host_wake irq\n");
|
||||
goto free_host_wake;
|
||||
}
|
||||
} else
|
||||
BDP_DBG("host_wake not registered\n");
|
||||
|
||||
if (IS_ERR(bluedroid_pm->ext_wake)) {
|
||||
BDP_DBG("host_wake not registered\n");
|
||||
} else {
|
||||
/* configure ext_wake as output mode*/
|
||||
gpiod_direction_output(bluedroid_pm->ext_wake, 1);
|
||||
|
||||
if (create_bt_proc_interface(bluedroid_pm)) {
|
||||
BDP_ERR("Failed to create proc interface");
|
||||
goto free_ext_wake;
|
||||
goto free_host_wake;
|
||||
}
|
||||
/* initialize wake lock */
|
||||
bluedroid_pm->wake_lock = wakeup_source_register(&pdev->dev,
|
||||
@@ -480,6 +462,20 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
|
||||
bluedroid_pm_timer_expire, 0);
|
||||
}
|
||||
|
||||
if (bluedroid_pm->host_wake_irq > -1) {
|
||||
BDP_DBG("found host_wake irq\n");
|
||||
ret = request_irq(bluedroid_pm->host_wake_irq,
|
||||
bluedroid_pm_hostwake_isr,
|
||||
IRQF_TRIGGER_RISING,
|
||||
"bluetooth hostwake", bluedroid_pm);
|
||||
if (ret) {
|
||||
BDP_ERR("Failed to get host_wake irq\n");
|
||||
goto free_host_wake;
|
||||
}
|
||||
} else {
|
||||
BDP_DBG("host_wake not registered\n");
|
||||
}
|
||||
|
||||
INIT_WORK(&bluedroid_pm->work, bluedroid_work);
|
||||
spin_lock_init(&bluedroid_pm->lock);
|
||||
|
||||
@@ -491,9 +487,6 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
|
||||
|
||||
free_bt_proc:
|
||||
remove_bt_proc_interface();
|
||||
free_ext_wake:
|
||||
if (bluedroid_pm->host_wake_irq > -1)
|
||||
free_irq(bluedroid_pm->host_wake_irq, bluedroid_pm);
|
||||
free_host_wake:
|
||||
if (bluedroid_pm->rfkill)
|
||||
rfkill_unregister(bluedroid_pm->rfkill);
|
||||
|
||||
Reference in New Issue
Block a user