Commit dd36a2d9 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-for-4.13b' of...

Merge tag 'iio-for-4.13b' 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.13 cycle.

A few reverts here. One was a general failure to notice a device was already
supported by another driver.  The second is due to a review comment pointing
out that the original patch was a bad idea and would break existing systems.

Reverts
* bma180
  - Revert addition of support for the BMA250E it is already supported by
    the bmc150-accel and better supported at that. Oops.
* hi8435
  - The fix for cleanup of the reset gpio stuff isn't a good way to go.  It
    breaks systems where an inverting level convertor is used.  The right fix
    is to make the original devicetree correct - even if it involves patching
    the devicetree in kernel.

New Device Support
* stm32-adc
  - STM32H7 support and bindings.

Features
* core
  - add a hardware triggered operating mode for systems in which the actual
    trigger is never seen by the kernel.  This is typically only used when
    a device 'can' use other triggers, but if a particular magic one is
    enabled the interrupt is effectively handled in hardware and we never see
    it.
* st-lsm6dsx
  - support active low interrupts.
* stm32-adc
  - Make the core adc clock optional as not all hardware supported requires it.
  - Make the bus clock optional in the per instance driver as it may be shared
    by all instances of the ADC and is handled by the core.
  - Rework to have a data structure representing the device type specific
    elements.
* stm32-trigger (and counter)
  - Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
  - Add an attribute to configure device modes for quadrature counting etc.

Clean ups and minor fixes
* IIO core.
  - use __sysfs_match_string() helper rather than open coding the same.
* ad7791
  - use sysfs_match_string() helper rather than open coding the same.
* aspeed-adc
  - handle return value of clk_prepare_enable
* cpcap
  - Fix default register values and ensure the battery thermistor is enabled
    correctly.
  - Fix the reported die temperature where we can - docs are lacking.
  - Remove the hung interrupt quirk as no longer happens due to fix in the
    mfd driver.
* hi8435
  - Remove &s from hi8435_info definition as unneeded and inconsistent.
* hid-sensor-trgger
  - Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
* ina2xx
  - Make the use of iio_info_mask* elements consistent for all channels.
    This doesn't have any visible effect, but acts as clear documentation of
    which channels various resulting attributes apply to.
* lpc32xx
  - handle the return value of clk_prepare_enable.
* meson-saradc
  - NULL instead of 0 for pointer.
* mma9551
  - use NULL for GPIO connection ID to aid implementation fo ACPI support.
    Here the connection ID doesn't actually tell us anything and it is much
    easier to deal with the driver if it's not there.
* mpu6050
  - Fix lock issues through use of a local mux.
  - Replace sprintf with scnprintf as appropriate.
  - Check whoami against all known values.  This allows for a small number of
    boards where we are really fishing for the part not being present at all.
    It is unfortunately common to have undescribed changes to use newer chips.
    We paper over this but just emitting a warning for those cases as long as
    we know about.
* mxs-lradc
  - Fix some non static warnings.
* rcar-adc
  - Part of making the naming for this part consistent across the kernel.
* st_accel
  - drop some spi_device_id entries for variants with no SPI support
* st_magn
  - drop some spi_device_id entries for variants with no SPI support.
* sx9500
  - Use devm_gpiod_get instead of indexed value with an index of 0 on all
    occasions.
* twl4030
  - Drop unused twl4030_get_madc_conversion as callers removed now throughout
    kernel.
  - Unexport twl4030_madc_conversion() as no used only within this driver.
  - Drop twl4030_madc_user_params as not used now.
  - Drop twl4030_madc_request.func_cb as not used now.
  - Fold the twl4030-madc.h header into the driver as no longer used anywhere
    else in the kernel.
* xilinx
  - Handle the return value of clk_prepare_enable
parents cbf4b386 881b556f
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -138,3 +138,18 @@ Description:
			Counting is enabled on rising edge of the connected
			trigger, and remains enabled for the duration of this
			selected mode.

What:		/sys/bus/iio/devices/iio:deviceX/in_count_trigger_mode_available
KernelVersion:	4.13
Contact:	benjamin.gaignard@st.com
Description:
		Reading returns the list possible trigger modes.

