Merge tag 'iio-for-5.2b' 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 cleanup for the 5.2 cycle.

New device suport
* ad7606
  - Support the AD7616 16 channel, 12bit ADC.
* fxas21002c
  - New driver for this gyroscope with I2C and SPI support.
* lsm6dsx
  - Support the lsm6dsr, new device information structure and dt bindings.
* srf04
  - Addition device IDs for mb1000, mb1010, mb1020, mb1030 and mb1040 +
    support of different required trigger pulse lengths.
* st-accel
  - Support the ls2de12, new device info and dt bindings.
* ti-ads8344
  - New driver for this 8 channel, 16 bit SPI ADC.

Binding conversions to yaml - we have started doing these in general for IIO.
* avia-hx711
* bmp085

Cleanups and minor fixes / additions
* ad5758
  - Fixup for some changes between preproduction parts and final part.
* ad7606
  - Refactor handling of oversampling to make it easy to vary between
    supported devices.
* ad9832
  - Organise includes.
  - Clock framework to handle clocks.
* ad9834
  - Drop unnecessary parenthesis.
* bmc150
  - Use __func__ rather than hardcoding.
* dummy_evgen.
  - Fix a memleak on error in probe.
* kxcjk1013
  - Add KXCJ91008 ACPI ID as seen in the wild.
  - Use __func__ rather than hardcoding.
* imx7d
  - Local dev variable to simplify code a bit.
  - dev_err replaces pr_err to give more info.
  - devm_platform_ioremap_resource for small reduction in boilerplate.
  - Simplify probe and remove by sharing suspend / resume logic.
  - Devm for iio_device_register as remove only contains the unregister.
* lsm6dsx
  - Remove a variable that was never read.
  - Open code values where they are effectively described by what is assigned
    to them rather than using uninformative defines.
* max31856
  - Avoid an unintialized ret variable in a path that can't actually occur
    but is hard for a static checker to know.
* max9611
  - White space
* mpu3050
  - Reduce a sleep worst case by switching from msleep to usleep_range.
* qcom-spmi-adc5
  - Add MODULE_DEVICE_TABLE to assist autoloading of this as a module.
* stm32-dfsdm
  - Fix missing dependencies.
* stm32-timer trigger
  - Fix a build issue when disabled.
* ti-ads7950
  - Fix mising dependency on CONFIG_GPIOLIB.

* tag 'iio-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (42 commits)
  iio: adc: qcom-spmi-adc5: Fix of-based module autoloading
  iio: dummy_evgen: fix possible memleak in evgen init
  iio:accel:Switch hardcoded function name with a reference to __func__ making the code more maintainable
  iio: adc: stm32-dfsdm: fix triggered buffer build dependency
  iio: adc: stm32-dfsdm: fix unmet direct dependencies detected
  iio: trigger: stm32-timer: fix build issue when disabled
  iio: imx7d_adc: Use devm_iio_device_register()
  iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend()
  iio: imx7d_adc: Simplify imx7d_adc_probe() with imx7d_adc_resume()
  drivers/iio/gyro/mpu3050-core.c: This patch fix the following checkpatch warning.
  iio: dac: ad5758: Modifications for new revision
  iio: imu: st_lsm6dsx: inline per-sensor data
  iio: adc: Add driver for the TI ADS8344 A/DC chips
  dt-bindings: iio: adc: Add bindings for TI ADS8344 A/DC chips
  MAINTAINERS: add entry for fxas21002c gyro driver
  iio: gyro: fxas21002c: add spi driver
  iio: gyro: fxas21002c: add i2c driver
  iio: gyro: add core driver for fxas21002c
  iio: gyro: add DT bindings to fxas21002c
  Kconfig: change configuration of srf04 ultrasonic iio sensor
  ...
This commit is contained in:
Greg Kroah-Hartman
2019-04-25 10:50:51 +02:00
förälder 817de6b859 447ccb4e08
incheckning bf402c08eb
47 ändrade filer med 2278 tillägg och 343 borttagningar

