diff mbox series

Bluetooth: Patch for CYW4373 hci up fail issue

Message ID 6267800d70ae4344acaba3486b54bc0c@infineon.com (mailing list archive)
State New
Headers show
Series Bluetooth: Patch for CYW4373 hci up fail issue | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch fail WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #84: Due to the issue, Bluetooth driver of 5.15 and later kernel fails to hci up. WARNING: line length of 138 exceeds 100 columns #114: FILE: drivers/bluetooth/btbcm.c:451: + int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]); WARNING: Prefer ARRAY_SIZE(disable_broken_read_transmit_power_by_chip_ver) #114: FILE: drivers/bluetooth/btbcm.c:451: + int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]); ERROR: that open brace { should be on the previous line #117: FILE: drivers/bluetooth/btbcm.c:454: + for( i=0 ; i<table_size ; i++, entry++) + { ERROR: spaces required around that '=' (ctx:VxV) #117: FILE: drivers/bluetooth/btbcm.c:454: + for( i=0 ; i<table_size ; i++, entry++) ^ ERROR: spaces required around that '<' (ctx:VxV) #117: FILE: drivers/bluetooth/btbcm.c:454: + for( i=0 ; i<table_size ; i++, entry++) ^ ERROR: space prohibited after that open parenthesis '(' #117: FILE: drivers/bluetooth/btbcm.c:454: + for( i=0 ; i<table_size ; i++, entry++) ERROR: space required before the open parenthesis '(' #117: FILE: drivers/bluetooth/btbcm.c:454: + for( i=0 ; i<table_size ; i++, entry++) ERROR: space prohibited after that open parenthesis '(' #119: FILE: drivers/bluetooth/btbcm.c:456: + if( (chip_id == entry->chip_id) && (baseline == entry->baseline) ) ERROR: space prohibited before that close parenthesis ')' #119: FILE: drivers/bluetooth/btbcm.c:456: + if( (chip_id == entry->chip_id) && (baseline == entry->baseline) ) ERROR: space required before the open parenthesis '(' #119: FILE: drivers/bluetooth/btbcm.c:456: + if( (chip_id == entry->chip_id) && (baseline == entry->baseline) ) WARNING: From:/Signed-off-by: email name mismatch: 'From: Nobuaki.Tsunashima@infineon.com' != 'Signed-off-by: Nobuaki Tsunashima <nobuaki.tsunashima@infineon.com>' total: 8 errors, 4 warnings, 59 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13665743.patch has style problems, please review. NOTE: Ignored message types: UNKNOWN_COMMIT_ID NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 8: B1 Line exceeds max length (84>80): "Especially in USB i/f case, it would be difficult to download patch FW that includes" 9: B1 Line exceeds max length (84>80): "Its fix unless hci is up. The patch forces the driver to skip LE_Read_Transmit_Power"
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning warning CheckSparse WARNING drivers/bluetooth/btbcm.c: In function ‘btbcm_is_disable_broken_read_tx_power_by_chip_ver’:drivers/bluetooth/btbcm.c:453:41: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 453 | struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0]; | ^
tedd_an/CheckSparse warning CheckSparse WARNING drivers/bluetooth/btbcm.c: In function ‘btbcm_is_disable_broken_read_tx_power_by_chip_ver’:drivers/bluetooth/btbcm.c:453:41: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]drivers/bluetooth/btbcm.c:453:95: warning: incorrect type in initializer (different modifiers)drivers/bluetooth/btbcm.c:453:95: expected struct bcm_chip_version_table *entrydrivers/bluetooth/btbcm.c:453:95: got struct bcm_chip_version_table const *
tedd_an/CheckSmatch fail CheckSparse: FAIL: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o' make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Nobuaki Tsunashima May 16, 2024, 5:08 a.m. UTC
CYW4373 ROM FW has an issue that it claims LE_Read_Transmit_Power command
as supported in a response of Read_Local_Supported_Command command but
rejects the LE_Read_Transmit_Power command with "Unknown HCI Command"
status.
Due to the issue, Bluetooth driver of 5.15 and later kernel fails to hci up.
Especially in USB i/f case, it would be difficult to download patch FW that includes
Its fix unless hci is up. The patch forces the driver to skip LE_Read_Transmit_Power
Command when it detects CYW4373 with ROM FW build.

