BPI-R2 Kernel bluetooth module

i have used your patch and bt should be working as in 4.4…but it seems that no data can be received…any idea?

Hi @frank-w, I compiled the kernel from your github.

There is some changes about the network, there is a wan, four lanN, For now, I can’t use the network, when I try sudo dhclient lan0, It shows up RTNETLINK answers: Network is down.

I’m not familiar with lanN or wan stuff. Is there any documents or tutorial to teach me about that?

I know how a “entity switch” works, you know , the “Broadcast domain” Stuffs. But when it comes to be a chip “MT7350” and MII interface, I did not learn before…

You need to make sure the NIC are up prior to configure then.

ip link set eth0 up
ip link set lan0 up
dhclient lan0

:grinning: Thanks, I will try that tomorrow!

As per this thread if you could test the bluetouh module it would be great.

the bluetooth-driver file mentioned by gary is the same as in 4.4 (no output to diff).

so i try to focus on mtk_wcn_stp_receive_data in drivers/misc/mediatek/connectivity/common/common_detect/wmt_stp_exp.c

INT32 mtk_wcn_stp_receive_data(PUINT8 buffer, UINT32 length, UINT8 type)
{
    INT32 ret = -1;

    if (mtk_wcn_stp_receive_data_f)
        ret = (*mtk_wcn_stp_receive_data_f) (buffer, length, type);
    else
        WMT_STP_EXP_ERR_FUNC("mtk_wcn_stp_receive_data_f cb is null\n");

    return ret;
}

