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

Commit f08e691f authored by Mahesh Kumar Sharma's avatar Mahesh Kumar Sharma Committed by Gerrit - the friendly Code Review server
Browse files

bluetooth: Add logic to avoid XO leakage



SW implementation for XO selection option for HSP
in Lahaina/LahainaPro.
Once BT_EN is asserted, pull GPIO201 high and pull it
down to low after 2ms delay to avoid leakage.

Change-Id: Ib9f6ce27a27c26a84975bcbbae1da22dedd4e1ec
Signed-off-by: default avatarMahesh Kumar Sharma <smahesh@codeaurora.org>
parent b48d0659
Loading
Loading
Loading
Loading
+32 −2
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ static int bt_configure_gpios(int on)
	int wl_reset_gpio = bt_power_pdata->wl_gpio_sys_rst;
	int bt_sw_ctrl_gpio  =  bt_power_pdata->bt_gpio_sw_ctrl;
	int bt_debug_gpio  =  bt_power_pdata->bt_gpio_debug;
	int xo_reset_gpio =  bt_power_pdata->xo_gpio_sys_rst;
	int assert_dbg_gpio = 0;

	if (on) {
@@ -386,6 +387,27 @@ 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",
					__func__, xo_reset_gpio, rc);
		} 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__);
			}
		}
		msleep(50);
		/*  Check  if  SW_CTRL  is  asserted  */
		if  (bt_sw_ctrl_gpio  >=  0)  {
@@ -482,6 +504,8 @@ static int bluetooth_power(int on)
			gpio_free(bt_power_pdata->bt_gpio_sys_rst);
		if (bt_power_pdata->wl_gpio_sys_rst > 0)
			gpio_free(bt_power_pdata->wl_gpio_sys_rst);
		if (bt_power_pdata->xo_gpio_sys_rst > 0)
			gpio_free(bt_power_pdata->xo_gpio_sys_rst);
		if  (bt_power_pdata->bt_gpio_sw_ctrl > 0)
			gpio_free(bt_power_pdata->bt_gpio_sw_ctrl);
		if  (bt_power_pdata->bt_gpio_debug > 0)
@@ -793,6 +817,12 @@ static int bt_power_populate_dt_pinfo(struct platform_device *pdev)
		if (bt_power_pdata->bt_gpio_debug < 0)
			pr_warn("bt-debug-gpio not provided in devicetree\n");

		bt_power_pdata->xo_gpio_sys_rst =
			of_get_named_gpio(pdev->dev.of_node,
						"qcom,xo-reset-gpio", 0);
		if (bt_power_pdata->xo_gpio_sys_rst < 0)
			pr_warn("xo-reset-gpio not provided in devicetree\n");

		rc = bt_dt_parse_clk_info(&pdev->dev,
					&bt_power_pdata->bt_chip_clk);
		if (rc < 0)
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ struct bluetooth_power_platform_data {
	int wl_gpio_sys_rst;                   /* Wlan reset gpio */
	int bt_gpio_sw_ctrl;                   /* Bluetooth sw_ctrl gpio */
	int bt_gpio_debug;                     /* Bluetooth debug gpio */
	int xo_gpio_sys_rst;                    /* XO reset gpio*/
	struct device *slim_dev;
	struct bt_power_vreg_data *vreg_info;  /* VDDIO voltage regulator */
	struct bt_power_clk_data *bt_chip_clk; /* bluetooth reference clock */