Signed-off-by: Nobuaki Tsunashima <nobuaki.tsunashima@infineon.com>

---
 drivers/bluetooth/btbcm.c | 32 +++++++++++++++++++++++++++++++-
 drivers/bluetooth/btusb.c |  4 ++++
 2 files changed, 35 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com May 16, 2024, 5:33 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=853578

---Test result---

Test Summary:
CheckPatch                    FAIL      1.07 seconds
GitLint                       FAIL      0.44 seconds
SubjectPrefix                 PASS      0.07 seconds
BuildKernel                   PASS      29.54 seconds
CheckAllWarning               WARNING   32.16 seconds
CheckSparse                   WARNING   37.46 seconds
CheckSmatch                   FAIL      35.73 seconds
BuildKernel32                 PASS      28.33 seconds
TestRunnerSetup               PASS      516.67 seconds
TestRunner_l2cap-tester       PASS      20.34 seconds
TestRunner_iso-tester         PASS      32.56 seconds
TestRunner_bnep-tester        PASS      4.66 seconds
TestRunner_mgmt-tester        PASS      111.34 seconds
TestRunner_rfcomm-tester      PASS      7.24 seconds
TestRunner_sco-tester         PASS      14.90 seconds
TestRunner_ioctl-tester       PASS      7.65 seconds
TestRunner_mesh-tester        PASS      5.78 seconds
TestRunner_smp-tester         PASS      6.68 seconds
TestRunner_userchan-tester    PASS      4.90 seconds
IncrementalBuild              PASS      27.20 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: Patch for CYW4373 hci up fail issue
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
#84: 
Due to the issue, Bluetooth driver of 5.15 and later kernel fails to hci up.

WARNING: line length of 138 exceeds 100 columns
#114: FILE: drivers/bluetooth/btbcm.c:451:
+	int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]);

WARNING: Prefer ARRAY_SIZE(disable_broken_read_transmit_power_by_chip_ver)
#114: FILE: drivers/bluetooth/btbcm.c:451:
+	int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]);

ERROR: that open brace { should be on the previous line
#117: FILE: drivers/bluetooth/btbcm.c:454:
+	for( i=0 ; i<table_size ; i++, entry++)
+	{

ERROR: spaces required around that '=' (ctx:VxV)
#117: FILE: drivers/bluetooth/btbcm.c:454:
+	for( i=0 ; i<table_size ; i++, entry++)
 	      ^

ERROR: spaces required around that '<' (ctx:VxV)
#117: FILE: drivers/bluetooth/btbcm.c:454:
+	for( i=0 ; i<table_size ; i++, entry++)
 	            ^

ERROR: space prohibited after that open parenthesis '('
#117: FILE: drivers/bluetooth/btbcm.c:454:
+	for( i=0 ; i<table_size ; i++, entry++)

ERROR: space required before the open parenthesis '('
#117: FILE: drivers/bluetooth/btbcm.c:454:
+	for( i=0 ; i<table_size ; i++, entry++)

ERROR: space prohibited after that open parenthesis '('
#119: FILE: drivers/bluetooth/btbcm.c:456:
+		if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )

ERROR: space prohibited before that close parenthesis ')'
#119: FILE: drivers/bluetooth/btbcm.c:456:
+		if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )

ERROR: space required before the open parenthesis '('
#119: FILE: drivers/bluetooth/btbcm.c:456:
+		if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )

WARNING: From:/Signed-off-by: email name mismatch: 'From: Nobuaki.Tsunashima@infineon.com' != 'Signed-off-by: Nobuaki Tsunashima <nobuaki.tsunashima@infineon.com>'

