Skip to content

Commit 3bd1482

Browse files
committed
Merge tag 'staging-5.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO fixes from Greg KH: "Here are a number of small staging and IIO driver fixes for 5.6-rc7 Nothing major here, just resolutions for some reported problems: - iio bugfixes for a number of different drivers - greybus loopback_test fixes - wfx driver fixes All of these have been in linux-next with no reported issues" * tag 'staging-5.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: rtl8188eu: Add device id for MERCUSYS MW150US v2 staging: greybus: loopback_test: fix potential path truncations staging: greybus: loopback_test: fix potential path truncation staging: greybus: loopback_test: fix poll-mask build breakage staging: wfx: fix RCU usage between hif_join() and ieee80211_bss_get_ie() staging: wfx: fix RCU usage in wfx_join_finalize() staging: wfx: make warning about pending frame less scary staging: wfx: fix lines ending with a comma instead of a semicolon staging: wfx: fix warning about freeing in-use mutex during device unregister staging/speakup: fix get_word non-space look-ahead iio: ping: set pa_laser_ping_cfg in of_ping_match iio: chemical: sps30: fix missing triggered buffer dependency iio: st_sensors: remap SMO8840 to LIS2DH12 iio: light: vcnl4000: update sampling periods for vcnl4040 iio: light: vcnl4000: update sampling periods for vcnl4200 iio: accel: adxl372: Set iio_chan BE iio: magnetometer: ak8974: Fix negative raw values in sysfs iio: trigger: stm32-timer: disable master mode when stopping iio: adc: stm32-dfsdm: fix sleep in atomic context iio: adc: at91-sama5d2_adc: fix differential channels in triggered mode
2 parents b07c2e7 + 14800df commit 3bd1482

File tree

16 files changed

+95
-79
lines changed

16 files changed

+95
-79
lines changed

drivers/iio/accel/adxl372.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ static const struct adxl372_axis_lookup adxl372_axis_lookup_table[] = {
237237
.realbits = 12, \
238238
.storagebits = 16, \
239239
.shift = 4, \
240+
.endianness = IIO_BE, \
240241
}, \
241242
}
242243

drivers/iio/accel/st_accel_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ MODULE_DEVICE_TABLE(of, st_accel_of_match);
110110

111111
#ifdef CONFIG_ACPI
112112
static const struct acpi_device_id st_accel_acpi_match[] = {
113-
{"SMO8840", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME},
113+
{"SMO8840", (kernel_ulong_t)LIS2DH12_ACCEL_DEV_NAME},
114114
{"SMO8A90", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME},
115115
{ },
116116
};

drivers/iio/adc/at91-sama5d2_adc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
723723

724724
for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) {
725725
struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit);
726+
u32 cor;
726727

727728
if (!chan)
728729
continue;
@@ -731,6 +732,20 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
731732
chan->type == IIO_PRESSURE)
732733
continue;
733734

735+
if (state) {
736+
cor = at91_adc_readl(st, AT91_SAMA5D2_COR);
737+
738+
if (chan->differential)
739+
cor |= (BIT(chan->channel) |
740+
BIT(chan->channel2)) <<
741+
AT91_SAMA5D2_COR_DIFF_OFFSET;
742+
else
743+
cor &= ~(BIT(chan->channel) <<
744+
AT91_SAMA5D2_COR_DIFF_OFFSET);
745+
746+
at91_adc_writel(st, AT91_SAMA5D2_COR, cor);
747+
}
748+
734749
if (state) {
735750
at91_adc_writel(st, AT91_SAMA5D2_CHER,
736751
BIT(chan->channel));

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -842,43 +842,13 @@ static inline void stm32_dfsdm_process_data(struct stm32_dfsdm_adc *adc,
842842
}
843843
}
844844

