History

Merge tag 'iio-for-5.9a-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes: First set of new device support, cleanups and features for IIO in the 5.9 cycle Some new devices, but particularly good this time is the core rework coming from Alexandru. Some of this has been in Analog's tree a long time, but other parts are motivated by closing down common mistakes in new drivers. Changes since first try at this pull request: * Add missed patch to actually remove iio_priv_to_dev and as a result also drop a few ingenic patches that need to be updated to take this into account. * Fix an ordering issue int he pollfunc attach in the core rework. New device support * qcom pmic7 adc - New driver using common qcom-vadc library. Some associated cleanups and refactors. * invensense icm42600 - New driver supporting icm42600, icm42602, icm42605 and icm42622 via i2c or spi. These are all 6 axis IMUs with gyro and accelerometers. Driver supports buffered modes using the hardware fifo and interpolation for accurate timestamps. * sensirion scd30 - New driver for this carbon dioxide sensor including i2c and serial interfaces + bindings. Features * ak8975 - Add reset gpio support. * bma400 - Support SPI. * bmc150 - Document and add support for bmc156b and bmm150b, tidy up _magn endings. * bmi160 - Regulator and mount matrix support. * mxc4005 - Add ID for mxc6655 * rockchip-saradc - Triggered buffer support. DT bindings * qcom spmi-vadc converted to yaml + pmic7 bindings * ak8975 tidy up and convert to yaml + add reset-gpio binding * ingenic-adc -convert to yaml. Core rework all carried through by Alexandru Ardelean. * Assign parent device in the core rather than every driver. A few devices need to provide specific non standard parents, so there is support for overriding. * Start to take parts of struct iio_dev opaque to the drivers. This will be a long term job, but should reduce the number of drivers we get that use parts that are currently only 'internal' by documentation. * Move attach and detach of pollfunc to the core. Every triggered buffer using driver had to do the same thing, so lets do it in the core. The hard part here was getting all the drivers into canonical form so there would be no functional changes in this final patch. That's taken quite a lot of work over last couple of cycles! Cleanups and minor fixes. * docs - Improve IIO_CONCENTRATION channel type description in ABI docs. - Drop doubled word cases. - Http to Https conversion. * core - Make iio_device_get_drvdata take a const struct iio_dev * avoiding some nasty casts. * ADCs - Drop lots of users of of_match_ptr macro, includes of mod_devicetable.h and CONFIG_OF protections. These prevent use of ACPI PRP0001 with these drivers and get coppied into lots of new drivers. * ad5380 - Constify iio_chan_spec_ext_info * ad5592r - Constify iio_chan_spec_ext_info - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * ad8366 - Make gpio optional as doesn't matter if its there or not. * adis16480 - Use irq types instead of the flags. * atlas-ezo-sensor - Minimize scope of ret variable. * at91-adc - Add COMPILE_TEST dependency to driver to improve build coverage. - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * at91-sama5d2 - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) - Drop Ludovic as a co-maintaienr. * cros_ec - Reapply the range after resume. - Add a read only frequency entry for legacy version. - Typo fixes * hts221 - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * inv_mpu - Drop double check on ACPI companion device. * iqs621 - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * iqs624 - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * max11100 - Constify iio_chan_spec * mmc35240 - Constify reg_default * rockchip-saradc - Move to managed allocators for everything in probe. - Use more distinctive prefix for channel macros. * stk3310 - Constify regmap_config. * stm32-adc - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * stm32-dfsdm-adc - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * ti-am335x - Use managed allocations where straight forward in probe function. * tsl2563 - Avoid use of iio_priv_to_dev (precursor to taking parts of iio_dev opaque) * tag 'iio-for-5.9a-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (107 commits) iio: buffer: fix attach/detach pollfunc order iio: core: remove iio_priv_to_dev() helper Replace HTTP links with HTTPS ones: drivers/iio Replace HTTP links with HTTPS ones: Documentation/devicetree/bindings/iio dt-bindings: iio/adc: Convert ingenic-adc docs to YAML. iio: cros_ec_accel_legacy: Add Read Only frequency entries MAINTAINERS: adc: at91-sama5d2_adc: remove myself as co-maintainer iio: adc: ti_am335x_adc: alloc kfifo & IRQ via devm_ functions iio: adc: ti_am335x_adc: alloc channels via devm_kcalloc() iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections. iio:adc:ti-adc161s626: Drop of_match_ptr protection. iio:adc:ti-adc084s021: drop of_match_ptr protection iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include ...

Greg Kroah-Hartman committed 6 years ago

Commit f6b35db2 parents 4193170 62a30a2429 files · +7973 −1642Browse files

