Skip to content

Commit 9df438e

Browse files
committed
feat(android): Add M.2 Wi-Fi/Bluetooth Module Setup application note
Add a new application note documenting the Android build system modifications required to integrate third-party M.2 Wi-Fi/Bluetooth modules on AM62Px-SK and AM62x-SK EVMs. The guide covers: - Wi-Fi firmware setup (Android.bp, product makefile) - Bluetooth configuration (HAL, permissions, properties) - SELinux policy for UART access - ueventd permissions Signed-off-by: Guillaume La Roque <[email protected]>
1 parent 6bb8848 commit 9df438e

File tree

5 files changed

+329
-0
lines changed

5 files changed

+329
-0
lines changed

configs/AM62PX/AM62PX_android_toc.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ devices/AM62PX/android/Release_Specific_Release_Notes
44
devices/AM62PX/android/Application_Notes
55
devices/AM62PX/android/Application_Notes_dtbo_support
66

7+
android/Application_Notes_M2_WiFi_BT
8+
79
android/Application_Notes_Android_Bootloader_SD_Card
810
android/Application_Notes_Android_Dual_Screen
911
android/Application_Notes_Android_Low_Power

configs/AM62X/AM62X_android_toc.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ devices/AM62X/android/Application_Notes
55
devices/AM62X/android/Application_Notes_dtbo_support
66
devices/AM62X/android/Application_Notes_BeaglePlay
77

