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
42 * @resp: motion sensor response structure42 * @resp: motion sensor response structure
43 * @type: type of motion sensor43 * @type: type of motion sensor
44 * @loc: location where the motion sensor is placed44 * @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.
45 * @calib: calibration parameters. Note that trigger49 * @calib: calibration parameters. Note that trigger
46 * captured data will always provide the calibrated50 * captured data will always provide the calibrated
47 * data51 * data
@@ -65,6 +69,9 @@ struct cros_ec_sensors_core_state { · 17 unmodified lines
65 enum motionsensor_type type;69 enum motionsensor_type type;
66 enum motionsensor_location loc;70 enum motionsensor_location loc;
67 71
72 bool range_updated;
73 int curr_range;
74
68 struct calib_data {75 struct calib_data {
69 s16 offset;76 s16 offset;
70 u16 scale;77 u16 scale;
@@ -114,7 +121,9 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, · 43 unmodified lines
114 struct iio_chan_spec const *chan,121 struct iio_chan_spec const *chan,
115 int val, int val2, long mask);122 int val, int val2, long mask);
116 123
117/* List of extended channel specification for all sensors */124extern const struct dev_pm_ops cros_ec_sensors_pm_ops;
125
126/* List of extended channel specification for all sensors. */
118extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];127extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[];
119extern const struct attribute *cros_ec_sensor_fifo_attributes[];128extern const struct attribute *cros_ec_sensor_fifo_attributes[];
120 129
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 */
19struct 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
488 * @currentmode: [DRIVER] current operating mode488 * @currentmode: [DRIVER] current operating mode
489 * @dev: [DRIVER] device structure, should be assigned a parent489 * @dev: [DRIVER] device structure, should be assigned a parent
490 * and owner490 * and owner
491 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
492 * @buffer: [DRIVER] any buffer present491 * @buffer: [DRIVER] any buffer present
493 * @buffer_list: [INTERN] list of all buffers currently attached
494 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux492 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
495 * @mlock: [INTERN] lock used to prevent simultaneous device state493 * @mlock: [INTERN] lock used to prevent simultaneous device state
496 * changes494 * changes
@@ -506,9 +504,6 @@ struct iio_buffer_setup_ops { · 9 unmodified lines
506 * @pollfunc_event: [DRIVER] function run on events trigger being received504 * @pollfunc_event: [DRIVER] function run on events trigger being received
507 * @channels: [DRIVER] channel specification structure table505 * @channels: [DRIVER] channel specification structure table
508 * @num_channels: [DRIVER] number of channels specified in @channels.506 * @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
512 * @name: [DRIVER] name of the device.507 * @name: [DRIVER] name of the device.
513 * @label: [DRIVER] unique name to identify which device this is508 * @label: [DRIVER] unique name to identify which device this is
514 * @info: [DRIVER] callbacks and constant info from driver509 * @info: [DRIVER] callbacks and constant info from driver
@@ -520,8 +515,8 @@ struct iio_buffer_setup_ops { · 5 unmodified lines
520 * @groups: [INTERN] attribute groups515 * @groups: [INTERN] attribute groups
521 * @groupcounter: [INTERN] index of next attribute group516 * @groupcounter: [INTERN] index of next attribute group
522 * @flags: [INTERN] file ops related flags including busy flag.517 * @flags: [INTERN] file ops related flags including busy flag.
523 * @debugfs_dentry: [INTERN] device specific debugfs dentry.518 * @priv: [DRIVER] reference to driver's private information
524 * @cached_reg_addr: [INTERN] cached register address for debugfs reads.519 * **MUST** be accessed **ONLY** via iio_priv() helper
525 */520 */
526struct iio_dev {521struct iio_dev {
527 int id;522 int id;
@@ -531,10 +526,7 @@ struct iio_dev { · 3 unmodified lines
531 int currentmode;526 int currentmode;
532 struct device dev;527 struct device dev;
533 528
534 struct iio_event_interface *event_interface;
535
536 struct iio_buffer *buffer;529 struct iio_buffer *buffer;
537 struct list_head buffer_list;
538 int scan_bytes;530 int scan_bytes;
539 struct mutex mlock;531 struct mutex mlock;
540 532
@@ -551,8 +543,6 @@ struct iio_dev { · 10 unmodified lines
551 struct iio_chan_spec const *channels;543 struct iio_chan_spec const *channels;
552 int num_channels;544 int num_channels;
553 545
554 struct list_head channel_attr_list;
555 struct attribute_group chan_attr_group;
556 const char *name;546 const char *name;
557 const char *label;547 const char *label;
558 const struct iio_info *info;548 const struct iio_info *info;
@@ -565,12 +555,7 @@ struct iio_dev { · 6 unmodified lines
565 int groupcounter;555 int groupcounter;
566 556
567 unsigned long flags;557 unsigned long flags;
568#if defined(CONFIG_DEBUG_FS)558 void *priv;
569 struct dentry *debugfs_dentry;
570 unsigned cached_reg_addr;
571 char read_buf[20];
572 unsigned int read_buf_len;
573#endif
574};559};
575 560
576const struct iio_chan_spec561const struct iio_chan_spec
@@ -649,6 +634,26 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev) · 72 unmodified lines
649 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;634 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
650}635}
651 636
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 **/
652static inline void iio_device_set_parent(struct iio_dev *indio_dev,
653 struct device *parent)
654{
655 indio_dev->dev.parent = parent;
656}
652 657
653/**658/**
654 * iio_device_set_drvdata() - Set device driver data659 * 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
669 *674 *
670 * Returns the data previously set with iio_device_set_drvdata()675 * Returns the data previously set with iio_device_set_drvdata()
671 */676 */
672static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)677static inline void *iio_device_get_drvdata(const struct iio_dev *indio_dev)
673{678{
674 return dev_get_drvdata(&indio_dev->dev);679 return dev_get_drvdata(&indio_dev->dev);
675}680}
676 681
677/* Can we make this smaller? */682/* Can we make this smaller? */
678#define IIO_ALIGN L1_CACHE_BYTES683#define IIO_ALIGN L1_CACHE_BYTES
679struct iio_dev *iio_device_alloc(int sizeof_priv);684struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
680 685
686/* The information at the returned address is guaranteed to be cacheline aligned */
681static inline void *iio_priv(const struct iio_dev *indio_dev)687static inline void *iio_priv(const struct iio_dev *indio_dev)
682{688{
683 return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);689 return indio_dev->priv;
684}
685
686static 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));
690}690}
691 691
692void iio_device_free(struct iio_dev *indio_dev);692void iio_device_free(struct iio_dev *indio_dev);
693struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);693struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
694struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,694struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
695 const char *fmt, ...);695 const char *fmt, ...);
696/**696/**
@@ -709,10 +709,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) · 12 unmodified lines
709 * @indio_dev: IIO device structure for device709 * @indio_dev: IIO device structure for device
710 **/710 **/
711#if defined(CONFIG_DEBUG_FS)711#if defined(CONFIG_DEBUG_FS)
712static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)712struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev);
713{
714 return indio_dev->debugfs_dentry;
715}
716#else713#else
717static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)714static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
718{715{
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
50 50
51void iio_trigger_notify_done(struct iio_trigger *trig);51void iio_trigger_notify_done(struct iio_trigger *trig);
52 52
53/*
54 * Two functions for common case where all that happens is a pollfunc
55 * is attached and detached from a trigger
56 */
57int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
58int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
59
60#endif53#endif