total: 8 errors, 4 warnings, 59 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13665743.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: Patch for CYW4373 hci up fail issue

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
8: B1 Line exceeds max length (84>80): "Especially in USB i/f case, it would be difficult to download patch FW that includes"
9: B1 Line exceeds max length (84>80): "Its fix unless hci is up. The patch forces the driver to skip LE_Read_Transmit_Power"
##############################
Test: CheckAllWarning - WARNING
Desc: Run linux kernel with all warning enabled
Output:
drivers/bluetooth/btbcm.c: In function ‘btbcm_is_disable_broken_read_tx_power_by_chip_ver’:drivers/bluetooth/btbcm.c:453:41: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]  453 |  struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];      |                                         ^
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
drivers/bluetooth/btbcm.c: In function ‘btbcm_is_disable_broken_read_tx_power_by_chip_ver’:drivers/bluetooth/btbcm.c:453:41: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]drivers/bluetooth/btbcm.c:453:95: warning: incorrect type in initializer (different modifiers)drivers/bluetooth/btbcm.c:453:95:    expected struct bcm_chip_version_table *entrydrivers/bluetooth/btbcm.c:453:95:    got struct bcm_chip_version_table const *
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2


---
Regards,
Linux Bluetooth
kernel test robot May 16, 2024, 7:43 p.m. UTC | #2
Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master linus/master v6.9 next-20240516]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nobuaki-Tsunashima-infineon-com/Bluetooth-Patch-for-CYW4373-hci-up-fail-issue/20240516-131000
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/6267800d70ae4344acaba3486b54bc0c%40infineon.com
patch subject: [PATCH] Bluetooth: Patch for CYW4373 hci up fail issue
config: arm-pxa_defconfig (https://download.01.org/0day-ci/archive/20240517/202405170330.QEHgPNm1-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240517/202405170330.QEHgPNm1-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405170330.QEHgPNm1-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/bluetooth/btbcm.c: In function 'btbcm_is_disable_broken_read_tx_power_by_chip_ver':
>> drivers/bluetooth/btbcm.c:453:48: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     453 |         struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];
         |                                                ^


vim +/const +453 drivers/bluetooth/btbcm.c

   440	
   441	struct bcm_chip_version_table {
   442		u8	chip_id;
   443		u16 baseline;
   444	};
   445	#define BCM_ROMFW_BASELINE_NUM	0xFFFF
   446	static const struct bcm_chip_version_table disable_broken_read_transmit_power_by_chip_ver[] = {
   447		{0x87, BCM_ROMFW_BASELINE_NUM}		/* CYW4373/4373E */
   448	};
   449	static bool btbcm_is_disable_broken_read_tx_power_by_chip_ver(u8 chip_id, u16 baseline)
   450	{
   451		int i;
   452		int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]);
 > 453		struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];
   454	
   455		for( i=0 ; i<table_size ; i++, entry++)
   456		{
   457			if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )
   458				return true;
   459		}
   460	
   461		return false;
   462	}
   463
kernel test robot May 16, 2024, 8:57 p.m. UTC | #3
Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on bluetooth/master]
[also build test ERROR on bluetooth-next/master linus/master v6.9 next-20240516]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nobuaki-Tsunashima-infineon-com/Bluetooth-Patch-for-CYW4373-hci-up-fail-issue/20240516-131000
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/6267800d70ae4344acaba3486b54bc0c%40infineon.com
patch subject: [PATCH] Bluetooth: Patch for CYW4373 hci up fail issue
config: x86_64-buildonly-randconfig-003-20240517 (https://download.01.org/0day-ci/archive/20240517/202405170433.qYUNBTtS-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240517/202405170433.qYUNBTtS-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405170433.qYUNBTtS-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/bluetooth/btbcm.c:453:33: error: initializing 'struct bcm_chip_version_table *' with an expression of type 'const struct bcm_chip_version_table *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
     453 |         struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];
         |                                        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 error generated.


vim +453 drivers/bluetooth/btbcm.c

   440	
   441	struct bcm_chip_version_table {
   442		u8	chip_id;
   443		u16 baseline;
   444	};
   445	#define BCM_ROMFW_BASELINE_NUM	0xFFFF
   446	static const struct bcm_chip_version_table disable_broken_read_transmit_power_by_chip_ver[] = {
   447		{0x87, BCM_ROMFW_BASELINE_NUM}		/* CYW4373/4373E */
   448	};
   449	static bool btbcm_is_disable_broken_read_tx_power_by_chip_ver(u8 chip_id, u16 baseline)
   450	{
   451		int i;
   452		int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]);
 > 453		struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];
   454	
   455		for( i=0 ; i<table_size ; i++, entry++)
   456		{
   457			if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )
   458				return true;
   459		}
   460	
   461		return false;
   462	}
   463
