Loading Documentation/devicetree/bindings/bluetooth/bluetooth_power.txt +14 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ Required properties: - compatible: Should be set to one of the following: qca,ar3002 qca,qca6174 qca,wcn3990 - qca,bt-reset-gpio: GPIO pin to bring BT Controller out of reset Optional properties: Loading @@ -18,7 +19,6 @@ Optional properties: - qca,bt-chip-pwd-supply: Chip power down gpio is required when bluetooth module and other modules like wifi co-exist in a singe chip and shares a common gpio to bring chip out of reset. - qca,bt-vdd-pa-voltage-level: specifies VDD PA voltage levels for supply. Should be specified in pairs (min, max), units uV - qca,bt-vdd-io-voltage-level: specifies VDD IO voltage levels for supply. Loading @@ -29,6 +29,12 @@ Optional properties: Should be specified in pairs (min, max), units uV - qca,bt-vdd-core-voltage-level: specifies VDD CORE voltage levels for supply. Should be specified in pairs (min, max), units uV - qca,bt-vdd-io-current-level: specifies VDD IO current level in microamps - qca,bt-vdd-xtal-current-level: specifies VDD XTAL current level in microamps - qca,bt-vdd-core-current-level: specifies VDD CORE current level in microamps. - qca,bt-vdd-ldo-current-level: specifies VDD LDO current level in microamps. - qca,bt-vdd-pa-current-level: specifies VDD PA current level in microamps. - qca,bt-chip-pwd-current-level: specifies Chip Power current level in microamps. Example: bt-ar3002 { Loading @@ -39,8 +45,15 @@ Example: qca,bt-vdd-xtal-supply = <&pm8994_l30>; qca,bt-vdd-core-supply = <&pm8994_s3>; qca,bt-chip-pwd-supply = <&ath_chip_pwd_l>; qca,bt-vdd-io-voltage-level = <1800000 1800000>; qca,bt-vdd-pa-voltage-level = <2900000 2900000>; qca,bt-vdd-xtal-voltage-level = <1800000 1800000>; qca,bt-vdd-core-voltage-level = <1300000 1300000>; qca,bt-vdd-io-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-xtal-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-core-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-ldo-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-pa-current-level = <1>; /* LPM/PFM */ }; arch/arm/boot/dts/qcom/msmcobalt-cdp.dtsi +24 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,27 @@ */ #include "msmcobalt-pinctrl.dtsi" / { bluetooth: bt_wcn3990 { compatible = "qca,wcn3990"; qca,bt-vdd-io-supply = <&pmcobalt_s3>; qca,bt-vdd-xtal-supply = <&pmcobalt_s5>; qca,bt-vdd-core-supply = <&pmcobalt_l7_pin_ctrl>; qca,bt-vdd-ldo-supply = <&pmcobalt_l17_pin_ctrl>; qca,bt-vdd-pa-supply = <&pmcobalt_l25_pin_ctrl>; qca,bt-chip-pwd-supply = <&pmicobalt_bob_pin1>; qca,bt-vdd-io-voltage-level = <1350000 1350000>; qca,bt-vdd-xtal-voltage-level = <2050000 2050000>; qca,bt-vdd-core-voltage-level = <1800000 1800000>; qca,bt-vdd-ldo-voltage-level = <1300000 1300000>; qca,bt-vdd-pa-voltage-level = <3300000 3300000>; qca,bt-chip-pwd-voltage-level = <3600000 3600000>; qca,bt-vdd-io-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-xtal-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-core-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-ldo-current-level = <0>; /* LPM/PFM */ qca,bt-vdd-pa-current-level = <0>; /* LPM/PFM */ }; }; arch/arm/boot/dts/qcom/msmcobalt-mtp.dtsi +24 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,27 @@ */ #include "msmcobalt-pinctrl.dtsi" / { bluetooth: bt_wcn3990 { compatible = "qca,wcn3990"; qca,bt-vdd-io-supply = <&pmcobalt_s3>; qca,bt-vdd-xtal-supply = <&pmcobalt_s5>; qca,bt-vdd-core-supply = <&pmcobalt_l7_pin_ctrl>; qca,bt-vdd-ldo-supply = <&pmcobalt_l17_pin_ctrl>; qca,bt-vdd-pa-supply = <&pmcobalt_l25_pin_ctrl>; qca,bt-chip-pwd-supply = <&pmicobalt_bob_pin1>; qca,bt-vdd-io-voltage-level = <1350000 1350000>; qca,bt-vdd-xtal-voltage-level = <2050000 2050000>; qca,bt-vdd-core-voltage-level = <1800000 1800000>; qca,bt-vdd-ldo-voltage-level = <1300000 1300000>; qca,bt-vdd-pa-voltage-level = <3300000 3300000>; qca,bt-chip-pwd-voltage-level = <3600000 3600000>; qca,bt-vdd-io-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-xtal-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-core-current-level = <0>; /* LPM/PFM */ qca,bt-vdd-ldo-current-level = <0>; /* LPM/PFM */ qca,bt-vdd-pa-current-level = <0>; /* LPM/PFM */ }; }; drivers/bluetooth/bluetooth-power.c +36 −9 Original line number Diff line number Diff line /* Copyright (c) 2009-2010, 2013-2015 The Linux Foundation. All rights reserved. /* Copyright (c) 2009-2010, 2013-2016 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 Loading Loading @@ -36,6 +36,7 @@ static struct of_device_id bt_power_match_table[] = { { .compatible = "qca,ar3002" }, { .compatible = "qca,qca6174" }, { .compatible = "qca,wcn3990" }, {} }; Loading Loading @@ -85,6 +86,16 @@ static int bt_vreg_enable(struct bt_power_vreg_data *vreg) } } if (vreg->load_uA >= 0) { rc = regulator_set_optimum_mode(vreg->reg, vreg->load_uA); if (rc < 0) { BT_PWR_ERR("vreg_set_mode(%s) failed rc=%d\n", vreg->name, rc); goto out; } } rc = regulator_enable(vreg->reg); if (rc < 0) { BT_PWR_ERR("regulator_enable(%s) failed. rc=%d\n", Loading Loading @@ -117,14 +128,19 @@ static int bt_vreg_disable(struct bt_power_vreg_data *vreg) if (vreg->set_voltage_sup) { /* Set the min voltage to 0 */ rc = regulator_set_voltage(vreg->reg, 0, rc = regulator_set_voltage(vreg->reg, 0, vreg->high_vol_level); if (rc < 0) { BT_PWR_ERR("vreg_set_vol(%s) failed rc=%d\n", vreg->name, rc); goto out; } } if (vreg->load_uA >= 0) { rc = regulator_set_optimum_mode(vreg->reg, 0); if (rc < 0) { BT_PWR_ERR("vreg_set_mode(%s) failed rc=%d\n", vreg->name, rc); } } } Loading Loading @@ -154,7 +170,7 @@ static int bt_configure_gpios(int on) int rc = 0; int bt_reset_gpio = bt_power_pdata->bt_gpio_sys_rst; BT_PWR_DBG("%s bt_gpio= %d on: %d", __func__, bt_reset_gpio, on); BT_PWR_DBG("bt_gpio= %d on: %d", bt_reset_gpio, on); if (on) { rc = gpio_request(bt_reset_gpio, "bt_sys_rst_n"); Loading Loading @@ -211,7 +227,6 @@ static int bluetooth_power(int on) goto vdd_core_fail; } } if (bt_power_pdata->bt_vdd_pa) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_pa); if (rc < 0) { Loading Loading @@ -378,6 +393,7 @@ static int bt_dt_parse_vreg_info(struct device *dev, vreg->name = vreg_name; /* Parse voltage-level from each node */ snprintf(prop_name, MAX_PROP_SIZE, "%s-voltage-level", vreg_name); prop = of_get_property(np, prop_name, &len); Loading @@ -389,10 +405,21 @@ static int bt_dt_parse_vreg_info(struct device *dev, vreg->high_vol_level = be32_to_cpup(&prop[1]); } /* Parse current-level from each node */ snprintf(prop_name, MAX_PROP_SIZE, "%s-current-level", vreg_name); ret = of_property_read_u32(np, prop_name, &vreg->load_uA); if (ret < 0) { BT_PWR_DBG("%s property is not valid\n", prop_name); vreg->load_uA = -1; ret = 0; } *vreg_data = vreg; BT_PWR_DBG("%s: vol=[%d %d]uV\n", BT_PWR_DBG("%s: vol=[%d %d]uV, current=[%d]uA\n", vreg->name, vreg->low_vol_level, vreg->high_vol_level); vreg->high_vol_level, vreg->load_uA); } else BT_PWR_INFO("%s: is not provided in device tree", vreg_name); Loading include/linux/bluetooth-power.h +3 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2016, 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 Loading Loading @@ -27,6 +27,8 @@ struct bt_power_vreg_data { /* voltage levels to be set */ unsigned int low_vol_level; unsigned int high_vol_level; /* current level to be set */ unsigned int load_uA; /* * is set voltage supported for this regulator? * false => set voltage is not supported Loading Loading
Documentation/devicetree/bindings/bluetooth/bluetooth_power.txt +14 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ Required properties: - compatible: Should be set to one of the following: qca,ar3002 qca,qca6174 qca,wcn3990 - qca,bt-reset-gpio: GPIO pin to bring BT Controller out of reset Optional properties: Loading @@ -18,7 +19,6 @@ Optional properties: - qca,bt-chip-pwd-supply: Chip power down gpio is required when bluetooth module and other modules like wifi co-exist in a singe chip and shares a common gpio to bring chip out of reset. - qca,bt-vdd-pa-voltage-level: specifies VDD PA voltage levels for supply. Should be specified in pairs (min, max), units uV - qca,bt-vdd-io-voltage-level: specifies VDD IO voltage levels for supply. Loading @@ -29,6 +29,12 @@ Optional properties: Should be specified in pairs (min, max), units uV - qca,bt-vdd-core-voltage-level: specifies VDD CORE voltage levels for supply. Should be specified in pairs (min, max), units uV - qca,bt-vdd-io-current-level: specifies VDD IO current level in microamps - qca,bt-vdd-xtal-current-level: specifies VDD XTAL current level in microamps - qca,bt-vdd-core-current-level: specifies VDD CORE current level in microamps. - qca,bt-vdd-ldo-current-level: specifies VDD LDO current level in microamps. - qca,bt-vdd-pa-current-level: specifies VDD PA current level in microamps. - qca,bt-chip-pwd-current-level: specifies Chip Power current level in microamps. Example: bt-ar3002 { Loading @@ -39,8 +45,15 @@ Example: qca,bt-vdd-xtal-supply = <&pm8994_l30>; qca,bt-vdd-core-supply = <&pm8994_s3>; qca,bt-chip-pwd-supply = <&ath_chip_pwd_l>; qca,bt-vdd-io-voltage-level = <1800000 1800000>; qca,bt-vdd-pa-voltage-level = <2900000 2900000>; qca,bt-vdd-xtal-voltage-level = <1800000 1800000>; qca,bt-vdd-core-voltage-level = <1300000 1300000>; qca,bt-vdd-io-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-xtal-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-core-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-ldo-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-pa-current-level = <1>; /* LPM/PFM */ };
arch/arm/boot/dts/qcom/msmcobalt-cdp.dtsi +24 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,27 @@ */ #include "msmcobalt-pinctrl.dtsi" / { bluetooth: bt_wcn3990 { compatible = "qca,wcn3990"; qca,bt-vdd-io-supply = <&pmcobalt_s3>; qca,bt-vdd-xtal-supply = <&pmcobalt_s5>; qca,bt-vdd-core-supply = <&pmcobalt_l7_pin_ctrl>; qca,bt-vdd-ldo-supply = <&pmcobalt_l17_pin_ctrl>; qca,bt-vdd-pa-supply = <&pmcobalt_l25_pin_ctrl>; qca,bt-chip-pwd-supply = <&pmicobalt_bob_pin1>; qca,bt-vdd-io-voltage-level = <1350000 1350000>; qca,bt-vdd-xtal-voltage-level = <2050000 2050000>; qca,bt-vdd-core-voltage-level = <1800000 1800000>; qca,bt-vdd-ldo-voltage-level = <1300000 1300000>; qca,bt-vdd-pa-voltage-level = <3300000 3300000>; qca,bt-chip-pwd-voltage-level = <3600000 3600000>; qca,bt-vdd-io-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-xtal-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-core-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-ldo-current-level = <0>; /* LPM/PFM */ qca,bt-vdd-pa-current-level = <0>; /* LPM/PFM */ }; };
arch/arm/boot/dts/qcom/msmcobalt-mtp.dtsi +24 −0 Original line number Diff line number Diff line Loading @@ -11,3 +11,27 @@ */ #include "msmcobalt-pinctrl.dtsi" / { bluetooth: bt_wcn3990 { compatible = "qca,wcn3990"; qca,bt-vdd-io-supply = <&pmcobalt_s3>; qca,bt-vdd-xtal-supply = <&pmcobalt_s5>; qca,bt-vdd-core-supply = <&pmcobalt_l7_pin_ctrl>; qca,bt-vdd-ldo-supply = <&pmcobalt_l17_pin_ctrl>; qca,bt-vdd-pa-supply = <&pmcobalt_l25_pin_ctrl>; qca,bt-chip-pwd-supply = <&pmicobalt_bob_pin1>; qca,bt-vdd-io-voltage-level = <1350000 1350000>; qca,bt-vdd-xtal-voltage-level = <2050000 2050000>; qca,bt-vdd-core-voltage-level = <1800000 1800000>; qca,bt-vdd-ldo-voltage-level = <1300000 1300000>; qca,bt-vdd-pa-voltage-level = <3300000 3300000>; qca,bt-chip-pwd-voltage-level = <3600000 3600000>; qca,bt-vdd-io-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-xtal-current-level = <1>; /* LPM/PFM */ qca,bt-vdd-core-current-level = <0>; /* LPM/PFM */ qca,bt-vdd-ldo-current-level = <0>; /* LPM/PFM */ qca,bt-vdd-pa-current-level = <0>; /* LPM/PFM */ }; };
drivers/bluetooth/bluetooth-power.c +36 −9 Original line number Diff line number Diff line /* Copyright (c) 2009-2010, 2013-2015 The Linux Foundation. All rights reserved. /* Copyright (c) 2009-2010, 2013-2016 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 Loading Loading @@ -36,6 +36,7 @@ static struct of_device_id bt_power_match_table[] = { { .compatible = "qca,ar3002" }, { .compatible = "qca,qca6174" }, { .compatible = "qca,wcn3990" }, {} }; Loading Loading @@ -85,6 +86,16 @@ static int bt_vreg_enable(struct bt_power_vreg_data *vreg) } } if (vreg->load_uA >= 0) { rc = regulator_set_optimum_mode(vreg->reg, vreg->load_uA); if (rc < 0) { BT_PWR_ERR("vreg_set_mode(%s) failed rc=%d\n", vreg->name, rc); goto out; } } rc = regulator_enable(vreg->reg); if (rc < 0) { BT_PWR_ERR("regulator_enable(%s) failed. rc=%d\n", Loading Loading @@ -117,14 +128,19 @@ static int bt_vreg_disable(struct bt_power_vreg_data *vreg) if (vreg->set_voltage_sup) { /* Set the min voltage to 0 */ rc = regulator_set_voltage(vreg->reg, 0, rc = regulator_set_voltage(vreg->reg, 0, vreg->high_vol_level); if (rc < 0) { BT_PWR_ERR("vreg_set_vol(%s) failed rc=%d\n", vreg->name, rc); goto out; } } if (vreg->load_uA >= 0) { rc = regulator_set_optimum_mode(vreg->reg, 0); if (rc < 0) { BT_PWR_ERR("vreg_set_mode(%s) failed rc=%d\n", vreg->name, rc); } } } Loading Loading @@ -154,7 +170,7 @@ static int bt_configure_gpios(int on) int rc = 0; int bt_reset_gpio = bt_power_pdata->bt_gpio_sys_rst; BT_PWR_DBG("%s bt_gpio= %d on: %d", __func__, bt_reset_gpio, on); BT_PWR_DBG("bt_gpio= %d on: %d", bt_reset_gpio, on); if (on) { rc = gpio_request(bt_reset_gpio, "bt_sys_rst_n"); Loading Loading @@ -211,7 +227,6 @@ static int bluetooth_power(int on) goto vdd_core_fail; } } if (bt_power_pdata->bt_vdd_pa) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_pa); if (rc < 0) { Loading Loading @@ -378,6 +393,7 @@ static int bt_dt_parse_vreg_info(struct device *dev, vreg->name = vreg_name; /* Parse voltage-level from each node */ snprintf(prop_name, MAX_PROP_SIZE, "%s-voltage-level", vreg_name); prop = of_get_property(np, prop_name, &len); Loading @@ -389,10 +405,21 @@ static int bt_dt_parse_vreg_info(struct device *dev, vreg->high_vol_level = be32_to_cpup(&prop[1]); } /* Parse current-level from each node */ snprintf(prop_name, MAX_PROP_SIZE, "%s-current-level", vreg_name); ret = of_property_read_u32(np, prop_name, &vreg->load_uA); if (ret < 0) { BT_PWR_DBG("%s property is not valid\n", prop_name); vreg->load_uA = -1; ret = 0; } *vreg_data = vreg; BT_PWR_DBG("%s: vol=[%d %d]uV\n", BT_PWR_DBG("%s: vol=[%d %d]uV, current=[%d]uA\n", vreg->name, vreg->low_vol_level, vreg->high_vol_level); vreg->high_vol_level, vreg->load_uA); } else BT_PWR_INFO("%s: is not provided in device tree", vreg_name); Loading
include/linux/bluetooth-power.h +3 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2016, 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 Loading Loading @@ -27,6 +27,8 @@ struct bt_power_vreg_data { /* voltage levels to be set */ unsigned int low_vol_level; unsigned int high_vol_level; /* current level to be set */ unsigned int load_uA; /* * is set voltage supported for this regulator? * false => set voltage is not supported Loading