Commit b0de415a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are a number of iio and staging driver fixes for reported issues
  for 4.2-rc4.

  All have been in linux-next for a while with no problems"

* tag 'staging-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (34 commits)
  iio:light:stk3310: make endianness independent of host
  iio:light:stk3310: move device register to end of probe
  iio: mma8452: use iio event type IIO_EV_TYPE_MAG
  iio: mcp320x: Fix NULL pointer dereference
  iio: adc: vf610: fix the adc register read fail issue
  iio: mlx96014: Replace offset sign
  iio: magnetometer: mmc35240: fix SET/RESET sequence
  iio: magnetometer: mmc35240: Fix SET/RESET mask
  iio: magnetometer: mmc35240: Fix crash in pm suspend
  iio:magnetometer:bmc150_magn: output intended variable
  iio:magnetometer:bmc150_magn: add regmap dependency
  staging: vt6656: check ieee80211_bss_conf bssid not NULL
  staging: vt6655: check ieee80211_bss_conf bssid not NULL
  iio: tmp006: Check channel info on write
  iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able()
  iio:light:ltr501: fix regmap dependency
  iio:light:ltr501: fix variable in ltr501_init
  iio: sx9500: fix bug in compensation code
  iio: sx9500: rework error handling of raw readings
  iio: magnetometer: mmc35240: fix available sampling frequencies
  ...
