aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-14 14:42:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-14 14:42:03 -0400
commit552edf8d79096c7458cdc2a7b1f9936e7925e2aa (patch)
treee069ed3ec2fc7ef77a98645aa0f5ef84e1c83881 /include/linux/iio
parentd2f3e1058c7ff9dc18d14548f6263dcf13af67f7 (diff)
parent1696566f995cfd4ddf3f167b4097cdc83f1458f2 (diff)
Merge tag 'iio-for-4.9b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Second set of iio new device support, features and cleanups for the 4.9 cycle. New device support * ad8801 dac - new driver supporting ad8801 and ad8803 DACs. * adc12138 - new driver supporting TI adc12130/adc12132 and adc12138 ADCs. * ltc2485 adc - new driver * mxc6255 - add support for the mxc6225 part name and fixup the ID check so it works. * vz89x VOC sensor - add support for the vz89te part which drops the voc_short channel and adds CRCs compared to other supported parts. New features * core - immutable triggers. These effectively grant exclusive control over a trigger. The typical usecase is a device representing an analog part (perhaps a MUX) that needs to control the sampling of a downstream ADC. - resource managed trigger registration and triggered_buffer_init. - iio_push_event now protected against case of the event interface registration not having yet occured. Only matters if an interrupt can occur during this window - might happen on shared interrupt lines. - helper to let a driver query if the trigger it is using is provided by itself (using the convention of both device and trigger having the same parent). * tools - iio-utils. Used channel modifier scaling in preference to generic scaling when both exist. * at91-adc - Add support for touchscreen switches closure time needed by some newer parts. * stx104 - support the ADC channels on this ADC/DAC board. As these are the primary feature of the board also move the driver to the iio/adc directory. * sx9500 - device tree bindings. Cleanups / Fixes * ad5755 - fix an off-by-one on devnr limit check (introduced earlier this cycle) * ad7266 - drop NULL check on devm_regulator_get_optional as it can't return NULL. * ak8974 - avoid an unused functional warning due to rework in PM core code. - remove .owner field setting as done by i2c_core. * ina2xx - clear out a left over debug field from chip global data. * hid-sensors - avoid an unused functional warning due to rework in PM core code. * maxim-thermocouple - fix non static symbol warnings. * ms5611 - fetch and enable regulators unconditionally when they aren't optional. * sca3000 - whitespace cleanup. * st_sensors - fetch and enable regulators unconditionally rather than having them supported as optional regulators (missunderstanding on my part amongst others a while back) - followup to previous patch fixes error checking on the regulators. - mark symbols static where possible. - use the 'is it my trigger' help function. This prevents the odd case of another device triggering from the st-sensors trigger whilst the st-sensors trigger is itself not using it but rather using say an hrtimer. * ti-ads1015 - add missing of_node_put. * vz89x - rework to all support of new devices. - prevent reading of a corrupted buffer. - fixup a return value of 0/1 in a bool returning function. Address updates - Vlad Dogaru email address change.
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/iio.h3
-rw-r--r--include/linux/iio/trigger.h26
-rw-r--r--include/linux/iio/triggered_buffer.h8
3 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 854e2dad1e0d..b4a0679e4a49 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -483,6 +483,7 @@ struct iio_buffer_setup_ops {
483 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp 483 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp
484 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp 484 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
485 * @trig: [INTERN] current device trigger (buffer modes) 485 * @trig: [INTERN] current device trigger (buffer modes)
486 * @trig_readonly [INTERN] mark the current trigger immutable
486 * @pollfunc: [DRIVER] function run on trigger being received 487 * @pollfunc: [DRIVER] function run on trigger being received
487 * @pollfunc_event: [DRIVER] function run on events trigger being received 488 * @pollfunc_event: [DRIVER] function run on events trigger being received
488 * @channels: [DRIVER] channel specification structure table 489 * @channels: [DRIVER] channel specification structure table
@@ -523,6 +524,7 @@ struct iio_dev {
523 bool scan_timestamp; 524 bool scan_timestamp;
524 unsigned scan_index_timestamp; 525 unsigned scan_index_timestamp;
525 struct iio_trigger *trig; 526 struct iio_trigger *trig;
527 bool trig_readonly;
526 struct iio_poll_func *pollfunc; 528 struct iio_poll_func *pollfunc;
527 struct iio_poll_func *pollfunc_event; 529 struct iio_poll_func *pollfunc_event;
528 530
@@ -642,6 +644,7 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
642} 644}
643 645
644void iio_device_free(struct iio_dev *indio_dev); 646void iio_device_free(struct iio_dev *indio_dev);
647int devm_iio_device_match(struct device *dev, void *res, void *data);
645struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv); 648struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
646void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev); 649void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
647struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, 650struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index 1c9e028e0d4a..4f1154f7a33c 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -56,6 +56,9 @@ struct iio_trigger_ops {
56 * @subirqs: [INTERN] information about the 'child' irqs. 56 * @subirqs: [INTERN] information about the 'child' irqs.
57 * @pool: [INTERN] bitmap of irqs currently in use. 57 * @pool: [INTERN] bitmap of irqs currently in use.
58 * @pool_lock: [INTERN] protection of the irq pool. 58 * @pool_lock: [INTERN] protection of the irq pool.
59 * @attached_own_device:[INTERN] if we are using our own device as trigger,
60 * i.e. if we registered a poll function to the same
61 * device as the one providing the trigger.
59 **/ 62 **/
60struct iio_trigger { 63struct iio_trigger {
61 const struct iio_trigger_ops *ops; 64 const struct iio_trigger_ops *ops;
@@ -73,6 +76,7 @@ struct iio_trigger {
73 struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER]; 76 struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
74 unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)]; 77 unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)];
75 struct mutex pool_lock; 78 struct mutex pool_lock;
79 bool attached_own_device;
76}; 80};
77 81
78 82
@@ -125,12 +129,27 @@ static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)
125 **/ 129 **/
126int iio_trigger_register(struct iio_trigger *trig_info); 130int iio_trigger_register(struct iio_trigger *trig_info);
127 131
132int devm_iio_trigger_register(struct device *dev,
133 struct iio_trigger *trig_info);
134
128/** 135/**
129 * iio_trigger_unregister() - unregister a trigger from the core 136 * iio_trigger_unregister() - unregister a trigger from the core
130 * @trig_info: trigger to be unregistered 137 * @trig_info: trigger to be unregistered
131 **/ 138 **/
132void iio_trigger_unregister(struct iio_trigger *trig_info); 139void iio_trigger_unregister(struct iio_trigger *trig_info);
133 140
141void devm_iio_trigger_unregister(struct device *dev,
142 struct iio_trigger *trig_info);
143
144/**
145 * iio_trigger_set_immutable() - set an immutable trigger on destination
146 *
147 * @indio_dev - IIO device structure containing the device
148 * @trig - trigger to assign to device
149 *
150 **/
151int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig);
152
134/** 153/**
135 * iio_trigger_poll() - called on a trigger occurring 154 * iio_trigger_poll() - called on a trigger occurring
136 * @trig: trigger which occurred 155 * @trig: trigger which occurred
@@ -145,6 +164,13 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
145__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...); 164__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
146void iio_trigger_free(struct iio_trigger *trig); 165void iio_trigger_free(struct iio_trigger *trig);
147 166
167/**
168 * iio_trigger_using_own() - tells us if we use our own HW trigger ourselves
169 * @indio_dev: device to check
170 */
171bool iio_trigger_using_own(struct iio_dev *indio_dev);
172
173
148#else 174#else
149struct iio_trigger; 175struct iio_trigger;
150struct iio_trigger_ops; 176struct iio_trigger_ops;
diff --git a/include/linux/iio/triggered_buffer.h b/include/linux/iio/triggered_buffer.h
index f72f70d5a97b..30145616773d 100644
--- a/include/linux/iio/triggered_buffer.h
+++ b/include/linux/iio/triggered_buffer.h
@@ -12,4 +12,12 @@ int iio_triggered_buffer_setup(struct iio_dev *indio_dev,
12 const struct iio_buffer_setup_ops *setup_ops); 12 const struct iio_buffer_setup_ops *setup_ops);
13void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev); 13void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev);
14 14
15int devm_iio_triggered_buffer_setup(struct device *dev,
16 struct iio_dev *indio_dev,
17 irqreturn_t (*h)(int irq, void *p),
18 irqreturn_t (*thread)(int irq, void *p),
19 const struct iio_buffer_setup_ops *ops);
20void devm_iio_triggered_buffer_cleanup(struct device *dev,
21 struct iio_dev *indio_dev);
22
15#endif 23#endif