845-
static irqreturn_t stm32_dfsdm_adc_trigger_handler(int irq, void *p)
846-
{
847-
struct iio_poll_func *pf = p;
848-
struct iio_dev *indio_dev = pf->indio_dev;
849-
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
850-
int available = stm32_dfsdm_adc_dma_residue(adc);
851-
852-
while (available >= indio_dev->scan_bytes) {
853-
s32 *buffer = (s32 *)&adc->rx_buf[adc->bufi];
854-
855-
stm32_dfsdm_process_data(adc, buffer);
856-
857-
iio_push_to_buffers_with_timestamp(indio_dev, buffer,
858-
pf->timestamp);
859-
available -= indio_dev->scan_bytes;
860-
adc->bufi += indio_dev->scan_bytes;
861-
if (adc->bufi >= adc->buf_sz)
862-
adc->bufi = 0;
863-
}
864-
865-
iio_trigger_notify_done(indio_dev->trig);
866-
867-
return IRQ_HANDLED;
868-
}
869-
870845
static void stm32_dfsdm_dma_buffer_done(void *data)
871846
{
872847
struct iio_dev *indio_dev = data;
873848
struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
874849
int available = stm32_dfsdm_adc_dma_residue(adc);
875850
size_t old_pos;
876851

877-
if (indio_dev->currentmode & INDIO_BUFFER_TRIGGERED) {
878-
iio_trigger_poll_chained(indio_dev->trig);
879-
return;
880-
}
881-
882852
/*
883853
* FIXME: In Kernel interface does not support cyclic DMA buffer,and
884854
* offers only an interface to push data samples per samples.
@@ -906,7 +876,15 @@ static void stm32_dfsdm_dma_buffer_done(void *data)
906876
adc->bufi = 0;
907877
old_pos = 0;
908878
}
909-
/* regular iio buffer without trigger */
879+
/*
880+
* In DMA mode the trigger services of IIO are not used
881+
* (e.g. no call to iio_trigger_poll).
882+
* Calling irq handler associated to the hardware trigger is not
883+
* relevant as the conversions have already been done. Data
884+
* transfers are performed directly in DMA callback instead.
885+
* This implementation avoids to call trigger irq handler that
886+
* may sleep, in an atomic context (DMA irq handler context).
887+
*/
910888
if (adc->dev_data->type == DFSDM_IIO)
911889
iio_push_to_buffers(indio_dev, buffer);
912890
}
@@ -1536,8 +1514,7 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev)
15361514
}
15371515

15381516
ret = iio_triggered_buffer_setup(indio_dev,
1539-
&iio_pollfunc_store_time,
1540-
&stm32_dfsdm_adc_trigger_handler,
1517+
&iio_pollfunc_store_time, NULL,
15411518
&stm32_dfsdm_buffer_setup_ops);
15421519
if (ret) {
15431520
stm32_dfsdm_dma_release(indio_dev);

drivers/iio/chemical/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ config SPS30
9191
tristate "SPS30 particulate matter sensor"
9292
depends on I2C
9393
select CRC8
94+
select IIO_BUFFER
95+
select IIO_TRIGGERED_BUFFER
9496
help
9597
Say Y here to build support for the Sensirion SPS30 particulate
9698
matter sensor.

drivers/iio/light/vcnl4000.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,17 @@ static int vcnl4200_init(struct vcnl4000_data *data)
167167
data->vcnl4200_ps.reg = VCNL4200_PS_DATA;
168168
switch (id) {
169169
case VCNL4200_PROD_ID:
170-
/* Integration time is 50ms, but the experiments */
171-
/* show 54ms in total. */
172-
data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000);
173-
data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000);
170+
/* Default wait time is 50ms, add 20% tolerance. */
171+
data->vcnl4200_al.sampling_rate = ktime_set(0, 60000 * 1000);
172+
/* Default wait time is 4.8ms, add 20% tolerance. */
173+
data->vcnl4200_ps.sampling_rate = ktime_set(0, 5760 * 1000);
174174
data->al_scale = 24000;
175175
break;
176176
case VCNL4040_PROD_ID:
177-
/* Integration time is 80ms, add 10ms. */
178-
data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
179-
data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
177+
/* Default wait time is 80ms, add 20% tolerance. */
178+
data->vcnl4200_al.sampling_rate = ktime_set(0, 96000 * 1000);
179+
/* Default wait time is 5ms, add 20% tolerance. */
180+
data->vcnl4200_ps.sampling_rate = ktime_set(0, 6000 * 1000);
180181
data->al_scale = 120000;
181182
break;
182183
}

drivers/iio/magnetometer/ak8974.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ static int ak8974_read_raw(struct iio_dev *indio_dev,
564564
* We read all axes and discard all but one, for optimized
565565
* reading, use the triggered buffer.
566566
*/
567-
*val = le16_to_cpu(hw_values[chan->address]);
567+
*val = (s16)le16_to_cpu(hw_values[chan->address]);
568568

569569
ret = IIO_VAL_INT;
570570
}

drivers/iio/proximity/ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static const struct iio_chan_spec ping_chan_spec[] = {
269269

270270
static const struct of_device_id of_ping_match[] = {
271271
{ .compatible = "parallax,ping", .data = &pa_ping_cfg},
272-
{ .compatible = "parallax,laserping", .data = &pa_ping_cfg},
272+
{ .compatible = "parallax,laserping", .data = &pa_laser_ping_cfg},
273273
{},
274274
};
275275

drivers/iio/trigger/stm32-timer-trigger.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv,
161161
return 0;
162162
}
163163