UINT32 mtk_wcn_stp_exp_cb_reg(P_MTK_WCN_STP_EXP_CB_INFO pStpExpCb)
{
    WMT_STP_EXP_INFO_FUNC("call stp exp cb reg\n");
    ...
    mtk_wcn_stp_receive_data_f = pStpExpCb->stp_receive_data_cb;


drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/stp_exp.c:252:		.stp_receive_data_cb = _mtk_wcn_stp_receive_data,

that function is now in drivers/misc/mediatek/connectivity/common/conn_soc/core/stp_core.c

#if STP_EXP_HID_API_EXPORT
INT32 _mtk_wcn_stp_receive_data(UINT8 *buffer, UINT32 length, UINT8 type)
#else
INT32 mtk_wcn_stp_receive_data(UINT8 *buffer, UINT32 length, UINT8 type)
#endif
{
    /* GeorgeKuo modify: reduce "if" branch */
    UINT16 copyLen = 0;
    UINT16 tailLen = 0;

    osal_lock_unsleepable_lock(&stp_core_ctx.ring[type].mtx);

    while (stp_core_ctx.ring[type].read_p != stp_core_ctx.ring[type].write_p) {
        /* GeorgeKuo modify: reduce if branch */
        if (stp_core_ctx.ring[type].write_p > stp_core_ctx.ring[type].read_p) {
            copyLen = stp_core_ctx.ring[type].write_p - stp_core_ctx.ring[type].read_p;
            if (copyLen > length)
                copyLen = length;

            osal_memcpy(buffer, stp_core_ctx.ring[type].buffer + stp_core_ctx.ring[type].read_p, copyLen);
            stp_core_ctx.ring[type].read_p += copyLen;
        } else {
            tailLen = MTKSTP_BUFFER_SIZE - stp_core_ctx.ring[type].read_p;
            if (tailLen > length) { /* exclude equal case to skip wrap check */
                copyLen = length;
                osal_memcpy(buffer, stp_core_ctx.ring[type].buffer + stp_core_ctx.ring[type].read_p,
                        copyLen);
                stp_core_ctx.ring[type].read_p += copyLen;
            } else {
                /* part 1: copy tailLen */
                osal_memcpy(buffer, stp_core_ctx.ring[type].buffer + stp_core_ctx.ring[type].read_p,
                        tailLen);

                buffer += tailLen;  /* update buffer offset */

                /* part 2: check if head length is enough */
                copyLen = length - tailLen;
                copyLen =
                    (stp_core_ctx.ring[type].write_p <
                     copyLen) ? stp_core_ctx.ring[type].write_p : copyLen;

                if (copyLen)
                    osal_memcpy(buffer, stp_core_ctx.ring[type].buffer + 0, copyLen);

                /* Update read_p final position */
                stp_core_ctx.ring[type].read_p = copyLen;

                /* update return length: head + tail */
                copyLen += tailLen;
            }
        }
        break;
    }

    osal_unlock_unsleepable_lock(&stp_core_ctx.ring[type].mtx);

    if ((MTK_WCN_BOOL_TRUE == stp_psm_is_quick_ps_support()) && (type != WMT_TASK_INDX)) {
#if PSM_USE_COUNT_PACKAGE
        stp_psm_disable_by_tx_rx_density(STP_PSM_CORE(stp_core_ctx), 1);
#else
        stp_psm_disable_by_tx_rx_density(STP_PSM_CORE(stp_core_ctx), 1, copyLen);
#endif
    }

    return copyLen;
}

as i see here the osal-stack is used…i did not understand what this function does exactly

there are multiple osal_memcpy(buffer, stp_core_ctx.ring[type].buffer + x,length) which seem to copy from osal-buffer to param-buffer in chunks. As there are 0 bytes received, the first chunk must fail…

@xbgmsharp which modules have you loaded?

have tried to initilize BT with kernel, i’ve got curretly on my board (may be without some BT-modules)

find  /lib/modules/4.14.12-00008-g2e65188/ -name '*.ko*' | grep bt
/lib/modules/4.14.12-00008-g2e65188/kernel/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.ko
root@bpi-r2:~# modprobe stp_chrdev_bt.ko
modprobe: FATAL: Module stp_chrdev_bt.ko not found in directory /lib/modules/4.14.12-00008-g2e65188
connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.koel/drivers/misc/mediatek/c
-bash: /lib/modules/4.14.12-00008-g2e65188/kernel/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.ko: Permission denied

You first need to load the WIFI. then the BT device should be present, eg: # hciconfig -a

Kernel log:

[ 1656.555608] [BT-MOD-INIT][I]do_bluetooth_drv_init:start to do bluetooth driver init
[ 1656.563532] [MTK-BT] BT_init: mtk_stp_BT_chrdev driver(major 192) installed
[ 1656.570895] [BT-MOD-INIT][I]do_bluetooth_drv_init:finish bluetooth driver init, i_ret:0

enable wifi

root@bpi-r2:~# less wifi.sh 

### BEGIN INIT INFO
# Provides:       wifi
# Required-Start: $network $remote_fs $syslog
# Required-Stop:  $network $remote_fs $syslog
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    Load MediaTek MT6625L firmware
### END INIT INFO

# Don't exit on error status
set +e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/dev/null
NAME=wifi
DESC="Load MediaTek MT6625L firmware wifi & BT"

# Check FILE exists and is executable
if [[ -x /usr/bin/wmt_loader ]];
then
        # ??
        /usr/bin/wmt_loader
        sleep 3
else
        echo "Error, unable to find wmt_loader"
fi

# Check FILE exists and is character special
if  [[ -c /dev/stpwmt ]];
then
        # Load firmware
        /usr/bin/stp_uart_launcher -p /etc/firmware &
        sleep 5
else
        echo "Error, device no created, /dev/stpwmt"
fi

# Check FILE exists and is character special
if  [[ -c /dev/wmtWifi ]];
then
        echo 0 >/dev/wmtWifi
        sleep 5
        echo A >/dev/wmtWifi
        sleep 2
else
        echo "Error, wifi device no created, /dev/wmtWifi"
fi

# Check NIC ap0
ifconfig ap0
if [[ $? != "0" ]]
then
        echo "Error, device no available, ap0"
else
        echo "Done, all good, ready to lauch hostapd"
        #hostapd -B /etc/hostapd/hostapd.conf
fi

hciconfig seems to be part of bluez…gary says me that bluez currently does not work stable…how to scan without bluez?

have not done much with bluetooth :wink:

since ifconfig is not part of debian stretch we can use “ip addr show ap0” instead of ifconfig

also you should not call echo 0 > /dev/wmtWifi

here my full log:

root@bpi-r2:~# ./wifi.sh 
init combo devic[   29.515869] [WMT-DETECT][I]wmt_detect_open:open major 154 minor 0 (pid 540)
e
[   29.524123] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191037),arg(0)
Opened combo dev[   29.532287] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (1074034433),arg(30243)
ice
get device[   29.540313] set current consys chipid (0x7623)
 id : 30243
