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

Commit e08567e2 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: Add the support for wcn3980 in SDM429w"

parents 5f8870bd d603e191
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1271,6 +1271,21 @@
		qcom,has-vsys-adc-channel;
	};

	bluetooth: bt_wcn3990 {
		compatible = "qca,wcn3990";
		qca,bt-3P3-en-gpio = <&tlmm 47 0>; /* WCN3980_3P3_EN_*/
		qca,bt-1P3-en-gpio = <&tlmm 57 0>; /* WCN3980_1P3_EN */

		qca,bt-vdd-xtal-supply = <&pm660_l12>;
		qca,bt-vdd-io-supply = <&pm660_l13>;

		qca,bt-vdd-xtal-voltage-level = <1800000 1900000>;
		qca,bt-vdd-io-voltage-level = <1800000 1900000>;

		qca,bt-vdd-xtal-current-level = <80000>;
		qca,bt-vdd-io-current-level = <10000>;
	};

	qcom,bam_dmux@4044000 {
		compatible = "qcom,bam_dmux";
		reg = <0x4044000 0x19000>;
@@ -1380,3 +1395,8 @@
	clocks = <&gcc GCC_OXILI_GFX3D_CLK>;
	status = "okay";
};

&blsp2_uart2_hs {
	status = "okay";
};
+85 −0
Original line number Diff line number Diff line
@@ -242,6 +242,64 @@ static int bt_clk_disable(struct bt_power_clk_data *clk)
	return rc;
}

static int bt_configure_gpios_2wcn(int on)
{
	int rc = 0;
	int bt_3p3_en_gpio = bt_power_pdata->bt_gpio_3p3_en;
	int bt_1p3_en_gpio = bt_power_pdata->bt_gpio_1p3_en;

	BT_PWR_DBG("2wcn - bt_gpio= %d on: %d", bt_3p3_en_gpio, on);

	if (on) {
		rc = gpio_request(bt_3p3_en_gpio, "bt_3p3_en_n");
		if (rc) {
			BT_PWR_ERR("unable to request gpio %d (%d)\n",
					bt_3p3_en_gpio, rc);
			return rc;
		}

		rc = gpio_direction_output(bt_3p3_en_gpio, 0);
		if (rc) {
			BT_PWR_ERR("Unable to set direction\n");
			return rc;
		}
		msleep(50);
		rc = gpio_direction_output(bt_3p3_en_gpio, 1);
		if (rc) {
			BT_PWR_ERR("Unable to set direction\n");
			return rc;
		}
		msleep(50);

		rc = gpio_request(bt_1p3_en_gpio, "bt_1p3_en_n");
		if (rc) {
			BT_PWR_ERR("unable to request gpio %d (%d)\n",
					bt_1p3_en_gpio, rc);
			return rc;
		}

		rc = gpio_direction_output(bt_1p3_en_gpio, 0);
		if (rc) {
			BT_PWR_ERR("Unable to set direction\n");
			return rc;
		}
		msleep(50);
		rc = gpio_direction_output(bt_1p3_en_gpio, 1);
		if (rc) {
			BT_PWR_ERR("Unable to set direction\n");
			return rc;
		}
		msleep(50);
	} else {
		gpio_set_value(bt_3p3_en_gpio, 0);
		msleep(100);
		gpio_set_value(bt_1p3_en_gpio, 0);
		msleep(100);
	}
	return rc;
}


static int bt_configure_gpios(int on)
{
	int rc = 0;
@@ -305,12 +363,27 @@ static int bluetooth_power(int on)
				goto gpio_fail;
			}
		}
		if (bt_power_pdata->bt_gpio_3p3_en > 0) {
			BT_PWR_ERR(
			"bt_power gpio config start for  2wcn gpios");
			rc = bt_configure_gpios_2wcn(on);
			if (rc < 0) {
				BT_PWR_ERR("bt_power gpio config failed");
				goto gpio_fail;
			}
		}
	} else {
		if (bt_power_pdata->bt_gpio_sys_rst > 0)
			bt_configure_gpios(on);
		if (bt_power_pdata->bt_gpio_3p3_en > 0)
			bt_configure_gpios_2wcn(on);
gpio_fail:
		if (bt_power_pdata->bt_gpio_sys_rst > 0)
			gpio_free(bt_power_pdata->bt_gpio_sys_rst);
		if (bt_power_pdata->bt_gpio_3p3_en > 0)
			gpio_free(bt_power_pdata->bt_gpio_3p3_en);
		if (bt_power_pdata->bt_gpio_1p3_en > 0)
			gpio_free(bt_power_pdata->bt_gpio_1p3_en);
		if (bt_power_pdata->bt_chip_clk)
			bt_clk_disable(bt_power_pdata->bt_chip_clk);
clk_fail:
@@ -584,6 +657,18 @@ static int bt_power_populate_dt_pinfo(struct platform_device *pdev)
		if (bt_power_pdata->bt_gpio_sys_rst < 0)
			BT_PWR_ERR("bt-reset-gpio not provided in device tree");

		bt_power_pdata->bt_gpio_3p3_en =
			of_get_named_gpio(pdev->dev.of_node,
						"qca,bt-3P3-en-gpio", 0);
		if (bt_power_pdata->bt_gpio_3p3_en < 0)
			BT_PWR_INFO("bt-3P3-gpio not provided in devicetree");

		bt_power_pdata->bt_gpio_1p3_en =
			of_get_named_gpio(pdev->dev.of_node,
						"qca,bt-1P3-en-gpio", 0);
		if (bt_power_pdata->bt_gpio_1p3_en < 0)
			BT_PWR_INFO("bt-1P3-gpio not provided in devicetree");

		rc = bt_dt_parse_clk_info(&pdev->dev,
					&bt_power_pdata->bt_chip_clk);
		if (rc < 0)
+5 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2018,2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -59,6 +59,10 @@ struct bt_power_clk_data {
struct bluetooth_power_platform_data {
	/* Bluetooth reset gpio */
	int bt_gpio_sys_rst;
	/* Bluetooth 3p3 gpio */
	int bt_gpio_3p3_en;
	/* Bluetooth 1p3 gpio */
	int bt_gpio_1p3_en;
	struct device *slim_dev;
	/* VDDIO voltage regulator */
	struct bt_power_vreg_data *vreg_info;