What:		/sys/bus/iio/devices/iio:deviceX/in_count0_trigger_mode
KernelVersion:	4.13
Contact:	benjamin.gaignard@st.com
Description:
		Configure the device counter trigger mode
		counting direction is set by in_count0_count_direction
		attribute and the counter is clocked by the connected trigger
		rising edges.
+1 −1
Original line number Diff line number Diff line
* Renesas RCar GyroADC device driver
* Renesas R-Car GyroADC device driver

The GyroADC block is a reduced SPI block with up to 8 chipselect lines,
which supports the SPI protocol of a selected few SPI ADCs. The SPI ADCs
+21 −7
Original line number Diff line number Diff line
@@ -21,11 +21,19 @@ own configurable sequence and trigger:
Contents of a stm32 adc root node:
-----------------------------------
Required properties:
- compatible: Should be "st,stm32f4-adc-core".
- compatible: Should be one of:
  "st,stm32f4-adc-core"
  "st,stm32h7-adc-core"
- reg: Offset and length of the ADC block register set.
- interrupts: Must contain the interrupt for ADC block.
- clocks: Clock for the analog circuitry (common to all ADCs).
- clock-names: Must be "adc".
- clocks: Core can use up to two clocks, depending on part used:
  - "adc" clock: for the analog circuitry, common to all ADCs.
    It's required on stm32f4.
    It's optional on stm32h7.
  - "bus" clock: for registers access, common to all ADCs.
    It's not present on stm32f4.
    It's required on stm32h7.
- clock-names: Must be "adc" and/or "bus" depending on part used.
- interrupt-controller: Identifies the controller node as interrupt-parent
- vref-supply: Phandle to the vref input analog reference voltage.
- #interrupt-cells = <1>;
@@ -42,14 +50,18 @@ An ADC block node should contain at least one subnode, representing an
ADC instance available on the machine.

Required properties:
- compatible: Should be "st,stm32f4-adc".
- compatible: Should be one of:
  "st,stm32f4-adc"
  "st,stm32h7-adc"
- reg: Offset of ADC instance in ADC block (e.g. may be 0x0, 0x100, 0x200).
- clocks: Input clock private to this ADC instance.
- clocks: Input clock private to this ADC instance. It's required only on
  stm32f4, that has per instance clock input for registers access.
- interrupt-parent: Phandle to the parent interrupt controller.
- interrupts: IRQ Line for the ADC (e.g. may be 0 for adc@0, 1 for adc@100 or
  2 for adc@200).
- st,adc-channels: List of single-ended channels muxed for this ADC.
  It can have up to 16 channels, numbered from 0 to 15 (resp. for in0..in15).
  It can have up to 16 channels on stm32f4 or 20 channels on stm32h7, numbered
  from 0 to 15 or 19 (resp. for in0..in15 or in0..in19).
- #io-channel-cells = <1>: See the IIO bindings section "IIO consumers" in
  Documentation/devicetree/bindings/iio/iio-bindings.txt

@@ -58,7 +70,9 @@ Optional properties:
  See ../../dma/dma.txt for details.
- dma-names: Must be "rx" when dmas property is being used.
- assigned-resolution-bits: Resolution (bits) to use for conversions. Must
  match device available resolutions (e.g. can be 6, 8, 10 or 12 on stm32f4).
  match device available resolutions:
  * can be 6, 8, 10 or 12 on stm32f4
  * can be 8, 10, 12, 14 or 16 on stm32h7
  Default is maximum resolution if unset.

Example:
+2 −1
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@ Optional properties:
  "data ready" (valid values: 1 or 2).
- interrupt-parent: should be the phandle for the interrupt controller
- interrupts: interrupt mapping for IRQ. It should be configured with
  flags IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING.
  flags IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or
  IRQ_TYPE_EDGE_FALLING.

  Refer to interrupt-controller/interrupts.txt for generic interrupt
  client node bindings.
+3 −42
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
 * BMA250: 7-bit I2C slave address 0x18 or 0x19
 */

#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
@@ -37,7 +36,6 @@
enum chip_ids {
	BMA180,
	BMA250,
	BMA250E,
};

