当前位置:网站首页>一点点读懂regulator(三)
一点点读懂regulator(三)
2022-08-04 22:50:00 【szembed】
本节我们主要介绍Regulator Machine Driver Interface
The regulator machine driver interface用于配置regulator subsystem的board/machine特定初始化代码。
Consider the following machine:
Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
|
+-> [Consumer B @ 3.3V]
consumers A和B的驱动器必须映射到正确的regulator上才能控制其电源。通过为每个regulator创建一个结构体 regulator_consumer_supply就可以在machine initialisation code中实现此映射:
struct regulator_consumer_supply {
const char *dev_name; /* consumer dev_name() */
const char *supply; /* consumer supply - e.g. "vcc" */
};
e.g. for the machine above:
static struct regulator_consumer_supply regulator1_consumers[] = {
REGULATOR_SUPPLY("Vcc", "consumer B"),};
static struct regulator_consumer_supply regulator2_consumers[] = {
REGULATOR_SUPPLY("Vcc", "consumer A"),};
This maps Regulator-1 to the ‘Vcc’ supply for Consumer B and maps Regulator-2 to the ‘Vcc’ supply for Consumer A.
现在,可以通过为每个regulator电源域定义一个结构体regulator_init_data来注册约束。此结构还将consumers映射到其supply regulators:
static struct regulator_init_data regulator1_data = {
.constraints = {
.name = "Regulator-1",
.min_uV = 3300000,
.max_uV = 3300000,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(regulator1_consumers),
.consumer_supplies = regulator1_consumers,
};
The name field should be set to something that is usefully descriptive for the board for configuration of supplies for other regulators and for use in logging and other diagnostic output. Normally the name used for the supply rail in the schematic is a good choice. If no name is provided then the subsystem will choose one.
Regulator-1 supplies power to Regulator-2. This relationship must be registered with the core so that Regulator-1 is also enabled when Consumer A enables its supply (Regulator-2). The supply regulator is set by the supply_regulator field below and co:
static struct regulator_init_data regulator2_data = {
.supply_regulator = "Regulator-1",
.constraints = {
.min_uV = 1800000,
.max_uV = 2000000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(regulator2_consumers),
.consumer_supplies = regulator2_consumers,
};
Finally the regulator devices must be registered in the usual manner:
static struct platform_device regulator_devices[] = {
{
.name = "regulator",
.id = DCDC_1,
.dev = {
.platform_data = ®ulator1_data,
},
},
{
.name = "regulator",
.id = DCDC_2,
.dev = {
.platform_data = ®ulator2_data,
},
},
};
/* register regulator 1 device */
platform_device_register(®ulator_devices[0]);
/* register regulator 2 device */
platform_device_register(®ulator_devices[1]);
边栏推荐
- 【项目实战】仿照Room实现简单管理系统
- 软件测试外包公司怎么样?有什么好处和坏处?为什么没人去?
- synchronized和ReentrantLock都很丝滑,因为他们都是可重入锁,一个线程多次拿锁也不会死锁,我们需要可重入
- If you can't get your heart, use "distributed lock" to lock your people
- 【3D建模制作技巧分享】ZBrush如何重新拓扑
- Redisson
- 【3D建模制作技巧分享】ZBrush如何设置笔刷快捷键
- 【3D建模制作技巧分享】Maya模型如何导入zbrush
- PowerBI scripture series
- js中小数四则运算精度问题原因及解决办法
猜你喜欢
随机推荐
Redis理解
Reconfigure the ffmpeg plugin in chrome
后排乘客不系安全带?事故瞬间被甩出
质量管理大师爱德华·戴明博士经典的质量管理14条原则
ANT1.7下载以及配置方法
FinClip崁入式搭建生态平台,降低合作门槛
Redisson
三个多月、40余场面试浓缩为6000字
【转载】kill掉垃圾进程(在资源管理器占用的情况下)
【云原生 · Kubernetes】Kubernetes运维
3D建模师为了让甲方爸爸过稿,还可以这么做,就是在赚血汗钱啊
剑指 Offer | 03. 数组中重复的数字
力扣19-删除链表的倒数第 N 个结点——链表
【3D建模制作技巧分享】ZBrush如何设置笔刷快捷键
temp7777
老叶的三束玫瑰
MySQL的JSON 数据类型2
赶紧进来!!!教你C语言实现扫雷小游戏(文章最后有源码!!!)
Charles & TCPDump & Fiddler 抓包三兄弟七夕联手,还抓不到你的心?
移动web开发03



![Rt-thread [二] 系统初始化流程](/img/46/6e2942e4c18c0220378050205e6528.png)



![MQTT[一]基础知识介绍](/img/25/3ba24127e2258902b2d5ecc7c3727b.png)