基于上篇的环境,继续修改; 这里主要是修改驱动模块和配置文件
2. driver修改当前broadcom系统的ap6xxx模组,wifi是共用同一份驱动,增加同系列的一款wifi的支持,仅需要修改驱动的dhd_common_init()函数,指定firmware和nvram的路径名和名称
void dhd_common_init(osl_t *osh) { int select_type = 0; //aw checkout which wifi had select select_type = wifi_pm_get_mod_type(); #ifdef CONFIG_BCMDHD_FW_PATH //select ap6181 or ap6210 or ap6476 if (select_type == 1 || select_type == 2 || select_type == 10) { bcm_strncpy_s(fw_path, sizeof(fw_path), “/system/vendor/modules/fw_bcm40181a2.bin”, MOD_PARAM_PATHLEN-1); } #else /* CONFIG_BCMDHD_FW_PATH */ fw_path[0] = \0; #endif /* CONFIG_BCMDHD_FW_PATH */ #ifdef CONFIG_BCMDHD_NVRAM_PATH …… //select ap6476 if (select_type == 10) { bcm_strncpy_s(nv_path, sizeof(nv_path), “/system/vendor/modules/nvram_ap6476.txt”, MOD_PARAM_PATHLEN-1); } #else /* CONFIG_BCMDHD_NVRAM_PATH */ nv_path[0] = \0; #endif /* CONFIG_BCMDHD_NVRAM_PATH */ ……. #ifdef SOFTAP fw_path2[0] = \0; #endif }bcmdhd驱动是built-in到内核,在系统启动驱动被加载时会做检测firmware和nvram的操作
3. 电源管理修改rf电源管理要添加ap6476的支持,包括两个方面,一是wifi电源管理的支持,二是PG组I/O电压要调成1.8V。
ap6476 wifi电源管理的支持需要在wifi_pm.c中做修改,修改的地方如下
@@ -22,6 +22,7 @@ static char* wifi_mod[] = {” “, “mtk6620”, /* 7 – MTK6620() */ “rtl8723au”, /* 8 – RTL8723AU*/ “ap6330”, /* 9 – AP6330*/ + “ap6476”, /* 10- AP6476*/ }; int wifi_pm_get_mod_type(void) @@ -193,6 +194,9 @@ static int __devinit wifi_pm_probe(struct platform_device *pdev) case 9: /* AP6330 */ ap6xxx_gpio_init(); break; + case 10: /* AP6476 */ + ap6xxx_gpio_init(); + break; default: wifi_pm_msg(“wrong sdio module select %d !\n”, ops->module_sel.val); }PG的电压是由axp22_dldo2提供,axp22_dldo2的电压决定PG组的I/O电压,要把PG的I/O电压需要修改wifi_pm_ap6xxx.c文件,把axp22_dldo2电压值设成1.8V,修改如下
@@ -41,8 +85,8 @@ static int ap6xxx_module_power(int onoff) } if (onoff) { – ap6xxx_msg(“regulator on.\n”); – ret = regulator_set_voltage(wifi_ldo, 3300000, 3300000); + ap6xxx_msg(“regulator on, PG->1.8v.\n”); + ret = regulator_set_voltage(wifi_ldo, 1800000, 1800000); if (ret < 0) { ap6xxx_msg(“regulator_set_voltage fail, return %d.\n”, ret); regulator_put(wifi_ldo); 4. 安卓平台文件修改(1)BoardConfig.mk
BoardConfig.mk是android系统平台配置文件,wpa_supplicant的版本、驱动接口、相关库名和所使用的wifi模组设备均是在BoardConfig.mk中指定
BOARD_WIFI_VENDOR := broadcom ifeq ($(BOARD_WIFI_VENDOR), broadcom) BOARD_WPA_SUPPLICANT_DRIVER := NL80211 WPA_SUPPLICANT_VERSION := VER_0_8_X BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_HOSTAPD_DRIVER := NL80211 BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_bcmdhd BOARD_WLAN_DEVICE := bcmdhd WIFI_DRIVER_FW_PATH_PARAM := “/sys/module/bcmdhd/parameters/firmware_path” SW_BOARD_USR_WIFI := AP6476 WIFI_DRIVER_FW_PATH_STA := “/system/vendor/modules/fw_bcm40181a2.bin” WIFI_DRIVER_FW_PATH_P2P := “/system/vendor/modules/fw_bcm40181a2_p2p.bin” WIFI_DRIVER_FW_PATH_AP := “/system/vendor/modules/fw_bcm40181a2_apsta.bin” endif对于ap6476 wifi,需要在BoardConfig.mk中添加以上内容,其中firmware的路径和名称在wifi打开时会经由HAL传给wifi驱动。
(2)fiber_xxx.mk fiber_xxx.mk中要添加对firmware和nvram文件拷贝的操作
# ap6476 fw and nvram PRODUCT_COPY_FILES += \ hardware/broadcom/wlan/firmware/ap6476/fw_bcm40181a2.bin:system/vendor/modules/fw_bcm40181a2.bin \ hardware/broadcom/wlan/firmware/ap6476/fw_bcm40181a2_apsta.bin:system/vendor/modules/fw_bcm40181a2_apsta.bin \ hardware/broadcom/wlan/firmware/ap6476/fw_bcm40181a2_p2p.bin:system/vendor/modules/fw_bcm40181a2_p2p.bin \ hardware/broadcom/wlan/firmware/ap6476/nvram_ap6476.txt:system/vendor/modules/nvram_ap6476.txt在android开始编译时就会执行fiber_xxx.mk文件,把相关的文件拷贝到out目录下对应的文件夹
5. 启动脚本修改init.sun6i.rc中添加wifi station和softap的wpa_supplicant服务、p2p的p2p_supplicant服务。
# broadcom wifi service # broadcom wifi station and softap service wpa_supplicant /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot # braodcom wifi sta p2p concurrent service service p2p_supplicant /system/bin/wpa_supplicant \ -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \ -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -puse_p2p_group_interface=1 class main socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot这两个服务是在wifi打开时由HAL(wifi.c)层开启的。
免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:全志平台ap6476 wifi模组调试(2)驱动移植& 配置文件修改 https://www.yhzz.com.cn/a/13184.html