Visa fil

@@ -73,6 +73,28 @@ config BMG160_SPI
tristate
select REGMAP_SPI
config FXAS21002C
tristate "NXP FXAS21002C Gyro Sensor"
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
select FXAS21002C_I2C if (I2C)
select FXAS21002C_SPI if (SPI)
depends on (I2C || SPI_MASTER)
help
Say yes here to build support for NXP FXAS21002C Tri-axis Gyro
Sensor driver connected via I2C or SPI.
This driver can also be built as a module. If so, the module
will be called fxas21002c_i2c or fxas21002c_spi.
config FXAS21002C_I2C
tristate
select REGMAP_I2C
config FXAS21002C_SPI
tristate
select REGMAP_SPI
config HID_SENSOR_GYRO_3D
depends on HID_SENSOR_HUB
select IIO_BUFFER

Visa fil

@@ -12,6 +12,9 @@ obj-$(CONFIG_ADXRS450) += adxrs450.o
obj-$(CONFIG_BMG160) += bmg160_core.o
obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o
obj-$(CONFIG_BMG160_SPI) += bmg160_spi.o
obj-$(CONFIG_FXAS21002C) += fxas21002c_core.o
obj-$(CONFIG_FXAS21002C_I2C) += fxas21002c_i2c.o
obj-$(CONFIG_FXAS21002C_SPI) += fxas21002c_spi.o
obj-$(CONFIG_HID_SENSOR_GYRO_3D) += hid-sensor-gyro-3d.o

Visa fil

