Skip to content

Commit ee1a800

Browse files
committed
Add support for new gen3 devices share with gen2 chip id, for example: 0x8087:0x0026.
1 parent 47f943f commit ee1a800

File tree

5 files changed

+246
-102
lines changed

5 files changed

+246
-102
lines changed

IntelBluetoothFirmware/IntelBluetoothFirmware.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,10 @@ bool IntelBluetoothFirmware::start(IOService *provider)
7272
stop(this);
7373
return false;
7474
}
75-
switch (currentType) {
76-
case kTypeGen1:
77-
m_pBTIntel = new IntelBluetoothOpsGen1();
78-
break;
79-
case kTypeGen2:
80-
m_pBTIntel = new IntelBluetoothOpsGen2();
81-
break;
82-
case kTypeGen3:
83-
m_pBTIntel = new IntelBluetoothOpsGen3();
84-
break;
75+
if (currentType == kTypeGen1) {
76+
m_pBTIntel = new IntelBluetoothOpsGen1();
77+
} else {
78+
m_pBTIntel = new IntelBluetoothOpsGen3();
8579
}
8680
if (!m_pBTIntel->initWithDevice(this, m_pDevice)) {
8781
XYLog("start fail, can not init device\n");

IntelBluetoothFirmware/IntelBluetoothOpsGen2.cpp

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
OSDefineMetaClassAndStructors(IntelBluetoothOpsGen2, BtIntel)
1313

1414
bool IntelBluetoothOpsGen2::
15-
setup()
15+
bootloaderSetup(IntelVersion *ver)
1616
{
17-
IntelVersion ver;
17+
IntelVersion newVer;
1818
IntelBootParams params;
19-
IntelDebugFeatures features;
2019
uint32_t bootParams;
2120
char ddcname[64];
2221

@@ -26,26 +25,12 @@ setup()
2625
*/
2726
bootParams = 0x00000000;
2827

29-
/* Read the Intel version information to determine if the device
30-
* is in bootloader mode or if it already has operational firmware
31-
* loaded.
32-
*/
33-
if (!readVersion(&ver)) {
34-
XYLog("Intel Read version failed\n");
35-
resetToBootloader();
36-
return false;
37-
}
38-
39-
if (!intelVersionInfo(&ver)) {
40-
return false;
41-
}
42-
43-
if (!downloadFirmware(&ver, &params, &bootParams)) {
28+
if (!downloadFirmware(ver, &params, &bootParams)) {
4429
return false;
4530
}
4631

4732
/* controller is already having an operational firmware */
48-
if (ver.fw_variant == 0x23) {
33+
if (ver->fw_variant == 0x23) {
4934
XYLog("Frimware is already running, finishing\n");
5035
goto finish;
5136
}
@@ -55,7 +40,7 @@ setup()
5540
return false;
5641
}
5742

58-
if (!getFirmware(&ver, &params, ddcname, sizeof(ddcname), "ddc")) {
43+
if (!getFirmware(ver, &params, ddcname, sizeof(ddcname), "ddc")) {
5944
XYLog("Unsupported Intel firmware naming\n");
6045
} else {
6146
/* Once the device is running in operational mode, it needs to
@@ -67,20 +52,12 @@ setup()
6752
loadDDCConfig(ddcname);
6853
}
6954

70-
/* Read the Intel supported features and if new exception formats
71-
* supported, need to load the additional DDC config to enable.
72-
*/
73-
readDebugFeatures(&features);
74-
75-
/* Set DDC mask for available debug features */
76-
setDebugFeatures(&features);
77-
7855
/* Read the Intel version information after loading the FW */
79-
if (!readVersion(&ver)) {
56+
if (!readVersion(&newVer)) {
8057
return false;
8158
}
8259

83-
intelVersionInfo(&ver);
60+
intelVersionInfo(&newVer);
8461

8562
finish:
8663

@@ -96,6 +73,28 @@ setup()
9673
return true;
9774
}
9875

76+
bool IntelBluetoothOpsGen2::
77+
setup()
78+
{
79+
IntelVersion ver;
80+
81+
/* Read the Intel version information to determine if the device
82+
* is in bootloader mode or if it already has operational firmware
83+
* loaded.
84+
*/
85+
if (!readVersion(&ver)) {
86+
XYLog("Intel Read version failed\n");
87+
resetToBootloader();
88+
return false;
89+
}
90+
91+
if (!intelVersionInfo(&ver)) {
92+
return false;
93+
}
94+
95+
return bootloaderSetup(&ver);
96+
}
97+
9998
bool IntelBluetoothOpsGen2::
10099
downloadFirmware(IntelVersion *ver, IntelBootParams *params, uint32_t *bootParams)
101100
{

IntelBluetoothFirmware/IntelBluetoothOpsGen2.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class IntelBluetoothOpsGen2 : public BtIntel {
3838

3939
bool firmwareVersion(uint8_t num, uint8_t ww, uint8_t yy, OSData *fwData, uint32_t *bootAddr);
4040

41+
bool bootloaderSetup(IntelVersion *ver);
42+
4143
private:
4244

4345
bool getFirmware(IntelVersion *ver, IntelBootParams *params, char *name, size_t len, const char *suffix);

0 commit comments

Comments
 (0)