From 7fce6f74475285933e71c052c07e41626c782fd5 Mon Sep 17 00:00:00 2001 From: Nolen Johnson Date: Fri, 25 Jun 2021 01:05:35 -0400 Subject: [PATCH] sabrina: Configure Broadcom Bluetooth/Wi-Fi HALs * We're not unifying things, and the stock MultiHAL requires framework side magic, so we're going with the hardware/broadcom solution. * Set Bluetooth overlays based on stock. * bdroid_buildcfg header and vnd_$device.txt configuration are loosely taken from OEM uploads of Amlogic BCM Wi-Fi/BT device sources. * Unlike all other g12a devices, sabrina sets ro.bt.bdaddr_path on stock to `/sys/class/bt_addr/value`. Change-Id: Ie8e0f2d2a5f1cb8337ebe88b903fb18a71602f18 --- BoardConfig.mk | 19 ++++++++++++ bluetooth/include/bdroid_buildcfg.h | 31 +++++++++++++++++++ bluetooth/vnd_deadpool.txt | 10 ++++++ device.mk | 8 +++++ .../apps/Bluetooth/res/values/config.xml | 16 ++++++++++ vendor.prop | 8 +++++ 6 files changed, 92 insertions(+) create mode 100644 bluetooth/include/bdroid_buildcfg.h create mode 100644 bluetooth/vnd_deadpool.txt create mode 100644 overlay/packages/apps/Bluetooth/res/values/config.xml create mode 100644 vendor.prop diff --git a/BoardConfig.mk b/BoardConfig.mk index 53d08a3..bb1fe06 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -10,8 +10,27 @@ include device/amlogic/g12-common/BoardConfigCommon.mk DEVICE_PATH := device/google/sabrina +## Bluetooth +BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth/include +BOARD_CUSTOM_BT_CONFIG := $(DEVICE_PATH)/bluetooth/vnd_deadpool.txt +BOARD_HAVE_BLUETOOTH := true +BOARD_HAVE_BLUETOOTH_BCM := true + ## Bootloader TARGET_BOOTLOADER_BOARD_NAME := sabrina ## DTB TARGET_DTB_NAME := sm1_s905d3_sabrina + +## Properties +TARGET_VENDOR_PROP += $(DEVICE_PATH)/vendor.prop + +## Wi-Fi +BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd +BOARD_WLAN_DEVICE := bcmdhd +BOARD_WPA_SUPPLICANT_DRIVER := NL80211 +BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd +WIFI_DRIVER_FW_PATH_AP := "/vendor/etc/wifi/buildin/fw_fw_bcm4356a2_ag_apsta.bin" +WIFI_DRIVER_FW_PATH_STA := "/vendor/etc/wifi/buildin/fw_bcm4356a2_ag.bin" +WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/dhd/parameters/firmware_path" +WPA_SUPPLICANT_VERSION := VER_0_8_X diff --git a/bluetooth/include/bdroid_buildcfg.h b/bluetooth/include/bdroid_buildcfg.h new file mode 100644 index 0000000..82400dd --- /dev/null +++ b/bluetooth/include/bdroid_buildcfg.h @@ -0,0 +1,31 @@ +/* +* Copyright (C) 2021 The LineageOS Project +* +* SPDX-License-Identifier: Apache-2.0 +*/ + +#ifndef _BDROID_BUILDCFG_H +#define _BDROID_BUILDCFG_H + +#define BTM_DEF_LOCAL_NAME "ADT-3" + +#define BLE_VND_INCLUDED TRUE + +#define BTA_DM_COD {0x20, BTM_COD_MAJOR_AUDIO, BTM_COD_MINOR_SET_TOP_BOX} + +// Turn off BLE_PRIVACY_SPT. Remote reconnect fails on +// often if this is enabled. +#define BLE_PRIVACY_SPT FALSE + +#define BTM_BLE_CONN_INT_MIN_DEF 0x18 +#define BTM_BLE_CONN_INT_MAX_DEF 0x28 +#define BTM_BLE_CONN_TIMEOUT_DEF 200 +/* minimum acceptable connection interval */ +#define BTM_BLE_CONN_INT_MIN_LIMIT 0x0006 /*7.5ms=6*1.25*/ + +#define BTM_BLE_SCAN_SLOW_INT_1 512 + +/*fix r311&r321 bt not open*/ +#define KERNEL_MISSING_CLOCK_BOOTTIME_ALARM TRUE + +#endif diff --git a/bluetooth/vnd_deadpool.txt b/bluetooth/vnd_deadpool.txt new file mode 100644 index 0000000..6ff0f44 --- /dev/null +++ b/bluetooth/vnd_deadpool.txt @@ -0,0 +1,10 @@ +BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyS1" +FW_PATCHFILE_LOCATION = "/vendor/etc/bluetooth/" +UART_TARGET_BAUD_RATE = 2000000 +BT_WAKE_VIA_USERIAL_IOCTL = FALSE +LPM_IDLE_TIMEOUT_MULTIPLE = 5 +SCO_USE_I2S_INTERFACE = FALSE +BTVND_DBG = FALSE +BTHW_DBG = TRUE +VNDUSERIAL_DBG = FALSE +UPIO_DBG = FALSE diff --git a/device.mk b/device.mk index 3b14852..c1bc597 100644 --- a/device.mk +++ b/device.mk @@ -10,6 +10,14 @@ $(call inherit-product, vendor/google/sabrina/sabrina-vendor.mk) $(call inherit-product, device/amlogic/g12-common/g12.mk) +## Bluetooth +PRODUCT_PACKAGES += \ + libbt-vendor + ## Kernel Modules PRODUCT_PACKAGES += \ dhd + +## Overlays +DEVICE_PACKAGE_OVERLAYS += \ + $(DEVICE_PATH)/overlay diff --git a/overlay/packages/apps/Bluetooth/res/values/config.xml b/overlay/packages/apps/Bluetooth/res/values/config.xml new file mode 100644 index 0000000..acd4fcf --- /dev/null +++ b/overlay/packages/apps/Bluetooth/res/values/config.xml @@ -0,0 +1,16 @@ + + + + true + false + false + false + false + false + false + false + false + diff --git a/vendor.prop b/vendor.prop new file mode 100644 index 0000000..e82bac8 --- /dev/null +++ b/vendor.prop @@ -0,0 +1,8 @@ +# +# Copyright (C) 2021 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +## Bluetooth +ro.bt.bdaddr_path=/sys/class/bt_addr/value -- 2.20.1