staging:iio: abi updates for new drivers from Analog.
Subsystems (4)
cover staging:iio: abi updates for new drivers from Analog.
Here are the 3 abi update patches needed to make the drivers Mike posted to work with the current mainline kernel.
These (or equivalent) will need to get merged into the underlying drivers before they are sent on to Greg KH.
For reference these were against staging-next with the patches Mike sent applied.
Thanks,
Jonathan
Jonathan Cameron (3):
staging:iio:adis16201 update driver to compile with mainline abi. staging:iio:adis16203 update driver to compile with mainline abi. staging:iio:adis16204 update driver to compile with mainline abi.
drivers/staging/iio/accel/adis16201.h | 2 -- drivers/staging/iio/accel/adis16201_core.c | 19 +++++++++---------- drivers/staging/iio/accel/adis16201_ring.c | 4 ++-- drivers/staging/iio/accel/adis16201_trigger.c | 10 ++++------ drivers/staging/iio/accel/adis16203.h | 2 -- drivers/staging/iio/accel/adis16203_core.c | 19 +++++++++---------- drivers/staging/iio/accel/adis16203_ring.c | 4 ++-- drivers/staging/iio/accel/adis16203_trigger.c | 10 ++++------ drivers/staging/iio/accel/adis16204.h | 2 -- drivers/staging/iio/accel/adis16204_core.c | 19 +++++++++---------- drivers/staging/iio/accel/adis16204_ring.c | 4 ++-- drivers/staging/iio/accel/adis16204_trigger.c | 10 ++++------ 12 files changed, 45 insertions(+), 60 deletions(-)
PATCH 1/3 staging:iio:adis16201 update driver to compile with mainline abi.
--- drivers/staging/iio/accel/adis16201.h | 2 -- drivers/staging/iio/accel/adis16201_core.c | 19 +++++++++---------- drivers/staging/iio/accel/adis16201_ring.c | 4 ++-- drivers/staging/iio/accel/adis16201_trigger.c | 10 ++++------ 4 files changed, 15 insertions(+), 20 deletions(-)
drivers/staging/iio/accel/adis16201.h +0 -2
@@ -65,7 +65,6 @@* struct adis16201_state - device instance specific data * @us: actual spi_device * @work_trigger_to_ring: bh for triggered event handling -* @work_cont_thresh: CLEAN * @inter: used to check if new interrupt has been triggered * @last_timestamp: passing timestamp from th to bh of interrupt handler * @indio_dev: industrial I/O device structure
@@ -77,7 +76,6 @@struct adis16201_state {struct spi_device *us;struct work_struct work_trigger_to_ring; -struct iio_work_cont work_cont_thresh;s64 last_timestamp;struct iio_dev *indio_dev;struct iio_trigger *trig;
drivers/staging/iio/accel/adis16201_core.c +9 -10
@@ -22,7 +22,6 @@#include "../sysfs.h" #include "accel.h" #include "inclinometer.h" -#include "../imu/volt.h" #include "../gyro/gyro.h" #include "../adc/adc.h"
@@ -418,12 +417,12 @@ err_ret:return ret; } -static IIO_DEV_ATTR_VOLT(supply, adis16201_read_12bit_unsigned, +static IIO_DEV_ATTR_IN_NAMED_RAW(supply, adis16201_read_12bit_unsigned, ADIS16201_SUPPLY_OUT); -static IIO_CONST_ATTR(volt_supply_scale, "0.00122"); -static IIO_DEV_ATTR_VOLT(aux, adis16201_read_12bit_unsigned, +static IIO_CONST_ATTR(in_supply_scale, "0.00122"); +static IIO_DEV_ATTR_IN_RAW(0, adis16201_read_12bit_unsigned, ADIS16201_AUX_ADC); -static IIO_CONST_ATTR(volt_aux_scale, "0.00061"); +static IIO_CONST_ATTR(in0_scale, "0.00061"); static IIO_DEV_ATTR_ACCEL_X(adis16201_read_14bit_signed, ADIS16201_XACCL_OUT);
@@ -457,7 +456,7 @@ static IIO_DEV_ATTR_TEMP(adis16201_read_temp); static IIO_CONST_ATTR(temp_offset, "25"); static IIO_CONST_ATTR(temp_scale, "-0.47"); -static IIO_DEV_ATTR_RESET (adis16201_write_reset); +static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16201_write_reset, 0); static IIO_CONST_ATTR(name, "adis16201");
@@ -470,15 +469,15 @@ static struct attribute_group adis16201_event_attribute_group = { };static struct attribute *adis16201_attributes[] = { - &iio_dev_attr_volt_supply.dev_attr.attr, - &iio_const_attr_volt_supply_scale.dev_attr.attr, + &iio_dev_attr_in_supply_raw.dev_attr.attr, + &iio_const_attr_in_supply_scale.dev_attr.attr, &iio_dev_attr_temp.dev_attr.attr, &iio_const_attr_temp_offset.dev_attr.attr, &iio_const_attr_temp_scale.dev_attr.attr, &iio_dev_attr_reset.dev_attr.attr, &iio_const_attr_name.dev_attr.attr, - &iio_dev_attr_volt_aux.dev_attr.attr, - &iio_const_attr_volt_aux_scale.dev_attr.attr, + &iio_dev_attr_in0_raw.dev_attr.attr, + &iio_const_attr_in0_scale.dev_attr.attr, &iio_dev_attr_accel_x_raw.dev_attr.attr, &iio_dev_attr_accel_y_raw.dev_attr.attr, &iio_dev_attr_accel_x_offset.dev_attr.attr,
drivers/staging/iio/accel/adis16201_ring.c +2 -2
@@ -65,10 +65,10 @@ static struct attribute_group adis16201_scan_el_group = {* adis16201_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16201_poll_func_th (struct iio_dev *indio_dev) +static void adis16201_poll_func_th (struct iio_dev *indio_dev,s64 time) {struct adis16201_state *st =iio_dev_get_devdata (indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time;schedule_work (&st->work_trigger_to_ring); }
drivers/staging/iio/accel/adis16201_trigger.c +4 -6
@@ -23,8 +23,7 @@ static int adis16201_data_rdy_trig_poll(struct iio_dev *dev_info,struct adis16201_state *st =iio_dev_get_devdata (dev_info);struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; -iio_trigger_poll (trig); +iio_trigger_poll (trig, timestamp);return IRQ_HANDLED ; }
@@ -83,14 +82,13 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)struct adis16201_state *st = indio_dev->dev_data; st->trig =iio_allocate_trigger (); - st->trig->name =kmalloc (IIO_TRIGGER_NAME_LENGTH ,GFP_KERNEL ); + st->trig->name =kasprintf (GFP_KERNEL , +"adis16201-dev%d" , + indio_dev->id);if (!st->trig->name) { ret = -ENOMEM ; goto error_free_trig; } -snprintf ((char *)st->trig->name, -IIO_TRIGGER_NAME_LENGTH , -"adis16201-dev%d" , indio_dev->id); st->trig->dev.parent = &st->us->dev; st->trig->owner =THIS_MODULE ; st->trig->private_data = st;
Signature · 1 line
1.7.0.4
PATCH 2/3 staging:iio:adis16203 update driver to compile with mainline abi.
In reply to Jonathan Cameron--- drivers/staging/iio/accel/adis16203.h | 2 -- drivers/staging/iio/accel/adis16203_core.c | 19 +++++++++---------- drivers/staging/iio/accel/adis16203_ring.c | 4 ++-- drivers/staging/iio/accel/adis16203_trigger.c | 10 ++++------ 4 files changed, 15 insertions(+), 20 deletions(-)
drivers/staging/iio/accel/adis16203.h +0 -2
@@ -60,7 +60,6 @@* struct adis16203_state - device instance specific data * @us: actual spi_device * @work_trigger_to_ring: bh for triggered event handling -* @work_cont_thresh: CLEAN * @inter: used to check if new interrupt has been triggered * @last_timestamp: passing timestamp from th to bh of interrupt handler * @indio_dev: industrial I/O device structure
@@ -72,7 +71,6 @@struct adis16203_state {struct spi_device *us;struct work_struct work_trigger_to_ring; -struct iio_work_cont work_cont_thresh;s64 last_timestamp;struct iio_dev *indio_dev;struct iio_trigger *trig;
drivers/staging/iio/accel/adis16203_core.c +9 -10
@@ -22,7 +22,6 @@#include "../sysfs.h" #include "accel.h" #include "inclinometer.h" -#include "../imu/volt.h" #include "../gyro/gyro.h" #include "../adc/adc.h"
@@ -370,12 +369,12 @@ err_ret:return ret; } -static IIO_DEV_ATTR_VOLT(supply, adis16203_read_12bit_unsigned, +static IIO_DEV_ATTR_IN_NAMED_RAW(supply, adis16203_read_12bit_unsigned, ADIS16203_SUPPLY_OUT); -static IIO_CONST_ATTR(volt_supply_scale, "0.00122"); -static IIO_DEV_ATTR_VOLT(aux, adis16203_read_12bit_unsigned, +static IIO_CONST_ATTR(in_supply_scale, "0.00122"); +static IIO_DEV_ATTR_IN_RAW(0, adis16203_read_12bit_unsigned, ADIS16203_AUX_ADC); -static IIO_CONST_ATTR(volt_aux_scale, "0.00061"); +static IIO_CONST_ATTR(in0_scale, "0.00061"); static IIO_DEV_ATTR_INCLI_X(adis16203_read_14bit_signed, ADIS16203_XINCL_OUT);
@@ -391,7 +390,7 @@ static IIO_DEV_ATTR_TEMP(adis16203_read_temp); static IIO_CONST_ATTR(temp_offset, "25"); static IIO_CONST_ATTR(temp_scale, "-0.47"); -static IIO_DEV_ATTR_RESET (adis16203_write_reset); +static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16203_write_reset, 0); static IIO_CONST_ATTR(name, "adis16203");
@@ -404,15 +403,15 @@ static struct attribute_group adis16203_event_attribute_group = { };static struct attribute *adis16203_attributes[] = { - &iio_dev_attr_volt_supply.dev_attr.attr, - &iio_const_attr_volt_supply_scale.dev_attr.attr, + &iio_dev_attr_in_supply_raw.dev_attr.attr, + &iio_const_attr_in_supply_scale.dev_attr.attr, &iio_dev_attr_temp.dev_attr.attr, &iio_const_attr_temp_offset.dev_attr.attr, &iio_const_attr_temp_scale.dev_attr.attr, &iio_dev_attr_reset.dev_attr.attr, &iio_const_attr_name.dev_attr.attr, - &iio_dev_attr_volt_aux.dev_attr.attr, - &iio_const_attr_volt_aux_scale.dev_attr.attr, + &iio_dev_attr_in0_raw.dev_attr.attr, + &iio_const_attr_in0_scale.dev_attr.attr, &iio_dev_attr_incli_x_raw.dev_attr.attr, &iio_dev_attr_incli_y_raw.dev_attr.attr, &iio_dev_attr_incli_x_offset.dev_attr.attr,
drivers/staging/iio/accel/adis16203_ring.c +2 -2
@@ -59,10 +59,10 @@ static struct attribute_group adis16203_scan_el_group = {* adis16203_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16203_poll_func_th (struct iio_dev *indio_dev) +static void adis16203_poll_func_th (struct iio_dev *indio_dev,s64 timestamp) {struct adis16203_state *st =iio_dev_get_devdata (indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = timestamp;schedule_work (&st->work_trigger_to_ring); }
drivers/staging/iio/accel/adis16203_trigger.c +4 -6
@@ -23,8 +23,7 @@ static int adis16203_data_rdy_trig_poll(struct iio_dev *dev_info,struct adis16203_state *st =iio_dev_get_devdata (dev_info);struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; -iio_trigger_poll (trig); +iio_trigger_poll (trig, timestamp);return IRQ_HANDLED ; }
@@ -83,14 +82,13 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)struct adis16203_state *st = indio_dev->dev_data; st->trig =iio_allocate_trigger (); - st->trig->name =kmalloc (IIO_TRIGGER_NAME_LENGTH ,GFP_KERNEL ); + st->trig->name =kasprintf (GFP_KERNEL , +"adis16203-dev%d" , + indio_dev->id);if (!st->trig->name) { ret = -ENOMEM ; goto error_free_trig; } -snprintf ((char *)st->trig->name, -IIO_TRIGGER_NAME_LENGTH , -"adis16203-dev%d" , indio_dev->id); st->trig->dev.parent = &st->us->dev; st->trig->owner =THIS_MODULE ; st->trig->private_data = st;
Signature · 1 line
1.7.0.4
PATCH 3/3 staging:iio:adis16204 update driver to compile with mainline abi.
In reply to Jonathan Cameron--- drivers/staging/iio/accel/adis16204.h | 2 -- drivers/staging/iio/accel/adis16204_core.c | 19 +++++++++---------- drivers/staging/iio/accel/adis16204_ring.c | 4 ++-- drivers/staging/iio/accel/adis16204_trigger.c | 10 ++++------ 4 files changed, 15 insertions(+), 20 deletions(-)
drivers/staging/iio/accel/adis16204.h +0 -2
@@ -68,7 +68,6 @@* struct adis16204_state - device instance specific data * @us: actual spi_device * @work_trigger_to_ring: bh for triggered event handling -* @work_cont_thresh: CLEAN * @inter: used to check if new interrupt has been triggered * @last_timestamp: passing timestamp from th to bh of interrupt handler * @indio_dev: industrial I/O device structure
@@ -80,7 +79,6 @@struct adis16204_state {struct spi_device *us;struct work_struct work_trigger_to_ring; -struct iio_work_cont work_cont_thresh;s64 last_timestamp;struct iio_dev *indio_dev;struct iio_trigger *trig;
drivers/staging/iio/accel/adis16204_core.c +9 -10
@@ -21,7 +21,6 @@#include "../iio.h" #include "../sysfs.h" #include "accel.h" -#include "../imu/volt.h" #include "../gyro/gyro.h" #include "../adc/adc.h"
@@ -394,12 +393,12 @@ err_ret:return ret; } -static IIO_DEV_ATTR_VOLT(supply, adis16204_read_12bit_unsigned, +static IIO_DEV_ATTR_IN_NAMED_RAW(supply, adis16204_read_12bit_unsigned, ADIS16204_SUPPLY_OUT); -static IIO_CONST_ATTR(volt_supply_scale, "0.00122"); -static IIO_DEV_ATTR_VOLT(aux, adis16204_read_12bit_unsigned, +static IIO_CONST_ATTR(in_supply_scale, "0.00122"); +static IIO_DEV_ATTR_IN_RAW(0, adis16204_read_12bit_unsigned, ADIS16204_AUX_ADC); -static IIO_CONST_ATTR(volt_aux_scale, "0.00061"); +static IIO_CONST_ATTR(in0_scale, "0.00061"); static IIO_DEV_ATTR_ACCEL_X(adis16204_read_14bit_signed, ADIS16204_XACCL_OUT);
@@ -429,7 +428,7 @@ static IIO_DEV_ATTR_TEMP(adis16204_read_temp); static IIO_CONST_ATTR(temp_offset, "25"); static IIO_CONST_ATTR(temp_scale, "-0.47"); -static IIO_DEV_ATTR_RESET (adis16204_write_reset); +static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16204_write_reset, 0); static IIO_CONST_ATTR(name, "adis16204");
@@ -442,15 +441,15 @@ static struct attribute_group adis16204_event_attribute_group = { };static struct attribute *adis16204_attributes[] = { - &iio_dev_attr_volt_supply.dev_attr.attr, - &iio_const_attr_volt_supply_scale.dev_attr.attr, + &iio_dev_attr_in_supply_raw.dev_attr.attr, + &iio_const_attr_in_supply_scale.dev_attr.attr, &iio_dev_attr_temp.dev_attr.attr, &iio_const_attr_temp_offset.dev_attr.attr, &iio_const_attr_temp_scale.dev_attr.attr, &iio_dev_attr_reset.dev_attr.attr, &iio_const_attr_name.dev_attr.attr, - &iio_dev_attr_volt_aux.dev_attr.attr, - &iio_const_attr_volt_aux_scale.dev_attr.attr, + &iio_dev_attr_in0_raw.dev_attr.attr, + &iio_const_attr_in0_scale.dev_attr.attr, &iio_dev_attr_accel_x_raw.dev_attr.attr, &iio_dev_attr_accel_y_raw.dev_attr.attr, &iio_dev_attr_accel_xy.dev_attr.attr,
drivers/staging/iio/accel/adis16204_ring.c +2 -2
@@ -59,10 +59,10 @@ static struct attribute_group adis16204_scan_el_group = {* adis16204_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16204_poll_func_th (struct iio_dev *indio_dev) +static void adis16204_poll_func_th (struct iio_dev *indio_dev,s64 timestamp) {struct adis16204_state *st =iio_dev_get_devdata (indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = timestamp;schedule_work (&st->work_trigger_to_ring); }
drivers/staging/iio/accel/adis16204_trigger.c +4 -6
@@ -23,8 +23,7 @@ static int adis16204_data_rdy_trig_poll(struct iio_dev *dev_info,struct adis16204_state *st =iio_dev_get_devdata (dev_info);struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; -iio_trigger_poll (trig); +iio_trigger_poll (trig, timestamp);return IRQ_HANDLED ; }
@@ -83,14 +82,13 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)struct adis16204_state *st = indio_dev->dev_data; st->trig =iio_allocate_trigger (); - st->trig->name =kmalloc (IIO_TRIGGER_NAME_LENGTH ,GFP_KERNEL ); + st->trig->name =kasprintf (GFP_KERNEL , +"adis16204-dev%d" , + indio_dev->id);if (!st->trig->name) { ret = -ENOMEM ; goto error_free_trig; } -snprintf ((char *)st->trig->name, -IIO_TRIGGER_NAME_LENGTH , -"adis16204-dev%d" , indio_dev->id); st->trig->dev.parent = &st->us->dev; st->trig->owner =THIS_MODULE ; st->trig->private_data = st;
Signature · 1 line
1.7.0.4
Quoted 2 lines · Jonathan Cameron
Here are the 3 abi update patches needed to make the drivers Mike posted to work with the current mainline kernel.
thanks, i merged your changes into our tree and was able to extend them to another driver (gyro/adis16261). we did have a tracker item open to cull imu/volt.h usage, but it wasnt fixed yet as you noticed ;).
question about iio_work_cont though ... we have some drivers using that field. static void ad7816_interrupt_bh(struct work_struct *work_s)
{
struct iio_work_cont *wc = to_iio_work_cont_no_check(work_s);
struct ad7816_chip_info *chip = wc->st;i'm guessing the ad7816_chip_info.iio_work_cont should be converted to a work_struct ?
-mike
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Jonathan Cameron
If anyone is looking at the ad7816 driver at the mo, can I just make a fe=
w
Quoted 1 line
quick comments. (I was glancing at it anyway given Mike's pointer to it a=
bove).
Quoted 1 line
Feel free to ignore these for now but I thought I'd send them as I was re=
ading it anyway!
ive logged this into our tracker so it doesnt get missed
Quoted 1 line
Incidentally I'm happy to give earlier feedback on drivers before you are=
ready to send
Quoted 1 line
them for a merge if it would smooth things later. =C2=A0Just send them to=
linux-iio and mark
Quoted 1 line
them as say 'not ready for merge' so no one picks them up!
rgr
-mike