parents e433b656 00243b1d
...@@ -557,21 +557,21 @@ static void mma8452_transient_interrupt(struct iio_dev *indio_dev) ...@@ -557,21 +557,21 @@ static void mma8452_transient_interrupt(struct iio_dev *indio_dev)
if (src & MMA8452_TRANSIENT_SRC_XTRANSE) if (src & MMA8452_TRANSIENT_SRC_XTRANSE)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X, IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_MAG,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
ts); ts);
if (src & MMA8452_TRANSIENT_SRC_YTRANSE) if (src & MMA8452_TRANSIENT_SRC_YTRANSE)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Y, IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Y,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_MAG,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
ts); ts);
if (src & MMA8452_TRANSIENT_SRC_ZTRANSE) if (src & MMA8452_TRANSIENT_SRC_ZTRANSE)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Z, IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Z,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_MAG,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
ts); ts);
} }
...@@ -644,7 +644,7 @@ static int mma8452_reg_access_dbg(struct iio_dev *indio_dev, ...@@ -644,7 +644,7 @@ static int mma8452_reg_access_dbg(struct iio_dev *indio_dev,
static const struct iio_event_spec mma8452_transient_event[] = { static const struct iio_event_spec mma8452_transient_event[] = {
{ {
.type = IIO_EV_TYPE_THRESH, .type = IIO_EV_TYPE_MAG,
.dir = IIO_EV_DIR_RISING, .dir = IIO_EV_DIR_RISING,
.mask_separate = BIT(IIO_EV_INFO_ENABLE), .mask_separate = BIT(IIO_EV_INFO_ENABLE),
.mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |
......
...@@ -299,6 +299,8 @@ static int mcp320x_probe(struct spi_device *spi) ...@@ -299,6 +299,8 @@ static int mcp320x_probe(struct spi_device *spi)
indio_dev->channels = chip_info->channels; indio_dev->channels = chip_info->channels;
indio_dev->num_channels = chip_info->num_channels; indio_dev->num_channels = chip_info->num_channels;
adc->chip_info = chip_info;
adc->transfer[0].tx_buf = &adc->tx_buf; adc->transfer[0].tx_buf = &adc->tx_buf;
adc->transfer[0].len = sizeof(adc->tx_buf); adc->transfer[0].len = sizeof(adc->tx_buf);
adc->transfer[1].rx_buf = adc->rx_buf; adc->transfer[1].rx_buf = adc->rx_buf;
......
...@@ -635,7 +635,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev, ...@@ -635,7 +635,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev,
struct vf610_adc *info = iio_priv(indio_dev); struct vf610_adc *info = iio_priv(indio_dev);
if ((readval == NULL) || if ((readval == NULL) ||
(!(reg % 4) || (reg > VF610_REG_ADC_PCTL))) ((reg % 4) || (reg > VF610_REG_ADC_PCTL)))
return -EINVAL; return -EINVAL;
*readval = readl(info->regs + reg); *readval = readl(info->regs + reg);
......
...@@ -200,7 +200,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev, ...@@ -200,7 +200,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
int *val, int *val2) int *val, int *val2)
{ {
u8 reg; u8 reg;
u16 buf; __be16 buf;
int ret; int ret;
struct stk3310_data *data = iio_priv(indio_dev); struct stk3310_data *data = iio_priv(indio_dev);
...@@ -222,7 +222,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev, ...@@ -222,7 +222,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
dev_err(&data->client->dev, "register read failed\n"); dev_err(&data->client->dev, "register read failed\n");
return ret; return ret;
} }
*val = swab16(buf); *val = be16_to_cpu(buf);
return IIO_VAL_INT; return IIO_VAL_INT;
} }
...@@ -235,7 +235,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev, ...@@ -235,7 +235,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
int val, int val2) int val, int val2)
{ {
u8 reg; u8 reg;
u16 buf; __be16 buf;
int ret; int ret;
unsigned int index; unsigned int index;
struct stk3310_data *data = iio_priv(indio_dev); struct stk3310_data *data = iio_priv(indio_dev);
...@@ -252,7 +252,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev, ...@@ -252,7 +252,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
else else
return -EINVAL; return -EINVAL;
buf = swab16(val); buf = cpu_to_be16(val);
ret = regmap_bulk_write(data->regmap, reg, &buf, 2); ret = regmap_bulk_write(data->regmap, reg, &buf, 2);
if (ret < 0) if (ret < 0)
dev_err(&client->dev, "failed to set PS threshold!\n"); dev_err(&client->dev, "failed to set PS threshold!\n");
...@@ -301,7 +301,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev, ...@@ -301,7 +301,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
int *val, int *val2, long mask) int *val, int *val2, long mask)
{ {
u8 reg; u8 reg;
u16 buf; __be16 buf;
int ret; int ret;
unsigned int index; unsigned int index;
struct stk3310_data *data = iio_priv(indio_dev); struct stk3310_data *data = iio_priv(indio_dev);
...@@ -322,7 +322,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev, ...@@ -322,7 +322,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
return ret; return ret;
} }
*val = swab16(buf); *val = be16_to_cpu(buf);
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_INT_TIME: case IIO_CHAN_INFO_INT_TIME:
...@@ -608,13 +608,7 @@ static int stk3310_probe(struct i2c_client *client, ...@@ -608,13 +608,7 @@ static int stk3310_probe(struct i2c_client *client,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = iio_device_register(indio_dev); if (client->irq < 0)
if (ret < 0) {
dev_err(&client->dev, "device_register failed\n");
stk3310_set_state(data, STK3310_STATE_STANDBY);
}
if (client->irq <= 0)
client->irq = stk3310_gpio_probe(client); client->irq = stk3310_gpio_probe(client);
if (client->irq >= 0) { if (client->irq >= 0) {
...@@ -629,6 +623,12 @@ static int stk3310_probe(struct i2c_client *client, ...@@ -629,6 +623,12 @@ static int stk3310_probe(struct i2c_client *client,
client->irq); client->irq);
} }
ret = iio_device_register(indio_dev);
if (ret < 0) {
dev_err(&client->dev, "device_register failed\n");
stk3310_set_state(data, STK3310_STATE_STANDBY);
}
return ret; return ret;
} }
......
...@@ -90,6 +90,7 @@ config IIO_ST_MAGN_SPI_3AXIS ...@@ -90,6 +90,7 @@ config IIO_ST_MAGN_SPI_3AXIS
config BMC150_MAGN config BMC150_MAGN
tristate "Bosch BMC150 Magnetometer Driver" tristate "Bosch BMC150 Magnetometer Driver"
depends on I2C depends on I2C
select REGMAP_I2C
select IIO_BUFFER select IIO_BUFFER
select IIO_TRIGGERED_BUFFER select IIO_TRIGGERED_BUFFER
help help
......
...@@ -706,11 +706,11 @@ static int bmc150_magn_init(struct bmc150_magn_data *data) ...@@ -706,11 +706,11 @@ static int bmc150_magn_init(struct bmc150_magn_data *data)
goto err_poweroff; goto err_poweroff;
} }
if (chip_id != BMC150_MAGN_CHIP_ID_VAL) { if (chip_id != BMC150_MAGN_CHIP_ID_VAL) {
dev_err(&data->client->dev, "Invalid chip id 0x%x\n", ret); dev_err(&data->client->dev, "Invalid chip id 0x%x\n", chip_id);
ret = -ENODEV; ret = -ENODEV;
goto err_poweroff; goto err_poweroff;
} }
dev_dbg(&data->client->dev, "Chip id %x\n", ret); dev_dbg(&data->client->dev, "Chip id %x\n", chip_id);
preset = bmc150_magn_presets_table[BMC150_MAGN_DEFAULT_PRESET]; preset = bmc150_magn_presets_table[BMC150_MAGN_DEFAULT_PRESET];
ret = bmc150_magn_set_odr(data, preset.odr); ret = bmc150_magn_set_odr(data, preset.odr);
......
...@@ -202,8 +202,8 @@ static int mmc35240_hw_set(struct mmc35240_data *data, bool set) ...@@ -202,8 +202,8 @@ static int mmc35240_hw_set(struct mmc35240_data *data, bool set)
coil_bit = MMC35240_CTRL0_RESET_BIT; coil_bit = MMC35240_CTRL0_RESET_BIT;
return regmap_update_bits(data->regmap, MMC35240_REG_CTRL0, return regmap_update_bits(data->regmap, MMC35240_REG_CTRL0,
MMC35240_CTRL0_REFILL_BIT, coil_bit, coil_bit);
coil_bit);
} }
static int mmc35240_init(struct mmc35240_data *data) static int mmc35240_init(struct mmc35240_data *data)
...@@ -222,14 +222,15 @@ static int mmc35240_init(struct mmc35240_data *data) ...@@ -222,14 +222,15 @@ static int mmc35240_init(struct mmc35240_data *data)
/* /*
* make sure we restore sensor characteristics, by doing * make sure we restore sensor characteristics, by doing
* a RESET/SET sequence * a SET/RESET sequence, the axis polarity being naturally
* aligned after RESET
*/ */
ret = mmc35240_hw_set(data, false); ret = mmc35240_hw_set(data, true);
if (ret < 0) if (ret < 0)
return ret; return ret;
usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1); usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1);
ret = mmc35240_hw_set(data, true); ret = mmc35240_hw_set(data, false);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -503,6 +504,7 @@ static int mmc35240_probe(struct i2c_client *client, ...@@ -503,6 +504,7 @@ static int mmc35240_probe(struct i2c_client *client,
} }
data = iio_priv(indio_dev); data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
data->client = client; data->client = client;
data->regmap = regmap; data->regmap = regmap;
data->res = MMC35240_16_BITS_SLOW; data->res = MMC35240_16_BITS_SLOW;
......
...@@ -204,7 +204,7 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev, ...@@ -204,7 +204,7 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
*val = ret; *val = ret;
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 13657; *val = -13657;
*val2 = 500000; *val2 = 500000;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment