Advertisement
Guest User

QCA BT

a guest
Mar 21st, 2018
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.64 KB | None | 0 0
  1. MSM8996 BLUETOOTH/FM QCA6174A Bluetooth 4.1
  2.  
  3. Bluetooth device Lite-on QCA6174A [04ca:3016]
  4.  
  5. Sort out
  6. Commits on Dec 2, 2016 - op3: Make qcacld driver a module
  7. https://github.com/LineageOS/android_device_oneplus_oneplus3/commit/7bb7b226f7f7cfda2520f45fd5789d3390d8e380
  8.  
  9. Commits on Jan 22, 2017 - Revert "op3: Make qcacld driver a module"
  10. https://github.com/LineageOS/android_device_oneplus_oneplus3/commit/4d67c8e37f4f7d58c626ea977cbe23fc793551d4
  11.  
  12. # bluetooth----------------------
  13. [ 2.400848] Bluetooth: HCI device and connection manager initialized
  14. [ 2.401214] Bluetooth: HCI socket layer initialized
  15. [ 2.401367] Bluetooth: L2CAP socket layer initialized
  16. [ 2.401855] Bluetooth: SCO socket layer initialized
  17.  
  18. Description of concepts
  19. https://android.googlesource.com/kernel/msm.git/+/android-msm-flo-3.4-l-preview/drivers/bluetooth/Kconfig
  20.  
  21. bluetooth
  22. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2016-10-02.log.html
  23. https://github.com/Keij0/droid-config-sirius/blob/master/sparse/usr/bin/droid/droid-wlan-fix.sh
  24. # Make sure that the /etc/firmware directory is linked
  25. if [ ! -d /etc/firmware/ ]; then
  26. ln -s /system/etc/firmware /etc/
  27. fi
  28.  
  29. !!! using hciuart for control, not hcismd
  30. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-07-26.log.html
  31.  
  32. Must See!
  33. https://public.etherpad-mozilla.org/p/faq-hadk#lineNumber=559
  34.  
  35. CONFIG_BT_HCIUART
  36. https://cateee.net/lkddb/web-lkddb/BT_HCIUART.html
  37.  
  38. !!! (most likely the right decision)
  39. sparse/lib/systemd/system/hciattach.service
  40. https://github.com/mer-hybris/droid-config-hammerhead/blob/master/sparse/lib/systemd/system/hciattach.service
  41. https://groups.google.com/forum/#!category-topic/beaglebone/ngcGap8-G8s
  42.  
  43.  
  44. drivers/staging/qcacld-2.0
  45.  
  46. https://github.com/MotorolaMobilityLLC/readme/blob/master/MMI-NCC25.106-11.txt
  47. https://emmaus.pro:3000/emmaus/android_kernel_zuk_msm8996/src/1272e8866408585e7052336e3dcab100740026fe/arch/arm64/configs/z2_row_defconfig
  48.  
  49. make android kernel
  50. https://stackoverflow.com/questions/28565640/build-kernel-with-aarch64-linux-gnu-gcc
  51.  
  52. Prima
  53. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2016-07-07.log.html
  54. https://code.fairphone.com/gerrit/gitweb?p=fp2-dev/platform/vendor/qcom-opensource/wlan/prima.git;a=blob;f=Android.mk;h=6bb1ec639545498f41193c394fbd168eda51d452;hb=refs/heads/fp2-sibon#l109
  55.  
  56. Perfd Manual - "perfd is a system performance daemon that provides real-time access to system performance metrics,
  57. locally or remotely."
  58.  
  59. !!! Oneplus3-Sailors/droid-config-oneplus3
  60. https://github.com/Oneplus3-Sailors/droid-config-oneplus3
  61.  
  62. list files (What files we take from the drain)
  63. http://4pda.ru/forum/lofiversion/index.php?t720349-800.html
  64.  
  65. Bluetooth audio with BlueZ 5
  66. https://github.com/ev3dev/ev3dev/issues/198
  67.  
  68. piggz falcon
  69. https://github.com/mer-hybris/droid-config-falcon/tree/master/sparse/etc/bluetooth
  70.  
  71. #bluetooth
  72. https://github.com/mlehtima/droid-config-fp2-sibon/blob/master/sparse/lib/systemd/system/wlan-module-load.service
  73.  
  74. https://raw.githubusercontent.com/mer-hybris/droid-config-onyx/master/sparse/usr/bin/droid/droid-hcismd-up.sh
  75. https://bugs.launchpad.net/ubuntu/+source/bluetooth-touch/+bug/1285146
  76.  
  77. BTS402x
  78. hadk/hardware/qcom/bt/msm8996/libbt-vendor
  79. BOARD_HAVE_BLUETOOTH_QCOM
  80.  
  81. !!!View Initiation bluetooth:
  82. http://biancheng.dnbcw.net/linux/413347.html
  83. http://www.itdadao.com/articles/c15a168725p0.html
  84. https://developer.qualcomm.com/forum/qdn-forums/software/snapdragon-sdk/30021
  85.  
  86.  
  87. https://public.etherpad-mozilla.org/p/faq-hadk#lineNumber=126
  88.  
  89. msm9660 (821) QCA6174A Chipset
  90. https://www.qualcomm.com/products/qca6174a-dual-band-wi-fi
  91. Bluetooth interface uart
  92.  
  93. for uart bluetooth:
  94. rpm/dhd/helpers/build_packages.sh --mw=https://github.com/mer-hybris/bluetooth-rfkill-event --spec=rpm/bluetooth-rfkill-event-hciattach.spec
  95.  
  96. [root@Sailfish rfkill0]# /system/bin/hci_qcomm_init -vvv -e
  97. /system/bin/hci_qcomm_init -d /dev/ttyHS0 -s 3000000 -i 115200 -r 32000000 -p 0 -P 1
  98. ro.qualcomm.bt.hci_transport not set
  99. bt_hci_qcomm_pfal_powerup: not configured to power up BT QSoC
  100. Failed to open the /sys/devices/platform/wcnss_wlan.0/smd_channel_ready
  101. bt_hci_qcomm_pfal_changebaudrate: new rates 115200, 115200
  102. bt_hci_qcomm_pfal_changebaudrate: new baud 115200 FAILED, got 0x1000
  103. Done intiailizing UART
  104.  
  105. bt_hci_qcomm_init : Started
  106. bt_hci_qcomm_init: Detecting BT SOC firmware at baud rate 115200
  107.  
  108. CMD: 01 00 FC 01 06
  109. EVT: 04 FF 48 00 02 45 20 20 20 20 52 65 6C 65 61 73 65 20 36 2E 30 33 2E 30 20 28 42 75 69 6C 64 20 30 36 30 32 29 20 5B 50 46 3D 51 43 41 36 31 37 34 20 42 42 3D 30 36 30 32 20 4C 4D 50 3D 30 36 30 32 20 43 46 47 3D 52 41 4D 5D
  110. EVT: 04 0E 04 01 00 00 00
  111. bt_hci_qcomm_vs_getappversion : Succeeded
  112. CMD: 01 00 FC 06 0D 34 00 00 8C 04
  113. EVT: 04 FF 0B 00 01 34 00 00 8C 04 EF BE AD DE
  114. EVT: 04 0E 04 01 00 00 00
  115. bt_hci_qcomm_vs_gethwversion : Succeeded
  116.  
  117. bt_hci_qcomm_init : Found QSoC type 20.
  118.  
  119. get_bdaddr: before: 0x3a.0x1d.0xfe.0xc6.0xa0.0x00
  120. get_bdaddr: after: 46.e5.22.2d.65.94
  121. bt_nv_cmd failed to get NV_BT_SOC_REFCLOCK_TYPE_I from NV, code 1
  122. bt_nv_cmd failed to get NV_BT_SOC_CLK_SHARING_TYPE_I from NV, code 1
  123. bt_hci_qcomm_pfal_get_wlan_type: 0
  124. bt_hci_qcomm_init - Clock=32Mhz ClockSharing=No Logging=No SOC=BT2.1 xo_support=No
  125. bt_hci_qcomm_init - Opened NVM module.
  126. bt_hci_qcomm_download_nvm - Sending NVM tag #2 (size 9)
  127. CMD: 01 0B FC 09 01 02 06 46 E5 22 2D 65 94
  128. EVT: 04 FF 0A 0B 01 02 06 46 E5 22 2D 65 94
  129. EVT: 04 0E 04 01 00 00 00
  130. bt_hci_qcomm_download_nvm - Sending NVM tag #95 (size 5)
  131. CMD: 01 0B FC 05 01 5F 02 00 0B
  132. EVT: 04 FF 62 0B 01 5F 5E 00 0B 01 0D 00 00 00 02 00 02 02 00 00 10 33 73 33 33 07 00 02 00 01 23 D7 03 EC 01 DA 00 66 06 33 13 FE 04 00 00 36 00 21 00 00 10 00 28 00 00 0A 01 14 64 0A 00 72 01 2B 2B 44 4A 47 45 45 45 43 44 58 57 55 54 5A 59 25 40 28 28 39 3D 39 3A 3A 3A 38 39 44 44 43 42 45 45 24 36 19 48
  133. EVT: 04 0E 04 01 00 00 00
  134. bt_hci_qcomm_download_nvm - Sending NVM tag #83 (size 6)
  135. CMD: 01 0B FC 06 01 53 03 07 07 07
  136. EVT: 04 FF 0C 0B 01 53 08 07 07 07 00 01 03 05 07
  137. EVT: 04 0E 04 01 00 00 00
  138. bt_hci_qcomm_download_nvm - Sending NVM tag #36 (size 15)
  139. CMD: 01 0B FC 0F 01 24 0C FF 03 07 09 09 09 00 00 09 09 04 00
  140. EVT: 04 FF 10 0B 01 24 0C FF 03 07 09 09 09 00 00 09 09 04 00
  141. EVT: 04 0E 04 01 00 00 00
  142. bt_hci_qcomm_download_nvm - Finished sending NVM data.
  143. bt_hci_qcomm_init - NVM download completed, doing HCI Reset...
  144. CMD: 01 0B FC 08 01 11 05 0A 01 0E 00 00
  145. EVT: 04 FF 0C 0B 01 11 08 0A 01 0E 00 00 02 0A 00
  146. EVT: 04 0E 04 01 00 00 00
  147. Binary file: 6.03.0_0602Flowing-off the SOC...
  148. CMD: 01 03 0C 00
  149. bt_hci_qcomm_pfal_changebaudrate: new rates 3000000, 3000000
  150. bt_hci_qcomm_pfal_changebaudrate: new baud 3000000 FAILED, got 0x1000
  151. EVT: 04 0E 04 01 03 0C 00
  152. bt_hci_qcomm_init - Successful
  153. BTS402x initialized successfully
  154.  
  155. BTS_DEVICE=/dev/ttyHS0;
  156. BTS_BAUD=3000000;
  157. BTS_TYPE=qualcomm;
  158. BTS_ADDRESS=94:65:2d:22:e5:46;
  159. export BTS_DEVICE BTS_BAUD BTS_TYPE BTS_ADDRESS;
  160.  
  161. [root@Sailfish nemo]# hciattach /dev/ttyHS0 qualcomm 3000000
  162. Qualcomm module LMP version : 0x07
  163. Qualcomm module LMP sub-version : 0x025a
  164. Opening firmware file: /etc/firmware/6.03.0_0602.bin
  165. Could not open firmware file /etc/firmware/6.03.0_0602.bin: No such file or directory (2).
  166.  
  167. CONFIG_QCA_CLD_WLAN = CONFIG_PRONTO_WLAN
  168. https://partner.nameless-rom.org/gitlab/OSS/android_kernel_oneplus_msm8996/commit/030150d28c8a50c68dab1fab8c18f99200eea6b5
  169.  
  170. load module bluetooth-power.ko manually (kernel config v11)
  171. in sparse/usr/lib/modules-load.d/droid-hal-oneplus.conf
  172. add line: bluetooth-power
  173.  
  174. /etc/firmware/tlv.conf
  175. [General]
  176.  
  177. patcher = hciattach
  178. uart_dev = /dev/ttyHS0
  179. type_id = qualcomm
  180. baud_rate = 3000000
  181. flow = 1
  182. tosleep = 1
  183. up_hci = 1
  184. reg_hci = 1
  185. no_flush = 1
  186. use_lpm = 1
  187. #bdaddr = /data/misc/bluetooth/bluetooth_bdaddr
  188.  
  189. !!!Sort out
  190. add in kernel CONFIG_WIL6210=m
  191. CONFIG_WIL6210_WRITE_IOCTL=y
  192.  
  193. (OnePlus 5)
  194. https://github.com/xreact
  195.  
  196. !!! Need talk with "krnlyng" for bluetooth
  197. maybe "krnlyng" from the sfos-porters channel can help you with the bt issue. As far as I know was it he, who fixed it for the "Sony xperia X". Hope this information is new and helpful to you.
  198.  
  199. !!!Instructions:
  200. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-10-22.log.html
  201. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-10-12.log.html
  202. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-09-09.log.html
  203.  
  204. #bluez
  205. https://git.merproject.org/mer-core/bluez5
  206. https://git.merproject.org/mgrover/bluez (modified with rome - bluez4)
  207.  
  208. discussion:
  209. https://www.spinics.net/lists/linux-bluetooth/mail2.html
  210. https://www.spinics.net/lists/linux-bluetooth/msg73746.html
  211.  
  212. patches (Most likely on bluez4 and it is not clear works or not)
  213. https://portland.source.codeaurora.org/patches/external/wlan/Automotive/3rdparty/fsl3-10/Release_1_12_23/
  214.  
  215. found information on the topic:
  216. https://askubuntu.com/questions/791584/bluetooth-not-working-in-ubuntu-16-04-with-0cf33004-atheros-adapter
  217. + https://wiki.gentoo.org/wiki/Qualcomm_Atheros_QCA6174
  218. https://bugs.launchpad.net/ubuntu/+source/linux-firmware/+bug/1542743
  219. https://patchwork.kernel.org/patch/9956893/
  220. https://ubuntuforums.org/showthread.php?t=2323812
  221. https://bbs.archlinux.org/viewtopic.php?id=213500
  222. + https://android.googlesource.com/kernel/msm/+/android-7.1.0_r0.2/drivers/net/wireless/cnss/Kconfig
  223.  
  224. edit in bluetooth_rfkill_event.c
  225. link: https://github.com/mer-hybris/bluetooth-rfkill-event/blob/master/bluetooth-rfkill-event/bluetooth_rfkill_event.c
  226. /* list of all supported chips:
  227. name is defined in the kernel driver implementing rfkill interface for power */
  228. #define BCM_RFKILL_NAME "bcm43xx Bluetooth\n"
  229. #define BCM_43341_UART_DEV "/dev/ttyMFD0"
  230. #define BD_ADD_FACTORY_FILE "/factory/bluetooth_address"
  231. char factory_bd_add[18];
  232. char default_bd_addr[18];
  233.  
  234. #define DEFAULT_CONFIG_FILE "/etc/firmware/bcm43341.conf"
  235.  
  236. #define HCIATTACH_TYPE_ID_DEFAULT "bcm43xx"
  237. http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-11-21.log.html
  238.  
  239. link: https://github.com/Lyokanthrope/bluetooth-rfkill-event/tree/master/bluetooth-rfkill-event
  240.  
  241. QCA bluetooth (ghosalmartin)
  242. https://github.com/ghosalmartin/android_device_lge_bullhead/blob/cm-13.0/BoardConfig.mk
  243. ?: ghosalmartin: you managed to start bluetooth (QCA)?
  244.  
  245. + Enable Qualcomm's Bluetooth Software In-Band Sleep UART protocol
  246. HCI_IBS (HCI In-Band Sleep) is Qualcomm's power management protocol extension to H4.
  247. https://github.com/ghosalmartin/android_kernel_lge_bullhead/commit/27ae706ceeb1c1cf7754b8afda59f8e9cfa2ac74#diff-a68c2acb00b0f732e44918a51ada503d
  248.  
  249. ?? check:
  250. BT_HCIUART_IBS in kernel config file
  251. Prompt: HCI_IBS protocol support
  252. docs: https://www.digi.com/resources/documentation/digidocs/90001548/reference/bsp/6ul/r_bluetooth_6ul.htm
  253.  
  254. check in kernel config file
  255. BT_ATH3K - Atheros firmware download driver
  256. BT_HCIUART_ATH3K - Atheros AR300x serial support
  257.  
  258. According to the protocol HCI_UART_IBS (!!!I will use it) (HCI_UART_QCA for kernel 4.4):
  259. /* QCA ROME */
  260. { "qca", 0x0000, 0x0000, HCI_UART_IBS, 115200, 115200, FLOW_CTL, DISABLE_PM, NULL, NULL, qca, NULL },
  261.  
  262. По протоколу HCI_UART_H4:
  263. /* QCA ROME */
  264. { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, DISABLE_PM, NULL, NULL, qca, NULL },
  265.  
  266. Understand what protocol should be used, I think it is preferable - HCI_UART_IBS
  267.  
  268. HCI_UART_IBS (in MSM kernel 3.x ) = HCI_UART_QCA (in Linux kernel 4.x)
  269. in file btattach.c
  270.  
  271. in MSM kernel 3.x
  272. drivers/bluetooth/hci_uart.h
  273. #define HCI_UART_IBS 6
  274.  
  275. in Linux kernel 4.x
  276. drivers/bluetooth/hci_uart.h
  277. #define HCI_UART_QCA 8
  278.  
  279. link: http://www.merproject.org/logs/%23sailfishos-porters/%23sailfishos-porters.2017-10-22.log.html#t2017-10-22T14:59:00
  280.  
  281. Roma files path in drivers/bluetooth/ath3k.c
  282.  
  283. CONFIG_BT_HCIUART_ATH3K
  284.  
  285. link: https://git.bricked.de/Bricked/mako/commit/8939f38015856a47b266ed768001ab7083868cad?view=parallel
  286.  
  287. In a pure core Linux 4.x (not MSM)
  288. patch kernel BT_QCA, HCI_UART_QCA , BT_QCOMSMD
  289. BT_QCOMSMD - it is necessary
  290. https://github.com/torvalds/linux/blob/master/drivers/bluetooth/hci_qca.c
  291.  
  292. patch (old for example):
  293. !!!+ https://www.spinics.net/lists/linux-bluetooth/msg63488.html
  294.  
  295.  
  296. in the end I'll patch bluez5 until I decide! Maybe a better kernel
  297. need a patch for BT_QCA ...
  298.  
  299. # Bluetooth
  300. - bluez5-tools
  301. - bluetooth-rfkill-event-hciattach
  302.  
  303. type_id = qualcomm
  304. hciattach /dev/ttyHS0 qualcomm
  305.  
  306. /sys/devices/soc/7570000.uart/tty/ttyHS0/hci0/address
  307.  
  308. service config_bt_addr /system/bin/btnvtool -O
  309. /persist/bluetooth/.bt_nv.bin - file with address
  310.  
  311. tools/btattach
  312. https://manpages.debian.org/testing/bluez/btattach.1.en.html
  313.  
  314. #OP msm8998
  315. https://github.com/OnePlusOSS/android_kernel_oneplus_msm8998
  316. I'll try to take from there bluetooth driver
  317.  
  318. branch oneplus/QC8998_N_7.1
  319. https://github.com/OnePlusOSS/android_kernel_oneplus_msm8998/tree/oneplus/QC8998_N_7.1
  320.  
  321. таже надо добавить в ядро
  322. config BT_QCOMSMD, берем из нового ядра Linux
  323. https://github.com/torvalds/linux
  324.  
  325. CHROMIUM: Bluetooth: update stack to bluetooth-next
  326. https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/322027
  327. https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-3.18/drivers/bluetooth/
  328.  
  329. 1. https://chromium.googlesource.com/chromiumos/third_party/kernel/+/ae3fa0331ff5a31e427ac54076c285a721fcbd7b%5E%21/#F1
  330. + (began with him) 2. https://chromium.googlesource.com/chromiumos/third_party/kernel/+/585993a62ad8b8f393841129c8c55e2ab59de681
  331.  
  332. # Bluetooth subsystem in linux and BlueZ
  333. https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/mgmt-api.txt
  334.  
  335. # firmware
  336. http://lists.busybox.net/pipermail/buildroot/2017-July/196690.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement