Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configs/AM62PX/AM62PX_android_toc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ devices/AM62PX/android/Release_Specific_Release_Notes
devices/AM62PX/android/Application_Notes
devices/AM62PX/android/Application_Notes_dtbo_support

android/Application_Notes_M2_WiFi_BT

android/Application_Notes_Android_Bootloader_SD_Card
android/Application_Notes_Android_Dual_Screen
android/Application_Notes_Android_Low_Power
Expand Down
2 changes: 2 additions & 0 deletions configs/AM62X/AM62X_android_toc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ devices/AM62X/android/Application_Notes
devices/AM62X/android/Application_Notes_dtbo_support
devices/AM62X/android/Application_Notes_BeaglePlay

android/Application_Notes_M2_WiFi_BT

android/Application_Notes_Android_Bootloader_SD_Card
android/Application_Notes_Android_Dual_Screen
android/Application_Notes_Android_Low_Power
Expand Down
323 changes: 323 additions & 0 deletions source/android/Application_Notes_M2_WiFi_BT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
.. _android-m2-wifi-bt:

################################
M.2 Wi-Fi/Bluetooth Module Setup

Check warning on line 4 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Slash] Use either 'or' or 'and' in 'Fi/Bluetooth' Raw Output: {"message": "[RedHat.Slash] Use either 'or' or 'and' in 'Fi/Bluetooth'", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 4, "column": 8}}}, "severity": "WARNING"}

Check warning on line 4 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Headings] Use sentence-style capitalization in 'M.2 Wi-Fi/Bluetooth Module Setup'. Raw Output: {"message": "[RedHat.Headings] Use sentence-style capitalization in 'M.2 Wi-Fi/Bluetooth Module Setup'.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 4, "column": 1}}}, "severity": "INFO"}
################################

This application note describes the Android build system modifications required
to integrate third-party M.2 Wi-Fi and Bluetooth modules.

.. warning::

This guide assumes the kernel already includes the required drivers and
device tree overlays. For kernel configuration, refer to :ref:`android-build-kernel`.

Check warning on line 13 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.TermsSuggestions] Depending on the context, consider using 'see' rather than 'refer to'. Raw Output: {"message": "[RedHat.TermsSuggestions] Depending on the context, consider using 'see' rather than 'refer to'.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 13, "column": 52}}}, "severity": "INFO"}

************
Introduction
************

The AM62Px-SK and AM62x-SK EVMs include an M.2 Key E connector that supports

Check warning on line 19 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'EVMs') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'EVMs') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 19, "column": 28}}}, "severity": "INFO"}
Wi-Fi and Bluetooth combo modules. These modules typically use:

- **SDIO** interface for Wi-Fi

Check warning on line 22 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'SDIO') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'SDIO') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 22, "column": 5}}}, "severity": "INFO"}
- **UART** interface for Bluetooth

Check warning on line 23 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'UART') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'UART') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 23, "column": 5}}}, "severity": "INFO"}

This guide lists the files you need to modify in the Android build system

Check warning on line 25 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.SimpleWords] Use simple language. Consider using 'change' rather than 'modify'. Raw Output: {"message": "[RedHat.SimpleWords] Use simple language. Consider using 'change' rather than 'modify'.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 25, "column": 40}}}, "severity": "INFO"}
to add support for a new Wi-Fi and Bluetooth module.


**********************
Wi-Fi Firmware Setup

Check warning on line 30 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Headings] Use sentence-style capitalization in 'Wi-Fi Firmware Setup'. Raw Output: {"message": "[RedHat.Headings] Use sentence-style capitalization in 'Wi-Fi Firmware Setup'.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 30, "column": 1}}}, "severity": "INFO"}
**********************

.. note::

Depending on your Wi-Fi module, you may also need to modify the Wi-Fi HAL

Check warning on line 35 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.SimpleWords] Use simple language. Consider using 'change' rather than 'modify'. Raw Output: {"message": "[RedHat.SimpleWords] Use simple language. Consider using 'change' rather than 'modify'.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 35, "column": 57}}}, "severity": "INFO"}

Check warning on line 35 in source/android/Application_Notes_M2_WiFi_BT.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.TermsWarnings] Consider using 'might' or 'can' rather than 'may' unless updating existing content that uses the term. Raw Output: {"message": "[RedHat.TermsWarnings] Consider using 'might' or 'can' rather than 'may' unless updating existing content that uses the term.", "location": {"path": "source/android/Application_Notes_M2_WiFi_BT.rst", "range": {"start": {"line": 35, "column": 40}}}, "severity": "WARNING"}
configuration in :file:`device/ti/am62x/shared/wifi/`. The default configuration
uses TI-specific libraries (``lib_driver_cmd_ti``). For other modules, you may
need to update :file:`BoardConfig.mk` to use the appropriate driver library
(e.g., ``lib_driver_cmd_nl80211`` for generic NL80211 drivers).

Adding firmware files
=====================

Copy the firmware files to the appropriate directory:

.. code-block:: console

$ cp <firmware_file> \
${YOUR_PATH}/ti-aosp-16/vendor/ti/am62x/wifi/vendor/firmware/<vendor_dir>/

Common vendor directories:

- ``mrvl/`` for Marvell/NXP
- ``ti-connectivity/`` for TI
- ``brcm/`` for Broadcom/Cypress
- ``nxp/`` for NXP Bluetooth firmware


Modifying Android.bp
====================

Edit :file:`vendor/ti/am62x/wifi/Android.bp` and add a prebuilt_firmware module.

.. code-block:: text

prebuilt_firmware {
name: "<package_name>",
vendor: true,
src: "vendor/firmware/<vendor_dir>/<firmware_file>",
filename: "<firmware_file>",
sub_dir: "<vendor_dir>",
proprietary: true,
}


Modifying the product makefile
==============================

.. ifconfig:: CONFIG_part_variant in ('AM62PX')

Edit :file:`vendor/ti/am62x/am62p.mk` and add the firmware to PRODUCT_PACKAGES.

.. ifconfig:: CONFIG_part_variant in ('AM62X')

Edit :file:`vendor/ti/am62x/am62x.mk` and add the firmware to PRODUCT_PACKAGES.

.. code-block:: makefile

PRODUCT_PACKAGES += \
<package_name>


************************
Bluetooth Configuration
************************

M.2 Wi-Fi and Bluetooth combo modules typically use UART for Bluetooth communication.
Modify the following files to enable Bluetooth.


Modifying shared/bluetooth/device_vendor.mk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to shorten this to just

Suggested change
Modifying shared/bluetooth/device_vendor.mk
Modifying device_vendor.mk

Makes the link and title a little more approachable, and it has less of a chance to change arbitrarily now

===========================================

Edit :file:`device/ti/am62x/shared/bluetooth/device_vendor.mk` to enable Bluetooth
permissions and HAL.

Change from disabled Bluetooth:

.. code-block:: makefile

PRODUCT_COPY_FILES += \
device/generic/car/common/android.hardware.disable.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
device/generic/car/common/android.hardware.disable.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml

To enabled Bluetooth:

.. code-block:: makefile

# Bluetooth configuration

# Enable Bluetooth permissions
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml

# Bluetooth HAL (AIDL)
PRODUCT_PACKAGES += \
android.hardware.bluetooth-service.default


Modifying product.prop
======================

Edit :file:`device/ti/am62x/product.prop` and add Bluetooth properties.

Example configuration (adjust profiles based on your module capabilities):

.. code-block:: text

# Bluetooth configuration
# Set the Bluetooth Class of Device
# Service Field: 0x5A -> 90
# Bit 17: Networking
# Bit 19: Capturing
# Bit 20: Object Transfer
# Bit 22: Telephony
# MAJOR_CLASS: 0x01 -> 1 (Computer)
# MINOR_CLASS: 0x04 -> 4 (Desktop workstation)
bluetooth.device.class_of_device=90,1,4

# Set supported Bluetooth profiles to enabled
bluetooth.profile.asha.central.enabled?=true
bluetooth.profile.a2dp.source.enabled?=true
bluetooth.profile.avrcp.target.enabled?=true
bluetooth.profile.gatt.enabled?=true
bluetooth.profile.hfp.ag.enabled?=true
bluetooth.profile.hid.device.enabled?=true
bluetooth.profile.hid.host.enabled?=true
bluetooth.profile.map.server.enabled?=true
bluetooth.profile.opp.enabled?=true
bluetooth.profile.pan.nap.enabled?=true
bluetooth.profile.pan.panu.enabled?=true
bluetooth.profile.pbap.server.enabled?=true

# Disable LeAudio profiles (requires specific hardware support)
bluetooth.profile.bap.broadcast.assist.enabled=false
bluetooth.profile.bap.unicast.client.enabled=false
bluetooth.profile.bas.client.enabled=false
bluetooth.profile.ccp.server.enabled=false
bluetooth.profile.csip.set_coordinator.enabled=false
bluetooth.profile.hap.client.enabled=false
bluetooth.profile.vcp.controller.enabled=false

.. note::

The ``bluetooth.profile.*.enabled?=true`` syntax (with ``?``) means the profile
is enabled by default but can be overridden. Profiles disabled with ``=false``
(without ``?``) cannot be overridden.


Modifying ueventd.rc
====================

.. ifconfig:: CONFIG_part_variant in ('AM62PX')