[   29.546139] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191036),arg(30243)
set device id : [   29.554760] [WMT-MOD-INIT][I]do_common_drv_init:start to do common driver init, chipid:0x00007623
30243
[   29.568860] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   29.576286] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   29.584413] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   29.591790] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   29.599950] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   29.607318] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   29.617880] [WMT-CONSYS-HW][E]mtk_wmt_probe(122):Wmt Cannot find pinctrl default!
[   29.626396] [WMT-MOD-INIT][I]do_common_drv_init:finish common driver init
[   29.633153] [BT-MOD-INIT][I]do_bluetooth_drv_init:CONFIG_MTK_COMBO_BT is not defined
[   29.640909] [WCN-MOD-INIT][E]do_connectivity_driver_init(57):do common driver init failed, ret:-1
[   29.649748] [GPS-MOD-INIT][I]do_gps_drv_init:CONFIG_MTK_COMBO_GPS is not defined
[   29.657118] [WCN-MOD-INIT][E]do_connectivity_driver_init(62):do common driver init failed, ret:-1
[   29.665956] [FM-MOD-INIT][I]do_fm_drv_init:start to do fm module init
[   29.672351] [FM-MOD-INIT][I]do_fm_drv_init:finish fm module init
[   29.678346] [WLAN-MOD-INIT][I]do_wlan_drv_init:start to do wlan module init 0x7623
[   29.686165] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major 153) installed.
[   29.693708] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:0
[   29.701695] [WLAN-MOD-INIT][I]do_wlan_drv_init:WLAN-GEN2 driver init, ret:0
[   29.708705] [WLAN-MOD-INIT][I]do_wlan_drv_init:finish wlan module init
do module init: [   29.715566] [WMT-DETECT][I]wmt_detect_close:close major 154 minor 0 (pid 540)
30243
failed to init module 
open device node[   32.735688] [WMT-DEV][W]WMT_unlocked_ioctl:chipid = 0x7623
 succeed.(Node:/[   32.742656] [WMT-LIB][W]wmt_lib_set_hif:new hifType: 2, fm:2
dev/stpwmt, fd:3[   32.749531] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added
) 
chip id is 0[   32.749533] [WMT-DEV][W]WMT_unlocked_ioctl:unknown cmd (-2147180516)
x7623
chiId:0x7[   32.765358] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 234 
623, setting to [   32.772116] vcn18: mode operation not allowed
property((null))[   32.777775] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 238 

chiId:0x7623
[   32.784474] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 241 
run SOC chip flo[   32.791223] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 243 
w
create pwr on[   32.798448] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 250 
 thread ok
[   32.804962] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 277 
[   32.811651] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 279 
[   32.817034] DEBUG: Passed mtk_wcn_consys_power_on 193 
[   32.822167] DEBUG: Passed mtk_wcn_consys_power_on 195 
[   32.827342] DEBUG: Passed mtk_wcn_consys_power_on 202 
[   32.832445] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 281 
[   32.837841] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 286 
[   32.896231] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   32.903590] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   32.911760] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   32.919145] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   32.927294] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   32.934648] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   32.944733] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: read hw_ver (hw version) (0x8a00)
[   32.953227] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: read fw_ver (rom version) (0x8a00)
[   32.961221] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: ic info: SOC_CONSYS.E1 (0x8a00/0x8a00, WMTHWVER:0, patch_ext:_e1)
enter power on connsys flowpatch name pre-fix:ROMv2_lm_patch
fwVersion:0x8a00
/etc/firmware/ROMv2_lm_patch_1_0_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x22,0x00,0x06,0x00
gpatchnum = [2]
gdwonseq = [2]
/etc/firmware/ROMv2_lm_patch_1_1_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x21,0x00,0x0e,0xf0
gdwonseq = [1]
cmd(srh_patch) resp(ok)
[   33.072502] [WMT-IC][W]mtk_wcn_soc_patch_dwn:wmt_core: patch dwn:0 frag(51, 268) ok
[   33.222661] [WMT-IC][W]mtk_wcn_soc_patch_dwn:wmt_core: patch dwn:0 frag(114, 52) ok
[   33.558518] [WMT-IC][W]mtk_wcn_soc_sw_init:co-clock disabled.
[   33.565015] [STP] mtk_wcn_stp_psm_enable:[W] STP Not Ready, Dont do Sleep/Wakeup
[   33.572403] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:0 lpbk:2 coredump:0 wmt:2 stp:0)
[   33.582859] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(9) ok
[   37.734904] [MTK-WIFI] WIFI_open: WIFI_open: major 153 minor 0 (pid 539)
[   37.741755] [MTK-WIFI] WIFI_write: WIFI_write A
[   37.741755] 
[   37.786920] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt wlan func on before wlan probe
[   37.798410] kalFirmwareImageMapping firmware size 225840
[   38.869759] [MTK-WIFI] register_set_p2p_mode_handler: (pid 545) register set p2p mode handler c050ebd0
[   38.879095] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt call wlan probe ok
[   38.885936] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:2 lpbk:2 coredump:0 wmt:2 stp:0)
[   38.896494] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(3) ok
[   38.902588] [MTK-WIFI] WIFI_write: WMT turn on WIFI success!
[   38.909882] [MTK-WIFI] WIFI_write: Set wlan mode 0 --> 1
[   38.915656] [MTK-WIFI] WIFI_close: WIFI_close: major 153 minor 0 (pid 539)
12: ap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 02:08:22:d8:03:fc brd ff:ff:ff:ff:ff:ff
Done, all good, ready to lauch hostapd
root@bpi-r2:~# hciconfig -a
root@bpi-r2:~# 

