KernelNewbies:

These tasks are for you to get familiar with the IIO subsystem. For IIO related questions you can join #linux-iio IRC channel (server irc.oftc.net).

Please email your solutions to daniel.baluta at intel dot com. Your email should have the subject Task XX: Short task description

Experimenting with IIO subsystem

For this we will use two kernel modules found in drivers/staging/iio:

Dummy modules compilation

You need to select the following config options:

Use the following commands for modules compilation:

Use the following commands for module loading:

Task 01:

Task 02:

IIO event monitor

IIO event monitor is an user space example application which reads events from IIO layer and pretty prints the results. Implementation can be found in iio_event_monitor.c under tools/iio/. BR

Task 03:

Compile iio_event_monitor:

Task 04:

Read events using iio_event_monitor

Generic buffer

Task 05:

Create triggers using configfs interface.

Task 06:

Read samples from buffer generated by the iio_dummy module.

Small coding tasks inside the IIO subsystem

Before starting to work on a task make sure that:

Coding task 1:

--- a/drivers/iio/pressure/bmp280.c
+++ b/drivers/iio/pressure/bmp280.c
@@ -69,7 +69,6 @@
 #define BMP280_SOFT_RESET_VAL          0xB6
 
 struct bmp280_data {
-       struct i2c_client *client;
        struct mutex lock;
        struct regmap *regmap;
 
@@ -150,11 +149,12 @@ static s32 bmp280_compensate_temp(struct bmp280_data *data,
        int ret;
        s32 var1, var2;
        __le16 buf[BMP280_COMP_TEMP_REG_COUNT / 2];
+       struct device *dev = regmap_get_device(data->regmap);
 
        ret = regmap_bulk_read(data->regmap, BMP280_REG_COMP_TEMP_START,
                               buf, BMP280_COMP_TEMP_REG_COUNT);
        if (ret < 0) {
-               dev_err(&data->client->dev,
+               dev_err(&dev,
                        "failed to read temperature calibration parameters\n");
                return ret;
        }

Coding task 2:

--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -288,6 +288,7 @@ static int ads1015_read_raw(struct iio_dev *indio_dev,
        int ret, idx;
        struct ads1015_data *data = iio_priv(indio_dev);
 
+       mutex_lock(&indio_dev->mlock);
        mutex_lock(&data->lock);
        switch (mask) {
        case IIO_CHAN_INFO_RAW:
                if (iio_buffer_enabled(indio_dev)) {
                        ret = -EBUSY;
                        break;
                }
        /* .... */
        mutex_unlock(&data->lock);
+       mutex_unlock(&indio_dev->mlock);

KernelNewbies: IIO_tasks (last edited 2016-02-08 15:55:28 by DanielBaluta)