Edit :file:`device/ti/am62x/am62p/ueventd.am62p.rc` and add UART permissions:

.. ifconfig:: CONFIG_part_variant in ('AM62X')

Edit :file:`device/ti/am62x/am62x/ueventd.am62x.rc` and add UART permissions:

.. code-block:: text

# Bluetooth UART
/dev/ttyS1 0660 bluetooth bluetooth

.. note::

The UART device name (``ttyS1``, ``ttyS2``, etc.) depends on your device tree
overlay configuration.


Modifying file_contexts
=======================

Edit :file:`device/ti/am62x/sepolicy/common/file_contexts` and add:

.. code-block:: text

# Bluetooth UART
/dev/ttyS1 u:object_r:hci_attach_dev:s0


Adding SELinux policy
=====================

Create :file:`device/ti/am62x/sepolicy/common/hal_bluetooth_default.te`:

.. code-block:: text

# Allow Bluetooth HAL to access UART device
allow hal_bluetooth_default hci_attach_dev:chr_file rw_file_perms;


***************
Build and Flash
***************

Rebuild Android
===============

.. code-block:: console

$ cd ${YOUR_PATH}/ti-aosp-16
$ source build/envsetup.sh
$ lunch <BUILD_TARGET>
$ m

Flash the device
================

After building, perform a full reflash of the device following the standard
flashing procedure documented in :ref:`android-flashing`.

Configure DTBO
==============

After flashing, configure the DTBO index from U-Boot:

.. code-block:: console

=> env set adtbo_idx <your_dtbo_index>
=> saveenv
=> reset

Refer to :ref:`android-dtbo` for the list of available DTBOs and their indices.


*******
Summary
*******

Modify the following files to add Wi-Fi and Bluetooth support:

.. ifconfig:: CONFIG_part_variant in ('AM62PX')

.. list-table::
:header-rows: 1
:widths: 50 50

* - File
- Purpose

* - :file:`vendor/ti/am62x/wifi/Android.bp`
- Add prebuilt_firmware module for Wi-Fi/BT firmware

* - :file:`vendor/ti/am62x/am62p.mk`
- Add firmware to PRODUCT_PACKAGES

* - :file:`device/ti/am62x/shared/bluetooth/device_vendor.mk`
- Enable Bluetooth permissions XML and HAL

* - :file:`device/ti/am62x/product.prop`
- Add Bluetooth properties (class of device, profiles)

* - :file:`device/ti/am62x/am62p/ueventd.am62p.rc`
- Set UART device permissions for Bluetooth

* - :file:`device/ti/am62x/sepolicy/common/file_contexts`
- Add SELinux context for Bluetooth UART

* - :file:`device/ti/am62x/sepolicy/common/hal_bluetooth_default.te`
- Add SELinux policy for Bluetooth HAL UART access

.. ifconfig:: CONFIG_part_variant in ('AM62X')

.. list-table::
:header-rows: 1
:widths: 50 50

* - File
- Purpose

* - :file:`vendor/ti/am62x/wifi/Android.bp`
- Add prebuilt_firmware module for Wi-Fi/BT firmware

* - :file:`vendor/ti/am62x/am62x.mk`
- Add firmware to PRODUCT_PACKAGES

* - :file:`device/ti/am62x/shared/bluetooth/device_vendor.mk`
- Enable Bluetooth permissions XML and HAL

* - :file:`device/ti/am62x/product.prop`
- Add Bluetooth properties (class of device, profiles)

* - :file:`device/ti/am62x/am62x/ueventd.am62x.rc`
- Set UART device permissions for Bluetooth

* - :file:`device/ti/am62x/sepolicy/common/file_contexts`
- Add SELinux context for Bluetooth UART

* - :file:`device/ti/am62x/sepolicy/common/hal_bluetooth_default.te`
- Add SELinux policy for Bluetooth HAL UART access
1 change: 1 addition & 0 deletions source/devices/AM62PX/android/Application_Notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Application Notes

/android/Application_Notes_Partitions
Application_Notes_dtbo_support
/android/Application_Notes_M2_WiFi_BT
/android/Application_Notes_Android_Bootloader_SD_Card
/android/Application_Notes_Android_SD_CARD
/android/Application_Notes_Android_Dual_Screen
Expand Down
1 change: 1 addition & 0 deletions source/devices/AM62X/android/Application_Notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Application Notes

/android/Application_Notes_Partitions
Application_Notes_dtbo_support
/android/Application_Notes_M2_WiFi_BT
/android/Application_Notes_Android_Bootloader_SD_Card
/android/Application_Notes_Android_SD_CARD
/android/Application_Notes_Android_Dual_Screen
Expand Down
Loading