Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

Merge tag 'iio-for-3.17c' of...

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

Jonathan writes:

3rd round of IIO new drivers, cleanups and functionality for the 3.17 cycle.

New drivers
* isl29125 digital color light sensor driver
* TAOS/AMS tcs3414 digital color sensor

Staging graduation
* ad7291 ADC driver.

New functionality
* st_sensors - device tree support and bindings
* mma8452 - device tree support

Cleanups
* Drop redundant variables in a number of drivers.
* Reorder a structure definition to ealy wiht a warning about static
  not being at the beginning in the hid-sensors driver.
* Switch a few more drivers away from using explicit sampling_frequency
  attribute to providing this through the core.
* Make hid_sensor_get_reporting_interval static as only used within a single
  file.
* Drop a redundant check for negative values in an unsigned variable from
  ad9832
* Drop some duplicate case labels in the event monitor example code.
* Use devm_ioremap_resource to simplify error handling.
* Use devm_kzalloc within the blackfin timer driver to simplify error
  handling and removal.
* A number of cleanups of the ad7291 from Hartmut Knaack in response
  to a patch moving it out of staging.
* Core support for the period info element about events.  It has been
  in the abi for a while, but not added until now to the newer handling
  of information related to events.
* Add HAS_IOMEM dependency to mxs_lradc to avoid build issues when testing
  enabled.
parents 01e11629 90c5f2d1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ epson,rx8581 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
fsl,mag3110		MAG3110: Xtrinsic High Accuracy, 3D Magnetometer
fsl,mc13892		MC13892: Power Management Integrated Circuit (PMIC) for i.MX35/51
fsl,mma8450		MMA8450Q: Xtrinsic Low-power, 3-axis Xtrinsic Accelerometer
fsl,mma8452		MMA8452Q: 3-axis 12-bit / 8-bit Digital Accelerometer
fsl,mpr121		MPR121: Proximity Capacitive Touch Sensor Controller
fsl,sgtl5000		SGTL5000: Ultra Low-Power Audio Codec
gmt,g751		G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
+54 −0
Original line number Diff line number Diff line
STMicroelectronics MEMS sensors

The STMicroelectronics sensor devices are pretty straight-forward I2C or
SPI devices, all sharing the same device tree descriptions no matter what
type of sensor it is.

Required properties:
- compatible: see the list of valid compatible strings below
- reg: the I2C or SPI address the device will respond to

Optional properties:
- vdd-supply: an optional regulator that needs to be on to provide VDD
  power to the sensor.
- vddio-supply: an optional regulator that needs to be on to provide the
  VDD IO power to the sensor.
- st,drdy-int-pin: the pin on the package that will be used to signal
  "data ready" (valid values: 1 or 2). This property is not configurable
  on all sensors.

Sensors may also have applicable pin control settings, those use the
standard bindings from pinctrl/pinctrl-bindings.txt.

Valid compatible strings:

Accelerometers:
- st,lsm303dlh-accel
- st,lsm303dlhc-accel
- st,lis3dh-accel
- st,lsm330d-accel
- st,lsm330dl-accel
- st,lsm330dlc-accel
- st,lis331dlh-accel
- st,lsm303dl-accel
- st,lsm303dlm-accel
- st,lsm330-accel

Gyroscopes:
- st,l3g4200d-gyro
- st,lsm330d-gyro
- st,lsm330dl-gyro
- st,lsm330dlc-gyro
- st,l3gd20-gyro
- st,l3g4is-gyro
- st,lsm330-gyro

Magnetometers:
- st,lsm303dlhc-magn
- st,lsm303dlm-magn
- st,lis3mdl-magn

Pressure sensors:
- st,lps001wp-press
- st,lps25h-press
- st,lps331ap-press
+6 −0
Original line number Diff line number Diff line
@@ -423,9 +423,15 @@ static const struct i2c_device_id mma8452_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mma8452_id);

