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

Merge tag 'iio-for-4.3a' of...

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

Jonathan writes:

First round of new drivers, cleanups and functionality for IIO in the 4.3 cycle.

Core and tools new stuff
* Allow explicit flush of hardware fifo by using an non blocking read.
  This is needed to support some of the Android requirements for HW fifo
  devices - also makes sense generally and clarifies a corner of the ABI.
* Add some missing modifier names.  Mostly these exist for weird and
  wonderful event types, but should still be present in the name array.
* Update iio_event_monitor to cope with new channel types.
* generic_buffer gains support for single byte scan elements (no idea
  how this never got implemented before!)

New device support
* ROHM rpr0521 light and proximity sensor driver.
* bmc150 gains bmc156 support.
* ms5611 gains ms5607 temperature and pressure sensor support.

Driver functionality
* inv-mpu - add scale_available attributes to aid userspace in
  configuring these devices.
* isl29125 - add scale_available attributes.
* stk8ba50 - sampling frequency control, triggered buffer support.
* stk8312 - sampling frequency control, triggered buffer support.
* cc10001 - ensure ADC powered up at probe time if shared by non linux
  running CPUs.
* bmc150-magn - decouple the buffer and trigger allowing other triggers
  to be used to drive this device's sampling.
Documentation
* Add some previously missed *scale_available attributes to the ABI docs.

Cleanups
* Clarify some crazy naming in iio_triggered_buffer_setup that seems to
  have somehow ended up backwards (dates back a long way).  Avoid the top
  half and bottom half naming entirely given we are how dealing with a
  handler and a thread in all cases.
* Tools cleanup including coding style, variable naming improvements, also
  a new sanity check on a full event having been read.
* stk8ba50 - replace the scale table with a struct for clarity. Also suspend
  the sensor if an error occurs in init.
* hid-sensor-prox - drop uneeded line break.
* mma9551 - use size in words for word read / write avoiding accidental
  sending of an odd number of bytes.
* mma9553 - fix code alignment and document the use of a mutex.
* light/Kconfig - typo fix in commment.
* cm3323 - don't eat an error value, replace an unneeded local variable with
  a generic local variable with the same use, add some blank lines for clarity.
* pressure/Kconfig - typo in Measurement Specialties name.
* bmc150-accel - actually use a mask definition rather than repeating the
  value inline, code style cleanup.
* adc/Kconfig - general help description cleanup.
* ssp_sensors - drop redundant spi driver bus initialization (done in the
  spi core)
* tmp006 - use genmask rather than hand generated masks.
* ms5611 - drop IIO_CHAN_INFO_SCALE as this driver provides a processed
  output and as such the read only scale adds nothing useful.
* kxcjk-1013, adf4350, dummy - drop unwanted blank lines.
* Drop all owner assignments from i2c_drivers and this is done in the
  i2c core.
parents 40403c1b 2155971a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -413,6 +413,11 @@ Description:
		to compute the calories burnt by the user.

What:		/sys/bus/iio/devices/iio:deviceX/in_accel_scale_available
What:		/sys/.../iio:deviceX/in_anglvel_scale_available
What:		/sys/.../iio:deviceX/in_magn_scale_available
What:		/sys/.../iio:deviceX/in_illuminance_scale_available
What:		/sys/.../iio:deviceX/in_intensity_scale_available
What:		/sys/.../iio:deviceX/in_proximity_scale_available
What:		/sys/.../iio:deviceX/in_voltageX_scale_available
What:		/sys/.../iio:deviceX/in_voltage-voltage_scale_available
What:		/sys/.../iio:deviceX/out_voltageX_scale_available
+0 −1
Original line number Diff line number Diff line
@@ -846,7 +846,6 @@ MODULE_DEVICE_TABLE(i2c, bma180_ids);
static struct i2c_driver bma180_driver = {
	.driver = {
		.name	= "bma180",
		.owner	= THIS_MODULE,
		.pm	= BMA180_PM_OPS,
	},
	.probe		= bma180_probe,
+50 −43
Original line number Diff line number Diff line
@@ -241,7 +241,6 @@ static const struct {
				       {500000, BMC150_ACCEL_SLEEP_500_MS},
				       {1000000, BMC150_ACCEL_SLEEP_1_SEC} };


static int bmc150_accel_set_mode(struct bmc150_accel_data *data,
				 enum bmc150_power_modes mode,
				 int dur_us)
@@ -259,8 +258,9 @@ static int bmc150_accel_set_mode(struct bmc150_accel_data *data,
				dur_val =
				bmc150_accel_sleep_value_table[i].reg_value;
		}
	} else
	} else {
		dur_val = 0;
	}

	if (dur_val < 0)
		return -EINVAL;
@@ -351,8 +351,7 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)

	ret = i2c_smbus_read_byte_data(data->client, BMC150_ACCEL_REG_CHIP_ID);
	if (ret < 0) {
		dev_err(&data->client->dev,
			"Error: Reading chip id\n");
		dev_err(&data->client->dev, "Error: Reading chip id\n");
		return ret;
	}