struct bma180_data;
@@ -57,7 +55,6 @@ struct bma180_part_info {
	u8 power_reg, power_mask, lowpower_val;
	u8 int_enable_reg, int_enable_mask;
	u8 softreset_reg;
	u8 chip_id;

	int (*chip_config)(struct bma180_data *data);
	void (*chip_disable)(struct bma180_data *data);
@@ -115,8 +112,6 @@ struct bma180_part_info {
#define BMA250_INT1_DATA_MASK	BIT(0)
#define BMA250_INT_RESET_MASK	BIT(7) /* Reset pending interrupts */

#define BMA250E_CHIP_ID		0xf9

struct bma180_data {
	struct i2c_client *client;
	struct iio_trigger *trig;
@@ -314,7 +309,7 @@ static int bma180_chip_init(struct bma180_data *data)

	if (ret < 0)
		return ret;
	if (ret != data->part_info->chip_id)
	if (ret != BMA180_ID_REG_VAL)
		return -ENODEV;

	ret = bma180_soft_reset(data);
@@ -637,7 +632,6 @@ static const struct bma180_part_info bma180_part_info[] = {
		BMA180_TCO_Z, BMA180_MODE_CONFIG, BMA180_LOW_POWER,
		BMA180_CTRL_REG3, BMA180_NEW_DATA_INT,
		BMA180_RESET,
		BMA180_CHIP_ID,
		bma180_chip_config,
		bma180_chip_disable,
	},
@@ -652,22 +646,6 @@ static const struct bma180_part_info bma180_part_info[] = {
		BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1,
		BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK,
		BMA250_RESET_REG,
		BMA180_CHIP_ID,
		bma250_chip_config,
		bma250_chip_disable,
	},
	[BMA250E] = {
		bma250_channels, ARRAY_SIZE(bma250_channels),
		bma250_scale_table, ARRAY_SIZE(bma250_scale_table),
		bma250_bw_table, ARRAY_SIZE(bma250_bw_table),
		BMA250_INT_RESET_REG, BMA250_INT_RESET_MASK,
		BMA250_POWER_REG, BMA250_SUSPEND_MASK,
		BMA250_BW_REG, BMA250_BW_MASK,
		BMA250_RANGE_REG, BMA250_RANGE_MASK,
		BMA250_POWER_REG, BMA250_LOWPOWER_MASK, 1,
		BMA250_INT_ENABLE_REG, BMA250_DATA_INTEN_MASK,
		BMA250_RESET_REG,
		BMA250E_CHIP_ID,
		bma250_chip_config,
		bma250_chip_disable,
	},
@@ -728,8 +706,6 @@ static const struct iio_trigger_ops bma180_trigger_ops = {
static int bma180_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{
	struct device *dev = &client->dev;
	const struct acpi_device_id *acpi_id;
	struct bma180_data *data;
	struct iio_dev *indio_dev;
	enum chip_ids chip;
@@ -742,17 +718,10 @@ static int bma180_probe(struct i2c_client *client,
	data = iio_priv(indio_dev);
	i2c_set_clientdata(client, indio_dev);
	data->client = client;
	if (dev->of_node) {
	if (client->dev.of_node)
		chip = (enum chip_ids)of_device_get_match_data(&client->dev);
	} else if (id) {
	else
		chip = id->driver_data;
	} else {
		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
		if (!acpi_id)
			return -ENODEV;

		chip = acpi_id->driver_data;
	}
	data->part_info = &bma180_part_info[chip];

	ret = data->part_info->chip_config(data);
@@ -873,16 +842,9 @@ static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume);
#define BMA180_PM_OPS NULL
#endif

static const struct acpi_device_id bma180_acpi_match[] = {
	{ "BMA250E", BMA250E },
	{ }
};
MODULE_DEVICE_TABLE(acpi, bma180_acpi_match);

static struct i2c_device_id bma180_ids[] = {
	{ "bma180", BMA180 },
	{ "bma250", BMA250 },
	{ "bma250e", BMA250E },
	{ }
};

@@ -904,7 +866,6 @@ MODULE_DEVICE_TABLE(of, bma180_of_match);
static struct i2c_driver bma180_driver = {
	.driver = {
		.name	= "bma180",
		.acpi_match_table = ACPI_PTR(bma180_acpi_match),
		.pm	= BMA180_PM_OPS,
		.of_match_table = bma180_of_match,
	},
Loading