[Letux-kernel] GTA04 Bluetooth

H. Nikolaus Schaller hns at goldelico.com
Mon Jun 12 18:27:41 CEST 2017


> Am 12.06.2017 um 18:25 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi,
> as we still use the w2cbw003 driver (serdev man-in-the-middle),
> there is only one remaining issue:
> 
>> root at letux:~# ./bt-scan 
>> hciattach /dev/ttyBT0 texas 115200
>> [  163.117614] 
>> [  163.119201] ============================================
>> [  163.124786] WARNING: possible recursive locking detected
>> [  163.130340] 4.12.0-rc5-letux+ #1107 Not tainted
>> [  163.135101] --------------------------------------------
>> [  163.140655] hciattach/2562 is trying to acquire lock:
>> [  163.145935]  (&tty->termios_rwsem){++++..}, at: [<c04bc638>] tty_set_termios+0x40/0x1b0
>> [  163.154357] 
>> [  163.154357] but task is already holding lock:
>> [  163.160461]  (&tty->termios_rwsem){++++..}, at: [<c04bc638>] tty_set_termios+0x40/0x1b0
>> [  163.168853] 
>> [  163.168853] other info that might help us debug this:
>> [  163.175689]  Possible unsafe locking scenario:
>> [  163.175689] 
>> [  163.181884]        CPU0
>> [  163.184417]        ----
>> [  163.186981]   lock(&tty->termios_rwsem);
>> [  163.191101]   lock(&tty->termios_rwsem);
>> [  163.195190] 
>> [  163.195190]  *** DEADLOCK ***
>> [  163.195190] 
>> [  163.201385]  May be due to missing lock nesting notation
>> [  163.201385] 
>> [  163.208496] 2 locks held by hciattach/2562:
>> [  163.212890]  #0:  (&tty->ldisc_sem){++++++}, at: [<c04bda64>] tty_ldisc_ref_wait+0x18/0x34
>> [  163.221527]  #1:  (&tty->termios_rwsem){++++..}, at: [<c04bc638>] tty_set_termios+0x40/0x1b0
>> [  163.230407] 
>> [  163.230407] stack backtrace:
>> [  163.234954] CPU: 0 PID: 2562 Comm: hciattach Not tainted 4.12.0-rc5-letux+ #1107
>> [  163.242706] Hardware name: Generic OMAP36xx (Flattened Device Tree)
>> [  163.249298] [<c010f478>] (unwind_backtrace) from [<c010b9bc>] (show_stack+0x10/0x14)
>> [  163.257415] [<c010b9bc>] (show_stack) from [<c04405e4>] (dump_stack+0x98/0xd0)
>> [  163.264984] [<c04405e4>] (dump_stack) from [<c01821cc>] (validate_chain+0x760/0x1010)
>> [  163.273193] [<c01821cc>] (validate_chain) from [<c0184034>] (__lock_acquire+0x690/0x760)
>> [  163.281677] [<c0184034>] (__lock_acquire) from [<c0184b44>] (lock_acquire+0x1d0/0x29c)
>> [  163.289947] [<c0184b44>] (lock_acquire) from [<c075deb4>] (down_write+0x28/0x78)
>> [  163.297729] [<c075deb4>] (down_write) from [<c04bc638>] (tty_set_termios+0x40/0x1b0)
>> [  163.305847] [<c04bc638>] (tty_set_termios) from [<c04d7824>] (ttyport_set_flow_control+0x58/0x60)
>> [  163.315155] [<c04d7824>] (ttyport_set_flow_control) from [<bf05d048>] (w2cbw_tty_set_termios+0x20/0x3c [w2cbw003_bluetooth])
>> [  163.326934] [<bf05d048>] (w2cbw_tty_set_termios [w2cbw003_bluetooth]) from [<c04bc74c>] (tty_set_termios+0x154/0x1b0)
>> [  163.338043] [<c04bc74c>] (tty_set_termios) from [<c04bcfb4>] (set_termios.part.1+0x3e4/0x460)
>> [  163.346984] [<c04bcfb4>] (set_termios.part.1) from [<c04bd294>] (tty_mode_ioctl+0x1e8/0x5cc)
>> [  163.355804] [<c04bd294>] (tty_mode_ioctl) from [<c04b812c>] (tty_ioctl+0xa1c/0xa98)
>> [  163.363830] [<c04b812c>] (tty_ioctl) from [<c027fdbc>] (vfs_ioctl+0x20/0x34)
>> [  163.371246] [<c027fdbc>] (vfs_ioctl) from [<c02807c8>] (do_vfs_ioctl+0x85c/0x97c)
>> [  163.379089] [<c02807c8>] (do_vfs_ioctl) from [<c0280934>] (SyS_ioctl+0x4c/0x74)
>> [  163.386749] [<c0280934>] (SyS_ioctl) from [<c0107060>] (ret_fast_syscall+0x0/0x1c)
>> Found a Texas Instruments' chip!
>> Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts
>> Loaded BTS script version 1
>> texas: changing baud rate to 3000000, flow control to 1
>> [  164.087524] Bluetooth: HCI UART driver ver 2.3
>> [  164.092254] Bluetooth: HCI UART protocol H4 registered
>> [  164.109252] Bluetooth: HCI UART protocol BCSP registered
>> [  164.121276] Bluetooth: HCI UART protocol LL registered
>> Device setup complete
>> Scanning ...
>> 
>> BD Address:     00:0F:F6:31:5E:4A [mode 1, clkoffset 0x6fe1]
>> Device name:    BT-348_GPS
>> Manufacturer:   Cambridge Silicon Radio (10)
>> LMP version:    1.1 (0x1) [subver 0x5e1]
>> LMP features:   0xff 0xfe 0x7f 0x00 0x00 0x00 0x00 0x80
>>                <3-slot packets> <5-slot packets> <encryption> <slot offset> 
>>                <timing accuracy> <role switch> <hold mode> <sniff mode> 
>>                <RSSI> <channel quality> <SCO link> <HV2 packets> 
>>                <HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme> 
>>                <power control> <transparent SCO> <extended features> 
>> 
>> BD Address:     00:23:12:3D:07:A2 [mode 1, clkoffset 0x48d6]
>> Device name:    iMac
>> Manufacturer:   Broadcom Corporation (15)
>> LMP version:    2.1 (0x4) [subver 0x21d0]
>> LMP features:   0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83
>>                <3-slot packets> <5-slot packets> <encryption> <slot offset> 
>>                <timing accuracy> <role switch> <hold mode> <sniff mode> 
>>                <park state> <RSSI> <channel quality> <SCO link> <HV2 packets> 
>>                <HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme> 
>>                <power control> <transparent SCO> <broadcast encrypt> 
>>                <EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan> 
>>                <interlaced iscan> <interlaced pscan> <inquiry with RSSI> 
>>                <extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave> 
>>                <AFH class. slave> <3-slot EDR ACL> <5-slot EDR ACL> 
>>                <sniff subrating> <pause encryption> <AFH cap. master> 
>>                <AFH class. master> <EDR eSCO 2 Mbps> <EDR eSCO 3 Mbps> 
>>                <3-slot EDR eSCO> <extended inquiry> <simple pairing> 
>>                <encapsulated PDU> <err. data report> <non-flush flag> <LSTO> 
>>                <inquiry TX power> <extended features> 
>> 
>> root at letux:~# 
> 
> Any ideas how to solve?
> 
> 
> For the WL183x based devices (Pyra and GTA04A5) it could be as simple
> as enabling the TI_ST driver ("shared transport" multiplexer for bluetooth,
> fm radio, gps and NFC).
> 
> For this to work I guess it could suffice to change to 
> 
> 	compatible="ti,wl1837-st"
> 
> At least
> 
> root at letux:~# modprobe -c | fgrep wl1837
> alias of:N*T*Cti,wl1837 wlcore_spi
> alias of:N*T*Cti,wl1837C* wlcore_spi
> alias of:N*T*Cti,wl1837_st hci_uart
> alias of:N*T*Cti,wl1837_stC* hci_uart
> root at letux:~# 
> 
> and
> 
> http://elixir.free-electrons.com/linux/v4.12-rc5/source/Documentation/devicetree/bindings/net/ti,wilink-st.txt
> 
> seem to confirm that such a compatible string exists.
> 
> This should automagically create some hci0 interface w/o hciattach.
> 
> Not 100% clear to me is how to control the wl183x bluetooth enable gpio.
> We do have to replace the vdd-regulator of the w2cbw003 driver by the gpio.
> 
> So this should be just some simple DT tweaking.
> 
> 
> And this is still not a solution for the w2cbw003 bluetooth on GTA04A3/A4.
> 
> In preparation for that I have added a CONFIG_W2CBW003_HCI which
> allows to turn off the creation of /dev/ttyBT0.
> 
> But it has no code yet to create a new hci interface, so it is just
> a skeleton.
> 
> Anyone who wants to submit a patch for testing?

I should add that I would like to get rid of the hciattach approach.

And modify the /root/bt-scan script as well as the /root/hw-test accordingly.

But for keeping user-space consistent, it is more difficult to switch only
the wl183x based devices. And therefore we need such a hci driver for
the w2cbw003.

BR,
Nikolaus



More information about the Letux-kernel mailing list