mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 04:12:04 -04:00
Bluetooth: Add conditional check before requesting gpio
Add a condition check before calling gpio_request in order to avoid non-fatal panic. Change-Id: Id77b99b0a7c119efb75e50c85ec185895dd8c031 Signed-off-by: Mahesh Kumar Sharma <smahesh@codeaurora.org>
This commit is contained in:
parent
73db1046f1
commit
669c9af027
1 changed files with 22 additions and 17 deletions
|
|
@ -398,25 +398,30 @@ static int bt_configure_gpios(int on)
|
|||
bt_power_src_status[BT_RESET_GPIO] =
|
||||
gpio_get_value(bt_reset_gpio);
|
||||
}
|
||||
rc = gpio_request(xo_reset_gpio, "xo_reset_gpio_n");
|
||||
if (rc) {
|
||||
pr_err("%s: unable to request gpio %d (%d)\n",
|
||||
|
||||
pr_info("xo_reset_gpio(%d)\n", xo_reset_gpio);
|
||||
|
||||
if (xo_reset_gpio > 0) {
|
||||
rc = gpio_request(xo_reset_gpio, "xo_reset_gpio_n");
|
||||
if (rc) {
|
||||
pr_err("%s: unable to request gpio %d (%d)\n",
|
||||
__func__, xo_reset_gpio, rc);
|
||||
} else {
|
||||
pr_info("%s: gpio_request for xo_reset_gpio succeed\n",
|
||||
} else {
|
||||
pr_info("%s: gpio_request for xo_reset_gpio succeed\n",
|
||||
__func__);
|
||||
//pull GPIO high
|
||||
rc = gpio_direction_output(xo_reset_gpio, 1);
|
||||
if (rc) {
|
||||
pr_err("%s: Unable to set direction of xo_reset_gpio\n",
|
||||
__func__);
|
||||
}
|
||||
udelay(2000);
|
||||
//pull GPIO low after 2 ms delay
|
||||
rc = gpio_direction_output(xo_reset_gpio, 0);
|
||||
if (rc) {
|
||||
pr_err("%s: Unable to set direction of xo_reset_gpio\n",
|
||||
__func__);
|
||||
//pull GPIO high
|
||||
rc = gpio_direction_output(xo_reset_gpio, 1);
|
||||
if (rc) {
|
||||
pr_err("%s: Unable to set direction of xo_reset_gpio\n",
|
||||
__func__);
|
||||
}
|
||||
udelay(2000);
|
||||
//pull GPIO low after 2 ms delay
|
||||
rc = gpio_direction_output(xo_reset_gpio, 0);
|
||||
if (rc) {
|
||||
pr_err("%s: Unable to set direction of xo_reset_gpio\n",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
}
|
||||
msleep(50);
|
||||
|
|
|
|||
Loading…
Reference in a new issue