@@ -0,0 +1,150 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Driver for NXP FXAS21002C Gyroscope - Header
*
* Copyright (C) 2019 Linaro Ltd.
*/
#ifndef FXAS21002C_H_
#define FXAS21002C_H_
#include <linux/regmap.h>
#define FXAS21002C_REG_STATUS 0x00
#define FXAS21002C_REG_OUT_X_MSB 0x01
#define FXAS21002C_REG_OUT_X_LSB 0x02
#define FXAS21002C_REG_OUT_Y_MSB 0x03
#define FXAS21002C_REG_OUT_Y_LSB 0x04
#define FXAS21002C_REG_OUT_Z_MSB 0x05
#define FXAS21002C_REG_OUT_Z_LSB 0x06
#define FXAS21002C_REG_DR_STATUS 0x07
#define FXAS21002C_REG_F_STATUS 0x08
#define FXAS21002C_REG_F_SETUP 0x09
#define FXAS21002C_REG_F_EVENT 0x0A
#define FXAS21002C_REG_INT_SRC_FLAG 0x0B
#define FXAS21002C_REG_WHO_AM_I 0x0C
#define FXAS21002C_REG_CTRL0 0x0D
#define FXAS21002C_REG_RT_CFG 0x0E
#define FXAS21002C_REG_RT_SRC 0x0F
#define FXAS21002C_REG_RT_THS 0x10
#define FXAS21002C_REG_RT_COUNT 0x11
#define FXAS21002C_REG_TEMP 0x12
#define FXAS21002C_REG_CTRL1 0x13
#define FXAS21002C_REG_CTRL2 0x14
#define FXAS21002C_REG_CTRL3 0x15
enum fxas21002c_fields {
F_DR_STATUS,
F_OUT_X_MSB,
F_OUT_X_LSB,
F_OUT_Y_MSB,
F_OUT_Y_LSB,
F_OUT_Z_MSB,
F_OUT_Z_LSB,
/* DR_STATUS */
F_ZYX_OW, F_Z_OW, F_Y_OW, F_X_OW, F_ZYX_DR, F_Z_DR, F_Y_DR, F_X_DR,
/* F_STATUS */
F_OVF, F_WMKF, F_CNT,
/* F_SETUP */
F_MODE, F_WMRK,
/* F_EVENT */
F_EVENT, FE_TIME,
/* INT_SOURCE_FLAG */
F_BOOTEND, F_SRC_FIFO, F_SRC_RT, F_SRC_DRDY,
/* WHO_AM_I */
F_WHO_AM_I,
/* CTRL_REG0 */
F_BW, F_SPIW, F_SEL, F_HPF_EN, F_FS,
/* RT_CFG */
F_ELE, F_ZTEFE, F_YTEFE, F_XTEFE,
/* RT_SRC */
F_EA, F_ZRT, F_ZRT_POL, F_YRT, F_YRT_POL, F_XRT, F_XRT_POL,
/* RT_THS */
F_DBCNTM, F_THS,
/* RT_COUNT */
F_RT_COUNT,
/* TEMP */
F_TEMP,
/* CTRL_REG1 */
F_RST, F_ST, F_DR, F_ACTIVE, F_READY,
/* CTRL_REG2 */
F_INT_CFG_FIFO, F_INT_EN_FIFO, F_INT_CFG_RT, F_INT_EN_RT,
F_INT_CFG_DRDY, F_INT_EN_DRDY, F_IPOL, F_PP_OD,
/* CTRL_REG3 */
F_WRAPTOONE, F_EXTCTRLEN, F_FS_DOUBLE,
/* MAX FIELDS */
F_MAX_FIELDS,
};
static const struct reg_field fxas21002c_reg_fields[] = {
[F_DR_STATUS] = REG_FIELD(FXAS21002C_REG_STATUS, 0, 7),
[F_OUT_X_MSB] = REG_FIELD(FXAS21002C_REG_OUT_X_MSB, 0, 7),
[F_OUT_X_LSB] = REG_FIELD(FXAS21002C_REG_OUT_X_LSB, 0, 7),
[F_OUT_Y_MSB] = REG_FIELD(FXAS21002C_REG_OUT_Y_MSB, 0, 7),
[F_OUT_Y_LSB] = REG_FIELD(FXAS21002C_REG_OUT_Y_LSB, 0, 7),
[F_OUT_Z_MSB] = REG_FIELD(FXAS21002C_REG_OUT_Z_MSB, 0, 7),
[F_OUT_Z_LSB] = REG_FIELD(FXAS21002C_REG_OUT_Z_LSB, 0, 7),
[F_ZYX_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 7, 7),
[F_Z_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 6, 6),
[F_Y_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 5, 5),
[F_X_OW] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 4, 4),
[F_ZYX_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 3, 3),
[F_Z_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 2, 2),
[F_Y_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 1, 1),
[F_X_DR] = REG_FIELD(FXAS21002C_REG_DR_STATUS, 0, 0),
[F_OVF] = REG_FIELD(FXAS21002C_REG_F_STATUS, 7, 7),
[F_WMKF] = REG_FIELD(FXAS21002C_REG_F_STATUS, 6, 6),
[F_CNT] = REG_FIELD(FXAS21002C_REG_F_STATUS, 0, 5),
[F_MODE] = REG_FIELD(FXAS21002C_REG_F_SETUP, 6, 7),
[F_WMRK] = REG_FIELD(FXAS21002C_REG_F_SETUP, 0, 5),
[F_EVENT] = REG_FIELD(FXAS21002C_REG_F_EVENT, 5, 5),
[FE_TIME] = REG_FIELD(FXAS21002C_REG_F_EVENT, 0, 4),
[F_BOOTEND] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 3, 3),
[F_SRC_FIFO] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 2, 2),
[F_SRC_RT] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 1, 1),
[F_SRC_DRDY] = REG_FIELD(FXAS21002C_REG_INT_SRC_FLAG, 0, 0),
[F_WHO_AM_I] = REG_FIELD(FXAS21002C_REG_WHO_AM_I, 0, 7),
[F_BW] = REG_FIELD(FXAS21002C_REG_CTRL0, 6, 7),
[F_SPIW] = REG_FIELD(FXAS21002C_REG_CTRL0, 5, 5),
[F_SEL] = REG_FIELD(FXAS21002C_REG_CTRL0, 3, 4),
[F_HPF_EN] = REG_FIELD(FXAS21002C_REG_CTRL0, 2, 2),
[F_FS] = REG_FIELD(FXAS21002C_REG_CTRL0, 0, 1),
[F_ELE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 3, 3),
[F_ZTEFE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 2, 2),
[F_YTEFE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 1, 1),
[F_XTEFE] = REG_FIELD(FXAS21002C_REG_RT_CFG, 0, 0),
[F_EA] = REG_FIELD(FXAS21002C_REG_RT_SRC, 6, 6),
[F_ZRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 5, 5),
[F_ZRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 4, 4),
[F_YRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 3, 3),
[F_YRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 2, 2),
[F_XRT] = REG_FIELD(FXAS21002C_REG_RT_SRC, 1, 1),
[F_XRT_POL] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 0),
[F_DBCNTM] = REG_FIELD(FXAS21002C_REG_RT_THS, 7, 7),
[F_THS] = REG_FIELD(FXAS21002C_REG_RT_SRC, 0, 6),
[F_RT_COUNT] = REG_FIELD(FXAS21002C_REG_RT_COUNT, 0, 7),
[F_TEMP] = REG_FIELD(FXAS21002C_REG_TEMP, 0, 7),
[F_RST] = REG_FIELD(FXAS21002C_REG_CTRL1, 6, 6),
[F_ST] = REG_FIELD(FXAS21002C_REG_CTRL1, 5, 5),
[F_DR] = REG_FIELD(FXAS21002C_REG_CTRL1, 2, 4),
[F_ACTIVE] = REG_FIELD(FXAS21002C_REG_CTRL1, 1, 1),
[F_READY] = REG_FIELD(FXAS21002C_REG_CTRL1, 0, 0),
[F_INT_CFG_FIFO] = REG_FIELD(FXAS21002C_REG_CTRL2, 7, 7),
[F_INT_EN_FIFO] = REG_FIELD(FXAS21002C_REG_CTRL2, 6, 6),
[F_INT_CFG_RT] = REG_FIELD(FXAS21002C_REG_CTRL2, 5, 5),
[F_INT_EN_RT] = REG_FIELD(FXAS21002C_REG_CTRL2, 4, 4),
[F_INT_CFG_DRDY] = REG_FIELD(FXAS21002C_REG_CTRL2, 3, 3),
[F_INT_EN_DRDY] = REG_FIELD(FXAS21002C_REG_CTRL2, 2, 2),
[F_IPOL] = REG_FIELD(FXAS21002C_REG_CTRL2, 1, 1),
[F_PP_OD] = REG_FIELD(FXAS21002C_REG_CTRL2, 0, 0),
[F_WRAPTOONE] = REG_FIELD(FXAS21002C_REG_CTRL3, 3, 3),
[F_EXTCTRLEN] = REG_FIELD(FXAS21002C_REG_CTRL3, 2, 2),
[F_FS_DOUBLE] = REG_FIELD(FXAS21002C_REG_CTRL3, 0, 0),
};
extern const struct dev_pm_ops fxas21002c_pm_ops;
int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name);
void fxas21002c_core_remove(struct device *dev);
#endif

Filskillnaden har hållits tillbaka eftersom den är för stor Load Diff

Visa fil

@@ -0,0 +1,69 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for NXP FXAS21002C Gyroscope - I2C
*
* Copyright (C) 2018 Linaro Ltd.
*/
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include "fxas21002c.h"
static const struct regmap_config fxas21002c_regmap_i2c_conf = {
.reg_bits = 8,
.val_bits = 8,
.max_register = FXAS21002C_REG_CTRL3,
};
static int fxas21002c_i2c_probe(struct i2c_client *i2c)
{
struct regmap *regmap;
regmap = devm_regmap_init_i2c(i2c, &fxas21002c_regmap_i2c_conf);
if (IS_ERR(regmap)) {
dev_err(&i2c->dev, "Failed to register i2c regmap: %ld\n",
PTR_ERR(regmap));
return PTR_ERR(regmap);
}
return fxas21002c_core_probe(&i2c->dev, regmap, i2c->irq, i2c->name);
}
static int fxas21002c_i2c_remove(struct i2c_client *i2c)
{
fxas21002c_core_remove(&i2c->dev);
return 0;
}
static const struct i2c_device_id fxas21002c_i2c_id[] = {
{ "fxas21002c", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, fxas21002c_i2c_id);
static const struct of_device_id fxas21002c_i2c_of_match[] = {
{ .compatible = "nxp,fxas21002c", },
{ }
};
MODULE_DEVICE_TABLE(of, fxas21002c_i2c_of_match);
static struct i2c_driver fxas21002c_i2c_driver = {
.driver = {
.name = "fxas21002c_i2c",
.pm = &fxas21002c_pm_ops,
.of_match_table = fxas21002c_i2c_of_match,
},
.probe_new = fxas21002c_i2c_probe,
.remove = fxas21002c_i2c_remove,
.id_table = fxas21002c_i2c_id,
};
module_i2c_driver(fxas21002c_i2c_driver);
MODULE_AUTHOR("Rui Miguel Silva <rui.silva@linaro.org>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("FXAS21002C I2C Gyro driver");

Visa fil

@@ -0,0 +1,70 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for NXP Fxas21002c Gyroscope - SPI
*
* Copyright (C) 2019 Linaro Ltd.
*/
#include <linux/err.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include "fxas21002c.h"
static const struct regmap_config fxas21002c_regmap_spi_conf = {
.reg_bits = 8,
.val_bits = 8,
.max_register = FXAS21002C_REG_CTRL3,
};
static int fxas21002c_spi_probe(struct spi_device *spi)
{
const struct spi_device_id *id = spi_get_device_id(spi);
struct regmap *regmap;
regmap = devm_regmap_init_spi(spi, &fxas21002c_regmap_spi_conf);
if (IS_ERR(regmap)) {
dev_err(&spi->dev, "Failed to register spi regmap: %ld\n",
PTR_ERR(regmap));
return PTR_ERR(regmap);
}
return fxas21002c_core_probe(&spi->dev, regmap, spi->irq, id->name);
}
static int fxas21002c_spi_remove(struct spi_device *spi)
{
fxas21002c_core_remove(&spi->dev);
return 0;
}
static const struct spi_device_id fxas21002c_spi_id[] = {
{ "fxas21002c", 0 },
{ }
};
MODULE_DEVICE_TABLE(spi, fxas21002c_spi_id);
static const struct of_device_id fxas21002c_spi_of_match[] = {
{ .compatible = "nxp,fxas21002c", },
{ }
};
MODULE_DEVICE_TABLE(of, fxas21002c_spi_of_match);
static struct spi_driver fxas21002c_spi_driver = {
.driver = {
.name = "fxas21002c_spi",
.pm = &fxas21002c_pm_ops,
.of_match_table = fxas21002c_spi_of_match,
},
.probe = fxas21002c_spi_probe,
.remove = fxas21002c_spi_remove,
.id_table = fxas21002c_spi_id,
};
module_spi_driver(fxas21002c_spi_driver);
MODULE_AUTHOR("Rui Miguel Silva <rui.silva@linaro.org>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("FXAS21002C SPI Gyro driver");

Visa fil

@@ -865,7 +865,7 @@ static int mpu3050_power_up(struct mpu3050 *mpu3050)
dev_err(mpu3050->dev, "error setting power mode\n");
return ret;
}
msleep(10);
usleep_range(10000, 20000);
return 0;
}