as you see hciconfig -a does not show any controller (must see my local BT-controller)

ifconfig apt-get install net-tools.

From your log, you are missing some kernel entry.

[   29.626396] [WMT-MOD-INIT][I]do_common_drv_init:finish common driver init
[   29.633153] [BT-MOD-INIT][I]do_bluetooth_drv_init:CONFIG_MTK_COMBO_BT is not defined
[   29.640909] [WCN-MOD-INIT][E]do_connectivity_driver_init(57):do common driver init failed, ret:-1
[   29.649748] [GPS-MOD-INIT][I]do_gps_drv_init:CONFIG_MTK_COMBO_GPS is not defined
[   29.657118] [WCN-MOD-INIT][E]do_connectivity_driver_init(62):do common driver init failed, ret:-1
[   29.665956] [FM-MOD-INIT][I]do_fm_drv_init:start to do fm module init
[   29.672351] [FM-MOD-INIT][I]do_fm_drv_init:finish fm module init
  │ Symbol: MTK_COMBO_BT [=m]                                                                                                                   │  
  │ Type  : tristate                                                                                                                            │  
  │ Prompt: MediaTek Combo Chip BT driver                                                                                                       │  
  │   Location:                                                                                                                                 │  
  │     -> Device Drivers                                                                                                                       │  
  │       -> Misc devices                                                                                                                       │  
  │         -> Mediatek Peripherals                                                                                                             │  
  │ (1)       -> Modem & Connectivity related configs                                                                                           │  
  │   Defined at drivers/misc/mediatek/connectivity/Kconfig:201                                                                                 │  
  │   Depends on: BT [=y] && MTK_COMBO [=y]                                                                                                     │  
  │   Selects: MTK_BTIF [=y]                                                                                                                    │  
  │                                                                                                                                             │  
  │                                                                                                                                             │  
  │ Symbol: MTK_COMBO_BT_HCI [=m]                                                                                                               │  
  │ Type  : tristate                                                                                                                            │  
  │ Prompt: MediaTek Combo Chip BlueZ driver                                                                                                    │  
  │   Location:                                                                                                                                 │  
  │     -> Device Drivers                                                                                                                       │  
  │       -> Misc devices                                                                                                                       │  
  │         -> Mediatek Peripherals                                                                                                             │  
  │ (2)       -> Modem & Connectivity related configs                                                                                           │  
  │   Defined at drivers/misc/mediatek/connectivity/Kconfig:208                                                                                 │  
  │   Depends on: BT [=y] && MTK_COMBO [=y]                                                                                                     │  
  │   Selects: MTK_BTIF [=y]           

have compiled with this options, but did not found the corresponding module to load…

edit had forgotten that modulename is with dashes and filename with underscores…

root@bpi-r2:~# find /lib/modules/$(uname -r) -name '*.ko' | grep bt                                                                                 
/lib/modules/4.14.12-bpi-r2/kernel/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.ko
root@bpi-r2:~# modprobe stp-chrdev-bt
root@bpi-r2:~# lsmod
Module                  Size  Used by
stp_chrdev_bt          24576  0
bridge                151552  0
mt76x2e                61440  0
mt76                   32768  1 mt76x2e
mtk_thermal            16384  0
thermal_sys            61440  1 mtk_thermal
pwm_mediatek           16384  0
ip_tables              24576  0
x_tables               28672  1 ip_tables
ipv6                  409600  19 bridge

rebooted, loaded module again (is visible in lsmod) and then started wifi.sh…

do_bluetooth_drv_init:CONFIG_MTK_COMBO_BT is not defined

again…have you compiled in the driver fixed?

Hi, recently I am busy. And for now, I even not enable bpi-r2 board’s wifi, so for now, there is no bluetooth device in my system… I will take a look into the bluetooth device after a while :joy::joy:

you might want to compare with the kernel 4.4, below my config on kernel 4.14

$ grep BT .config | grep -v '#'
CONFIG_BT=y
CONFIG_BT_BREDR=y
CONFIG_BT_HS=y
CONFIG_BT_LE=y
CONFIG_BT_DEBUGFS=y
CONFIG_MTK_BTIF=y
CONFIG_MTK_COMBO_BT=y
CONFIG_MTK_COMBO_BT_HCI=y

with that options i see hci0 :wink:

root@bpi-r2:~# hciconfig -a
    hci0:   Type: Primary  Bus: SDIO
            BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
            DOWN 
            RX bytes:0 acl:0 sco:0 events:0 errors:0
            TX bytes:0 acl:0 sco:0 commands:0 errors:0
            Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
            Packet type: DM1 DH1 HV1 
            Link policy: 
            Link mode: SLAVE ACCEPT 

full log of wifi.sh (1,3 KB) (which inits also BT):

init combo devic[   74.590430] [WMT-DETECT][I]wmt_detect_open:open major 154 minor 0 (pid 562)
e
[   74.598685] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191037),arg(0)
Opened combo dev[   74.606856] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (1074034433),arg(30243)
ice
get device[   74.614897] set current consys chipid (0x7623)
 id : 30243
[   74.620719] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191036),arg(30243)
set device id : [   74.629339] [WMT-MOD-INIT][I]do_common_drv_init:start to do common driver init, chipid:0x00007623
30243
[   74.643712] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   74.651130] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   74.659283] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   74.666632] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   74.674779] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   74.682144] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   74.692699] [WMT-CONSYS-HW][E]mtk_wmt_probe(122):Wmt Cannot find pinctrl default!
[   74.701227] [WMT-MOD-INIT][I]do_common_drv_init:finish common driver init
[   74.707989] [BT-MOD-INIT][I]do_bluetooth_drv_init:start to do bluetooth driver init
[   74.715984] [MTK-BT] BT_init: mtk_stp_BT_chrdev driver(major 192) installed
[   74.723352] [BT-MOD-INIT][I]do_bluetooth_drv_init:finish bluetooth driver init, i_ret:0
[   74.724416] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 234 
[   74.724434] vcn18: mode operation not allowed
[   74.724440] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 238 
[   74.724446] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 241 
[   74.724456] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 243 
[   74.724990] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 250 
[   74.725326] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 277 
[   74.725930] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 279 
[   74.725933] DEBUG: Passed mtk_wcn_consys_power_on 193 
[   74.725967] DEBUG: Passed mtk_wcn_consys_power_on 195 
[   74.726025] DEBUG: Passed mtk_wcn_consys_power_on 202 
[   74.726028] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 281 
[   74.726050] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 286 
[   74.726058] [WMT-CONSYS-HW][E]mtk_wcn_consys_hw_reg_ctrl(301):Read CONSYS chipId(0xfffff093)
[   74.799919] [GPS-MOD-INIT][I]do_gps_drv_init:CONFIG_MTK_COMBO_GPS is not defined
[   74.815690] [WCN-MOD-INIT][E]do_connectivity_driver_init(62):do common driver init failed, ret:-1
[   74.819555] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   74.819563] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   74.819569] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   74.819575] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   74.819581] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   74.819586] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   74.819824] [WMT-CORE][E]wmt_core_stp_init(648):WMT-CORE: no hif info!
[   74.819828] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 649, (0)
[   74.819834] [WMT-CORE][E]opfunc_pwr_on(918):WMT-CORE: wmt_core_stp_init fail (-1)
[   74.819837] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 919, (0)
[   74.819843] [WMT-CORE][W]wmt_core_stp_deinit:gMtkWmtCtx.p_ic_ops is NULL
[   74.819848] [WMT-CTRL][W]wmt_ctrl_stp_conf:CTRL_STP_ENABLE but invalid Handle of WmtStp
[   74.819855] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(1), value(0) iRet:(-1)
[   74.819858] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   74.819862] [WMT-CTRL][W]wmt_ctrl_stp_conf:CTRL_STP_ENABLE but invalid Handle of WmtStp
[   74.819868] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(0), value(0) iRet:(-1)
[   74.819871] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   74.819879] [STP-BTIF][W]mtk_wcn_consys_stp_btif_rx_cb_register:NULL BTIF ID reference
[   74.819879] !
[   74.819884] [WMT-CTRL][W]wmt_ctrl_stp_close:mtk_wcn_stp_rxcb_unregister fail(-1)
[   74.819890] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(3), type(0), value(0) iRet:(-2)
[   74.819894] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   74.819897] [WMT-CORE][W]wmt_core_stp_deinit:end with fail:-4
[   74.820089] vcn18: mode operation not allowed
[   74.820114] [WMT-CORE][W]opfunc_pwr_off:HW_PWR_OFF ok
[   74.820123] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 234 
[   74.820129] vcn18: mode operation not allowed
[   74.820132] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 238 
[   74.820135] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 241 
[   74.820139] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 243 
[   74.820642] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 250 
[   74.820954] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 277 
[   74.821540] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 279 
[   74.821543] DEBUG: Passed mtk_wcn_consys_power_on 193 
[   74.821566] DEBUG: Passed mtk_wcn_consys_power_on 195 
[   74.821612] DEBUG: Passed mtk_wcn_consys_power_on 202 
[   74.821615] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 281 
[   74.821634] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 286 
[   74.821638] [WMT-CONSYS-HW][E]mtk_wcn_consys_hw_reg_ctrl(301):Read CONSYS chipId(0xfffff093)
[   74.919479] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   74.919487] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   74.919493] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   74.919499] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   74.919505] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   74.919511] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   74.919756] [WMT-CORE][E]wmt_core_stp_init(648):WMT-CORE: no hif info!
[   74.919761] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 649, (0)
[   74.919766] [WMT-CORE][E]opfunc_pwr_on(918):WMT-CORE: wmt_core_stp_init fail (-1)
[   74.919769] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 919, (0)
[   74.919775] [WMT-CORE][W]wmt_core_stp_deinit:gMtkWmtCtx.p_ic_ops is NULL
[   74.919780] [WMT-CTRL][W]wmt_ctrl_stp_conf:CTRL_STP_ENABLE but invalid Handle of WmtStp
[   74.919787] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(1), value(0) iRet:(-1)
[   74.919790] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   74.919794] [WMT-CTRL][W]wmt_ctrl_stp_conf:CTRL_STP_ENABLE but invalid Handle of WmtStp
[   74.919800] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(0), value(0) iRet:(-1)
[   74.919803] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   74.919811] [STP-BTIF][W]mtk_wcn_consys_stp_btif_rx_cb_register:NULL BTIF ID reference
[   74.919811] !
[   74.919816] [WMT-CTRL][W]wmt_ctrl_stp_close:mtk_wcn_stp_rxcb_unregister fail(-1)
[   74.919822] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(3), type(0), value(0) iRet:(-2)
[   74.919826] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   74.919829] [WMT-CORE][W]wmt_core_stp_deinit:end with fail:-4
[   74.920016] vcn18: mode operation not allowed
[   74.920041] [WMT-CORE][W]opfunc_pwr_off:HW_PWR_OFF ok
[   74.920050] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 234 
[   74.920056] vcn18: mode operation not allowed
[   74.920059] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 238 
[   74.920061] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 241 
[   74.920066] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 243 
[   74.920571] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 250 
[   74.920883] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 277 
[   74.921486] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 279 
[   74.921489] DEBUG: Passed mtk_wcn_consys_power_on 193 
[   74.921512] DEBUG: Passed mtk_wcn_consys_power_on 195 
[   74.921556] DEBUG: Passed mtk_wcn_consys_power_on 202 
[   74.921560] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 281 
[   74.921578] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 286 
[   74.921583] [WMT-CONSYS-HW][E]mtk_wcn_consys_hw_reg_ctrl(301):Read CONSYS chipId(0xfffff093)
[   75.019398] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   75.019405] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   75.019411] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   75.019417] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   75.019423] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   75.019428] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   75.019667] [WMT-CORE][E]wmt_core_stp_init(648):WMT-CORE: no hif info!
[   75.019671] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 649, (0)
[   75.019676] [WMT-CORE][E]opfunc_pwr_on(918):WMT-CORE: wmt_core_stp_init fail (-1)
[   75.019679] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 919, (0)
[   75.019684] [WMT-CORE][W]wmt_core_stp_deinit:gMtkWmtCtx.p_ic_ops is NULL
[   75.019688] [WMT-CTRL][W]wmt_ctrl_stp_conf:CTRL_STP_ENABLE but invalid Handle of WmtStp
[   75.019694] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(1), value(0) iRet:(-1)
[   75.019698] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   75.019701] [WMT-CTRL][W]wmt_ctrl_stp_conf:CTRL_STP_ENABLE but invalid Handle of WmtStp
[   75.019707] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(5), type(0), value(0) iRet:(-1)
[   75.019710] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   75.019716] [STP-BTIF][W]mtk_wcn_consys_stp_btif_rx_cb_register:NULL BTIF ID reference
[   75.019716] !
[   75.019721] [WMT-CTRL][W]wmt_ctrl_stp_close:mtk_wcn_stp_rxcb_unregister fail(-1)
[   75.019726] [WMT-CORE][E]wmt_core_ctrl(500):WMT-CORE: wmt_core_ctrl failed: id(3), type(0), value(0) iRet:(-2)
[   75.019730] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 501, (0)
[   75.019733] [WMT-CORE][W]wmt_core_stp_deinit:end with fail:-4
[   75.019851] vcn18: mode operation not allowed
[   75.019869] [WMT-CORE][W]opfunc_pwr_off:HW_PWR_OFF ok
[   75.019876] [WMT-CORE][E]opfunc_func_on(1025):func(0) pwr_on fail(-2)
[   75.019880] drivers/misc/mediatek/connectivity/common/conn_soc/core/wmt_core.c, 1026, (0)
[   75.019889] [WMT-LIB][W]wmtd_thread:opid (3) failed, iRet(-3)
[   75.019916] [WMT-LIB][W]wmt_lib_put_act_op:opId(3) result:-3
[   75.019924] [STP] mtk_wcn_stp_psm_enable:[W] STP Not Ready, Dont do Sleep/Wakeup
[   75.019933] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(0) fail
[   75.019942] mtk_bt_hci_open func on failed with 0
[   75.576325] [FM-MOD-INIT][I]do_fm_drv_init:start to do fm module init
[   75.582738] [FM-MOD-INIT][I]do_fm_drv_init:finish fm module init
[   75.588711] [WLAN-MOD-INIT][I]do_wlan_drv_init:start to do wlan module init 0x7623
[   75.596587] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major 153) installed.
[   75.604192] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:0
[   75.612179] [WLAN-MOD-INIT][I]do_wlan_drv_init:WLAN-GEN2 driver init, ret:0
[   75.619120] [WLAN-MOD-INIT][I]do_wlan_drv_init:finish wlan module init
do module init: [   75.626015] [WMT-DETECT][I]wmt_detect_close:close major 154 minor 0 (pid 562)
30243
failed to init module 
open device node[   78.645812] [WMT-DEV][W]WMT_unlocked_ioctl:chipid = 0x7623
 succeed.(Node:/[   78.652715] [WMT-LIB][W]wmt_lib_set_hif:new hifType: 2, fm:2
dev/stpwmt, fd:3[   78.659692] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added
) 
chip id is 0[   78.660603] [WMT-DEV][W]WMT_unlocked_ioctl:unknown cmd (-2147180516)
x7623
chiId:0x7[   78.675546] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 234 
623, setting to [   78.682293] vcn18: mode operation not allowed
property((null))[   78.687971] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 238 

