全志平台ap6476 wifi模组调试(2)驱动移植& 配置文件修改
1. 前言
基于上篇的环境,继续修改;
这里主要是修改驱动模块和配置文件
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)层开启的。
- 分享
- 举报
-
浏览量:8362次2021-01-20 17:04:49
-
浏览量:6221次2021-01-15 17:26:20
-
浏览量:14513次2021-01-16 15:43:02
-
浏览量:6944次2021-01-22 15:28:47
-
浏览量:8358次2021-01-20 17:16:00
-
浏览量:2244次2022-07-09 08:47:55
-
浏览量:8416次2020-11-26 14:22:19
-
浏览量:5599次2021-04-12 16:15:46
-
浏览量:1186次2024-03-15 09:51:11
-
浏览量:7033次2020-09-10 09:46:52
-
浏览量:3088次2020-09-22 14:12:32
-
浏览量:10997次2020-12-16 18:56:54
-
浏览量:6516次2021-01-08 15:16:17
-
浏览量:10280次2020-11-26 15:59:29
-
浏览量:4245次2020-09-23 19:01:05
-
浏览量:6494次2018-08-28 16:40:09
-
浏览量:843次2024-01-24 15:46:44
-
浏览量:8735次2020-09-08 19:26:12
-
浏览量:1509次2024-03-16 10:01:36
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
free-jdx
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明