详解linux电源管理驱动编写

2019-01-16 22:01:39于海丽

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, };

7、由代码得知,regulator_ops和regulator_desc才是特有的regulator数据结构,当然也少不了注册函数

rdev = regulator_register(&stm32_vrefbuf_regu, &config); if (IS_ERR(rdev)) { ret = PTR_ERR(rdev); dev_err(&pdev->dev, "register failed with error %dn", ret); goto err_clk_dis; } platform_set_drvdata(pdev, rdev);

8、进一步确认of_device_id是不是真实存在,可以在arch/arm/boot/dts/stm32h743.dtsi找到对应内容

vrefbuf: regulator@58003C00 { compatible = "st,stm32-vrefbuf"; reg = <0x58003C00 0x8>; clocks = <&rcc VREF_CK>; regulator-min-microvolt = <1500000>; regulator-max-microvolt = <2500000>; status = "disabled"; };

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。

您可能感兴趣的文章:

详解linux 看门狗驱动编写linux nand flash驱动编写详解linux驱动编写(入门)详解linux 驱动编写(sd卡驱动)详解linux dma驱动编写详解linux lcd驱动编写linux 触摸屏驱动编写详解linux pwm驱动编写linux 驱动编写之虚拟字符设备的编写实例详解Linux 字符设备驱动框架详细介绍