/
Теги: document user manual
Год: 2011
Текст
LY
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Bluetooth HCI Transport Driver
Customer Document
Version:
Release date:
3.0
2011-12-08
© 2008 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Specifications are subject to change without notice.
LY
MT6620
Confidential B
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Document Revision History
Revision
Date
Author
Description
0.1
2010-05-24
CH Yeh
Initial Draft
0.2
2010-06-05
Chunhui Li
Second version
0.3
2010-06-18
Chunhui Li
Third version
1.0
2010-06-18
Chunhui Li
1.0 official version
2.0
2010-11-26
Enlai Chu
Update for Android 2.2(MTK BT solution)
2.1
2011-09-19
Tingting Lei
Update for MT6622/MT6626
3.0
2011-11-10
Tingting Lei
Merge all supported Bluetooth controllers (standalone chip &
combo chip)
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 2 of 31
LY
MT6620
Confidential B
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Table of Contents
Document Revision History .................................................................................................................. 2
Table of Contents ................................................................................................................................... 3
1
Introduction................................................................................................................................... 4
1.1
1.2
1.3
2
Design............................................................................................................................................ 6
2.1
2.2
3
3.2
User Space Functions ........................................................................................................ 11
3.1.1
mtk ...................................................................................................................... 11
3.1.2
bt_restore ........................................................................................................... 11
Kernel Functions ................................................................................................................. 12
3.2.1
mt_bt_power_on / mt_bt_power_off................................................................... 12
3.2.2
mt_bt_enable_irq/ mt_bt_disable_irq ................................................................. 12
3.2.3
mt_bt_eirq_handler ............................................................................................ 12
Customization ............................................................................................................................. 14
4.1
4.2
4.3
4.4
4.5
5
Architecture........................................................................................................................... 6
2.1.1
MT661x/MT6622/MT6626 .................................................................................... 6
2.1.2
MT6620 ................................................................................................................ 7
Procedure & Flow ................................................................................................................. 9
2.2.1
MT661x/MT6622/MT6626 .................................................................................... 9
2.2.2
MT6620 .............................................................................................................. 10
Interface....................................................................................................................................... 11
3.1
4
Software/Hardware Environment ......................................................................................... 4
1.1.1
Software Environment .......................................................................................... 4
1.1.2
Hardware Environment ........................................................................................ 4
Functionality.......................................................................................................................... 4
Hardware Background .......................................................................................................... 4
1.3.1
Hardware component used in this driver.............................................................. 4
1.3.2
Hardware connection ........................................................................................... 4
Firmware Configurations in NVRAM .................................................................................. 14
4.1.1
MT661x .............................................................................................................. 15
4.1.2
MT6620 .............................................................................................................. 17
4.1.3
MT6622/26 ......................................................................................................... 21
Bluetooth Related GPIO Pins ............................................................................................. 28
4.2.1
MT661x/MT6622/MT6626 .................................................................................. 28
4.2.2
MT6620 .............................................................................................................. 28
Bluetooth UART port and baud rate Customization ........................................................... 29
Bluetooth Chip Selection .................................................................................................... 29
Bluetooth Firmware patch Update ...................................................................................... 30
Build............................................................................................................................................. 31
5.1
5.2
Source Code Structure & File Description.......................................................................... 31
Build Option ........................................................................................................................ 31
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 3 of 31
LY
MT6620
Confidential B
Introduction
1.1
Software/Hardware Environment
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
1
1.1.1
Software Environment
Driver discussed in this document is designed based on Linux Kernel 2.6.35 and Android 2.3.
Bluetooth protocol stack is BlueAngel.
1.1.2
Hardware Environment
Driver discussed in this document can run on the devices with MT6573. Bluetooth Controller covers
standalone chip MT6611/MT6612/MT6616/MT6622/MT6626 and combo chip MT6620.
Notice:
MT661x is not supported on MT6573 currently, it runs on MT6516.
1.2
Functionality
This driver is used to provide an HCI transport driver. The main functionality is
(1) To power up/down Bluetooth controller.
(2) To handle external interrupt generated by Bluetooth controller.
(3) To init Bluetooth controller.
On combo chip MT6620, power and interrupt are centralized controlled by low-layer WMT driver, so
only the last function is performed here.
1.3
1.3.1
Hardware Background
Hardware component used in this driver
Following Bluetooth controllers are supported:
MT6611/MT6612/MT6616/MT6622/MT6626, in which MT6616/MT6626 are the controllers with
Bluetooth/FM features;
MT6620 combo chip, the controller with Bluetooth/Wi-Fi/GPS/FM features together.
1.3.2
Hardware connection
UART Tx/Rx are used to exchange HCI packets between controller and MT6573. An external interrupt
is used to wake up MT6573.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 4 of 31
LY
MT6620
Confidential B
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
VBAT
LDO
BT_PWR_EN
BT_RESET
MT6573
RTCCLK_32k
Controller
EINT
MT6622/26
UART
PCM
Figure 1 MT6573 and MT6622/26 connection
VBAT
LDO
PMU_EN
RST
RTCCLK_32k
MT6573
GPS_SYNC
EINT
MT6620
I2S
UART
PCM
SDIO
Figure 2 MT6573 and MT6620 connection
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 5 of 31
Design
2.1
Architecture
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
2
LY
MT6620
Confidential B
Bluetooth transport driver invoked by BlueAngel stack mtkbt to initialize Bluetooth controllers.
2.1.1
MT661x/MT6622/MT6626
Figure 3 Android System Architecture (standalone BT chip)
Use rfkill to power on/off Bluetooth controller, write rfkill state: /sys/class/rfkill/rfkill0/state.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 6 of 31
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
LY
MT6620
Confidential B
BlueAngel
Transport
ttySn Driver
(libhciattach_mtk.so)
Power On
Init chip library
(libbluetoothinit_mtk.so)
User Space
Linux Kernel
UART Driver
BT Power On/Off
Hardware
Bluetooth
Chip
Figure 4 Android Bluetooth Architecture (standalone BT chip)
2.1.2
MT6620
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 7 of 31
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
LY
MT6620
Confidential B
Figure 5 Android System Architecture (combo chip)
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 8 of 31
LY
MT6620
Confidential B
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
BlueAngel
Transport
ttySn Driver
(libhciattach_mtk.so)
Power On
Init chip library
(libbluetoothinit_mtk.so)
/dev/stpbt
WMT Driver
STP Driver
UART Driver
MT6620
Figure 6 Android Bluetooth Architecture (combo chip)
2.2
Procedure & Flow
The following describes the procedure & flow of Bluetooth transport driver.
2.2.1
MT661x/MT6622/MT6626
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 9 of 31
libhciattach_mtk.so libbluetoothinit_mtk.so
ttySn
Board.c
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
mtkbt
LY
MT6620
Confidential B
Power On
Open uart
mtk()
…
…
…
Bt_restore()
Close uart
Power Off
Figure 7 Bluetooth initialize and de-initialize procedure (standalone chip)
2.2.2
MT6620
mtkbt
Libhciattach_mtk.so
libbluetoothinit_mtk.so
stpbt
Power On
Open stpbt
mtk()
…
…
Bt_restore()
Close stpbt
Power Off
Figure 8 Bluetooth initialize and de-initialize procedure (combo chip)
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 10 of 31
LY
MT6620
Confidential B
Interface
3.1
User Space Functions
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
3
Path: alps/mediate/source/external/bluetooth/driver/mtk.c
3.1.1
mtk
Initialize Bluetooth controller.
Interface of libhciattach_mtk.so, which will load libbluetoothinit_mtk.so to perform chip initialize
procedure. It is called by mtkbt executable.
Prototype
int mtk(int fd, struct uart_t *u, struct termios *ti)
Description
This function implements the MTK chip init procedure.
Parameters
In
fd
UART serial port file descriptor
in
u
Struct defined in hci_attach.c for uart parameter transfer.
in
ti
Unused.
Return Value
0: success;
Otherwise: error
3.1.2
bt_restore
Interface of libhciattach_mtk.so, which will load libbluetoothinit_mtk.so to deinit BT chip if needed. It is
called by mtkbt executable.
Prototype
int bt_restore(int fd)
Description
This function will restore the BT chip to initial state if needed.
Parameters
In
fd
UART serial port file descriptor
Return Value
0: success;
Otherwise: error
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 11 of 31
Kernel Functions
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
3.2
LY
MT6620
Confidential B
3.2.1
mt_bt_power_on / mt_bt_power_off
Path: alps/mediate/custom/[project]/kernel/core/src/board.c
Power on/off Bluetooth controller.
Not used on combo chip MT6620, the power is controlled centralize in WMT driver.
Prototype
void mt_bt_power_on (void)
Parameters
Return Value
void
Prototype
void mt_bt_power_off (void)
Parameters
Return Value
void
3.2.2
mt_bt_enable_irq/ mt_bt_disable_irq
Path: alps/mediate/custom/[project]/kernel/core/src/board.c
Enable/disable BT EINT (external interrupt).
Not used on combo chip MT6620, the EINT is controlled in WMT driver.
Prototype
void mt_bt_enable_irq (void)
Parameters
Return Value
Void
Prototype
void mt_bt_disable_irq (void)
Parameters
Return Value
void
3.2.3
mt_bt_eirq_handler
Path: alps/mediate/platform/mt6573/kernel/core/mt_bt.c
BT interrupt handler, which is called when EINT comes.
Not used on combo chip MT6620.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 12 of 31
LY
MT6620
Confidential B
Prototype
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
void mt_bt_eirq_handler (void* param)
Parameters
Return Value
Void
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 13 of 31
LY
MT6620
Confidential B
Customization
4.1
Firmware Configurations in NVRAM
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4
Customer can change BT firmware configurations stored in NVRAM, address index
AP_CFG_RDEB_FILE_BT_ADDR_LID. Those settings will be set to controller by vendor-specific HCI
commands.
BT NVRAM data structure is different by chipsets:
MT661x:
MT6620:
MT6622/26:
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 14 of 31
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
LY
MT6620
Confidential B
Customer can use AP NVRAM Editor to modify the default values stored in NVRAM.
4.1.1
4.1.1.1
MT661x
Bluetooth Address
Parameter
Bluetooth address
MediaTek Confidential
Bytes
Parameter Description
Byte 0:0x4c
Byte 1:0x12
Byte 2:0x66
Byte 3:0x46
Byte 4:0x8e
Byte 5:0x76
6
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 15 of 31
Bluetooth Calibration Data
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.1.1.2
LY
MT6620
Confidential B
In Radio Frequency Test Spec, it is specified that “Each of the EUT’s carrier frequency f0 as measured
must be within ±75 kHz from the EUT’s chosen nominal carrier frequency fTX. To pass this test item,
we need some instruments, such as CBT Bluetooth Tester to help us measure the carrier frequency,
and a mechanism to adjust the carrier frequency when it is too high or too low.
The calibration data is stored in NVRAM, which may be requested to change by customer.
Parameter
Bytes
Default
(Byte
0:
LSB)
Parameter Description
This parameter is provided to adjust the carrier frequency when it is too
high or too low.
Cap ID has 26 scales, an example of the effect on the carrier frequency
when adjusting Cap ID value is shown in below table:
Cap ID
4.1.1.3
Byte
0:0x40
1
Bluetooth PCM Configuration
Below parameters are used for setting PCM format.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 16 of 31
Default
(Byte 0: LSB)
Bytes
Parameter Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Parameter
LY
MT6620
Confidential B
xxxxx000: PCM clock output at 128KHz
xxxxx001: PCM clock output at 1024KHz
xxxxx010: PCM clock output at 63KHz
xxxxx011: PCM clock input mode
xxxxx100: PCM clock output at 256KHz
xxxxx101: PCM clock output at 512KHz
xxxxx11x: Reserved
PCM Setting:
VCI_CLK_SEL &
VCI_CLK_SEL_MAP
PCM Setting: VCI
Sync Direction
1
Byte 0:0x23
xxxx0xxx: Input (slave)
xxxx1xxx: Output (master)
PCM Setting: PCM
1M CLK
xxx0xxxx: PCM clock input < 1MHz
xxx1xxxx: PCM clock input >=1MHz
PCM Setting: Frame
Sync Format
xx0xxxxx: Long Frame Sync
xx1xxxxx: Short Frame Sync
PCM Setting: LSB or
MSB first
x0xxxxxx: MSB first
x1xxxxxx: LSB first
PCM Setting: Sign
Extension
0xxxxxxx: Zero padding
1xxxxxxx: Sign Extension
4.1.2
4.1.2.1
MT6620
Bluetooth Address
Parameter
Bluetooth address
4.1.2.2
Bytes
Parameter Description
Byte 0:0x8b
Byte 1:0x20
Byte 2:0x66
Byte 3:0x46
Byte 4:0x90
Byte 5:0x5e
6
Bluetooth Voice Configuration
Below parameters are used for default voice settings for SCO connection.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 17 of 31
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
LY
MT6620
Confidential B
Parameter
Bytes
Voice Setting
4.1.2.3
2
Default
(Byte 0: LSB)
Byte 0:0x60
Byte 1:0x00
Parameter Description
Please refer to Bluetooth Core Specification
V2.1,volume 2, part E
Bluetooth PCM Configuration
Below parameters are used for setting PCM format.
Parameter
Bytes
Default
(Byte 0: LSB)
PCM Setting:
VCI_CLK_SEL &
VCI_CLK_SEL_MAP
1
Byte 0:0x23
Parameter Description
xxxxx000: PCM clock output at 128KHz
xxxxx001: PCM clock output at 1024KHz
xxxxx010: PCM clock output at 63KHz
xxxxx011: PCM clock input mode
xxxxx100: PCM clock output at 256KHz
xxxxx101: PCM clock output at 512KHz
xxxxx11x: Reserved
PCM Setting: VCI
Sync Direction
xxxx0xxx: Input (slave)
xxxx1xxx: Output (master)
PCM Setting: PCM
1M CLK
xxx0xxxx: PCM clock input < 1MHz
xxx1xxxx: PCM clock input >=1MHz
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 18 of 31
Bytes
Default
(Byte 0: LSB)
Parameter Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Parameter
LY
MT6620
Confidential B
PCM Setting: Frame
Sync Format
xx0xxxxx: Long Frame Sync
xx1xxxxx: Short Frame Sync
PCM Setting: LSB or
MSB first
x0xxxxxx: MSB first
x1xxxxxx: LSB first
PCM Setting: Sign
Extension
0xxxxxxx: Zero padding
1xxxxxxx: Sign Extension
PCM Setting: Bit
width
xxx00000-xxx11111: Valid bit for PCM Setting
PCM Setting: PCM
setting format
1
Byte 1:0x10
x00xxxxx: PCM setting format
PCM Setting:
PCM_32BIT
1xxxxxxx: PCM Setting in 32 bit mode
PCM Setting:
RX_BYTE_SWAP
xxxxxxx0: In 32bit mode RX use SWAP or not
PCM Setting:
TX_BTYE_SWAP
xxxxxx0x: In 32bit mode TX use SWAP or not
PCM Setting:
TWO_WORD
1
Byte 2:0x00
xxxxx0xx: In 32bit mode, two word or not.
PCM Setting:
16K_SYNC
xxxx0xxx: sync in 8K or 16K.
Reserved
4.1.2.4
1
Byte 3:0x00
Reserved
Bluetooth RF Configuration
Below parameters are used for default RF settings.
Parameter
Bytes
Radio Init power
1
MediaTek Confidential
Default
(Byte 0: LSB)
Byte 0:0x06
Parameter Description
Initial RF output power step, range: 0~7.
Decreasing the value 1 decrease the output
power about 4dB.
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 19 of 31
Bytes
Default
(Byte 0: LSB)
Parameter Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Parameter
LY
MT6620
Confidential B
Peer power monitor
period
2
Byte 1:0x80
Byte 2:0x00
Internal Setting
2
Byte 3:0x06
Byte 4:0x03
Tx max power level
1
Byte 5:0x06
4.1.2.5
This parameter controls the frequency to scan
each active link and determine if power levels
should be adjusted.
Internal Setting
Max power step of RF output power, range:
0~7.
Bluetooth Sleep Mode Configuration
Below parameters are used for setting Bluetooth sleep mode.
Parameter
Low power
mode
Bytes
sleep
1
Default
(Byte 0: LSB)
Byte 0:0x03
Non sleep duration
2
Byte 1:0x40
Byte 2:0x1F
Host
non
duration
2
Byte 1:0x40
Byte 2:0x1F
Wake up host pin
1
Byte 4:0x00
Timing compensation
slots
1
Byte 5:0x04
sleep
Parameter Description
0x00: Disable low power mode
0x03: Enable low power mode
When there is no activity on UART TX/RX in
last “Non sleep duration”, BT may go into low
power state.
When there is no activity on UART TX/RX in
last “Host non sleep duration”, host may go into
low power state.
GPIO pin number of BT to wakeup host.
MediaTek Confidential
Duration of timing compensation after wakeup.
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 20 of 31
TX Power Channel Offset Compensation
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.1.2.6
LY
MT6620
Confidential B
The channel compensation may be requested to change by customer if he cares about the channel
flatness at BPF-out, because the channel flatness at BPF-out will change by different BPF. Therefore,
MTK provides a method to let the modification be easy for customer. The channels are separated to
three groups, so the NVRAM need three bytes to save the compensation offset. The default value of
the three bytes is {0xFF, 0xFF, 0xFF}.
Parameter
Tx Power Offset
4.1.3
4.1.3.1
Default
(Byte 0: LSB)
Bytes
3
Byte 0:0xFF
Byte 1:0xFF
Byte 2:0xFF
Parameter Description
The channel flatness at BPF-out will be
changed by different BPF.
MT6622/26
Bluetooth Address
Parameter
Bluetooth address
MediaTek Confidential
Bytes
6
Parameter Description
Byte 0, 4, 5 are auto generated.
MT6622 example:
Byte 0:0x4c
Byte 1:0x22
Byte 2:0x66
Byte 3:0x46
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 21 of 31
Parameter
Bytes
LY
MT6620
Confidential B
Parameter Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Byte 4:0x8e
Byte 5:0x76
MT6626 example:
Byte 0:0x4c
Byte 1:0x26
Byte 2:0x66
Byte 3:0x46
Byte 4:0x8e
Byte 5:0x76
4.1.3.2
Bluetooth Calibration Setting
Parameter
Bytes
Cap ID
4.1.3.3
1
Default
(Byte 0: LSB)
Byte 0:0x40
Parameter Description
Please refer to 4.1.1.2.
Bluetooth Link Key Type Configuration
Link key is used for all security transactions between two Bluetooth devices. It can either be a
combination key or one of the device’s unit key. Below parameters are used for setting default link key
type.
Parameter
Bytes
Link Key Type
4.1.3.4
1
Default
(Byte 0: LSB)
Byte 0:0x01
Parameter Description
00: Unit key
01: Combination key
Bluetooth Unit Key Configuration
Below parameters are used for setting default unit key value stored in Bluetooth controller.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 22 of 31
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
LY
MT6620
Confidential B
Parameter
Bytes
Unit Key
4.1.3.5
Default
(Byte 0: LSB)
Parameter Description
Unit key is disabled, link key uses combination
key now.
16
Bluetooth Encryption Configuration
Encryption key is generated during authentication process, if encryption mode is on. Below
parameters are used for default encryption settings.
Parameter
Bytes
Encryption mode
MediaTek Confidential
1
Default
(Byte 0: LSB)
Byte 0:0x00
Parameter Description
0x00: Encryption mode OFF
0x03: Encryption mode ON
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 23 of 31
Bytes
Default
(Byte 0: LSB)
Parameter Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Parameter
LY
MT6620
Confidential B
Min Key Size
1
Byte 1:0x02
Max Key Size
1
Byte 2:0x10
4.1.3.6
Encryption key is generated between this size
limit.
Bluetooth Pin Code Type Configuration
Below parameters are used for setting the pin code type used for pairing.
Parameter
Bytes
Pin Code Type
4.1.3.7
1
Default
(Byte 0: LSB)
Byte 0:0x00
Parameter Description
00: Variable PIN
01: Fixed PIN
Bluetooth Voice Configuration
Parameter
Bytes
Voice Setting
2
MediaTek Confidential
Default
(Byte 0: LSB)
Byte 0:0x60
Byte 1:0x00
Parameter Description
Please refer to 4.1.2.2.
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 24 of 31
Bluetooth PCM Configuration
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.1.3.8
LY
MT6620
Confidential B
Parameter
Bytes
PCM Setting
4.1.3.9
4
Default
(Byte 0: LSB)
Byte 0:0x23
Byte 1:0x00
Byte 2:0x00
Byte 3:0x00
Parameter Description
Please refer to 4.1.2.3.
Bluetooth RF Configuration
Parameter
Bytes
MediaTek Confidential
Default
(Byte 0: LSB)
Parameter Description
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 25 of 31
Bytes
Default
(Byte 0: LSB)
Parameter Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
Parameter
LY
MT6620
Confidential B
Radio Setting
4.1.3.10
6
Byte 0:0x06
Byte 1:0x80
Byte 2:0x00
Byte 3:0x06
Byte 4:0x03
Byte 5:0x06
Please refer to 4.1.2.4.
Bluetooth Sleep Mode Configuration
Parameter
Bytes
Sleep Mode
7
MediaTek Confidential
Default
(Byte 0: LSB)
Byte 0:0x03
Byte 1:0x40
Byte 2:0x1F
Byte 1:0x40
Byte 2:0x1F
Byte 4:0x00
Byte 5:0x04
Parameter Description
Please refer to 4.1.2.5.
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 26 of 31
External CLK Select (only used on MT6626)
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.1.3.11
LY
MT6620
Confidential B
For cost down, MT6626 remove a pin which called ECLK_SEL. The pin is to trap the clock setting of
the chip, because hardware needs to know whether a PLL shall be power-on.
Since the pin is removed but hardware still need to know the clock source, so software will need to set
a register to inform the hardware. The register value is calculated based on this byte stored in
NVRAM.
Parameter
Bytes
ECLK_SEL
1
MediaTek Confidential
Default
(Byte 0: LSB)
Byte 0:0x00
Parameter Description
((nvram ECLK_SEL & 0x1) << 0x1) | 0x1
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 27 of 31
Bluetooth Related GPIO Pins
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.2
LY
MT6620
Confidential B
4.2.1
MT661x/MT6622/MT6626
The GPIO customization is combined with DCT (Driver Customization Tool). Please also refer to the
document.
Power Enable and Reset:
GPIO_BT_POWREN_PIN
PCM:
GPIO_BT_RESET_PIN
GPIO_PCM_DAICLK_PIN,
GPIO_PCM_DAIPCMOUT_PIN,
GPIO_PCM_DAIPCMIN_PIN,
GPIO_PCM_DAISYNC_PIN
External Interrupt:
GPIO_BT_EINT_PIN
32K Clock Source:
GPIO_BT_CLK_PIN
UART Pins:
UART pins used by Bluetooth are also controlled by mt_bt_power_on/ mt_bt_power_off,
please care the UART port used need to sync with UART pin.
These PINs should be defined with DCT tool.
Notes:
Daisy chain is BT&WIFI use the same 26M clock mechanism. If HW use daisy chain, need add
btwlan_module_power_handler(BTWLAN_POWER_BT, 1) in mt_bt_power_on, add add
btwlan_module_power_handler(BTWLAN_POWER_BT, 0) in mt_bt_power_off. Till now only
MT6611(BT&WIFI co-module) need to enable daisy chain, other controllers do not use.
4.2.2
MT6620
mt_bt_power_on/mt_bt_power_off is not used on combo chip MT6620. The combo chip has its own
WMT driver to do centralized power on sequence, so BT related GPIO pins are deprecated here.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 28 of 31
Bluetooth UART port and baud rate Customization
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.3
LY
MT6620
Confidential B
1. Announce to use Bluetooth UART port custom folder
Path: alps/mediate/config/[project]/ProjectConfig.mak
CUSTOM_HAL_BLUETOOTH = bluetooth
2. Select UART port and baud rate
Path: alps/mediate/custom/[project]/hal/bluetooth/bluetooth/cust_bt.h
MT661x/MT6622/MT6626:
/* SERIAL PORT */
#define CUST_BT_SERIAL_PORT "/dev/ttyMT2"
/* BAUDRATE */
#define CUST_BT_BAUD_RATE 3250000
MT6620:
/* SERIAL PORT */
#define CUST_BT_SERIAL_PORT "/dev/stpbt"
/* BAUDRATE */
#define CUST_BT_BAUD_RATE 4000000 (use 4M but is not controlled by BT directly)
3. Set the UART port attribute in init.rc
Path: alps/mediate/config/[project]/init.rc
MT661x/MT6622/MT6626:
# BT
chmod 0660 /dev/ttyMT2
chown bluetooth bluetooth /dev/ttyMT2
MT6620:
insmod /system/lib/modules/mtk_stp_bt.ko
chmod 0666 /dev/stpbt
4.4
Bluetooth Chip Selection
Path: alps/mediate/config/[project]/ProjectConfig.mak
Example:
MTK_BT_CHIP = MTK_MT6622
#candidate setting: MTK_MT6611/MTK_MT6612/MTK_MT6616/MTK_MT6620/
MTK_MT6622/MTK_MT6626
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 29 of 31
Bluetooth Firmware patch Update
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
4.5
LY
MT6620
Confidential B
Path: alps/mediate/source/external/bluetooth/driver
If need to update the firmware patch for specific BT chip, customer should only modify the patch file
name to MTK_MT66XX_EY_Patch.nb0(XX means chip, Y means ECO version), then put it to the
above folder path, it will overwrite the old one.
Figure 9 Bluetooth firmware patch update patch.
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 30 of 31
LY
MT6620
Confidential B
Build
5.1
Source Code Structure & File Description
FO M
R ED
yu IA
.li@ T
E
tin K C
no O
mo NF
bil ID
e.c EN
om T
I
US AL
EO
N
5
File
Description
alps\mediatek\source\external\bluetooth\driver
*.*
5.2
Initialization library
Build Option
To enable BT function, ensure the following lines exist in corresponding file:
Patch: alps/mediatek/config/<project-name>/ProjectConfig.mk:
MTK_BT_SUPPORT=yes
MTK_BT_CHIP = MTK_MT6620 (or MTK_MT6611, MTK_MT6612, MTK_MT6616,
MTK_MT6622, MTK_MT6626)
MediaTek Confidential
© 2010 - 2011 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
Page 31 of 31