Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
On 27/03/2019 13:28, Harish Bandi wrote: > +bool qca_is_wcn399x(enum qca_btsoc_type soc_type) > +{ > + if ((soc_type == QCA_WCN3990) || (soc_type == QCA_WCN3998)) > + return true; > + > + return false; > +} Dunno if you saw my earlier comment. The above is not very idiomatic. I would write: bool is_qca_soc_type_wcn399x_family(enum qca_btsoc_type soc_type) { return soc_type == QCA_WCN3990 || soc_type == QCA_WCN3998; } Regards.
Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
Hi Matthias, On 2019-03-29 02:53, Matthias Kaehlcke wrote: On Fri, Mar 29, 2019 at 05:05:49AM +0800, kbuild test robot wrote: Hi Harish, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bluetooth-next/master] [also build test WARNING on next-20190328] [cannot apply to v5.1-rc2] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Harish-Bandi/Bluetooth-hci_qca-Added-support-for-WCN3998/20190328-213357 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: riscv-allmodconfig (attached as .config) compiler: riscv64-linux-gcc (GCC) 8.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=8.1.0 make.cross ARCH=riscv Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/bluetooth/btqca.c: In function 'qca_uart_setup': >> drivers/bluetooth/btqca.c:369:3: warning: 'rom_ver' may be used uninitialized in this function [-Wmaybe-uninitialized] snprintf(config.fwname, sizeof(config.fwname), ^~ "qca/crnv%02x.bin", rom_ver); vim +/rom_ver +369 drivers/bluetooth/btqca.c 83e81961 Ben Young Tae Kim 2015-08-10 333 aadebac4 Balakrishna Godavarthi 2018-08-03 334 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, aadebac4 Balakrishna Godavarthi 2018-08-03 335 enum qca_btsoc_type soc_type, u32 soc_ver) 83e81961 Ben Young Tae Kim 2015-08-10 336 { 83e81961 Ben Young Tae Kim 2015-08-10 337 struct rome_config config; 83e81961 Ben Young Tae Kim 2015-08-10 338 int err; 4219d468 Balakrishna Godavarthi 2018-08-03 339 u8 rom_ver; With the use of qca_is_wcn399x() the compiler can't determine anymore that rom_ver is only read for WCN399x, in which case it is also initialized. Just initialize rom_ver with 0 to keep the compiler happy. [Harish] - sure, will wait for few more comments and address all comments in new patch version. 83e81961 Ben Young Tae Kim 2015-08-10 340 ba493d4f Balakrishna Godavarthi 2018-08-03 341 bt_dev_dbg(hdev, "QCA setup on UART"); 83e81961 Ben Young Tae Kim 2015-08-10 342 83e81961 Ben Young Tae Kim 2015-08-10 343 config.user_baud_rate = baudrate; 83e81961 Ben Young Tae Kim 2015-08-10 344 83e81961 Ben Young Tae Kim 2015-08-10 345 /* Download rampatch file */ 83e81961 Ben Young Tae Kim 2015-08-10 346 config.type = TLV_TYPE_PATCH; cc8a70bd Harish Bandi 2019-03-27 347 if (qca_is_wcn399x(soc_type)) { 4219d468 Balakrishna Godavarthi 2018-08-03 348 /* Firmware files to download are based on ROM version. 4219d468 Balakrishna Godavarthi 2018-08-03 349 * ROM version is derived from last two bytes of soc_ver. 4219d468 Balakrishna Godavarthi 2018-08-03 350 */ 4219d468 Balakrishna Godavarthi 2018-08-03 351 rom_ver = ((soc_ver & 0x0f00) >> 0x04) | 4219d468 Balakrishna Godavarthi 2018-08-03 352 (soc_ver & 0x000f); 4219d468 Balakrishna Godavarthi 2018-08-03 353 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 354 "qca/crbtfw%02x.tlv", rom_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 355 } else { 4219d468 Balakrishna Godavarthi 2018-08-03 356 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 357 "qca/rampatch_%08x.bin", soc_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 358 } 4219d468 Balakrishna Godavarthi 2018-08-03 359 ba493d4f Balakrishna Godavarthi 2018-08-03 360 err = qca_download_firmware(hdev, ); 83e81961 Ben Young Tae Kim 2015-08-10 361 if (err < 0) { ba493d4f Balakrishna Godavarthi 2018-08-03 362 bt_dev_err(hdev, "QCA Failed to download patch (%d)", err); 83e81961 Ben Young Tae Kim 2015-08-10 363 return err; 83e81961 Ben Young Tae Kim 2015-08-10 364 } 83e81961 Ben Young Tae Kim 2015-08-10 365 83e81961 Ben Young Tae Kim 2015-08-10 366 /* Download NVM configuration */ 83e81961 Ben Young Tae Kim 2015-08-10 367 config.type = TLV_TYPE_NVM; cc8a70bd Harish Bandi 2019-03-27 368 if (qca_is_wcn399x(soc_type)) 4219d468 Balakrishna Godavarthi 2018-08-03 @369 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 370 "qca/crnv%02x.bin", rom_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 371 else 4219d468 Balakrishna Godavarthi 2018-08-03 372 snprintf(config.fwname,
Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
Hi Matthias, On 2019-03-27 22:26, Matthias Kaehlcke wrote: On Wed, Mar 27, 2019 at 05:58:42PM +0530, Harish Bandi wrote: Added new compatible for WCN3998 and corresponding voltage and current values to WCN3998 compatible. Changed driver code to support WCN3998 Signed-off-by: Harish Bandi You forgot to add 'Reviewed-by' my tag from v5. No need to resend, I'll add it again below, but it's the general practice to include tags like 'Reviewed-by' or 'Acked-by' when sending a new revision. [Harish] - sorry for missing, will follow from new version. --- Changes in V6: - changed return value to false in the qca_is_wcn399x()stub --- drivers/bluetooth/btqca.c | 13 +++-- drivers/bluetooth/btqca.h | 8 +++- drivers/bluetooth/hci_qca.c | 40 ++-- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index 6122685..383e99f 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -344,7 +344,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download rampatch file */ config.type = TLV_TYPE_PATCH; - if (soc_type == QCA_WCN3990) { + if (qca_is_wcn399x(soc_type)) { /* Firmware files to download are based on ROM version. * ROM version is derived from last two bytes of soc_ver. */ @@ -365,7 +365,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download NVM configuration */ config.type = TLV_TYPE_NVM; - if (soc_type == QCA_WCN3990) + if (qca_is_wcn399x(soc_type)) snprintf(config.fwname, sizeof(config.fwname), "qca/crnv%02x.bin", rom_ver); else @@ -410,6 +410,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) } EXPORT_SYMBOL_GPL(qca_set_bdaddr); +bool qca_is_wcn399x(enum qca_btsoc_type soc_type) +{ + if ((soc_type == QCA_WCN3990) || (soc_type == QCA_WCN3998)) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(qca_is_wcn399x); + MODULE_AUTHOR("Ben Young Tae Kim "); MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver " VERSION); MODULE_VERSION(VERSION); diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h index 6fdc25d..0f68c9e7 100644 --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h @@ -132,7 +132,8 @@ enum qca_btsoc_type { QCA_INVALID = -1, QCA_AR3002, QCA_ROME, - QCA_WCN3990 + QCA_WCN3990, + QCA_WCN3998, }; #if IS_ENABLED(CONFIG_BT_QCA) @@ -142,6 +143,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, enum qca_btsoc_type soc_type, u32 soc_ver); int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); +bool qca_is_wcn399x(enum qca_btsoc_type soc_type); #else static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) @@ -165,4 +167,8 @@ static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) return -EOPNOTSUPP; } +static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type) +{ + return false; +} #endif diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 4ea995d..4af580a 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -521,7 +521,7 @@ static int qca_open(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type != QCA_WCN3990) { + if (!qca_is_wcn399x(qcadev->btsoc_type)) { gpiod_set_value_cansleep(qcadev->bt_en, 1); } else { hu->init_speed = qcadev->init_speed; @@ -627,7 +627,7 @@ static int qca_close(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type == QCA_WCN3990) + if (qca_is_wcn399x(qcadev->btsoc_type)) qca_power_shutdown(hu); else gpiod_set_value_cansleep(qcadev->bt_en, 0); @@ -1008,7 +1008,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); /* Give the controller time to process the request */ - if (qca_soc_type(hu) == QCA_WCN3990) + if (qca_is_wcn399x(qca_soc_type(hu))) msleep(10); else msleep(300); @@ -1084,7 +1084,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu, static int qca_check_speeds(struct hci_uart *hu) { - if (qca_soc_type(hu) == QCA_WCN3990) { + if (qca_is_wcn399x(qca_soc_type(hu))) { if (!qca_get_speed(hu, QCA_INIT_SPEED) &&
Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
On Fri, Mar 29, 2019 at 05:05:49AM +0800, kbuild test robot wrote: > Hi Harish, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on bluetooth-next/master] > [also build test WARNING on next-20190328] > [cannot apply to v5.1-rc2] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Harish-Bandi/Bluetooth-hci_qca-Added-support-for-WCN3998/20190328-213357 > base: > https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git > master > config: riscv-allmodconfig (attached as .config) > compiler: riscv64-linux-gcc (GCC) 8.1.0 > reproduce: > wget > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O > ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > GCC_VERSION=8.1.0 make.cross ARCH=riscv > > Note: it may well be a FALSE warning. FWIW you are at least aware of it now. > http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings > > All warnings (new ones prefixed by >>): > >drivers/bluetooth/btqca.c: In function 'qca_uart_setup': > >> drivers/bluetooth/btqca.c:369:3: warning: 'rom_ver' may be used > >> uninitialized in this function [-Wmaybe-uninitialized] > snprintf(config.fwname, sizeof(config.fwname), > ^~ > "qca/crnv%02x.bin", rom_ver); > > > vim +/rom_ver +369 drivers/bluetooth/btqca.c > > 83e81961 Ben Young Tae Kim 2015-08-10 333 > aadebac4 Balakrishna Godavarthi 2018-08-03 334 int qca_uart_setup(struct > hci_dev *hdev, uint8_t baudrate, > aadebac4 Balakrishna Godavarthi 2018-08-03 335 enum > qca_btsoc_type soc_type, u32 soc_ver) > 83e81961 Ben Young Tae Kim 2015-08-10 336 { > 83e81961 Ben Young Tae Kim 2015-08-10 337 struct rome_config > config; > 83e81961 Ben Young Tae Kim 2015-08-10 338 int err; > 4219d468 Balakrishna Godavarthi 2018-08-03 339 u8 rom_ver; With the use of qca_is_wcn399x() the compiler can't determine anymore that rom_ver is only read for WCN399x, in which case it is also initialized. Just initialize rom_ver with 0 to keep the compiler happy. > 83e81961 Ben Young Tae Kim 2015-08-10 340 > ba493d4f Balakrishna Godavarthi 2018-08-03 341 bt_dev_dbg(hdev, "QCA > setup on UART"); > 83e81961 Ben Young Tae Kim 2015-08-10 342 > 83e81961 Ben Young Tae Kim 2015-08-10 343 config.user_baud_rate = > baudrate; > 83e81961 Ben Young Tae Kim 2015-08-10 344 > 83e81961 Ben Young Tae Kim 2015-08-10 345 /* Download rampatch > file */ > 83e81961 Ben Young Tae Kim 2015-08-10 346 config.type = > TLV_TYPE_PATCH; > cc8a70bd Harish Bandi 2019-03-27 347 if > (qca_is_wcn399x(soc_type)) { > 4219d468 Balakrishna Godavarthi 2018-08-03 348 /* Firmware > files to download are based on ROM version. > 4219d468 Balakrishna Godavarthi 2018-08-03 349* ROM version > is derived from last two bytes of soc_ver. > 4219d468 Balakrishna Godavarthi 2018-08-03 350*/ > 4219d468 Balakrishna Godavarthi 2018-08-03 351 rom_ver = > ((soc_ver & 0x0f00) >> 0x04) | > 4219d468 Balakrishna Godavarthi 2018-08-03 352 > (soc_ver & 0x000f); > 4219d468 Balakrishna Godavarthi 2018-08-03 353 > snprintf(config.fwname, sizeof(config.fwname), > 4219d468 Balakrishna Godavarthi 2018-08-03 354 > "qca/crbtfw%02x.tlv", rom_ver); > 4219d468 Balakrishna Godavarthi 2018-08-03 355 } else { > 4219d468 Balakrishna Godavarthi 2018-08-03 356 > snprintf(config.fwname, sizeof(config.fwname), > 4219d468 Balakrishna Godavarthi 2018-08-03 357 > "qca/rampatch_%08x.bin", soc_ver); > 4219d468 Balakrishna Godavarthi 2018-08-03 358 } > 4219d468 Balakrishna Godavarthi 2018-08-03 359 > ba493d4f Balakrishna Godavarthi 2018-08-03 360 err = > qca_download_firmware(hdev, ); > 83e81961 Ben Young Tae Kim 2015-08-10 361 if (err < 0) { > ba493d4f Balakrishna Godavarthi 2018-08-03 362 > bt_dev_err(hdev, "QCA Failed to download patch (%d)", err); > 83e81961 Ben Young Tae Kim 2015-08-10 363 return err; > 83e81961 Ben Young Tae Kim 2015-08-10 364 } > 83e81961 Ben Young Tae Kim 2015-08-10 365 > 83e81961 Ben Young Tae Kim 2015-08-10 366 /* Download NVM > configuration */ > 83e81961 Ben Young Tae Kim 2015-08-10 367 config.type = > TLV_TYPE_NVM; > cc8a70bd Harish Bandi 2019-03-27 368 if > (qca_is_wcn399x(soc_type)) > 4219d468 Balakrishna Godavarthi 2018-08-03 @369 > snprintf(config.fwname, sizeof(config.fwname), > 4219d468
Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
Hi Harish, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on bluetooth-next/master] [also build test WARNING on next-20190328] [cannot apply to v5.1-rc2] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Harish-Bandi/Bluetooth-hci_qca-Added-support-for-WCN3998/20190328-213357 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: riscv-allmodconfig (attached as .config) compiler: riscv64-linux-gcc (GCC) 8.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=8.1.0 make.cross ARCH=riscv Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/bluetooth/btqca.c: In function 'qca_uart_setup': >> drivers/bluetooth/btqca.c:369:3: warning: 'rom_ver' may be used >> uninitialized in this function [-Wmaybe-uninitialized] snprintf(config.fwname, sizeof(config.fwname), ^~ "qca/crnv%02x.bin", rom_ver); vim +/rom_ver +369 drivers/bluetooth/btqca.c 83e81961 Ben Young Tae Kim 2015-08-10 333 aadebac4 Balakrishna Godavarthi 2018-08-03 334 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, aadebac4 Balakrishna Godavarthi 2018-08-03 335enum qca_btsoc_type soc_type, u32 soc_ver) 83e81961 Ben Young Tae Kim 2015-08-10 336 { 83e81961 Ben Young Tae Kim 2015-08-10 337 struct rome_config config; 83e81961 Ben Young Tae Kim 2015-08-10 338 int err; 4219d468 Balakrishna Godavarthi 2018-08-03 339 u8 rom_ver; 83e81961 Ben Young Tae Kim 2015-08-10 340 ba493d4f Balakrishna Godavarthi 2018-08-03 341 bt_dev_dbg(hdev, "QCA setup on UART"); 83e81961 Ben Young Tae Kim 2015-08-10 342 83e81961 Ben Young Tae Kim 2015-08-10 343 config.user_baud_rate = baudrate; 83e81961 Ben Young Tae Kim 2015-08-10 344 83e81961 Ben Young Tae Kim 2015-08-10 345 /* Download rampatch file */ 83e81961 Ben Young Tae Kim 2015-08-10 346 config.type = TLV_TYPE_PATCH; cc8a70bd Harish Bandi 2019-03-27 347 if (qca_is_wcn399x(soc_type)) { 4219d468 Balakrishna Godavarthi 2018-08-03 348 /* Firmware files to download are based on ROM version. 4219d468 Balakrishna Godavarthi 2018-08-03 349 * ROM version is derived from last two bytes of soc_ver. 4219d468 Balakrishna Godavarthi 2018-08-03 350 */ 4219d468 Balakrishna Godavarthi 2018-08-03 351 rom_ver = ((soc_ver & 0x0f00) >> 0x04) | 4219d468 Balakrishna Godavarthi 2018-08-03 352 (soc_ver & 0x000f); 4219d468 Balakrishna Godavarthi 2018-08-03 353 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 354 "qca/crbtfw%02x.tlv", rom_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 355 } else { 4219d468 Balakrishna Godavarthi 2018-08-03 356 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 357 "qca/rampatch_%08x.bin", soc_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 358 } 4219d468 Balakrishna Godavarthi 2018-08-03 359 ba493d4f Balakrishna Godavarthi 2018-08-03 360 err = qca_download_firmware(hdev, ); 83e81961 Ben Young Tae Kim 2015-08-10 361 if (err < 0) { ba493d4f Balakrishna Godavarthi 2018-08-03 362 bt_dev_err(hdev, "QCA Failed to download patch (%d)", err); 83e81961 Ben Young Tae Kim 2015-08-10 363 return err; 83e81961 Ben Young Tae Kim 2015-08-10 364 } 83e81961 Ben Young Tae Kim 2015-08-10 365 83e81961 Ben Young Tae Kim 2015-08-10 366 /* Download NVM configuration */ 83e81961 Ben Young Tae Kim 2015-08-10 367 config.type = TLV_TYPE_NVM; cc8a70bd Harish Bandi 2019-03-27 368 if (qca_is_wcn399x(soc_type)) 4219d468 Balakrishna Godavarthi 2018-08-03 @369 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 370 "qca/crnv%02x.bin", rom_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 371 else 4219d468 Balakrishna Godavarthi 2018-08-03 372 snprintf(config.fwname, sizeof(config.fwname), 4219d468 Balakrishna Godavarthi 2018-08-03 373 "qca/nvm_%08x.bin", soc_ver); 4219d468 Balakrishna Godavarthi 2018-08-03 374
Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
On Wed, Mar 27, 2019 at 05:58:42PM +0530, Harish Bandi wrote: > Added new compatible for WCN3998 and corresponding voltage > and current values to WCN3998 compatible. > Changed driver code to support WCN3998 > > Signed-off-by: Harish Bandi You forgot to add 'Reviewed-by' my tag from v5. No need to resend, I'll add it again below, but it's the general practice to include tags like 'Reviewed-by' or 'Acked-by' when sending a new revision. > --- > Changes in V6: > - changed return value to false in the qca_is_wcn399x()stub > --- > drivers/bluetooth/btqca.c | 13 +++-- > drivers/bluetooth/btqca.h | 8 +++- > drivers/bluetooth/hci_qca.c | 40 ++-- > 3 files changed, 44 insertions(+), 17 deletions(-) > > diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c > index 6122685..383e99f 100644 > --- a/drivers/bluetooth/btqca.c > +++ b/drivers/bluetooth/btqca.c > @@ -344,7 +344,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, > > /* Download rampatch file */ > config.type = TLV_TYPE_PATCH; > - if (soc_type == QCA_WCN3990) { > + if (qca_is_wcn399x(soc_type)) { > /* Firmware files to download are based on ROM version. >* ROM version is derived from last two bytes of soc_ver. >*/ > @@ -365,7 +365,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, > > /* Download NVM configuration */ > config.type = TLV_TYPE_NVM; > - if (soc_type == QCA_WCN3990) > + if (qca_is_wcn399x(soc_type)) > snprintf(config.fwname, sizeof(config.fwname), >"qca/crnv%02x.bin", rom_ver); > else > @@ -410,6 +410,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t > *bdaddr) > } > EXPORT_SYMBOL_GPL(qca_set_bdaddr); > > +bool qca_is_wcn399x(enum qca_btsoc_type soc_type) > +{ > + if ((soc_type == QCA_WCN3990) || (soc_type == QCA_WCN3998)) > + return true; > + > + return false; > +} > +EXPORT_SYMBOL_GPL(qca_is_wcn399x); > + > MODULE_AUTHOR("Ben Young Tae Kim "); > MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver " > VERSION); > MODULE_VERSION(VERSION); > diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h > index 6fdc25d..0f68c9e7 100644 > --- a/drivers/bluetooth/btqca.h > +++ b/drivers/bluetooth/btqca.h > @@ -132,7 +132,8 @@ enum qca_btsoc_type { > QCA_INVALID = -1, > QCA_AR3002, > QCA_ROME, > - QCA_WCN3990 > + QCA_WCN3990, > + QCA_WCN3998, > }; > > #if IS_ENABLED(CONFIG_BT_QCA) > @@ -142,6 +143,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, > enum qca_btsoc_type soc_type, u32 soc_ver); > int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); > int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); > +bool qca_is_wcn399x(enum qca_btsoc_type soc_type); > #else > > static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t > *bdaddr) > @@ -165,4 +167,8 @@ static inline int qca_set_bdaddr(struct hci_dev *hdev, > const bdaddr_t *bdaddr) > return -EOPNOTSUPP; > } > > +static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type) > +{ > + return false; > +} > #endif > diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c > index 4ea995d..4af580a 100644 > --- a/drivers/bluetooth/hci_qca.c > +++ b/drivers/bluetooth/hci_qca.c > @@ -521,7 +521,7 @@ static int qca_open(struct hci_uart *hu) > if (hu->serdev) { > > qcadev = serdev_device_get_drvdata(hu->serdev); > - if (qcadev->btsoc_type != QCA_WCN3990) { > + if (!qca_is_wcn399x(qcadev->btsoc_type)) { > gpiod_set_value_cansleep(qcadev->bt_en, 1); > } else { > hu->init_speed = qcadev->init_speed; > @@ -627,7 +627,7 @@ static int qca_close(struct hci_uart *hu) > > if (hu->serdev) { > qcadev = serdev_device_get_drvdata(hu->serdev); > - if (qcadev->btsoc_type == QCA_WCN3990) > + if (qca_is_wcn399x(qcadev->btsoc_type)) > qca_power_shutdown(hu); > else > gpiod_set_value_cansleep(qcadev->bt_en, 0); > @@ -1008,7 +1008,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, > uint8_t baudrate) > msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); > > /* Give the controller time to process the request */ > - if (qca_soc_type(hu) == QCA_WCN3990) > + if (qca_is_wcn399x(qca_soc_type(hu))) > msleep(10); > else > msleep(300); > @@ -1084,7 +1084,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu, > > static int qca_check_speeds(struct hci_uart *hu) > { > - if (qca_soc_type(hu) == QCA_WCN3990) { > + if (qca_is_wcn399x(qca_soc_type(hu))) { > if (!qca_get_speed(hu, QCA_INIT_SPEED) && >
Re: [PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
Hi Harish, On 2019-03-27 17:58, Harish Bandi wrote: Added new compatible for WCN3998 and corresponding voltage and current values to WCN3998 compatible. Changed driver code to support WCN3998 Signed-off-by: Harish Bandi --- Changes in V6: - changed return value to false in the qca_is_wcn399x()stub --- drivers/bluetooth/btqca.c | 13 +++-- drivers/bluetooth/btqca.h | 8 +++- drivers/bluetooth/hci_qca.c | 40 ++-- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index 6122685..383e99f 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -344,7 +344,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download rampatch file */ config.type = TLV_TYPE_PATCH; - if (soc_type == QCA_WCN3990) { + if (qca_is_wcn399x(soc_type)) { /* Firmware files to download are based on ROM version. * ROM version is derived from last two bytes of soc_ver. */ @@ -365,7 +365,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download NVM configuration */ config.type = TLV_TYPE_NVM; - if (soc_type == QCA_WCN3990) + if (qca_is_wcn399x(soc_type)) snprintf(config.fwname, sizeof(config.fwname), "qca/crnv%02x.bin", rom_ver); else @@ -410,6 +410,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) } EXPORT_SYMBOL_GPL(qca_set_bdaddr); +bool qca_is_wcn399x(enum qca_btsoc_type soc_type) +{ + if ((soc_type == QCA_WCN3990) || (soc_type == QCA_WCN3998)) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(qca_is_wcn399x); + MODULE_AUTHOR("Ben Young Tae Kim "); MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver " VERSION); MODULE_VERSION(VERSION); diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h index 6fdc25d..0f68c9e7 100644 --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h @@ -132,7 +132,8 @@ enum qca_btsoc_type { QCA_INVALID = -1, QCA_AR3002, QCA_ROME, - QCA_WCN3990 + QCA_WCN3990, + QCA_WCN3998, }; #if IS_ENABLED(CONFIG_BT_QCA) @@ -142,6 +143,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, enum qca_btsoc_type soc_type, u32 soc_ver); int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); +bool qca_is_wcn399x(enum qca_btsoc_type soc_type); #else static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) @@ -165,4 +167,8 @@ static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) return -EOPNOTSUPP; } +static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type) +{ + return false; +} #endif diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 4ea995d..4af580a 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -521,7 +521,7 @@ static int qca_open(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type != QCA_WCN3990) { + if (!qca_is_wcn399x(qcadev->btsoc_type)) { gpiod_set_value_cansleep(qcadev->bt_en, 1); } else { hu->init_speed = qcadev->init_speed; @@ -627,7 +627,7 @@ static int qca_close(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type == QCA_WCN3990) + if (qca_is_wcn399x(qcadev->btsoc_type)) qca_power_shutdown(hu); else gpiod_set_value_cansleep(qcadev->bt_en, 0); @@ -1008,7 +1008,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); /* Give the controller time to process the request */ - if (qca_soc_type(hu) == QCA_WCN3990) + if (qca_is_wcn399x(qca_soc_type(hu))) msleep(10); else msleep(300); @@ -1084,7 +1084,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu, static int qca_check_speeds(struct hci_uart *hu) { - if (qca_soc_type(hu) == QCA_WCN3990) { + if (qca_is_wcn399x(qca_soc_type(hu))) { if (!qca_get_speed(hu, QCA_INIT_SPEED) && !qca_get_speed(hu, QCA_OPER_SPEED)) return -EINVAL; @@ -1116,7 +1116,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) /* Disable flow control for wcn3990 to deassert RTS while * changing the baudrate of chip and host. */ - if
[PATCH v6 1/2] Bluetooth: hci_qca: Added support for WCN3998
Added new compatible for WCN3998 and corresponding voltage and current values to WCN3998 compatible. Changed driver code to support WCN3998 Signed-off-by: Harish Bandi --- Changes in V6: - changed return value to false in the qca_is_wcn399x()stub --- drivers/bluetooth/btqca.c | 13 +++-- drivers/bluetooth/btqca.h | 8 +++- drivers/bluetooth/hci_qca.c | 40 ++-- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index 6122685..383e99f 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -344,7 +344,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download rampatch file */ config.type = TLV_TYPE_PATCH; - if (soc_type == QCA_WCN3990) { + if (qca_is_wcn399x(soc_type)) { /* Firmware files to download are based on ROM version. * ROM version is derived from last two bytes of soc_ver. */ @@ -365,7 +365,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download NVM configuration */ config.type = TLV_TYPE_NVM; - if (soc_type == QCA_WCN3990) + if (qca_is_wcn399x(soc_type)) snprintf(config.fwname, sizeof(config.fwname), "qca/crnv%02x.bin", rom_ver); else @@ -410,6 +410,15 @@ int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) } EXPORT_SYMBOL_GPL(qca_set_bdaddr); +bool qca_is_wcn399x(enum qca_btsoc_type soc_type) +{ + if ((soc_type == QCA_WCN3990) || (soc_type == QCA_WCN3998)) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(qca_is_wcn399x); + MODULE_AUTHOR("Ben Young Tae Kim "); MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver " VERSION); MODULE_VERSION(VERSION); diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h index 6fdc25d..0f68c9e7 100644 --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h @@ -132,7 +132,8 @@ enum qca_btsoc_type { QCA_INVALID = -1, QCA_AR3002, QCA_ROME, - QCA_WCN3990 + QCA_WCN3990, + QCA_WCN3998, }; #if IS_ENABLED(CONFIG_BT_QCA) @@ -142,6 +143,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, enum qca_btsoc_type soc_type, u32 soc_ver); int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); +bool qca_is_wcn399x(enum qca_btsoc_type soc_type); #else static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) @@ -165,4 +167,8 @@ static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) return -EOPNOTSUPP; } +static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type) +{ + return false; +} #endif diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 4ea995d..4af580a 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -521,7 +521,7 @@ static int qca_open(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type != QCA_WCN3990) { + if (!qca_is_wcn399x(qcadev->btsoc_type)) { gpiod_set_value_cansleep(qcadev->bt_en, 1); } else { hu->init_speed = qcadev->init_speed; @@ -627,7 +627,7 @@ static int qca_close(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type == QCA_WCN3990) + if (qca_is_wcn399x(qcadev->btsoc_type)) qca_power_shutdown(hu); else gpiod_set_value_cansleep(qcadev->bt_en, 0); @@ -1008,7 +1008,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); /* Give the controller time to process the request */ - if (qca_soc_type(hu) == QCA_WCN3990) + if (qca_is_wcn399x(qca_soc_type(hu))) msleep(10); else msleep(300); @@ -1084,7 +1084,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu, static int qca_check_speeds(struct hci_uart *hu) { - if (qca_soc_type(hu) == QCA_WCN3990) { + if (qca_is_wcn399x(qca_soc_type(hu))) { if (!qca_get_speed(hu, QCA_INIT_SPEED) && !qca_get_speed(hu, QCA_OPER_SPEED)) return -EINVAL; @@ -1116,7 +1116,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) /* Disable flow control for wcn3990 to deassert RTS while * changing the baudrate of chip and host. */ - if (soc_type == QCA_WCN3990) + if