Showing the changes to include/linux (4 of 429 files). Show all

Unified · Split

4 files
  1. include/linux/iio/common/cros_ec_sensors_core.h +10 −1
  2. include/linux/iio/iio-opaque.h +36 −0
  3. include/linux/iio/iio.h +29 −32
  4. include/linux/iio/trigger_consumer.h +0 −7
include/linux/iio/common/cros_ec_sensors_core.h+10−1
@@ -42,6 +42,10 @@ typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p); · 41 unmodified lines
4242 * @resp: motion sensor response structure
4343 * @type: type of motion sensor
4444 * @loc: location where the motion sensor is placed
45+ * @range_updated: True if the range of the sensor has been
46+ * updated.
47+ * @curr_range: If updated, the current range value.
48+ * It will be reapplied at every resume.
4549 * @calib: calibration parameters. Note that trigger
4650 * captured data will always provide the calibrated
4751 * data
@@ -65,6 +69,9 @@ struct cros_ec_sensors_core_state { · 17 unmodified lines
6569 enum motionsensor_type type;
6670 enum motionsensor_location loc;
6771
72+ bool range_updated;
73+ int curr_range;
74+
6875 struct calib_data {
6976 s16 offset;
7077 u16 scale;
@@ -114,7 +121,9 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, · 43 unmodified lines
114121 struct iio_chan_spec const *chan,
115122 int val, int val2, long mask);
116123
117−/* List of extended channel specification for all sensors */
124+extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
125+
126+/* List of extended channel specification for all sensors. */
118127 extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
119128 extern const struct attribute *cros_ec_sensor_fifo_attributes[];
120129
include/linux/iio/iio-opaque.h+36−0
@@ -0,0 +1,36 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+#ifndef _INDUSTRIAL_IO_OPAQUE_H_
4+#define _INDUSTRIAL_IO_OPAQUE_H_
5+
6+/**
7+ * struct iio_dev_opaque - industrial I/O device opaque information
8+ * @indio_dev: public industrial I/O device information
9+ * @event_interface: event chrdevs associated with interrupt lines
10+ * @buffer_list: list of all buffers currently attached
11+ * @channel_attr_list: keep track of automatically created channel
12+ * attributes
13+ * @chan_attr_group: group for all attrs in base directory
14+ * @debugfs_dentry: device specific debugfs dentry
15+ * @cached_reg_addr: cached register address for debugfs reads
16+ * @read_buf: read buffer to be used for the initial reg read
17+ * @read_buf_len: data length in @read_buf
18+ */
19+struct iio_dev_opaque {
20+ struct iio_dev indio_dev;
21+ struct iio_event_interface *event_interface;
22+ struct list_head buffer_list;
23+ struct list_head channel_attr_list;
24+ struct attribute_group chan_attr_group;
25+#if defined(CONFIG_DEBUG_FS)
26+ struct dentry *debugfs_dentry;
27+ unsigned cached_reg_addr;
28+ char read_buf[20];
29+ unsigned int read_buf_len;
30+#endif
31+};
32+
33+#define to_iio_dev_opaque(indio_dev) \
34+ container_of(indio_dev, struct iio_dev_opaque, indio_dev)
35+
36+#endif
include/linux/iio/iio.h+29−32
@@ -488,9 +488,7 @@ struct iio_buffer_setup_ops { · 487 unmodified lines
488488 * @currentmode: [DRIVER] current operating mode
489489 * @dev: [DRIVER] device structure, should be assigned a parent
490490 * and owner
491− * @event_interface: [INTERN] event chrdevs associated with interrupt lines
492491 * @buffer: [DRIVER] any buffer present
493− * @buffer_list: [INTERN] list of all buffers currently attached
494492 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
495493 * @mlock: [INTERN] lock used to prevent simultaneous device state
496494 * changes
@@ -506,9 +504,6 @@ struct iio_buffer_setup_ops { · 9 unmodified lines
506504 * @pollfunc_event: [DRIVER] function run on events trigger being received
507505 * @channels: [DRIVER] channel specification structure table
508506 * @num_channels: [DRIVER] number of channels specified in @channels.
509− * @channel_attr_list: [INTERN] keep track of automatically created channel
510− * attributes
511− * @chan_attr_group: [INTERN] group for all attrs in base directory
512507 * @name: [DRIVER] name of the device.
513508 * @label: [DRIVER] unique name to identify which device this is
514509 * @info: [DRIVER] callbacks and constant info from driver
@@ -520,8 +515,8 @@ struct iio_buffer_setup_ops { · 5 unmodified lines
520515 * @groups: [INTERN] attribute groups
521516 * @groupcounter: [INTERN] index of next attribute group
522517 * @flags: [INTERN] file ops related flags including busy flag.
523− * @debugfs_dentry: [INTERN] device specific debugfs dentry.
524− * @cached_reg_addr: [INTERN] cached register address for debugfs reads.
518+ * @priv: [DRIVER] reference to driver's private information
519+ * **MUST** be accessed **ONLY** via iio_priv() helper
525520 */
526521 struct iio_dev {
527522 int id;
@@ -531,10 +526,7 @@ struct iio_dev { · 3 unmodified lines
531526 int currentmode;
532527 struct device dev;
533528
534− struct iio_event_interface *event_interface;
535−
536529 struct iio_buffer *buffer;
537− struct list_head buffer_list;
538530 int scan_bytes;
539531 struct mutex mlock;
540532
@@ -551,8 +543,6 @@ struct iio_dev { · 10 unmodified lines
551543 struct iio_chan_spec const *channels;
552544 int num_channels;
553545
554− struct list_head channel_attr_list;
555− struct attribute_group chan_attr_group;
556546 const char *name;
557547 const char *label;
558548 const struct iio_info *info;
@@ -565,12 +555,7 @@ struct iio_dev { · 6 unmodified lines
565555 int groupcounter;
566556
567557 unsigned long flags;
568−#if defined(CONFIG_DEBUG_FS)
569− struct dentry *debugfs_dentry;
570− unsigned cached_reg_addr;
571− char read_buf[20];
572− unsigned int read_buf_len;
573−#endif
558+ void *priv;
574559 };
575560
576561 const struct iio_chan_spec
@@ -649,6 +634,26 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev) · 72 unmodified lines
649634 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
650635 }
651636
637+/**
638+ * iio_device_set_parent() - assign parent device to the IIO device object
639+ * @indio_dev: IIO device structure
640+ * @parent: reference to parent device object
641+ *
642+ * This utility must be called between IIO device allocation
643+ * (via devm_iio_device_alloc()) & IIO device registration
644+ * (via {devm_}iio_device_register()).
645+ * By default, the device allocation will also assign a parent device to
646+ * the IIO device object. In cases where devm_iio_device_alloc() is used,
647+ * sometimes the parent device must be different than the device used to
648+ * manage the allocation.
649+ * In that case, this helper should be used to change the parent, hence the
650+ * requirement to call this between allocation & registration.
651+ **/
652+static inline void iio_device_set_parent(struct iio_dev *indio_dev,
653+ struct device *parent)
654+{
655+ indio_dev->dev.parent = parent;
656+}
652657
653658 /**
654659 * iio_device_set_drvdata() - Set device driver data
@@ -669,28 +674,23 @@ static inline void iio_device_set_drvdata(struct iio_dev *indio_dev, void *data) · 14 unmodified lines
669674 *
670675 * Returns the data previously set with iio_device_set_drvdata()
671676 */
672−static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
677+static inline void *iio_device_get_drvdata(const struct iio_dev *indio_dev)
673678 {
674679 return dev_get_drvdata(&indio_dev->dev);
675680 }
676681
677682 /* Can we make this smaller? */
678683 #define IIO_ALIGN L1_CACHE_BYTES
679−struct iio_dev *iio_device_alloc(int sizeof_priv);
684+struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
680685
686+/* The information at the returned address is guaranteed to be cacheline aligned */
681687 static inline void *iio_priv(const struct iio_dev *indio_dev)
682688 {
683− return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
684−}
685−
686−static inline struct iio_dev *iio_priv_to_dev(void *priv)
687−{
688− return (struct iio_dev *)((char *)priv -
689− ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
689+ return indio_dev->priv;
690690 }
691691
692692 void iio_device_free(struct iio_dev *indio_dev);
693−struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
693+struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
694694 struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
695695 const char *fmt, ...);
696696 /**
@@ -709,10 +709,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) · 12 unmodified lines
709709 * @indio_dev: IIO device structure for device
710710 **/
711711 #if defined(CONFIG_DEBUG_FS)
712−static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
713−{
714− return indio_dev->debugfs_dentry;
715−}
712+struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev);
716713 #else
717714 static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
718715 {
include/linux/iio/trigger_consumer.h+0−7
@@ -50,11 +50,4 @@ irqreturn_t iio_pollfunc_store_time(int irq, void *p); · 49 unmodified lines
5050
5151 void iio_trigger_notify_done(struct iio_trigger *trig);
5252
53−/*
54− * Two functions for common case where all that happens is a pollfunc
55− * is attached and detached from a trigger
56− */
57−int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
58−int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
59−
6053 #endif