Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Driver example

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content