这个补丁是我在全志A40 4.4 增加的ap6236 wifi模块的适配 , 思路万古不变 , 希望能帮助到有需要的人。
这个补丁主要修改了 Android 的一些硬件配置和驱动代码,以支持 ap6236 wifi 模块并修复了 ap6236 wifi 模块。
修改的文件
android/device/softwinner/t3-p1/BoardConfig.mk
android/hardware/broadcom/libbt/src/userial_vendor.c
android/hardware/broadcom/wlan/bcmdhd/firmware/ap6212.zip
android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/device-bcm.mk
android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/nvram_ap6212.txt
android/hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk
android/hardware/libhardware_legacy/wifi_hardware_info/wifi_hardware_info.c
- `lichee/linux-3.10/arch/arm/configs/sun8iw11p1smp_android_defconfig## 对每个文件的修改说明
BoardConfig.mk
:修改了 wifi 和蓝牙的配置,将默认的 wifi 模块从 ap6212 修改为 ap6236。userial_vendor.c
:在 userial_vendor_open 函数中添加了对 ap6236 模块的支持。ap6212.zip
:添加了新的固件文件。device-bcm.mk
:创建了新的文件,定义了 ap6236 模块的固件文件路径。nvram_ap6212.txt
:创建了新的文件,定义了 ap6236 模块的 NVRAM 配置。firmware-bcm.mk
:在此文件中添加了对 ap6236 模块的支持。wifi_hardware_info.c
:在 wifi_list 中添加了对 ap6236 模块的支持。sun8iw11p1smp_android_defconfig
:修改了 BCMHD 的固件路径和 NVRAM 路径,将其指向 ap6236 模块的相关文件。
如何应用这个补丁
- 将这个补丁应用到你的 Android 源码树中。
- 根据你的硬件配置,可能需要修改
nvram_ap6212.txt
和sun8iw11p1smp_android_defconfig
中的相关设置。 - 编译并刷入你的 Android 系统。
- 当的设备启动时,系统应该能够正确地检测和使用 ap6236 wifi 模块。
注意:这个补丁可能需要根据你的具体硬件和 Android 版本进行一些调整。
Subject: [PATCH] Add ap6236 wifi & fiexd wifi module ap6236 --- .../device/softwinner/t3-p1/BoardConfig.mk | 8 +- .../broadcom/libbt/src/userial_vendor.c | 10 ++ .../broadcom/wlan/bcmdhd/firmware/ap6212.zip | Bin 0 -> 725992 bytes .../wlan/bcmdhd/firmware/ap6212/ap6212.hcd | Bin 0 -> 42667 bytes .../bcmdhd/firmware/ap6212/bcm43438a0.hcd | Bin 38644 -> 0 bytes .../wlan/bcmdhd/firmware/ap6212/device-bcm.mk | 11 +- .../bcmdhd/firmware/ap6212/nvram_ap6212.txt | 117 ++++++++++-------- .../wlan/bcmdhd/firmware/ap6236/ap6212.hcd | Bin 0 -> 42667 bytes .../wlan/bcmdhd/firmware/ap6236/device-bcm.mk | 24 ++++ .../bcmdhd/firmware/ap6236/nvram_ap6212.txt | 65 ++++++++++ .../wlan/bcmdhd/firmware/firmware-bcm.mk | 2 +- .../wifi_hardware_info/wifi_hardware_info.c | 13 +- .../configs/sun8iw11p1smp_android_defconfig | 4 +- 13 files changed, 189 insertions(+), 65 deletions(-) create mode 100755 android/hardware/broadcom/wlan/bcmdhd/firmware/ap6212.zip create mode 100755 android/hardware/broadcom/wlan/bcmdhd/firmware/ap6212/ap6212.hcd delete mode 100755 android/hardware/broadcom/wlan/bcmdhd/firmware/ap6212/bcm43438a0.hcd create mode 100755 android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/ap6212.hcd create mode 100755 android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/device-bcm.mk create mode 100755 android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/nvram_ap6212.txt diff --git a/android/device/softwinner/t3-p1/BoardConfig.mk b/android/device/softwinner/t3-p1/BoardConfig.mk index a9f8c3608c..807662cecb 100755 --- a/android/device/softwinner/t3-p1/BoardConfig.mk +++ b/android/device/softwinner/t3-p1/BoardConfig.mk @@ -20,19 +20,23 @@ BOARD_SYSTEMIMAGE_PARTITION_SIZE := 805306368 # wifi and bt configuration # 1. wifi Configuration +#$shh$20180829$modify$wifi module default ap6236$ WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_DRIVER := NL80211 BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd - +BOARD_USR_WIFI := ap6212 include hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk # 2. Bluetooth Configuration # make sure BOARD_HAVE_BLUETOOTH is true for every bt vendor -include device/softwinner/common/hardware/realtek/bluetooth/rtl8723bs/firmware/rtlbtfw_cfg.mk +#include device/softwinner/common/hardware/realtek/bluetooth/rtl8723bs/firmware/rtlbtfw_cfg.mk BOARD_HAVE_BLUETOOTH := true +BOARD_HAVE_BLUETOOTH_BCM := true +BOARD_HAVE_BLUETOOTH_NAME := ap6212 BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/softwinner/t3-p1/bluetooth/ +#$shh$20180829$modify$wifi module default ap6236$ # 3. Sensor HAL Configuration SW_BOARD_USES_SENSORS_TYPE = aw_sensors diff --git a/android/hardware/broadcom/libbt/src/userial_vendor.c b/android/hardware/broadcom/libbt/src/userial_vendor.c index 34981ba69c..ddcad1945e 100755 --- a/android/hardware/broadcom/libbt/src/userial_vendor.c +++ b/android/hardware/broadcom/libbt/src/userial_vendor.c @@ -271,6 +271,16 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg) } } else if (strcmp(module_info.mod_name, "ap6212") == 0) + { + usleep(300000); + close(vnd_userial.fd); + if ((vnd_userial.fd = open(vnd_userial.port_name, O_RDWR)) == -1) + { + ALOGE("userial vendor open: unable to open %s", vnd_userial.port_name); + return -1; + } + } + else if (strcmp(module_info.mod_name, "ap6236") == 0) { usleep(300000); close(vnd_userial.fd); diff --git a/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6212.zip b/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6212.zip literal 0 HcmV?d00001 diff --git a/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/device-bcm.mk b/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/device-bcm.mk new file mode 100755 index 0000000000..6c561de7dc --- /dev/null +++ b/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/device-bcm.mk @@ -0,0 +1,24 @@ +# +# Copyright (C) 2008 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +-include hardware/broadcom/wlan/bcmdhd/config/config-bcm.mk + +PRODUCT_COPY_FILES += \ + hardware/broadcom/wlan/bcmdhd/firmware/ap6236/fw_bcm43438a0.bin:system/vendor/modules/fw_bcm43438a0.bin \ + hardware/broadcom/wlan/bcmdhd/firmware/ap6236/fw_bcm43438a0_apsta.bin:system/vendor/modules/fw_bcm43438a0_apsta.bin \ + hardware/broadcom/wlan/bcmdhd/firmware/ap6236/fw_bcm43438a0_p2p.bin:system/vendor/modules/fw_bcm43438a0_p2p.bin \ + hardware/broadcom/wlan/bcmdhd/firmware/ap6236/nvram_ap6212.txt:system/vendor/modules/nvram_ap6212.txt \ + hardware/broadcom/wlan/bcmdhd/firmware/ap6236/ap6212.hcd:system/vendor/modules/ap6212.hcd diff --git a/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/nvram_ap6212.txt b/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/nvram_ap6212.txt new file mode 100755 index 0000000000..3537469be1 --- /dev/null +++ b/android/hardware/broadcom/wlan/bcmdhd/firmware/ap6236/nvram_ap6212.txt @@ -0,0 +1,65 @@ +#AP6236_NVRAM_V1.1_20170804 +# NVRAM file for BCM943430WLPTH, Bx Chip +# 2.4 GHz, 20 MHz BW mode + +# The following parameter values are just placeholders, need to be updated. +manfid=0x2d0 +prodid=0x0727 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0727 +boardrev=0x1331 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +boardflags3=0x08000000 +xtalfreq=26000 +nocrc=1 +ag0=255 +aa2g=1 +ccode=ALL + +pa0itssit=0x20 +extpagain2g=0 +#PA parameters for 2.4GHz, measured at CHIP OUTPUT +pa2ga0=-202,5582,-671 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=5 + +# PPR params +maxp2ga0=74 +txpwrbckof=6 +cckbw202gpo=0x2222 +legofdmbw202gpo=0x55555555 +mcsbw202gpo=0x76666666 +propbw202gpo=0xcc + +# OFDM IIR : +ofdmdigfilttype=18 +ofdmdigfilttypebe=18 +# PAPD mode: +papdmode=1 +pacalidx2g=42 +papdepsoffset=-22 +papdendidx=58 + +# LTECX flags +ltecxmux=0 +ltecxpadnum=0x0102 +ltecxfnsel=0x44 +ltecxgcigpio=0x01 + +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b + +deadman_to=0xffffffff +# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG +muxenab=0x10 +# CLDO PWM voltage settings - 0x4 - 1.1 volt +#cldo_pwm=0x4 + +#VCO freq 326.4MHz +spurconfig=0x3 + +AvVmidIQcal=0x2,0xa8 \ No newline at end of file diff --git a/android/hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk b/android/hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk index a6cd5ddff1..8e1c175a66 100755 --- a/android/hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk +++ b/android/hardware/broadcom/wlan/bcmdhd/firmware/firmware-bcm.mk @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +include hardware/broadcom/wlan/bcmdhd/firmware/ap6236/device-bcm.mk include hardware/broadcom/wlan/bcmdhd/firmware/ap6210/device-bcm.mk include hardware/broadcom/wlan/bcmdhd/firmware/ap6330/device-bcm.mk include hardware/broadcom/wlan/bcmdhd/firmware/ap6335/device-bcm.mk diff --git a/android/hardware/libhardware_legacy/wifi_hardware_info/wifi_hardware_info.c b/android/hardware/libhardware_legacy/wifi_hardware_info/wifi_hardware_info.c index 46b5101fe6..1e6e231d64 100755 --- a/android/hardware/libhardware_legacy/wifi_hardware_info/wifi_hardware_info.c +++ b/android/hardware/libhardware_legacy/wifi_hardware_info/wifi_hardware_info.c @@ -104,7 +104,17 @@ static const struct wifi_hardware_info wifi_list[] = { .fw_path_ap = "AP", .fw_path_p2p = "P2P", }, - + /*///$shh$20180829$add$ap6236 wifi module$ + { + .device_id = 0x1a9a6, + .module_name = "ap6236", + .driver_name = "bcmdhd", + .vendor_name = "broadcom", + .fw_path_sta = "/system/vendor/modules/fw_bcm43438a1.bin", + .fw_path_ap = "/system/vendor/modules/fw_bcm43438a1_apsta.bin", + .fw_path_p2p = "/system/vendor/modules/fw_bcm43438a1_p2p.bin", + }, + ///$shh$20180829$add$ap6236 wifi module$ */ { .device_id = 0x1a9a6, .module_name = "ap6212", @@ -114,6 +124,7 @@ static const struct wifi_hardware_info wifi_list[] = { .fw_path_ap = "/system/vendor/modules/fw_bcm43438a0_apsta.bin", .fw_path_p2p = "/system/vendor/modules/fw_bcm43438a0_p2p.bin", }, + { .device_id = 0x1a962, .module_name = "ap6210", diff --git a/lichee/linux-3.10/arch/arm/configs/sun8iw11p1smp_android_defconfig b/lichee/linux-3.10/arch/arm/configs/sun8iw11p1smp_android_defconfig index f9cb15cbdd..0f1907ab4d 100755 --- a/lichee/linux-3.10/arch/arm/configs/sun8iw11p1smp_android_defconfig +++ b/lichee/linux-3.10/arch/arm/configs/sun8iw11p1smp_android_defconfig @@ -1375,8 +1375,8 @@ CONFIG_RTL8189ES=m # CONFIG_WIFI_CONTROL_FUNC is not set # CONFIG_ATH_CARDS is not set CONFIG_BCMDHD=m -CONFIG_BCMDHD_FW_PATH="/system/vendor/modules/fw_bcm43438a0.bin" -CONFIG_BCMDHD_NVRAM_PATH="/system/vendor/modules/nvram_ap6212.txt" +CONFIG_BCMDHD_FW_PATH="/system/vendor/modules/fw_bcm43438a1.bin" +CONFIG_BCMDHD_NVRAM_PATH="/system/vendor/modules/nvram_ap6236.txt" CONFIG_BCMDHD_SDIO=y CONFIG_BCMDHD_OOB=y # CONFIG_BCMDHD_SDIO_IRQ is not set -- 2.25.1