kernel test robot May 16, 2024, 11:22 p.m. UTC | #4
Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master linus/master v6.9 next-20240516]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nobuaki-Tsunashima-infineon-com/Bluetooth-Patch-for-CYW4373-hci-up-fail-issue/20240516-131000
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/6267800d70ae4344acaba3486b54bc0c%40infineon.com
patch subject: [PATCH] Bluetooth: Patch for CYW4373 hci up fail issue
config: i386-randconfig-062-20240517 (https://download.01.org/0day-ci/archive/20240517/202405170648.10OEk1LW-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240517/202405170648.10OEk1LW-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405170648.10OEk1LW-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/bluetooth/btbcm.c:453:95: sparse: sparse: incorrect type in initializer (different modifiers) @@     expected struct bcm_chip_version_table *entry @@     got struct bcm_chip_version_table const * @@
   drivers/bluetooth/btbcm.c:453:95: sparse:     expected struct bcm_chip_version_table *entry
   drivers/bluetooth/btbcm.c:453:95: sparse:     got struct bcm_chip_version_table const *

vim +453 drivers/bluetooth/btbcm.c

   440	
   441	struct bcm_chip_version_table {
   442		u8	chip_id;
   443		u16 baseline;
   444	};
   445	#define BCM_ROMFW_BASELINE_NUM	0xFFFF
   446	static const struct bcm_chip_version_table disable_broken_read_transmit_power_by_chip_ver[] = {
   447		{0x87, BCM_ROMFW_BASELINE_NUM}		/* CYW4373/4373E */
   448	};
   449	static bool btbcm_is_disable_broken_read_tx_power_by_chip_ver(u8 chip_id, u16 baseline)
   450	{
   451		int i;
   452		int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]);
 > 453		struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];
   454	
   455		for( i=0 ; i<table_size ; i++, entry++)
   456		{
   457			if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )
   458				return true;
   459		}
   460	
   461		return false;
   462	}
   463
diff mbox series

Patch

diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 0a5445ac5e1b..c64d1ddd140d 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -437,18 +437,48 @@  static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 	{ }
 };
 
+struct bcm_chip_version_table {
+	u8	chip_id;
+	u16 baseline;
+};
+#define BCM_ROMFW_BASELINE_NUM	0xFFFF
+static const struct bcm_chip_version_table disable_broken_read_transmit_power_by_chip_ver[] = {
+	{0x87, BCM_ROMFW_BASELINE_NUM}		/* CYW4373/4373E */
+};
+static bool btbcm_is_disable_broken_read_tx_power_by_chip_ver(u8 chip_id, u16 baseline)
+{
+	int i;
+	int table_size = sizeof(disable_broken_read_transmit_power_by_chip_ver)/sizeof(disable_broken_read_transmit_power_by_chip_ver[0]);
+	struct bcm_chip_version_table *entry = &disable_broken_read_transmit_power_by_chip_ver[0];
+
+	for( i=0 ; i<table_size ; i++, entry++)
+	{
+		if( (chip_id == entry->chip_id) && (baseline == entry->baseline) )
+			return true;
+	}
+
+	return false;
+}
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	u8 chip_id;
+	u16 baseline;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
 	if (IS_ERR(skb))
 		return PTR_ERR(skb);
-
+	chip_id = skb->data[1];
+	baseline = skb->data[3] | (skb->data[4] << 8);
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Check Chip ID and disable broken Read LE Min/Max Tx Power */
+	if (btbcm_is_disable_broken_read_tx_power_by_chip_ver(chip_id, baseline))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index d31edad7a056..52561c8d8828 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -142,6 +142,10 @@  static const struct usb_device_id btusb_table[] = {
 	{ USB_VENDOR_AND_INTERFACE_INFO(0x04ca, 0xff, 0x01, 0x01),
 	  .driver_info = BTUSB_BCM_PATCHRAM },
 
+	/* Cypress devices with vendor specific id */
+	{ USB_VENDOR_AND_INTERFACE_INFO(0x04b4, 0xff, 0x01, 0x01),
+	  .driver_info = BTUSB_BCM_PATCHRAM },
+
 	/* Broadcom devices with vendor specific id */
 	{ USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01),
 	  .driver_info = BTUSB_BCM_PATCHRAM },