chiId:0x7623
[   78.694723] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 241 
run SOC chip flo[   78.701472] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 243 
w
create pwr on[   78.708693] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 250 
 thread ok
[   78.715274] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 277 
[   78.721953] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 279 
[   78.727314] DEBUG: Passed mtk_wcn_consys_power_on 193 
[   78.732468] DEBUG: Passed mtk_wcn_consys_power_on 195 
[   78.737623] DEBUG: Passed mtk_wcn_consys_power_on 202 
[   78.742747] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 281 
[   78.748132] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 286 
[   78.810001] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   78.817359] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   78.825515] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   78.832898] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   78.841053] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   78.848408] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   78.858532] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: read hw_ver (hw version) (0x8a00)
[   78.867020] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: read fw_ver (rom version) (0x8a00)
[   78.875010] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: ic info: SOC_CONSYS.E1 (0x8a00/0x8a00, WMTHWVER:0, patch_ext:_e1)
enter power on connsys flowpatch name pre-fix:ROMv2_lm_patch
fwVersion:0x8a00
/etc/firmware/ROMv2_lm_patch_1_0_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x22,0x00,0x06,0x00
gpatchnum = [2]
gdwonseq = [2]
/etc/firmware/ROMv2_lm_patch_1_1_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x21,0x00,0x0e,0xf0
gdwonseq = [1]
cmd(srh_patch) resp(ok)
[   78.979240] [WMT-IC][W]mtk_wcn_soc_patch_dwn:wmt_core: patch dwn:0 frag(51, 268) ok
[   79.120005] [WMT-IC][W]mtk_wcn_soc_patch_dwn:wmt_core: patch dwn:0 frag(114, 52) ok
[   79.455721] [WMT-IC][W]mtk_wcn_soc_sw_init:co-clock disabled.
[   79.462239] [STP] mtk_wcn_stp_psm_enable:[W] STP Not Ready, Dont do Sleep/Wakeup
[   79.469597] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:0 lpbk:2 coredump:0 wmt:2 stp:0)
[   79.480040] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(9) ok
[   83.644133] [MTK-WIFI] WIFI_open: WIFI_open: major 153 minor 0 (pid 561)
[   83.650982] [MTK-WIFI] WIFI_write: WIFI_write A
[   83.650982] 
[   83.690231] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt wlan func on before wlan probe
[   83.701698] kalFirmwareImageMapping firmware size 225840
[   84.748106] random: crng init done

