devm_regulator_get功能参数返回值
时间: 2023-12-25 09:05:02 浏览: 309
devm_regulator_get函数用于从设备树中获取并返回一个指向regulator结构体的指针,该结构体表示所需的调节器。它的参数包括:
- dev:指向设备的指针;
- id:调节器的标识符字符串;
- config:调节器的配置信息,包括电压、电流等。
函数的返回值是一个指向regulator结构体的指针,如果获取失败则返回一个错误码。
相关问题
devm_regulator_bulk_get
`devm_regulator_bulk_get`是一个函数,用于在设备驱动程序中获取一组相关的稳压器。这个函数使用设备管理器(devm)机制,因此可以确保在设备被释放时自动注销稳压器。这个函数需要传入一个指向设备结构体的指针、一个指向稳压器结构体数组的指针、以及数组中稳压器的数量。函数返回一个整数值,表示成功获取的稳压器数量。如果返回的值与期望值不同,则表示出现了错误。
devm_regulator_get
devm_regulator_get is a function provided by the Linux kernel API that allows a device driver to obtain a reference to a regulator device. This function is a managed version of the regulator_get function, which means that it automatically handles the deallocation of the regulator device when the driver is unloaded from the system.
The devm_regulator_get function takes two arguments: a pointer to the device structure of the device that requires the regulator, and a string that specifies the name of the regulator device. The function returns a pointer to the regulator device structure if successful, or an error code if it fails.
Once a driver obtains a reference to a regulator device using devm_regulator_get, it can use the regulator API functions to control the voltage or current supplied to the device. The driver should release the reference to the regulator device when it is no longer needed, but this is handled automatically by devm_regulator_get.
阅读全文