static int bluetooth_power(int on) { int rc = 0; BT_PWR_DBG("on: %d", on); if (on) { if (bt_power_pdata->bt_vdd_io) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_io); if (rc < 0) { BT_PWR_ERR("bt_power vddio config failed"); goto out; } } if (bt_power_pdata->bt_vdd_ldo) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_ldo); if (rc < 0) { BT_PWR_ERR("bt_power vddldo config failed"); goto vdd_ldo_fail; } } if (bt_power_pdata->bt_vdd_pa) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_pa); if (rc < 0) { BT_PWR_ERR("bt_power vddpa config failed"); goto vdd_pa_fail; } } if (bt_power_pdata->bt_chip_pwd) { rc = bt_configure_vreg(bt_power_pdata->bt_chip_pwd); if (rc < 0) { BT_PWR_ERR("bt_power vddldo config failed"); goto chip_pwd_fail; } } if (bt_power_pdata->bt_gpio_sys_rst) { rc = bt_configure_gpios(on); if (rc < 0) { BT_PWR_ERR("bt_power gpio config failed"); goto gpio_fail; } } } else { bt_configure_gpios(on); gpio_fail: if (bt_power_pdata->bt_gpio_sys_rst) gpio_free(bt_power_pdata->bt_gpio_sys_rst); bt_vreg_disable(bt_power_pdata->bt_chip_pwd); chip_pwd_fail: bt_vreg_disable(bt_power_pdata->bt_vdd_pa); vdd_pa_fail: bt_vreg_disable(bt_power_pdata->bt_vdd_ldo); vdd_ldo_fail: bt_vreg_disable(bt_power_pdata->bt_vdd_io); } out: return rc; }
static int bluetooth_power(int on) { int rc = 0; BT_PWR_INFO("on: %d", on); if (on) { if (bt_power_pdata->bt_vdd_io) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_io); if (rc < 0) { BT_PWR_ERR("bt_power vddio config failed"); goto out; } } if (bt_power_pdata->bt_vdd_pa) { rc = bt_configure_vreg(bt_power_pdata->bt_vdd_pa); if (rc < 0) { BT_PWR_ERR("bt_power vddpa config failed"); goto vdd_pa_fail; } } if (bt_power_pdata->bt_vdd_ldo) { #ifdef CONFIG_SEC_LENTIS_PROJECT pr_err("%s: system_rev=%d\n", __func__, system_rev); if(system_rev == 7) { bt_power_pdata->bt_vdd_ldo->low_vol_level = EXT_LDO_1_20_V_MIN; bt_power_pdata->bt_vdd_ldo->high_vol_level = EXT_LDO_1_20_V_MAX; } else if(system_rev > 7) { bt_power_pdata->bt_vdd_ldo->low_vol_level = EXT_LDO_1_18_V_MIN; bt_power_pdata->bt_vdd_ldo->high_vol_level = EXT_LDO_1_18_V_MAX; } else { BT_PWR_ERR("bt_power HW rev under 0x06"); } #endif rc = bt_configure_vreg(bt_power_pdata->bt_vdd_ldo); if (rc < 0) { BT_PWR_ERR("bt_power vddldo config failed"); goto vdd_ldo_fail; } } if (bt_power_pdata->bt_chip_pwd) { rc = bt_configure_vreg(bt_power_pdata->bt_chip_pwd); if (rc < 0) { BT_PWR_ERR("bt_power vddldo config failed"); goto chip_pwd_fail; } } if (bt_power_pdata->bt_gpio_sys_rst) { rc = bt_configure_gpios(on); if (rc < 0) { BT_PWR_ERR("bt_power gpio config failed"); goto gpio_fail; } } } else { bt_configure_gpios(on); gpio_fail: if (bt_power_pdata->bt_gpio_sys_rst) gpio_free(bt_power_pdata->bt_gpio_sys_rst); bt_vreg_disable(bt_power_pdata->bt_chip_pwd); chip_pwd_fail: bt_vreg_disable(bt_power_pdata->bt_vdd_pa); vdd_pa_fail: bt_vreg_disable(bt_power_pdata->bt_vdd_ldo); vdd_ldo_fail: bt_vreg_disable(bt_power_pdata->bt_vdd_io); } out: return rc; }