[   84.901421] [MTK-WIFI] register_set_p2p_mode_handler: (pid 567) register set p2p mode handler c050ffa8
[   84.910736] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt call wlan probe ok
[   84.917569] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:2 lpbk:2 coredump:0 wmt:2 stp:0)
[   84.928410] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(3) ok
[   84.934430] [MTK-WIFI] WIFI_write: WMT turn on WIFI success!
[   84.941335] [MTK-WIFI] WIFI_write: Set wlan mode 0 --> 1
[   84.946676] [MTK-WIFI] WIFI_close: WIFI_close: major 153 minor 0 (pid 561)

@garywang do you see anything wrong? how do you connect to bt-devices, if bluez not stable?

the only error i see is that:

open device node[   78.645812] [WMT-DEV][W]WMT_unlocked_ioctl:chipid = 0x7623
 succeed.(Node:/[   78.652715] [WMT-LIB][W]wmt_lib_set_hif:new hifType: 2, fm:2
dev/stpwmt, fd:3[   78.659692] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added
) 
chip id is 0[   78.660603] [WMT-DEV][W]WMT_unlocked_ioctl:unknown cmd (-2147180516) <<<<<<<
x7623
chiId:0x7[   78.675546] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 234 
623, setting to [   78.682293] vcn18: mode operation not allowed   <<<<<<<<<<<<<<<
property((null))[   78.687971] DEBUG: Passed mtk_wcn_consys_hw_reg_ctrl 238

Update to kernel 4.14.14 same issue, unable to run a BT scan even so the device is detected.

i had not changed anything in BT-Stack yet, because i don’t whats wrong

Anyone has an idea how to fix this? @garywang have you take a look into that?

Hi Frank

I guess the wifi is working fine, right? If yes, the BTIF interafce does work. Now you can see the hci0 device by running command hciconfig -a, can you please execute command “hciconfig hci0 up” to enable it, and then you will see the statistic of BT device by execute command: hciconfig

wifi (ap-mode) itself seems to work well

“hciconfig -a” lists all devices, but we want to connect to it, that fails

I do have a lot of issue with Wifi.

In regards to BT, we can see the device “hciconfig -a” and make the decive uctive. However LE scan does not work and you can’t to any device