一点点读懂regulator(二)

目录

1、Registration

2、Regulator Events


本章我们介绍Regulator Driver Interface相关接口使用。The regulator driver interface相对简单,旨在允许Regulator Driver向核心框架注册其服务。代码实现在regulator/core.c中

1、Registration

驱动程序可以通过调用以下接口注册调节器:

struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
                                         const struct regulator_config *config);

This will register the regulator’s capabilities and operations to the regulator core.

Regulators可以通过调用以下接口来unregister:

void regulator_unregister(struct regulator_dev *rdev);

​​​​​​​2、Regulator Events

Regulators可以通过调用以下接口向consumer drivers发送事件(例如过热、欠压等):

int regulator_notifier_call_chain(struct regulator_dev *rdev,
                                  unsigned long event, void *data);

要想被regulator_notifier_call_chain调用到,则需要相关模块来注册notifier_call_chain才行。core.c同样提供了注册和去注册接口

int regulator_register_notifier(struct regulator *regulator,
                  struct notifier_block *nb)

int regulator_unregister_notifier(struct regulator *regulator,
                struct notifier_block *nb)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值