@@ -376,8 +375,7 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
					BMC150_ACCEL_REG_PMU_RANGE,
					BMC150_ACCEL_DEF_RANGE_4G);
	if (ret < 0) {
		dev_err(&data->client->dev,
					"Error writing reg_pmu_range\n");
		dev_err(&data->client->dev, "Error writing reg_pmu_range\n");
		return ret;
	}

@@ -437,12 +435,13 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on)
{
	int ret;

	if (on)
	if (on) {
		ret = pm_runtime_get_sync(&data->client->dev);
	else {
	} else {
		pm_runtime_mark_last_busy(&data->client->dev);
		ret = pm_runtime_put_autosuspend(&data->client->dev);
	}

	if (ret < 0) {
		dev_err(&data->client->dev,
			"Failed: bmc150_accel_set_power_state for %d\n", on);
@@ -514,13 +513,13 @@ static int bmc150_accel_set_interrupt(struct bmc150_accel_data *data, int i,
	}

	/*
	 * We will expect the enable and disable to do operation in
	 * in reverse order. This will happen here anyway as our
	 * resume operation uses sync mode runtime pm calls, the
	 * suspend operation will be delayed by autosuspend delay
	 * So the disable operation will still happen in reverse of
	 * enable operation. When runtime pm is disabled the mode
	 * is always on so sequence doesn't matter
	 * We will expect the enable and disable to do operation in reverse
	 * order. This will happen here anyway, as our resume operation uses
	 * sync mode runtime pm calls. The suspend operation will be delayed
	 * by autosuspend delay.
	 * So the disable operation will still happen in reverse order of
	 * enable operation. When runtime pm is disabled the mode is always on,
	 * so sequence doesn't matter.
	 */
	ret = bmc150_accel_set_power_state(data, state);
	if (ret < 0)
@@ -574,7 +573,6 @@ out_fix_power_state:
	return ret;
}


static int bmc150_accel_set_scale(struct bmc150_accel_data *data, int val)
{
	int ret, i;
@@ -674,8 +672,9 @@ static int bmc150_accel_read_raw(struct iio_dev *indio_dev,
		if (chan->type == IIO_TEMP) {
			*val = BMC150_ACCEL_TEMP_CENTER_VAL;
			return IIO_VAL_INT;
		} else
		} else {
			return -EINVAL;
		}
	case IIO_CHAN_INFO_SCALE:
		*val = 0;
		switch (chan->type) {
@@ -776,7 +775,7 @@ static int bmc150_accel_write_event(struct iio_dev *indio_dev,

	switch (info) {
	case IIO_EV_INFO_VALUE:
		data->slope_thres = val & 0xFF;
		data->slope_thres = val & BMC150_ACCEL_SLOPE_THRES_MASK;
		break;
	case IIO_EV_INFO_PERIOD:
		data->slope_dur = val & BMC150_ACCEL_SLOPE_DUR_MASK;
@@ -793,7 +792,6 @@ static int bmc150_accel_read_event_config(struct iio_dev *indio_dev,
					  enum iio_event_type type,
					  enum iio_event_direction dir)
{

	struct bmc150_accel_data *data = iio_priv(indio_dev);

	return data->ev_enable_state;
@@ -963,6 +961,7 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev,
	u16 buffer[BMC150_ACCEL_FIFO_LENGTH * 3];
	int64_t tstamp;
	uint64_t sample_period;

	ret = i2c_smbus_read_byte_data(data->client,
				       BMC150_ACCEL_REG_FIFO_STATUS);
	if (ret < 0) {
@@ -1314,26 +1313,32 @@ static int bmc150_accel_handle_roc_event(struct iio_dev *indio_dev)
		dir = IIO_EV_DIR_RISING;

	if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X)
		iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL,
		iio_push_event(indio_dev,
			       IIO_MOD_EVENT_CODE(IIO_ACCEL,
						  0,
						  IIO_MOD_X,
						  IIO_EV_TYPE_ROC,
						  dir),
			       data->timestamp);

	if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y)
		iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL,
		iio_push_event(indio_dev,
			       IIO_MOD_EVENT_CODE(IIO_ACCEL,
						  0,
						  IIO_MOD_Y,
						  IIO_EV_TYPE_ROC,
						  dir),
			       data->timestamp);

	if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z)
		iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL,
		iio_push_event(indio_dev,
			       IIO_MOD_EVENT_CODE(IIO_ACCEL,
						  0,
						  IIO_MOD_Z,
						  IIO_EV_TYPE_ROC,
						  dir),
			       data->timestamp);

	return ret;
}

@@ -1365,7 +1370,9 @@ static irqreturn_t bmc150_accel_irq_thread_handler(int irq, void *private)
					BMC150_ACCEL_INT_MODE_LATCH_INT |
					BMC150_ACCEL_INT_MODE_LATCH_RESET);
		if (ret)
			dev_err(&data->client->dev, "Error writing reg_int_rst_latch\n");
			dev_err(&data->client->dev,
				"Error writing reg_int_rst_latch\n");

		ret = IRQ_HANDLED;
	} else {
		ret = IRQ_NONE;
+0 −3
Original line number Diff line number Diff line
@@ -658,10 +658,8 @@ static int kxcjk1013_set_scale(struct kxcjk1013_data *data, int val)
	int ret, i;
	enum kxcjk1013_mode store_mode;


	for (i = 0; i < ARRAY_SIZE(KXCJK1013_scale_table); ++i) {
		if (KXCJK1013_scale_table[i].scale == val) {

			ret = kxcjk1013_get_mode(data, &store_mode);
			if (ret < 0)
				return ret;
@@ -820,7 +818,6 @@ static int kxcjk1013_read_event_config(struct iio_dev *indio_dev,
					  enum iio_event_type type,
					  enum iio_event_direction dir)
{

	struct kxcjk1013_data *data = iio_priv(indio_dev);

	return data->ev_enable_state;
+16 −19
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ EXPORT_SYMBOL(mma9551_read_status_word);
 * @client:	I2C client
 * @app_id:	Application ID
 * @reg:	Application register
 * @len:	Length of array to read in bytes
 * @len:	Length of array to read (in words)
 * @buf:	Array of words to read
 *
 * Read multiple configuration registers (word-sized registers).
@@ -388,20 +388,19 @@ int mma9551_read_config_words(struct i2c_client *client, u8 app_id,
			      u16 reg, u8 len, u16 *buf)
{
	int ret, i;
	int len_words = len / sizeof(u16);
	__be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2];

	if (len_words > ARRAY_SIZE(be_buf)) {
	if (len > ARRAY_SIZE(be_buf)) {
		dev_err(&client->dev, "Invalid buffer size %d\n", len);
		return -EINVAL;
	}

	ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_CONFIG,
			       reg, NULL, 0, (u8 *) be_buf, len);
			       reg, NULL, 0, (u8 *)be_buf, len * sizeof(u16));
	if (ret < 0)
		return ret;

	for (i = 0; i < len_words; i++)
	for (i = 0; i < len; i++)
		buf[i] = be16_to_cpu(be_buf[i]);

	return 0;
@@ -413,7 +412,7 @@ EXPORT_SYMBOL(mma9551_read_config_words);
 * @client:	I2C client
 * @app_id:	Application ID
 * @reg:	Application register
 * @len:	Length of array to read in bytes
 * @len:	Length of array to read (in words)
 * @buf:	Array of words to read
 *
 * Read multiple status registers (word-sized registers).
@@ -428,20 +427,19 @@ int mma9551_read_status_words(struct i2c_client *client, u8 app_id,
			      u16 reg, u8 len, u16 *buf)
{
	int ret, i;
	int len_words = len / sizeof(u16);
	__be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2];

	if (len_words > ARRAY_SIZE(be_buf)) {
	if (len > ARRAY_SIZE(be_buf)) {
		dev_err(&client->dev, "Invalid buffer size %d\n", len);
		return -EINVAL;
	}

	ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_STATUS,
			       reg, NULL, 0, (u8 *) be_buf, len);
			       reg, NULL, 0, (u8 *)be_buf, len * sizeof(u16));
	if (ret < 0)
		return ret;

	for (i = 0; i < len_words; i++)
	for (i = 0; i < len; i++)
		buf[i] = be16_to_cpu(be_buf[i]);

	return 0;
@@ -453,7 +451,7 @@ EXPORT_SYMBOL(mma9551_read_status_words);
 * @client:	I2C client
 * @app_id:	Application ID
 * @reg:	Application register
 * @len:	Length of array to write in bytes
 * @len:	Length of array to write (in words)
 * @buf:	Array of words to write
 *
 * Write multiple configuration registers (word-sized registers).
@@ -468,19 +466,18 @@ int mma9551_write_config_words(struct i2c_client *client, u8 app_id,
			       u16 reg, u8 len, u16 *buf)
{
	int i;
	int len_words = len / sizeof(u16);
	__be16 be_buf[(MMA9551_MAX_MAILBOX_DATA_REGS - 1) / 2];

	if (len_words > ARRAY_SIZE(be_buf)) {
	if (len > ARRAY_SIZE(be_buf)) {
		dev_err(&client->dev, "Invalid buffer size %d\n", len);
		return -EINVAL;
	}

	for (i = 0; i < len_words; i++)
	for (i = 0; i < len; i++)
		be_buf[i] = cpu_to_be16(buf[i]);

	return mma9551_transfer(client, app_id, MMA9551_CMD_WRITE_CONFIG,
				reg, (u8 *) be_buf, len, NULL, 0);
				reg, (u8 *)be_buf, len * sizeof(u16), NULL, 0);
}
EXPORT_SYMBOL(mma9551_write_config_words);

Loading