Loading drivers/bluetooth/bluetooth-power.c +18 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ static bool previous; static int pwr_state; struct class *bt_class; static int bt_major; static int soc_id; static int bt_vreg_init(struct bt_power_vreg_data *vreg) { Loading Loading @@ -685,9 +686,16 @@ int bt_register_slimdev(struct device *dev) return 0; } int get_chipset_version(void) { BT_PWR_DBG(""); return soc_id; } static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret = 0, pwr_cntrl = 0; int chipset_version = 0; switch (cmd) { case BT_CMD_SLIM_TEST: Loading @@ -712,6 +720,16 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = 0; } break; case BT_CMD_CHIPSET_VERS: chipset_version = (int)arg; BT_PWR_ERR("BT_CMD_CHIP_VERS soc_version:%x", chipset_version); if (chipset_version) { soc_id = chipset_version; } else { BT_PWR_ERR("got invalid soc version"); soc_id = 0; } break; default: return -EINVAL; } Loading drivers/bluetooth/btfm_slim.c +15 −1 Original line number Diff line number Diff line Loading @@ -307,15 +307,29 @@ static int btfm_slim_get_logical_addr(struct slim_device *slim) static int btfm_slim_alloc_port(struct btfmslim *btfmslim) { int ret = -EINVAL, i; int chipset_ver; struct btfmslim_ch *rx_chs; struct btfmslim_ch *tx_chs; if (!btfmslim) return ret; chipset_ver = get_chipset_version(); BTFMSLIM_INFO("chipset soc version:%x", chipset_ver); rx_chs = btfmslim->rx_chs; tx_chs = btfmslim->tx_chs; if (chipset_ver == QCA_CHEROKEE_SOC_ID_0300) { for (i = 0; (tx_chs->port != BTFM_SLIM_PGD_PORT_LAST) && (i < BTFM_SLIM_NUM_CODEC_DAIS); i++, tx_chs++) { if (tx_chs->port == CHRK_SB_PGD_PORT_TX1_FM) tx_chs->port = CHRKVER3_SB_PGD_PORT_TX1_FM; else if (tx_chs->port == CHRK_SB_PGD_PORT_TX2_FM) tx_chs->port = CHRKVER3_SB_PGD_PORT_TX2_FM; BTFMSLIM_INFO("Tx port:%d", tx_chs->port); } tx_chs = btfmslim->tx_chs; } if (!rx_chs || !tx_chs) return ret; Loading drivers/bluetooth/btfm_slim_wcn3990.c +12 −3 Original line number Diff line number Diff line /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2018, 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 @@ -72,6 +72,8 @@ int btfm_slim_chrk_hw_init(struct btfmslim *btfmslim) static inline int is_fm_port(uint8_t port_num) { if (port_num == CHRK_SB_PGD_PORT_TX1_FM || port_num == CHRKVER3_SB_PGD_PORT_TX1_FM || port_num == CHRKVER3_SB_PGD_PORT_TX2_FM || port_num == CHRK_SB_PGD_PORT_TX2_FM) return 1; else Loading Loading @@ -138,9 +140,16 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num, /* txport */ /* Multiple Channel Setting */ if (is_fm_port(port_num)) { if (port_num == CHRKVER3_SB_PGD_PORT_TX1_FM) reg_val = (0x1 << CHRKVER3_SB_PGD_PORT_TX1_FM); else if (port_num == CHRKVER3_SB_PGD_PORT_TX2_FM) reg_val = (0x1 << CHRKVER3_SB_PGD_PORT_TX2_FM); else reg_val = (0x1 << CHRK_SB_PGD_PORT_TX1_FM) | (0x1 << CHRK_SB_PGD_PORT_TX2_FM); reg = CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_0(port_num); BTFMSLIM_INFO("writing reg_val (%d) to reg(%x)", reg_val, reg); ret = btfm_slim_write(btfmslim, reg, 1, ®_val, IFD); if (ret) { BTFMSLIM_ERR("failed to write (%d) reg 0x%x", ret, reg); Loading drivers/bluetooth/btfm_slim_wcn3990.h +28 −1 Original line number Diff line number Diff line /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2018, 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 @@ -78,9 +78,36 @@ #define CHRK_SB_PGD_PORT_TX_SCO 0 #define CHRK_SB_PGD_PORT_TX1_FM 1 #define CHRK_SB_PGD_PORT_TX2_FM 2 #define CHRKVER3_SB_PGD_PORT_TX1_FM 4 #define CHRKVER3_SB_PGD_PORT_TX2_FM 5 #define CHRK_SB_PGD_PORT_RX_SCO 16 #define CHRK_SB_PGD_PORT_RX_A2P 17 enum { QCA_CHEROKEE_SOC_ID_0100 = 0x40010100, QCA_CHEROKEE_SOC_ID_0200 = 0x40010200, QCA_CHEROKEE_SOC_ID_0201 = 0x40010201, QCA_CHEROKEE_SOC_ID_0210 = 0x40010214, QCA_CHEROKEE_SOC_ID_0211 = 0x40010224, QCA_CHEROKEE_SOC_ID_0300 = 0x40010300, }; enum{ QCA_APACHE_SOC_ID_0005 = 0x40020100, QCA_APACHE_SOC_ID_0006 = 0x40020110, QCA_APACHE_SOC_ID_0100 = 0x40020120, QCA_APACHE_SOC_ID_0101 = 0x40020121, QCA_APACHE_SOC_ID_0102 = 0x40020122, QCA_APACHE_SOC_ID_0103 = 0x40020123, QCA_APACHE_SOC_ID_0110 = 0x40020130, QCA_APACHE_SOC_ID_0111 = 0x40020140, }; enum { QCA_COMANCHE_SOC_ID_0100 = 0x40070100, QCA_COMANCHE_SOC_ID_0101 = 0x40070101, QCA_COMANCHE_SOC_ID_0110 = 0x40070110, }; /* Function Prototype */ Loading include/linux/bluetooth-power.h +3 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, 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 @@ -83,7 +83,9 @@ struct bluetooth_power_platform_data { }; int bt_register_slimdev(struct device *dev); int get_chipset_version(void); #define BT_CMD_SLIM_TEST 0xbfac #define BT_CMD_PWR_CTRL 0xbfad #define BT_CMD_CHIPSET_VERS 0xbfae #endif /* __LINUX_BLUETOOTH_POWER_H */ Loading
drivers/bluetooth/bluetooth-power.c +18 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ static bool previous; static int pwr_state; struct class *bt_class; static int bt_major; static int soc_id; static int bt_vreg_init(struct bt_power_vreg_data *vreg) { Loading Loading @@ -685,9 +686,16 @@ int bt_register_slimdev(struct device *dev) return 0; } int get_chipset_version(void) { BT_PWR_DBG(""); return soc_id; } static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret = 0, pwr_cntrl = 0; int chipset_version = 0; switch (cmd) { case BT_CMD_SLIM_TEST: Loading @@ -712,6 +720,16 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = 0; } break; case BT_CMD_CHIPSET_VERS: chipset_version = (int)arg; BT_PWR_ERR("BT_CMD_CHIP_VERS soc_version:%x", chipset_version); if (chipset_version) { soc_id = chipset_version; } else { BT_PWR_ERR("got invalid soc version"); soc_id = 0; } break; default: return -EINVAL; } Loading
drivers/bluetooth/btfm_slim.c +15 −1 Original line number Diff line number Diff line Loading @@ -307,15 +307,29 @@ static int btfm_slim_get_logical_addr(struct slim_device *slim) static int btfm_slim_alloc_port(struct btfmslim *btfmslim) { int ret = -EINVAL, i; int chipset_ver; struct btfmslim_ch *rx_chs; struct btfmslim_ch *tx_chs; if (!btfmslim) return ret; chipset_ver = get_chipset_version(); BTFMSLIM_INFO("chipset soc version:%x", chipset_ver); rx_chs = btfmslim->rx_chs; tx_chs = btfmslim->tx_chs; if (chipset_ver == QCA_CHEROKEE_SOC_ID_0300) { for (i = 0; (tx_chs->port != BTFM_SLIM_PGD_PORT_LAST) && (i < BTFM_SLIM_NUM_CODEC_DAIS); i++, tx_chs++) { if (tx_chs->port == CHRK_SB_PGD_PORT_TX1_FM) tx_chs->port = CHRKVER3_SB_PGD_PORT_TX1_FM; else if (tx_chs->port == CHRK_SB_PGD_PORT_TX2_FM) tx_chs->port = CHRKVER3_SB_PGD_PORT_TX2_FM; BTFMSLIM_INFO("Tx port:%d", tx_chs->port); } tx_chs = btfmslim->tx_chs; } if (!rx_chs || !tx_chs) return ret; Loading
drivers/bluetooth/btfm_slim_wcn3990.c +12 −3 Original line number Diff line number Diff line /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2018, 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 @@ -72,6 +72,8 @@ int btfm_slim_chrk_hw_init(struct btfmslim *btfmslim) static inline int is_fm_port(uint8_t port_num) { if (port_num == CHRK_SB_PGD_PORT_TX1_FM || port_num == CHRKVER3_SB_PGD_PORT_TX1_FM || port_num == CHRKVER3_SB_PGD_PORT_TX2_FM || port_num == CHRK_SB_PGD_PORT_TX2_FM) return 1; else Loading Loading @@ -138,9 +140,16 @@ int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t port_num, /* txport */ /* Multiple Channel Setting */ if (is_fm_port(port_num)) { if (port_num == CHRKVER3_SB_PGD_PORT_TX1_FM) reg_val = (0x1 << CHRKVER3_SB_PGD_PORT_TX1_FM); else if (port_num == CHRKVER3_SB_PGD_PORT_TX2_FM) reg_val = (0x1 << CHRKVER3_SB_PGD_PORT_TX2_FM); else reg_val = (0x1 << CHRK_SB_PGD_PORT_TX1_FM) | (0x1 << CHRK_SB_PGD_PORT_TX2_FM); reg = CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_0(port_num); BTFMSLIM_INFO("writing reg_val (%d) to reg(%x)", reg_val, reg); ret = btfm_slim_write(btfmslim, reg, 1, ®_val, IFD); if (ret) { BTFMSLIM_ERR("failed to write (%d) reg 0x%x", ret, reg); Loading
drivers/bluetooth/btfm_slim_wcn3990.h +28 −1 Original line number Diff line number Diff line /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2018, 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 @@ -78,9 +78,36 @@ #define CHRK_SB_PGD_PORT_TX_SCO 0 #define CHRK_SB_PGD_PORT_TX1_FM 1 #define CHRK_SB_PGD_PORT_TX2_FM 2 #define CHRKVER3_SB_PGD_PORT_TX1_FM 4 #define CHRKVER3_SB_PGD_PORT_TX2_FM 5 #define CHRK_SB_PGD_PORT_RX_SCO 16 #define CHRK_SB_PGD_PORT_RX_A2P 17 enum { QCA_CHEROKEE_SOC_ID_0100 = 0x40010100, QCA_CHEROKEE_SOC_ID_0200 = 0x40010200, QCA_CHEROKEE_SOC_ID_0201 = 0x40010201, QCA_CHEROKEE_SOC_ID_0210 = 0x40010214, QCA_CHEROKEE_SOC_ID_0211 = 0x40010224, QCA_CHEROKEE_SOC_ID_0300 = 0x40010300, }; enum{ QCA_APACHE_SOC_ID_0005 = 0x40020100, QCA_APACHE_SOC_ID_0006 = 0x40020110, QCA_APACHE_SOC_ID_0100 = 0x40020120, QCA_APACHE_SOC_ID_0101 = 0x40020121, QCA_APACHE_SOC_ID_0102 = 0x40020122, QCA_APACHE_SOC_ID_0103 = 0x40020123, QCA_APACHE_SOC_ID_0110 = 0x40020130, QCA_APACHE_SOC_ID_0111 = 0x40020140, }; enum { QCA_COMANCHE_SOC_ID_0100 = 0x40070100, QCA_COMANCHE_SOC_ID_0101 = 0x40070101, QCA_COMANCHE_SOC_ID_0110 = 0x40070110, }; /* Function Prototype */ Loading
include/linux/bluetooth-power.h +3 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, 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 @@ -83,7 +83,9 @@ struct bluetooth_power_platform_data { }; int bt_register_slimdev(struct device *dev); int get_chipset_version(void); #define BT_CMD_SLIM_TEST 0xbfac #define BT_CMD_PWR_CTRL 0xbfad #define BT_CMD_CHIPSET_VERS 0xbfae #endif /* __LINUX_BLUETOOTH_POWER_H */