Skip to content

Commit 6ea17ed

Browse files
committed
Merge tag 'staging-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO fixes from Greg KH: "Here are some staging and IIO driver fixes for 4.10-rc3. Most of these are minor IIO fixes of reported issues, along with one network driver fix to resolve an issue. And a MAINTAINERS update with a new mailing list. All of these, except the MAINTAINERS file update, have been in linux-next with no reported issues (the MAINTAINERS patch happened on Friday...)" * tag 'staging-4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: MAINTAINERS: add greybus subsystem mailing list staging: octeon: Call SET_NETDEV_DEV() iio: accel: st_accel: fix LIS3LV02 reading and scaling iio: common: st_sensors: fix channel data parsing iio: max44000: correct value in illuminance_integration_time_available iio: adc: TI_AM335X_ADC should depend on HAS_DMA iio: bmi160: Fix time needed to sleep after command execution iio: 104-quad-8: Fix active level mismatch for the preset enable option iio: 104-quad-8: Fix off-by-one errors when addressing IOR iio: 104-quad-8: Fix index control configuration
2 parents ea07b86 + 01d0f71 commit 6ea17ed

File tree

10 files changed

+56
-30
lines changed

10 files changed

+56
-30
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5507,6 +5507,7 @@ M: Alex Elder <elder@kernel.org>
55075507
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
55085508
S: Maintained
55095509
F: drivers/staging/greybus/
5510+
L: greybus-dev@lists.linaro.org
55105511

55115512
GREYBUS AUDIO PROTOCOLS DRIVERS
55125513
M: Vaibhav Agarwal <vaibhav.sr@gmail.com>

