1、dhd_module_init(驱动模块初始化函数)
→ dhd_wifi_platform_register_drv(查找设备,注册驱动)
→ 1) wifi_ctrlfunc_register_drv(wifi控制驱动注册) Y
2) dhd_wifi_platform_load(wifi控制功能不存在时调用) N
3) wifi_ctrlfunc_unregister_drv(由于初始化失败导致驱动未注册成功时调用) N
2、wifi_ctrlfunc_register_drv
→ 1)bus_find_device(寻找平台设备)
2)wifi_adapter_info_t *adapter(wifi_adapter_info_t初始化)
bcmdhd_wifi_platdata_t *dhd_wifi_platdata(bcmdhd_wifi_platdata_t初始化)
dhd_wifi_platdata->adapters = adapter(将adapter传递给全局变量dhd_wifi_platdata)
3) wifi_platform_data dhd_wlan_control(wifi_platform_data初始化)
adapter->wifi_plat_data = (void *)&dhd_wlan_control(使用dhd_wlan_control全局变量初始化adapter中的wifi_plat_data成员)
4)bcm_wlan_set_plat_data(wlan平台数据设置)
5)dhd_wifi_platform_load(wifi平台登录)
3、bcm_wlan_set_plat_data
→ 1)dhd_wlan_control.set_power = bcm_wlan_set_power
2)dhd_wlan_control.set_carddetect = bcm_wlan_set_carddetect
3) dhd_wlan_control.get_mac_addr = bcm_wlan_get_mac_address
4、dhd_wifi_platform_load
→ 1) wl_android_init(初始化dhd_msg_level |= DHD_ERROR_VAL,给iface_name赋值为wlan)
→ 2) dhd_wifi_platform_load_sdio
→ 1) dhd_bus_reg_sdio_notify(注册sdio driver,sdio驱动获取wifi列表的设备后调用dummy_probe -> up(dhd_chipup_sem))
→ 2) wifi_platform_set_power(调用adapter成员wifi_plat_data中的set_power开启模块电源)
→ 3) wifi_platform_bus_enumerate(调用adapter成员wifi_plat_data中的s et_carddetect)
→ 4) dhd_bus_register
→ bcmsdh_register(&dhd_sdio)
→ 1) 初始化drvinfo (见①)
→ 2) bcmsdh_register_client_driver
→ sdio_register_driver(注册名为bcmsdh_sdmmc的驱动)
→ 进入bcmsdh_sdmmc_probe
→ sdioh_probe
→ bcmsdh_probe→ drvinfo.probe(①) → dhdsdio_probe → dhd_download_fw_on_driverload = TRUE