目录
- 一、RTL8723DS WiFi 适配 --- 篇章
- 1、原理图分析(WiFi部分)
- `补充:`RTL8723DS时钟输入源讲解
- 2、根据原理图修改设备树和编辑驱动文件
- 3、实验验证
- 4、RTL8723DS WIFI驱动参考文档和博客网站
- 二、RTL8723DS 蓝牙Bluetooth 适配 --- 篇章
- 1、原理图分析(蓝牙Bluetooth部分)
- 2、根据原理图修改设备树
- 3、修改蓝牙相关的配置
- 4、RTL8723DS 蓝牙Bluetooth驱动参考文档
瑞芯微RK系列对“REALTEK瑞昱公司”的wifi、蓝牙双模的模组都有内置适配的,因此HAL层、Framework层、协议栈及库文件都不需要移植适配,只需修改设备树和一些配置文件即可。
一、RTL8723DS WiFi 适配 — 篇章
1、原理图分析(WiFi部分)
补充:
RTL8723DS时钟输入源讲解
RTL8723DS模组的第24号引脚是模组的时钟输入源,需要给此提供1.8V~3.3V,32KHz的输入源。由原理图可知,提供时钟输入源的是RK808 CLK32KOUT1引脚提供的外部32KHz时钟。因此需要添加:
clocks =<&rk808 1>;
clock-name = "ext_clock";
PATCH文件和规格书和参考文档👈
2、根据原理图修改设备树和编辑驱动文件
由原理图可以看出,板子上使用的RTL8723DS模块WIFI部分的接口是SDIO接口的,因此在设备树上修改对应的GPIO即可。
Ⅰ、首先打开对RTL8723DS模块的供电,也就是WL_ON引脚->GPIO8_A4,先需要使用pinctrl将其复用成GPIO功能,然后将其WL_ON引脚拉低电平,让其P-MOS管导通,处理方法如下图所示:
我这在HD_gpio_control.c这个GPIO驱动程序上初始化GPIO8_A4,默认拉低电平,如下图所示,这里随意写个驱动即可。
Ⅱ、修改sdio0设备树节点,如下图所示:
将RTL8723DS驱动添加到内核吗,如下图所示:
Ⅳ、修改make menuconfig,如下图所示:
3、实验验证
通过以上配置,基本驱动移植就配置好了,如下图所示:
4、RTL8723DS WIFI驱动参考文档和博客网站
博客参网站👈
路径:a\RKDocs\android\wifi\Rockchip_Introduction_REALTEK_WIFI_Driver_Porting_CN&EN.pdf和a\RKDocs\android\wifi\Rockchip_Introduction_WIFI_Configuration_CN&EN.pdf
二、RTL8723DS 蓝牙Bluetooth 适配 — 篇章
1、原理图分析(蓝牙Bluetooth部分)
上图黄色框框就是本次蓝牙功能适配需要关注的引脚接口。
2、根据原理图修改设备树
3、修改蓝牙相关的配置
diff --git a/device/rockchip/common/init.connectivity.rc b/device/rockchip/common/init.connectivity.rc
index 40fa8d31b2..66c4abf930 100755
--- a/device/rockchip/common/init.connectivity.rc
+++ b/device/rockchip/common/init.connectivity.rc
@@ -17,16 +17,16 @@ on zygote-start
chown bluetooth net_bt ro.bt.bdaddr_path
setprop ro.bt.bdaddr_path "/data/misc/bluetooth/bdaddr"
- #chmod 0660 /dev/ttyS0
+ chmod 0660 /dev/ttyS0
chmod 0660 /dev/ttyS1
- #chmod 0660 /dev/ttyS8
+ chmod 0660 /dev/ttyS4
chmod 0660 /dev/vflash
chmod 0664 /dev/vendor_storage
chown bluetooth net_bt /dev/vflash
chown bluetooth net_bt /dev/vendor_storage
#chown bluetooth net_bt /dev/ttyS0
- chown bluetooth net_bt /dev/ttyS1
- #chown bluetooth net_bt /dev/ttyS8
+ #chown bluetooth net_bt /dev/ttyS1
+ chown bluetooth net_bt /dev/ttyS4
chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
chmod 0664 /sys/class/rfkill/rfkill0/state
diff --git a/device/rockchip/common/ueventd.rockchip.rc b/device/rockchip/common/ueventd.rockchip.rc
index b69c909155..92fac57a91 100755
--- a/device/rockchip/common/ueventd.rockchip.rc
+++ b/device/rockchip/common/ueventd.rockchip.rc
@@ -65,18 +65,18 @@
/dev/gps 0660 gps gps
# for BT
-/dev/vflash 0660 bluetooth net_bt
/dev/ttyS0 0777 system system
-/dev/ttyS1 0660 bluetooth net_bt
+/dev/ttyS1 0777 system system
/dev/ttyS2 0777 system system
/dev/ttyS3 0777 system system
-/dev/ttyS4 0777 system system
/dev/ttyS5 0777 system system
/dev/ttyS7 0777 system system
/dev/ttyS8 0777 system system
/dev/ttyS9 0777 system system
-/dev/rtk_btusb 0660 bluetooth net_bt
+/dev/vflash 0660 bluetooth net_bt_stack
+/dev/ttyS4 0660 bluetooth net_bt_stack
+/dev/rtk_btusb 0660 bluetooth net_bt_stack
#for hid audio
/dev/hidraw0 0660 audio audio
diff --git a/device/rockchip/rk3288/bluetooth/rtkbt.conf b/device/rockchip/rk3288/bluetooth/rtkbt.conf
index 2bc297212b..42951cb793 100644
--- a/device/rockchip/rk3288/bluetooth/rtkbt.conf
+++ b/device/rockchip/rk3288/bluetooth/rtkbt.conf
@@ -9,7 +9,7 @@ DevClassMinorClass=0x1C
#Indicate USB or UART driver bluetooth
#BtDeviceNode=/dev/rtk_btusb
-BtDeviceNode=/dev/ttyS0
+BtDeviceNode=/dev/ttyS4
# Enable BtSnoop logging function
# valid value : true, false
diff --git a/device/rockchip/rk3288/rk3288_Android11/bt_vendor.conf b/device/rockchip/rk3288/rk3288_Android11/bt_vendor.conf
index 3714843d5b..a133cad89f 100755
--- a/device/rockchip/rk3288/rk3288_Android11/bt_vendor.conf
+++ b/device/rockchip/rk3288/rk3288_Android11/bt_vendor.conf
@@ -1,5 +1,5 @@
# UART device port where Bluetooth controller is attached
-UartPort = /dev/ttyS0
+UartPort = /dev/ttyS4
# Firmware patch file location
FwPatchFilePath = /vendor/etc/firmware/
diff --git a/hardware/realtek/rtkbt/code/libbt-vendor/include/bt_vendor_rtk.h b/hardware/realtek/rtkbt/code/libbt-vendor/include/bt_vendor_rtk.h
index a11546837e..f5a6080ffe 100755
--- a/hardware/realtek/rtkbt/code/libbt-vendor/include/bt_vendor_rtk.h
+++ b/hardware/realtek/rtkbt/code/libbt-vendor/include/bt_vendor_rtk.h
@@ -87,7 +87,7 @@
/* Device port name where Bluetooth controller attached */
#ifndef BLUETOOTH_UART_DEVICE_PORT
-#define BLUETOOTH_UART_DEVICE_PORT "/dev/ttyS1" /* maguro */
+#define BLUETOOTH_UART_DEVICE_PORT "/dev/ttyS4" /* maguro */
#endif
/* Location of firmware patch files */
diff --git a/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt.conf b/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt.conf
index a1e9b39361..c137c0ebd5 100755
--- a/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt.conf
+++ b/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt.conf
@@ -9,7 +9,11 @@ DevClassMinorClass=0x1C
#Indicate USB or UART driver bluetooth
#BtDeviceNode=/dev/rtkbt_dev
-BtDeviceNode=?/dev/ttyS1:H5
+BtDeviceNode=?/dev/ttyS4:H5
+
+# Enable BtSnoop logging function
+# valid value : true, false
+RtkBtsnoopDump=true
# BtSnoop log output file
BtSnoopFileName=/data/misc/bluedroid/btsnoop_hci.cfa
diff --git a/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt_S0.conf b/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt_S0.conf
index 87a8241f17..89cd47356a 100755
--- a/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt_S0.conf
+++ b/hardware/realtek/rtkbt/vendor/etc/bluetooth/rtkbt_S0.conf
@@ -9,7 +9,7 @@ DevClassMinorClass=0x1C
#Indicate USB or UART driver bluetooth
#BtDeviceNode=/dev/rtk_btusb
-BtDeviceNode=?/dev/ttyS0:H5
+BtDeviceNode=?/dev/ttyS4:H5
# Enable BtSnoop logging function
# valid value : true, false
4、RTL8723DS 蓝牙Bluetooth驱动参考文档
路径:a\RKDocs\android\bt\Rockchip_Introduction_Android9.0_BT_Configuration_CN.pdf