drivers/iio/accel/st_accel_core.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,19 +353,27 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
353353
[0] = {
354354
.num = ST_ACCEL_FS_AVL_2G,
355355
.value = 0x00,
356-
.gain = IIO_G_TO_M_S_2(1024),
356+
.gain = IIO_G_TO_M_S_2(1000),
357357
},
358358
[1] = {
359359
.num = ST_ACCEL_FS_AVL_6G,
360360
.value = 0x01,
361-
.gain = IIO_G_TO_M_S_2(340),
361+
.gain = IIO_G_TO_M_S_2(3000),
362362
},
363363
},
364364
},
365365
.bdu = {
366366
.addr = 0x21,
367367
.mask = 0x40,
368368
},
369+
/*
370+
* Data Alignment Setting - needs to be set to get
371+
* left-justified data like all other sensors.
372+
*/
373+
.das = {
374+
.addr = 0x21,
375+
.mask = 0x01,
376+
},
369377
.drdy_irq = {
370378
.addr = 0x21,
371379
.mask_int1 = 0x04,

drivers/iio/adc/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ config TI_ADS8688
561561

562562
config TI_AM335X_ADC
563563
tristate "TI's AM335X ADC driver"
564-
depends on MFD_TI_AM335X_TSCADC
564+
depends on MFD_TI_AM335X_TSCADC && HAS_DMA
565565
select IIO_BUFFER
566566
select IIO_KFIFO_BUF
567567
help

drivers/iio/common/st_sensors/st_sensors_buffer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ static int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
3030

3131
for_each_set_bit(i, indio_dev->active_scan_mask, num_data_channels) {
3232
const struct iio_chan_spec *channel = &indio_dev->channels[i];
33-
unsigned int bytes_to_read = channel->scan_type.realbits >> 3;
33+
unsigned int bytes_to_read =
34+
DIV_ROUND_UP(channel->scan_type.realbits +
35+
channel->scan_type.shift, 8);
3436
unsigned int storage_bytes =
3537
channel->scan_type.storagebits >> 3;
3638

drivers/iio/common/st_sensors/st_sensors_core.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
401401
return err;
402402
}
403403

404+
/* set DAS */
405+
if (sdata->sensor_settings->das.addr) {
406+
err = st_sensors_write_data_with_mask(indio_dev,
407+
sdata->sensor_settings->das.addr,
408+
sdata->sensor_settings->das.mask, 1);
409+
if (err < 0)
410+
return err;
411+
}
412+
404413
if (sdata->int_pin_open_drain) {
405414
dev_info(&indio_dev->dev,
406415
"set interrupt line to open drain mode\n");
@@ -483,8 +492,10 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,
483492
int err;
484493
u8 *outdata;
485494
struct st_sensor_data *sdata = iio_priv(indio_dev);
486-
unsigned int byte_for_channel = ch->scan_type.realbits >> 3;
495+
unsigned int byte_for_channel;
487496

497+
byte_for_channel = DIV_ROUND_UP(ch->scan_type.realbits +
498+
ch->scan_type.shift, 8);
488499
outdata = kmalloc(byte_for_channel, GFP_KERNEL);
489500
if (!outdata)
490501
return -ENOMEM;

drivers/iio/counter/104-quad-8.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int quad8_write_raw(struct iio_dev *indio_dev,
153153
ior_cfg = val | priv->preset_enable[chan->channel] << 1;
154154

155155
/* Load I/O control configuration */
156-
outb(0x40 | ior_cfg, base_offset);
156+
outb(0x40 | ior_cfg, base_offset + 1);
157157

158158
return 0;
159159
case IIO_CHAN_INFO_SCALE:
@@ -233,15 +233,15 @@ static ssize_t quad8_read_set_to_preset_on_index(struct iio_dev *indio_dev,
233233
const struct quad8_iio *const priv = iio_priv(indio_dev);
234234

235235
return snprintf(buf, PAGE_SIZE, "%u\n",
236-
priv->preset_enable[chan->channel]);
236+
!priv->preset_enable[chan->channel]);
237237
}
238238

239239
static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev,
240240
uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
241241
size_t len)
242242
{
243243
struct quad8_iio *const priv = iio_priv(indio_dev);
244-
const int base_offset = priv->base + 2 * chan->channel;
244+
const int base_offset = priv->base + 2 * chan->channel + 1;
245245
bool preset_enable;
246246
int ret;
247247
unsigned int ior_cfg;
@@ -250,6 +250,9 @@ static ssize_t quad8_write_set_to_preset_on_index(struct iio_dev *indio_dev,
250250
if (ret)
251251
return ret;
252252

253+
/* Preset enable is active low in Input/Output Control register */
254+
preset_enable = !preset_enable;
255+
253256
priv->preset_enable[chan->channel] = preset_enable;
254257

255258
ior_cfg = priv->ab_enable[chan->channel] |
@@ -362,7 +365,7 @@ static int quad8_set_synchronous_mode(struct iio_dev *indio_dev,
362365
priv->synchronous_mode[chan->channel] = synchronous_mode;
363366

364367
/* Load Index Control configuration to Index Control Register */
365-
outb(0x40 | idr_cfg, base_offset);
368+
outb(0x60 | idr_cfg, base_offset);
366369

367370
return 0;
368371
}
@@ -444,7 +447,7 @@ static int quad8_set_index_polarity(struct iio_dev *indio_dev,
444447
priv->index_polarity[chan->channel] = index_polarity;
445448

446449
/* Load Index Control configuration to Index Control Register */
447-
outb(0x40 | idr_cfg, base_offset);
450+
outb(0x60 | idr_cfg, base_offset);
448451

449452
return 0;
450453
}

drivers/iio/imu/bmi160/bmi160_core.c

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,8 @@
6666

6767
#define BMI160_REG_DUMMY 0x7F
6868

69-
#define BMI160_ACCEL_PMU_MIN_USLEEP 3200
70-
#define BMI160_ACCEL_PMU_MAX_USLEEP 3800
71-
#define BMI160_GYRO_PMU_MIN_USLEEP 55000
72-
#define BMI160_GYRO_PMU_MAX_USLEEP 80000
69+
#define BMI160_ACCEL_PMU_MIN_USLEEP 3800
70+
#define BMI160_GYRO_PMU_MIN_USLEEP 80000
7371
#define BMI160_SOFTRESET_USLEEP 1000
7472

7573
#define BMI160_CHANNEL(_type, _axis, _index) { \
@@ -151,20 +149,9 @@ static struct bmi160_regs bmi160_regs[] = {
151149
},
152150
};
153151

154-
struct bmi160_pmu_time {
155-
unsigned long min;
156-
unsigned long max;
157-
};
158-
159-
static struct bmi160_pmu_time bmi160_pmu_time[] = {
160-
[BMI160_ACCEL] = {
161-
.min = BMI160_ACCEL_PMU_MIN_USLEEP,
162-
.max = BMI160_ACCEL_PMU_MAX_USLEEP
163-
},
164-
[BMI160_GYRO] = {
165-
.min = BMI160_GYRO_PMU_MIN_USLEEP,
166-
.max = BMI160_GYRO_PMU_MIN_USLEEP,
167-
},
152+
static unsigned long bmi160_pmu_time[] = {
153+
[BMI160_ACCEL] = BMI160_ACCEL_PMU_MIN_USLEEP,
154+
[BMI160_GYRO] = BMI160_GYRO_PMU_MIN_USLEEP,
168155
};
169156

170157
struct bmi160_scale {
@@ -289,7 +276,7 @@ int bmi160_set_mode(struct bmi160_data *data, enum bmi160_sensor_type t,
289276
if (ret < 0)
290277
return ret;
291278

292-
usleep_range(bmi160_pmu_time[t].min, bmi160_pmu_time[t].max);
279+
usleep_range(bmi160_pmu_time[t], bmi160_pmu_time[t] + 1000);
293280

294281
return 0;
295282
}

drivers/iio/light/max44000.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static const char max44000_int_time_avail_str[] =
113113
"0.100 "
114114
"0.025 "
115115
"0.00625 "
116-
"0.001625";
116+
"0.0015625";
117117

118118
/* Available scales (internal to ulux) with pretty manual alignment: */
119119
static const int max44000_scale_avail_ulux_array[] = {

drivers/staging/octeon/ethernet.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
770770
/* Initialize the device private structure. */
771771
struct octeon_ethernet *priv = netdev_priv(dev);
772772

773+
SET_NETDEV_DEV(dev, &pdev->dev);
773774
dev->netdev_ops = &cvm_oct_pow_netdev_ops;
774775
priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
775776
priv->port = CVMX_PIP_NUM_INPUT_PORTS;
@@ -816,6 +817,7 @@ static int cvm_oct_probe(struct platform_device *pdev)
816817
}
817818

818819
/* Initialize the device private structure. */
820+
SET_NETDEV_DEV(dev, &pdev->dev);
819821
priv = netdev_priv(dev);
820822
priv->netdev = dev;
821823
priv->of_node = cvm_oct_node_for_port(pip, interface,

include/linux/iio/common/st_sensors.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ struct st_sensor_bdu {
115115
u8 mask;
116116
};
117117

118+
/**
119+
* struct st_sensor_das - ST sensor device data alignment selection
120+
* @addr: address of the register.
121+
* @mask: mask to write the das flag for left alignment.
122+
*/
123+
struct st_sensor_das {
124+
u8 addr;
125+
u8 mask;
126+
};
127+
118128
/**
119129
* struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt
120130
* @addr: address of the register.
@@ -185,6 +195,7 @@ struct st_sensor_transfer_function {
185195
* @enable_axis: Enable one or more axis of the sensor.
186196
* @fs: Full scale register and full scale list available.
187197
* @bdu: Block data update register.
198+
* @das: Data Alignment Selection register.
188199
* @drdy_irq: Data ready register of the sensor.
189200
* @multi_read_bit: Use or not particular bit for [I2C/SPI] multi-read.
190201
* @bootime: samples to discard when sensor passing from power-down to power-up.
@@ -200,6 +211,7 @@ struct st_sensor_settings {
200211
struct st_sensor_axis enable_axis;
201212
struct st_sensor_fullscale fs;
202213
struct st_sensor_bdu bdu;
214+
struct st_sensor_das das;
203215
struct st_sensor_data_ready_irq drdy_irq;
204216
bool multi_read_bit;
205217
unsigned int bootime;

0 commit comments

Comments
 (0)