October 2017
Intermediate to advanced
586 pages
14h 8m
English
Let's summarize what we have seen so far in a simple dummy driver, which will expose four voltage channels. We will ignore read() and write() functions:
#include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/of.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> #include <linux/iio/events.h> #include <linux/iio/buffer.h> #define FAKE_VOLTAGE_CHANNEL(num) \ { \ .type = IIO_VOLTAGE, \ .indexed = 1, \ .channel = (num), \ .address = (num), \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \ } struct my_private_data { int foo; int bar; struct mutex lock; }; static ...Read now
Unlock full access