本文主要是介绍高通android驱动和设备树-wifi驱动粗略记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、高通设备树
对驱动之类的略有了解,今天看wifi功耗问题的时候想看一下设备树的定义,一开始怎么也没找到设备树是哪个,后来经询问,得知在vendor目录下
vendor/qcom/proprietary/devicetree
这个是高通通用的设备树定义和驱动放置的位置
很想知道它是怎么被linux kernel一起编译的,最后发现其实就是个软连接
在kernel/msm-5.4/arch/arm64/boot/dts
lrwxrwxrwx 1 root root 52 10月 30 18:01 ./vendor -> ../../../../../../vendor/qcom/proprietary/devicetree
二、wifi- CNSS休眠唤醒日志:
这个是CNSS开机,到休眠,到唤醒的日志
https://download.csdn.net/download/yudelian/88602574
如上面日志
01-01 08:04:05.915 0 0 D cnss : De-assert WLAN_EN GPIO successfully
01-01 08:04:05.915 0 0 D cnss : Regulator vdd-wlan-vh is being disabled
01-01 08:04:05.916 0 0 D cnss : Regulator vdd-wlan-s5c is being disabled
01-01 08:04:05.916 0 0 D cnss : Regulator vdd-wlan-vm is being disabled
01-01 08:04:05.916 0 0 D cnss : Regulator vdd-wlan-vl is being disabled
01-01 08:04:05.916 0 0 D cnss : Regulator vdd-wlan-ctrl2 is being disabled
01-01 08:04:05.916 0 0 D cnss : Regulator vdd-wlan-ctrl1 is being disabled
休眠的时候 WLAN_EN,这个是一个引脚,会下电的,这样可以降低功耗
三、qcom wifi驱动源码文件地址:
vendor/qcom/opensource/wlan/qcacld-3.0/core/hdd/src/wlan_hdd_main.c
举功耗功能为例:
hdd_context_create
hdd_ctx->pm_notifier.notifier_call = hdd_pm_notify;
register_pm_notifier(&hdd_ctx->pm_notifier);
上面在创建context的时候,在linux内核里注册一个pm事件回调hdd_pm_notify,
hdd_shutdown_wlan_in_suspend_prepare根据ucfg_pmo_get_suspend_mode配置看是否支持shutdown功能,一开始这儿不支持,当系统休眠的时候,就会走到驱动的suspend和resume函数,导致wifi模块无法下电,后来在这里不管配置,直接走下去了,最后调用到pld_idle_shutdown,我们的wifi硬件接口是pcie的,所以最后调用到了
cnss_idle_shutdown,这个是cnss的驱动接口。
static int hdd_pm_notify(struct notifier_block *b,unsigned long event, void *p){switch (event) {case PM_SUSPEND_PREPARE:case PM_HIBERNATION_PREPARE:if (0 != hdd_shutdown_wlan_in_suspend_prepare())return NOTIFY_STOP;break;case PM_POST_SUSPEND:case PM_POST_HIBERNATION:break;}return NOTIFY_DONE;
}static QDF_STATUS hdd_shutdown_wlan_in_suspend_prepare(void)
{
#define SHUTDOWN_IN_SUSPEND_RETRY 10int count = 0;struct hdd_context *hdd_ctx;hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);if (wlan_hdd_validate_context(hdd_ctx) != 0)return -EINVAL;//if (ucfg_pmo_get_suspend_mode(hdd_ctx->psoc) != PMO_SUSPEND_SHUTDOWN) {// hdd_info("shutdown in suspend not supported");// return 0;//}hdd_debug("call pld idle shutdown directly");return pld_idle_shutdown(hdd_ctx->parent_dev, hdd_psoc_idle_shutdown);
}
四、wifi CNSS驱动
kernel/msm-5.4/drivers/net/wireless/cnss2
驱动在linux内核里,应该是通用的
这里面有MHI的使用,
MHI (Modem Host Interface) — The Linux Kernel documentation
https://download.csdn.net/download/yudelian/88602688
MHI (Modem Host Interface),就是一个Modem主机接口协议,用于主控制器和modem设备进行高速通信,主要应用于PCIE总线设备上,提供逻辑信道。
MHI (Modem Host Interface)
This document provides information about the MHI protocol.Overview
MHI is a protocol developed by Qualcomm Innovation Center, Inc. It is used by the host processors to control and communicate with modem devices over high speed peripheral buses or shared memory. Even though MHI can be easily adapted to any peripheral buses, it is primarily used with PCIe based devices. MHI provides logical channels over the physical buses and allows transporting the modem protocols, such as IP data packets, modem control messages, and diagnostics over at least one of those logical channels. Also, the MHI protocol provides data acknowledgment feature and manages the power state of the modems via one or more logical channels.
这篇关于高通android驱动和设备树-wifi驱动粗略记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!