October 2017
Intermediate to advanced
586 pages
14h 8m
English
Let's summarize the things discussed previously in a real driver, for a dummy PMIC with two regulators, where the first one has a voltage range of 850000 µV to 1600000 µV with a step of 50000 µV, and the second regulator has a fixed voltage of 1300000 µV:
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/platform_device.h> /* For platform devices */ #include <linux/interrupt.h> /* For IRQ */ #include <linux/of.h> /* For DT*/ #include <linux/err.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> #define DUMMY_VOLTAGE_MIN 850000 #define DUMMY_VOLTAGE_MAX 1600000 #define DUMMY_VOLTAGE_STEP 50000 struct my_private_data { int foo; int bar; struct mutex lock; }; static ...