8+
android/Application_Notes_M2_WiFi_BT
9+
810
android/Application_Notes_Android_Bootloader_SD_Card
911
android/Application_Notes_Android_Dual_Screen
1012
android/Application_Notes_Android_Low_Power
Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,323 @@
1+
.. _android-m2-wifi-bt:
2+
3+
################################
4+
M.2 Wi-Fi/Bluetooth Module Setup
5+
################################
6+
7+
This application note describes the Android build system modifications required
8+
to integrate third-party M.2 Wi-Fi and Bluetooth modules.
9+
10+
.. warning::
11+
12+
This guide assumes the kernel already includes the required drivers and
13+
device tree overlays. For kernel configuration, refer to :ref:`android-build-kernel`.
14+
15+
************
16+
Introduction
17+
************
18+
19+
The AM62Px-SK and AM62x-SK EVMs include an M.2 Key E connector that supports
20+
Wi-Fi and Bluetooth combo modules. These modules typically use:
21+
22+
- **SDIO** interface for Wi-Fi
23+
- **UART** interface for Bluetooth
24+
25+
This guide lists the files you need to modify in the Android build system
26+
to add support for a new Wi-Fi and Bluetooth module.
27+
28+
29+
**********************
30+
Wi-Fi Firmware Setup
31+
**********************
32+
33+
.. note::
34+
35+
Depending on your Wi-Fi module, you may also need to modify the Wi-Fi HAL
36+
configuration in :file:`device/ti/am62x/shared/wifi/`. The default configuration
37+
uses TI-specific libraries (``lib_driver_cmd_ti``). For other modules, you may
38+
need to update :file:`BoardConfig.mk` to use the appropriate driver library
39+
(e.g., ``lib_driver_cmd_nl80211`` for generic NL80211 drivers).
40+
41+
Adding firmware files
42+
=====================
43+
44+
Copy the firmware files to the appropriate directory:
45+
46+
.. code-block:: console
47+
48+
$ cp <firmware_file> \
49+
${YOUR_PATH}/ti-aosp-16/vendor/ti/am62x/wifi/vendor/firmware/<vendor_dir>/
50+
51+
Common vendor directories:
52+
53+
- ``mrvl/`` for Marvell/NXP
54+
- ``ti-connectivity/`` for TI
55+
- ``brcm/`` for Broadcom/Cypress
56+
- ``nxp/`` for NXP Bluetooth firmware
57+
58+
59+
Modifying Android.bp
60+
====================
61+
62+
Edit :file:`vendor/ti/am62x/wifi/Android.bp` and add a prebuilt_firmware module.
63+
64+
.. code-block:: text
65+
66+
prebuilt_firmware {
67+
name: "<package_name>",
68+
vendor: true,
69+
src: "vendor/firmware/<vendor_dir>/<firmware_file>",
70+
filename: "<firmware_file>",
71+
sub_dir: "<vendor_dir>",
72+
proprietary: true,
73+
}
74+
75+
76+
Modifying the product makefile
77+
==============================
78+
79+
.. ifconfig:: CONFIG_part_variant in ('AM62PX')
80+
81+
Edit :file:`vendor/ti/am62x/am62p.mk` and add the firmware to PRODUCT_PACKAGES.
82+
83+
.. ifconfig:: CONFIG_part_variant in ('AM62X')
84+
85+
Edit :file:`vendor/ti/am62x/am62x.mk` and add the firmware to PRODUCT_PACKAGES.
86+
87+
.. code-block:: makefile
88+
89+
PRODUCT_PACKAGES += \
90+
<package_name>
91+
92+
93+
************************
94+
Bluetooth Configuration
95+
************************
96+
97+
M.2 Wi-Fi and Bluetooth combo modules typically use UART for Bluetooth communication.
98+
Modify the following files to enable Bluetooth.
99+
100+
101+
Modifying shared/bluetooth/device_vendor.mk
102+
===========================================
103+
104+
Edit :file:`device/ti/am62x/shared/bluetooth/device_vendor.mk` to enable Bluetooth
105+
permissions and HAL.
106+
107+
Change from disabled Bluetooth:
108+
109+
.. code-block:: makefile
110+
111+
PRODUCT_COPY_FILES += \
112+
device/generic/car/common/android.hardware.disable.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
113+
device/generic/car/common/android.hardware.disable.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
114+
115+
To enabled Bluetooth:
116+
117+
.. code-block:: makefile
118+
119+
# Bluetooth configuration
120+
121+
# Enable Bluetooth permissions
122+
PRODUCT_COPY_FILES += \
123+
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
124+
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
125+
126+
# Bluetooth HAL (AIDL)
127+
PRODUCT_PACKAGES += \
128+
android.hardware.bluetooth-service.default
129+
130+
131+
Modifying product.prop
132+
======================
133+
134+
Edit :file:`device/ti/am62x/product.prop` and add Bluetooth properties.
135+
136+
Example configuration (adjust profiles based on your module capabilities):
137+
138+
.. code-block:: text
139+
140+
# Bluetooth configuration
141+
# Set the Bluetooth Class of Device
142+
# Service Field: 0x5A -> 90
143+
# Bit 17: Networking
144+
# Bit 19: Capturing
145+
# Bit 20: Object Transfer
146+
# Bit 22: Telephony
147+
# MAJOR_CLASS: 0x01 -> 1 (Computer)
148+
# MINOR_CLASS: 0x04 -> 4 (Desktop workstation)
149+
bluetooth.device.class_of_device=90,1,4
150+
151+
# Set supported Bluetooth profiles to enabled
152+
bluetooth.profile.asha.central.enabled?=true
153+
bluetooth.profile.a2dp.source.enabled?=true
154+
bluetooth.profile.avrcp.target.enabled?=true
155+
bluetooth.profile.gatt.enabled?=true
156+
bluetooth.profile.hfp.ag.enabled?=true
157+
bluetooth.profile.hid.device.enabled?=true
158+
bluetooth.profile.hid.host.enabled?=true
159+
bluetooth.profile.map.server.enabled?=true
160+
bluetooth.profile.opp.enabled?=true
161+
bluetooth.profile.pan.nap.enabled?=true
162+
bluetooth.profile.pan.panu.enabled?=true
163+
bluetooth.profile.pbap.server.enabled?=true
164+
165+
# Disable LeAudio profiles (requires specific hardware support)
166+
bluetooth.profile.bap.broadcast.assist.enabled=false
167+
bluetooth.profile.bap.unicast.client.enabled=false
168+
bluetooth.profile.bas.client.enabled=false
169+
bluetooth.profile.ccp.server.enabled=false
170+
bluetooth.profile.csip.set_coordinator.enabled=false
171+
bluetooth.profile.hap.client.enabled=false
172+
bluetooth.profile.vcp.controller.enabled=false
173+
174+
.. note::
175+
176+
The ``bluetooth.profile.*.enabled?=true`` syntax (with ``?``) means the profile
177+
is enabled by default but can be overridden. Profiles disabled with ``=false``
178+
(without ``?``) cannot be overridden.
179+
180+
181+
Modifying ueventd.rc
182+
====================
183+
184+
.. ifconfig:: CONFIG_part_variant in ('AM62PX')
185+
186+
Edit :file:`device/ti/am62x/am62p/ueventd.am62p.rc` and add UART permissions:
187+
188+
.. ifconfig:: CONFIG_part_variant in ('AM62X')
189+
190+
Edit :file:`device/ti/am62x/am62x/ueventd.am62x.rc` and add UART permissions:
191+
192+
.. code-block:: text
193+
194+
# Bluetooth UART
195+
/dev/ttyS1 0660 bluetooth bluetooth
196+
197+
.. note::
198+
199+
The UART device name (``ttyS1``, ``ttyS2``, etc.) depends on your device tree
200+
overlay configuration.
201+
202+
203+
Modifying file_contexts
204+
=======================
205+
206+
Edit :file:`device/ti/am62x/sepolicy/common/file_contexts` and add:
207+
208+
.. code-block:: text
209+
210+
# Bluetooth UART
211+
/dev/ttyS1 u:object_r:hci_attach_dev:s0
212+
213+
214+
Adding SELinux policy
215+
=====================
216+
217+
Create :file:`device/ti/am62x/sepolicy/common/hal_bluetooth_default.te`:
218+
219+
.. code-block:: text
220+
221+
# Allow Bluetooth HAL to access UART device
222+
allow hal_bluetooth_default hci_attach_dev:chr_file rw_file_perms;
223+
224+
225+
***************
226+
Build and Flash
227+
***************
228+
229+
Rebuild Android
230+
===============
231+
232+
.. code-block:: console
233+
234+
$ cd ${YOUR_PATH}/ti-aosp-16
235+
$ source build/envsetup.sh
236+
$ lunch <BUILD_TARGET>
237+
$ m
238+
239+
Flash the device
240+
================
241+
242+
After building, perform a full reflash of the device following the standard
243+
flashing procedure documented in :ref:`android-flashing`.
244+
245+
Configure DTBO
246+
==============
247+
248+
After flashing, configure the DTBO index from U-Boot:
249+
250+
.. code-block:: console
251+
252+
=> env set adtbo_idx <your_dtbo_index>
253+
=> saveenv
254+
=> reset
255+
256+
Refer to :ref:`android-dtbo` for the list of available DTBOs and their indices.
257+
258+
259+
*******
260+
Summary
261+
*******
262+
263+
Modify the following files to add Wi-Fi and Bluetooth support:
264+
265+
.. ifconfig:: CONFIG_part_variant in ('AM62PX')
266+
267+
.. list-table::
268+
:header-rows: 1
269+
:widths: 50 50
270+
271+
* - File
272+
- Purpose
273+
274+
* - :file:`vendor/ti/am62x/wifi/Android.bp`
275+
- Add prebuilt_firmware module for Wi-Fi/BT firmware
276+
277+
* - :file:`vendor/ti/am62x/am62p.mk`
278+
- Add firmware to PRODUCT_PACKAGES
279+
280+
* - :file:`device/ti/am62x/shared/bluetooth/device_vendor.mk`
281+
- Enable Bluetooth permissions XML and HAL
282+
283+
* - :file:`device/ti/am62x/product.prop`
284+
- Add Bluetooth properties (class of device, profiles)
285+
286+
* - :file:`device/ti/am62x/am62p/ueventd.am62p.rc`
287+
- Set UART device permissions for Bluetooth
288+
289+
* - :file:`device/ti/am62x/sepolicy/common/file_contexts`
290+
- Add SELinux context for Bluetooth UART
291+
292+
* - :file:`device/ti/am62x/sepolicy/common/hal_bluetooth_default.te`
293+
- Add SELinux policy for Bluetooth HAL UART access
294+
295+
.. ifconfig:: CONFIG_part_variant in ('AM62X')
296+
297+
.. list-table::
298+
:header-rows: 1
299+
:widths: 50 50
300+
301+
* - File
302+
- Purpose
303+
304+
* - :file:`vendor/ti/am62x/wifi/Android.bp`
305+
- Add prebuilt_firmware module for Wi-Fi/BT firmware
306+
307+
* - :file:`vendor/ti/am62x/am62x.mk`
308+
- Add firmware to PRODUCT_PACKAGES
309+
310+
* - :file:`device/ti/am62x/shared/bluetooth/device_vendor.mk`
311+
- Enable Bluetooth permissions XML and HAL
312+
313+
* - :file:`device/ti/am62x/product.prop`
314+
- Add Bluetooth properties (class of device, profiles)
315+
316+
* - :file:`device/ti/am62x/am62x/ueventd.am62x.rc`
317+
- Set UART device permissions for Bluetooth
318+
319+
* - :file:`device/ti/am62x/sepolicy/common/file_contexts`
320+
- Add SELinux context for Bluetooth UART
321+
322+
* - :file:`device/ti/am62x/sepolicy/common/hal_bluetooth_default.te`
323+
- Add SELinux policy for Bluetooth HAL UART access

source/devices/AM62PX/android/Application_Notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Application Notes
99

1010
/android/Application_Notes_Partitions
1111
Application_Notes_dtbo_support
12+
/android/Application_Notes_M2_WiFi_BT
1213
/android/Application_Notes_Android_Bootloader_SD_Card
1314
/android/Application_Notes_Android_SD_CARD
1415
/android/Application_Notes_Android_Dual_Screen

source/devices/AM62X/android/Application_Notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Application Notes
99

1010
/android/Application_Notes_Partitions
1111
Application_Notes_dtbo_support
12+
/android/Application_Notes_M2_WiFi_BT
1213
/android/Application_Notes_Android_Bootloader_SD_Card
1314
/android/Application_Notes_Android_SD_CARD
1415
/android/Application_Notes_Android_Dual_Screen

0 commit comments

Comments
 (0)