164-
static void stm32_timer_stop(struct stm32_timer_trigger *priv)
164+
static void stm32_timer_stop(struct stm32_timer_trigger *priv,
165+
struct iio_trigger *trig)
165166
{
166167
u32 ccer, cr1;
167168

@@ -179,6 +180,12 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv)
179180
regmap_write(priv->regmap, TIM_PSC, 0);
180181
regmap_write(priv->regmap, TIM_ARR, 0);
181182

183+
/* Force disable master mode */
184+
if (stm32_timer_is_trgo2_name(trig->name))
185+
regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0);
186+
else
187+
regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS, 0);
188+
182189
/* Make sure that registers are updated */
183190
regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG);
184191
}
@@ -197,7 +204,7 @@ static ssize_t stm32_tt_store_frequency(struct device *dev,
197204
return ret;
198205

199206
if (freq == 0) {
200-
stm32_timer_stop(priv);
207+
stm32_timer_stop(priv, trig);
201208
} else {
202209
ret = stm32_timer_start(priv, trig, freq);
203210
if (ret)

drivers/staging/greybus/tools/loopback_test.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <signal.h>
2020

2121
#define MAX_NUM_DEVICES 10
22+
#define MAX_SYSFS_PREFIX 0x80
2223
#define MAX_SYSFS_PATH 0x200
2324
#define CSV_MAX_LINE 0x1000
2425
#define SYSFS_MAX_INT 0x20
@@ -67,7 +68,7 @@ struct loopback_results {
6768
};
6869

6970
struct loopback_device {
70-
char name[MAX_SYSFS_PATH];
71+
char name[MAX_STR_LEN];
7172
char sysfs_entry[MAX_SYSFS_PATH];
7273
char debugfs_entry[MAX_SYSFS_PATH];
7374
struct loopback_results results;
@@ -93,8 +94,8 @@ struct loopback_test {
9394
int stop_all;
9495
int poll_count;
9596
char test_name[MAX_STR_LEN];
96-
char sysfs_prefix[MAX_SYSFS_PATH];
97-
char debugfs_prefix[MAX_SYSFS_PATH];
97+
char sysfs_prefix[MAX_SYSFS_PREFIX];
98+
char debugfs_prefix[MAX_SYSFS_PREFIX];
9899
struct timespec poll_timeout;
99100
struct loopback_device devices[MAX_NUM_DEVICES];
100101
struct loopback_results aggregate_results;
@@ -637,7 +638,7 @@ int find_loopback_devices(struct loopback_test *t)
637638
static int open_poll_files(struct loopback_test *t)
638639
{
639640
struct loopback_device *dev;
640-
char buf[MAX_STR_LEN];
641+
char buf[MAX_SYSFS_PATH + MAX_STR_LEN];
641642
char dummy;
642643
int fds_idx = 0;
643644
int i;
@@ -655,7 +656,7 @@ static int open_poll_files(struct loopback_test *t)
655656
goto err;
656657
}
657658
read(t->fds[fds_idx].fd, &dummy, 1);
658-
t->fds[fds_idx].events = EPOLLERR|EPOLLPRI;
659+
t->fds[fds_idx].events = POLLERR | POLLPRI;
659660
t->fds[fds_idx].revents = 0;
660661
fds_idx++;
661662
}
@@ -748,7 +749,7 @@ static int wait_for_complete(struct loopback_test *t)
748749
}
749750

750751
for (i = 0; i < t->poll_count; i++) {
751-
if (t->fds[i].revents & EPOLLPRI) {
752+
if (t->fds[i].revents & POLLPRI) {
752753
/* Dummy read to clear the event */
753754
read(t->fds[i].fd, &dummy, 1);
754755
number_of_events++;
@@ -907,10 +908,10 @@ int main(int argc, char *argv[])
907908
t.iteration_max = atoi(optarg);
908909
break;
909910
case 'S':
910-
snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
911+
snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg);
911912
break;
912913
case 'D':
913-
snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
914+
snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg);
914915
break;
915916
case 'm':
916917
t.mask = atol(optarg);
@@ -961,10 +962,10 @@ int main(int argc, char *argv[])
961962
}
962963

963964
if (!strcmp(t.sysfs_prefix, ""))
964-
snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix);
965+
snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix);
965966

966967
if (!strcmp(t.debugfs_prefix, ""))
967-
snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix);
968+
snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", debugfs_prefix);
968969

969970
ret = find_loopback_devices(&t);
970971
if (ret)

0 commit comments

Comments
 (0)