国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

詳解linux電源管理驅(qū)動編寫

2024-08-28 00:01:58
字體:
來源:轉載
供稿:網(wǎng)友

對于嵌入式設備來說,合適的電源管理,不僅可以延長電池的壽命,而且可以省電,延長設備運行時間,在提高用戶體驗方面有很大的好處。所以,各個soc廠家在這方面花了很多的功夫。下面,我們可以看看linux是如何處理電源管理驅(qū)動的。

1、代碼目錄

drivers/regulator 

2、查看目錄下的Kconfig文件

menuconfig REGULATOR   bool "Voltage and Current Regulator Support"   help    Generic Voltage and Current Regulator support.     This framework is designed to provide a generic interface to voltage    and current regulators within the Linux kernel. It's intended to    provide voltage and current control to client or consumer drivers and    also provide status information to user space applications through a    sysfs interface.     The intention is to allow systems to dynamically control regulator    output in order to save power and prolong battery life. This applies    to both voltage regulators (where voltage output is controllable) and    current sinks (where current output is controllable).     This framework safely compiles out if not selected so that client    drivers can still be used in systems with no software controllable    regulators.     If unsure, say no. 

3、閱讀文件,得知REGULATOR是最核心的模塊macro,那我們可以找一個設備的macro看看 

config REGULATOR_STM32_VREFBUF   tristate "STMicroelectronics STM32 VREFBUF"   depends on ARCH_STM32 || COMPILE_TEST   help    This driver supports STMicroelectronics STM32 VREFBUF (voltage    reference buffer) which can be used as voltage reference for    internal ADCs, DACs and also for external components through    dedicated Vref+ pin.     This driver can also be built as a module. If so, the module    will be called stm32-vrefbuf. 

4、沒有找到s3c,可以看一下stm32芯片的依賴屬性,接著看Makefile

obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o helpers.o devres.o obj-$(CONFIG_OF) += of_regulator.o obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o  obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o 

5、看的出來stm32只依賴于stm32-verfbuf.c文件,繼續(xù)查看

static const struct of_device_id stm32_vrefbuf_of_match[] = {   { .compatible = "st,stm32-vrefbuf", },   {}, }; MODULE_DEVICE_TABLE(of, stm32_vrefbuf_of_match);  static struct platform_driver stm32_vrefbuf_driver = {   .probe = stm32_vrefbuf_probe,   .remove = stm32_vrefbuf_remove,   .driver = {     .name = "stm32-vrefbuf",     .of_match_table = of_match_ptr(stm32_vrefbuf_of_match),   }, }; module_platform_driver(stm32_vrefbuf_driver); 

6、確認驅(qū)動為platform驅(qū)動,尋找regulator特有的數(shù)據(jù)結構

static const struct regulator_ops stm32_vrefbuf_volt_ops = {   .enable   = stm32_vrefbuf_enable,   .disable  = stm32_vrefbuf_disable,   .is_enabled = stm32_vrefbuf_is_enabled,   .get_voltage_sel = stm32_vrefbuf_get_voltage_sel,   .set_voltage_sel = stm32_vrefbuf_set_voltage_sel,   .list_voltage  = regulator_list_voltage_table, };  static const struct regulator_desc stm32_vrefbuf_regu = {   .name = "vref",   .supply_name = "vdda",   .volt_table = stm32_vrefbuf_voltages,   .n_voltages = ARRAY_SIZE(stm32_vrefbuf_voltages),   .ops = &stm32_vrefbuf_volt_ops,   .type = REGULATOR_VOLTAGE,   .owner = THIS_MODULE, }; 
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 虹口区| 全南县| 浦城县| 兴海县| 建湖县| 汝城县| 丰顺县| 五大连池市| 余庆县| 枣强县| 五莲县| 花莲县| 三明市| 将乐县| 延寿县| 鸡东县| 宜兴市| 清河县| 宜君县| 佛山市| 潜山县| 伊金霍洛旗| 门头沟区| 航空| 荃湾区| 安阳市| 永年县| 大庆市| 铅山县| 巩留县| 锡林浩特市| 靖远县| 思南县| 宾阳县| 五指山市| 札达县| 兴文县| 葫芦岛市| 金塔县| 柳河县| 上虞市|