static const struct of_device_id mma8452_dt_ids[] = {
	{ .compatible = "fsl,mma8452" },
	{ }
};

static struct i2c_driver mma8452_driver = {
	.driver = {
		.name	= "mma8452",
		.of_match_table = of_match_ptr(mma8452_dt_ids),
		.pm	= MMA8452_PM_OPS,
	},
	.probe = mma8452_probe,
+10 −2
Original line number Diff line number Diff line
@@ -393,6 +393,9 @@ static int st_accel_read_raw(struct iio_dev *indio_dev,
		*val = 0;
		*val2 = adata->current_fullscale->gain;
		return IIO_VAL_INT_PLUS_MICRO;
	case IIO_CHAN_INFO_SAMP_FREQ:
		*val = adata->odr;
		return IIO_VAL_INT;
	default:
		return -EINVAL;
	}
@@ -410,6 +413,13 @@ static int st_accel_write_raw(struct iio_dev *indio_dev,
	case IIO_CHAN_INFO_SCALE:
		err = st_sensors_set_fullscale_by_gain(indio_dev, val2);
		break;
	case IIO_CHAN_INFO_SAMP_FREQ:
		if (val2)
			return -EINVAL;
		mutex_lock(&indio_dev->mlock);
		err = st_sensors_set_odr(indio_dev, val);
		mutex_unlock(&indio_dev->mlock);
		return err;
	default:
		return -EINVAL;
	}
@@ -417,14 +427,12 @@ static int st_accel_write_raw(struct iio_dev *indio_dev,
	return err;
}

static ST_SENSOR_DEV_ATTR_SAMP_FREQ();
static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL();
static ST_SENSORS_DEV_ATTR_SCALE_AVAIL(in_accel_scale_available);

static struct attribute *st_accel_attributes[] = {
	&iio_dev_attr_sampling_frequency_available.dev_attr.attr,
	&iio_dev_attr_in_accel_scale_available.dev_attr.attr,
	&iio_dev_attr_sampling_frequency.dev_attr.attr,
	NULL,
};

+51 −0
Original line number Diff line number Diff line
@@ -18,6 +18,55 @@
#include <linux/iio/common/st_sensors_i2c.h>
#include "st_accel.h"

#ifdef CONFIG_OF
static const struct of_device_id st_accel_of_match[] = {
	{
		.compatible = "st,lsm303dlh-accel",
		.data = LSM303DLH_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm303dlhc-accel",
		.data = LSM303DLHC_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lis3dh-accel",
		.data = LIS3DH_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm330d-accel",
		.data = LSM330D_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm330dl-accel",
		.data = LSM330DL_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm330dlc-accel",
		.data = LSM330DLC_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lis331dlh-accel",
		.data = LIS331DLH_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm303dl-accel",
		.data = LSM303DL_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm303dlm-accel",
		.data = LSM303DLM_ACCEL_DEV_NAME,
	},
	{
		.compatible = "st,lsm330-accel",
		.data = LSM330_ACCEL_DEV_NAME,
	},
	{},
};
MODULE_DEVICE_TABLE(of, st_accel_of_match);
#else
#define st_accel_of_match NULL
#endif

static int st_accel_i2c_probe(struct i2c_client *client,
						const struct i2c_device_id *id)
{
@@ -31,6 +80,7 @@ static int st_accel_i2c_probe(struct i2c_client *client,

	adata = iio_priv(indio_dev);
	adata->dev = &client->dev;
	st_sensors_of_i2c_probe(client, st_accel_of_match);

	st_sensors_i2c_configure(indio_dev, client, adata);

@@ -67,6 +117,7 @@ static struct i2c_driver st_accel_driver = {
	.driver = {
		.owner = THIS_MODULE,
		.name = "st-accel-i2c",
		.of_match_table = of_match_ptr(st_accel_of_match),
	},
	.probe = st_accel_i2c_probe,
	.remove = st_accel_i2c_remove,
Loading