全志A33 Android4.4 RTL8723DS WIFI/BT驱动调试

老子叫甜甜 提交于 2020-12-23 11:31:22

平台:全志A33 Android4.4

模块:RTL8723DS

接口:SDIO、uart1(ttyS1)

kernel:Linux3.4

 

一、 移植8723ds驱动,让驱动参与编译

    1.将rtl8723ds驱动源码放到linux-3.4/drivers/net/wireless/目录下,并生成一个rtl8723ds目录

驱动下载地址:https://download.csdn.net/download/Mrdeath/13744931

注意:该驱动不是原版驱动,而是经过了我的修改去适配了A33 Android4.4的SDK,由于A33源码里面并没有8723ds的源码,所以sys_config.fex,以及rf目录下没有针对8723ds的电源控制,所以如果你是完全参考我方案来移植,请务必使用该版驱动。

    2.修改配置文件添让驱动参与编译:

      (1).修改Kconfig文件

--git a/lichee/linux-3.4/drivers/net/wireless/Kconfig b/lichee/linux-3.4/drivers/net/wireless/Kconfig
index 33409594d0..0055f4567c 100755
--- a/lichee/linux-3.4/drivers/net/wireless/Kconfig
+++ b/lichee/linux-3.4/drivers/net/wireless/Kconfig
@@ -297,4 +297,5 @@ source "drivers/net/wireless/rtl8189es/Kconfig"
 source "drivers/net/wireless/rtl8723bs/Kconfig"
 source "drivers/net/wireless/rtl8723bu/Kconfig
 source "drivers/net/wireless/esp8089/Kconfig"
+source "drivers/net/wireless/rtl8723ds/Kconfig"
 endif # WLAN

    (2).修改Makefile文件

--git a/lichee/linux-3.4/drivers/net/wireless/Makefile b/lichee/linux-3.4/drivers/net/wireless/Makefile
index 186b119d30..d24cd3cf45 100755
--- a/lichee/linux-3.4/drivers/net/wireless/Makefile
+++ b/lichee/linux-3.4/drivers/net/wireless/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_RTL8189ES) 	+= rtl8189es/
 obj-$(CONFIG_RTL8723BS) 	+= rtl8723bs/
 obj-$(CONFIG_RTL8723BS)     += rtl8723bu/
 obj-$(CONFIG_ESP8089) 		+= esp8089/
+obj-$(CONFIG_RTL8723DS)     += rtl8723ds/
 
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o

    (3).menuconfig里勾选rtl8723ds驱动,作为模块编译

 

配置完上面内容后,rtl8723ds驱动就能正确参与编译了。

 

二、 配置系统开机自动加载8723ds驱动

    1.修改BoardConfig.mk

SW_BOARD_USR_WIFI、BOARD_WLAN_DEVICE、SW_BOARD_HAVE_BLUETOOTH_NAME值改为8723ds

diff --git a/android4.4/device/softwinner/astar-y3/BoardConfig.mk b/android4.4/device/softwinner/astar-y3/BoardConfig.mk
index a2669cdbef..c1d191bae7 100755
--- a/android4.4/device/softwinner/astar-y3/BoardConfig.mk
+++ b/android4.4/device/softwinner/astar-y3/BoardConfig.mk
@@ -27,8 +27,8 @@ ifeq ($(BOARD_WIFI_VENDOR), realtek)
     BOARD_HOSTAPD_DRIVER        := NL80211
     BOARD_HOSTAPD_PRIVATE_LIB   := lib_driver_cmd_rtl
 
-	SW_BOARD_USR_WIFI := rtl8723bu
-	BOARD_WLAN_DEVICE := rtl8723bu
+    SW_BOARD_USR_WIFI := rtl8723ds
+    BOARD_WLAN_DEVICE := rtl8723ds
     
 	#SW_BOARD_USR_WIFI := rtl8188eu
 	#BOARD_WLAN_DEVICE := rtl8188eu
@@ -86,7 +86,7 @@ BOARD_HAVE_BLUETOOTH := true
 #SW_BOARD_HAVE_BLUETOOTH_NAME := ap6330
 BOARD_HAVE_BLUETOOTH_RTK := true
 #BLUETOOTH_HCI_USE_RTK_H5 := true
-SW_BOARD_HAVE_BLUETOOTH_NAME := rtl8723bs
+SW_BOARD_HAVE_BLUETOOTH_NAME := rtl8723ds
 
 # boostup code will on command to set CPU roomage and DDR freq
 # default enable

      2.修改 hardware/libhardware_legacy/wifi/Android.mk

diff --git a/android4.4/hardware/libhardware_legacy/wifi/Android.mk b/android4.4/hardware/libhardware_legacy/wifi/Android.mk
index bd89033896..f99f28038d 100755
--- a/android4.4/hardware/libhardware_legacy/wifi/Android.mk
+++ b/android4.4/hardware/libhardware_legacy/wifi/Android.mk
@@ -55,6 +55,12 @@ LOCAL_CFLAGS += -DRTL_8723BU_WIFI_USED
 LOCAL_CFLAGS += -DRTL_WIFI_VENDOR
 endif
 
+#realtek sdio wifi+bt module
+ifeq ($(SW_BOARD_USR_WIFI), rtl8723ds)
+LOCAL_CFLAGS += -DRTL_8723DS_WIFI_USED
+LOCAL_CFLAGS += -DRTL_WIFI_VENDOR
+endif
+
 #espressif sdio wifi module
 ifeq ($(SW_BOARD_USR_WIFI), esp8089)
 LOCAL_CFLAGS += -DESPRESSIF_ESP8089_WIFI_USED

       3.修改hardware/libhardware_legacy/wifi/wifi.c 

diff --git a/android4.4/hardware/libhardware_legacy/wifi/wifi.c b/android4.4/hardware/libhardware_legacy/wifi/wifi.c
index ce32ea4b43..fac4e489c6 100755
--- a/android4.4/hardware/libhardware_legacy/wifi/wifi.c
+++ b/android4.4/hardware/libhardware_legacy/wifi/wifi.c
@@ -116,6 +116,18 @@ static char primary_iface[PROPERTY_VALUE_MAX];
     #define WIFI_DRIVER_MODULE_ARG          "ifname=wlan0 if2name=p2p0"
     #endif
 
+#elif defined RTL_8723DS_WIFI_USED
+    /* rtl8723DS sdio+bt wifi */
+    #ifndef WIFI_DRIVER_MODULE_PATH
+    #define WIFI_DRIVER_MODULE_PATH         "/system/vendor/modules/8723ds.ko"
+    #endif
+    #ifndef WIFI_DRIVER_MODULE_NAME
+    #define WIFI_DRIVER_MODULE_NAME         "8723ds"
+    #endif
+    #ifndef WIFI_DRIVER_MODULE_ARG
+    #define WIFI_DRIVER_MODULE_ARG          "ifname=wlan0 if2name=p2p0"
+    #endif
+
 #elif defined ESPRESSIF_ESP8089_WIFI_USED
     /* esp8089 sdio wifi */
     #ifndef WIFI_DRIVER_MODULE_PATH

   将编译后的ko文件添加到android4.4/device/softwinner/astar-y3/modules/modules/目录下。    

   上面添加完之后,系统开机后就能自动加载8723.ko驱动,具体的加载流程我就不描述了。这里简单说下加载ko文件是在hardware/libhardware_legacy/wifi/wifi.c下的int wifi_load_driver() 加载对应的wifi驱动

 

三、添加fw和config固件

   1.修改astar_y3.mk

--- a/android4.4/device/softwinner/astar-y3/astar_y3.mk
+++ b/android4.4/device/softwinner/astar-y3/astar_y3.mk
@@ -71,6 +71,9 @@ PRODUCT_COPY_FILES += \
 #$(call inherit-product-if-exists, hardware/broadcom/wlan/firmware/ap6210/device-bcm.mk)
 #$(call inherit-product-if-exists, hardware/broadcom/wlan/firmware/ap6330/device-bcm.mk)
 
+#rtl8723ds bt fw and config
+$(call inherit-product, hardware/realtek/bluetooth/rtl8723ds/firmware/rtlbtfw_cfg.mk)
+
 #rtl8723bs bt fw and config
 $(call inherit-product, hardware/realtek/bluetooth/rtl8723bs/firmware/rtlbtfw_cfg.mk)

   2.将hw_bt_rtl8723ds.tar.gz压缩包解压到hardware/realtek/bluetooth目录下

目录名字重命名为rtl8723ds

 包下载地址:https://download.csdn.net/download/Mrdeath/13745180

注意:如果你的bt使用的接口不是ttyS1,请修改hardware/realtek/bluetooth/rtl8723ds/libbt-vendor/include/vnd_astar-y3.txt文件下的BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyS*"

 

四、配置8723ds参数

1.修改init.sun8i.rc

蓝牙串口改为ttyS1

 diff --git a/android4.4/device/softwinner/astar-y3/init.sun8i.rc b/android4.4/device/softwinner/astar-y3/init.sun8i.rc
index 7a9d9f63f1..df52fac6e0 100755
--- a/android4.4/device/softwinner/astar-y3/init.sun8i.rc
+++ b/android4.4/device/softwinner/astar-y3/init.sun8i.rc
 # UART device
-#    chmod 0666 /dev/rtk_btusb
-#    chown bluetooth net_bt_stack /dev/rtk_btusb
+     chmod 0666 /dev/ttyS1
+     chown bluetooth net_bt_stack /dev/ttyS1
 #
     # power up/down interface
 	chmod 0660 /sys/class/rfkill/rfkill0/state

2.修改sys_config文件

在[wifi_para]那一栏,我设置的是8723bs的参数,其实这里我是对8723ds的电源管理参考8723bs进行了修改,所以这些参数同样针对8723ds能使用,所以这几项正常打开配置使用就行。

注意:

wifi_mod_sel必须为5,因为我是根据8723bs的参数修改的8723ds驱动,所以这里mod要选择5

rtl8723bs_lpo_use_apclk为1,我的模块的32k时钟是从cpu引出的,所以我这边设为1,如果你使用的是外部32k时钟,这里设为0

diff --git a/lichee/tools/pack/chips/sun8iw5p1/configs/y3/sys_config.fex b/lichee/tools/pack/chips/sun8iw5p1/configs/y3/sys_config.fex
index 47e2de7f28..21ff98692d 100755
--- a/lichee/tools/pack/chips/sun8iw5p1/configs/y3/sys_config.fex
+++ b/lichee/tools/pack/chips/sun8iw5p1/configs/y3/sys_config.fex
@@ -259,11 +259,12 @@ uart_rx         = port:PF04<3><1><default><default>
 
 [uart1]
 uart_used       = 1
-uart_type       = 2
+uart_port	= 1
+uart_type       = 4
 uart_tx         = port:PG06<2><1><default><default>
 uart_rx         = port:PG07<2><1><default><default>
-;uart_rts        = port:PG08<2><1><default><default>
-;uart_cts        = port:PG09<2><1><default><default>
+uart_rts        = port:PG08<2><1><default><default>
+uart_cts        = port:PG09<2><1><default><default>
 
 [uart2]
 uart_used       = 1
@@ -786,19 +787,18 @@ sdc_regulator     = "none"
 
 [mmc1_para]
 sdc_used          = 1
-sdc_detmode       = 2
+sdc_detmode       = 4
 sdc_buswidth      = 4
-sdc_clk           = port:PG00<2><1><1><default>
-sdc_cmd           = port:PG01<2><1><1><default>
-sdc_d0            = port:PG02<2><1><1><default>
-sdc_d1            = port:PG03<2><1><1><default>
-sdc_d2            = port:PG04<2><1><1><default>
-sdc_d3            = port:PG05<2><1><1><default>
-sdc_det           = port:PB04<4><1><2><default>
-sdc_power_supply  = "axp22_dcdc1"
+sdc_clk           = port:PG00<2><1><2><default>
+sdc_cmd           = port:PG01<2><1><2><default>
+sdc_d0            = port:PG02<2><1><2><default>
+sdc_d1            = port:PG03<2><1><2><default>
+sdc_d2            = port:PG04<2><1><2><default>
+sdc_d3            = port:PG05<2><1><2><default>
+sdc_det           = 
 sdc_use_wp        = 0
 sdc_wp            =
-sdc_isio          = 0
+sdc_isio          = 1
 sdc_regulator     = "none"
 
 [mmc2_para]
@@ -938,13 +938,13 @@ lsm303d                   = 1
 ;--------------------------------------------------------------------------------
 [wifi_para]
 wifi_used          = 1
-wifi_sdc_id        = 0
+wifi_sdc_id        = 1
 wifi_usbc_id       = 1
 wifi_usbc_type     = 1
-wifi_mod_sel       = 3
-wifi_power         = ""
-wifi_power_ext1    = ""
-wifi_power_ext2    = ""
+wifi_mod_sel       = 5
+wifi_power         =  
+wifi_power_ext1    = 
+wifi_power_ext2    = 
 wifi_power_switch  = ;port:PH09<1><0><default><0>
 
 ; 1 - ap6181 sdio wifi gpio config
@@ -965,13 +965,13 @@ wifi_power_switch  = ;port:PH09<1><0><default><0>
 ; 4 - rtl8723au usb wifi + bt
 
 ; 5 - rtl8723bs sdio wifi + bt
-;rtl8723bs_chip_en       = port:PL11<1><default><default><0>
-;rtl8723bs_wl_regon      = port:PL06<1><default><default><0>
-;rtl8723bs_wl_host_wake  = port:PL07<4><default><default><0>
-;rtl8723bs_bt_regon      = port:PL08<1><default><default><0>
-;rtl8723bs_bt_wake       = port:PL10<1><default><default><0>
-;rtl8723bs_bt_host_wake  = port:PL09<4><default><default><0>
-;rtl8723bs_lpo_use_apclk = 0
+rtl8723bs_chip_en       = 
+rtl8723bs_wl_regon      = port:PL02<1><default><default><0>
+rtl8723bs_wl_host_wake  = port:PL07<4><default><default><0>
+rtl8723bs_bt_regon      = port:PL08<1><default><default><0>
+rtl8723bs_bt_wake       = port:PL10<1><default><default><0>
+rtl8723bs_bt_host_wake  = port:PL09<4><default><default><0>
+rtl8723bs_lpo_use_apclk = 1
 
 ; 6 - eagle sdio wifi
 ;esp_wl_chip_en        = port:PL03<1><default><default><0>
@@ -984,7 +984,7 @@ wifi_power_switch  = ;port:PH09<1><0><default><0>
 ;--------------------------------------------------------------------------------
 [bt_para]
 bt_used             = 1
-bt_uart_id          = ;1
+bt_uart_id          = 1
 
 ;--------------------------------------------------------------------------------
 ;3G configuration

以上修改完成后,驱动就能正常使用了

五、整个移植和修改的补丁patch,下载地址:https://download.csdn.net/download/Mrdeath/13745408

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!