Skip to content

Commit 1d4345e

Browse files
committed
Merge tag 'staging-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO driver fixes from Greg KH: "Some small staging and IIO driver fixes: - MAINTAINERS changes for the move of the staging mailing list - comedi driver fixes to get request_irq() to work correctly - counter driver fixes for reported issues with iio devices - tiny iio driver fixes for reported issues. All of these have been in linux-next with no reported problems" * tag 'staging-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: vt665x: fix alignment constraints staging: comedi: cb_pcidas64: fix request_irq() warn staging: comedi: cb_pcidas: fix request_irq() warn MAINTAINERS: move the staging subsystem to lists.linux.dev MAINTAINERS: move some real subsystems off of the staging mailing list iio: gyro: mpu3050: Fix error handling in mpu3050_trigger_handler iio: hid-sensor-temperature: Fix issues of timestamp channel iio: hid-sensor-humidity: Fix alignment issue of timestamp channel counter: stm32-timer-cnt: fix ceiling miss-alignment with reload register counter: stm32-timer-cnt: fix ceiling write max value counter: stm32-timer-cnt: Report count function when SLAVE_MODE_DISABLED iio: adc: ab8500-gpadc: Fix off by 10 to 3 iio:adc:stm32-adc: Add HAS_IOMEM dependency iio: adis16400: Fix an error code in adis16400_initial_setup() iio: adc: adi-axi-adc: add proper Kconfig dependencies iio: adc: ad7949: fix wrong ADC result due to incorrect bit mask iio: hid-sensor-prox: Fix scale not correct issue iio:adc:qcom-spmi-vadc: add default scale to LR_MUX2_BAT_ID channel
2 parents 3001c35 + 2cafd46 commit 1d4345e

File tree

14 files changed

+75
-48
lines changed

14 files changed

+75
-48
lines changed

MAINTAINERS

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ M: Joel Fernandes <[email protected]>
11811181
M: Christian Brauner <[email protected]>
11821182
M: Hridya Valsaraju <[email protected]>
11831183
M: Suren Baghdasaryan <[email protected]>
1184-
1184+
11851185
S: Supported
11861186
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
11871187
F: drivers/android/
@@ -8116,7 +8116,6 @@ F: drivers/crypto/hisilicon/sec2/sec_main.c
81168116

81178117
HISILICON STAGING DRIVERS FOR HIKEY 960/970
81188118
M: Mauro Carvalho Chehab <[email protected]>
8119-
81208119
S: Maintained
81218120
F: drivers/staging/hikey9xx/
81228121

@@ -17040,7 +17039,7 @@ F: drivers/staging/vt665?/
1704017039

1704117040
STAGING SUBSYSTEM
1704217041
M: Greg Kroah-Hartman <[email protected]>
17043-
17042+
1704417043
S: Supported
1704517044
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
1704617045
F: drivers/staging/
@@ -19135,7 +19134,7 @@ VME SUBSYSTEM
1913519134
M: Martyn Welch <[email protected]>
1913619135
M: Manohar Vanga <[email protected]>
1913719136
M: Greg Kroah-Hartman <[email protected]>
19138-
19137+
1913919138
S: Maintained
1914019139
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
1914119140
F: Documentation/driver-api/vme.rst

drivers/counter/stm32-timer-cnt.c

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct stm32_timer_cnt {
3131
struct counter_device counter;
3232
struct regmap *regmap;
3333
struct clk *clk;
34-
u32 ceiling;
34+
u32 max_arr;
3535
bool enabled;
3636
struct stm32_timer_regs bak;
3737
};
@@ -44,13 +44,14 @@ struct stm32_timer_cnt {
4444
* @STM32_COUNT_ENCODER_MODE_3: counts on both TI1FP1 and TI2FP2 edges
4545
*/
4646
enum stm32_count_function {
47-
STM32_COUNT_SLAVE_MODE_DISABLED = -1,
47+
STM32_COUNT_SLAVE_MODE_DISABLED,
4848
STM32_COUNT_ENCODER_MODE_1,
4949
STM32_COUNT_ENCODER_MODE_2,
5050
STM32_COUNT_ENCODER_MODE_3,
5151
};
5252

5353
static enum counter_count_function stm32_count_functions[] = {
54+
[STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_COUNT_FUNCTION_INCREASE,
5455
[STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
5556
[STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
5657
[STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
@@ -73,8 +74,10 @@ static int stm32_count_write(struct counter_device *counter,
7374
const unsigned long val)
7475
{
7576
struct stm32_timer_cnt *const priv = counter->priv;
77+
u32 ceiling;
7678

77-
if (val > priv->ceiling)
79+
regmap_read(priv->regmap, TIM_ARR, &ceiling);
80+
if (val > ceiling)
7881
return -EINVAL;
7982

8083
return regmap_write(priv->regmap, TIM_CNT, val);
@@ -90,6 +93,9 @@ static int stm32_count_function_get(struct counter_device *counter,
9093
regmap_read(priv->regmap, TIM_SMCR, &smcr);
9194

9295
switch (smcr & TIM_SMCR_SMS) {
96+
case 0:
97+
*function = STM32_COUNT_SLAVE_MODE_DISABLED;
98+
return 0;
9399
case 1:
94100
*function = STM32_COUNT_ENCODER_MODE_1;
95101
return 0;
@@ -99,9 +105,9 @@ static int stm32_count_function_get(struct counter_device *counter,
99105
case 3:
100106
*function = STM32_COUNT_ENCODER_MODE_3;
101107
return 0;
108+
default:
109+
return -EINVAL;
102110
}
103-
104-
return -EINVAL;
105111
}
106112

107113
static int stm32_count_function_set(struct counter_device *counter,
@@ -112,6 +118,9 @@ static int stm32_count_function_set(struct counter_device *counter,
112118
u32 cr1, sms;
113119

114120
switch (function) {
121+
case STM32_COUNT_SLAVE_MODE_DISABLED:
122+
sms = 0;
123+
break;
115124
case STM32_COUNT_ENCODER_MODE_1:
116125
sms = 1;
117126
break;
@@ -122,19 +131,14 @@ static int stm32_count_function_set(struct counter_device *counter,
122131
sms = 3;
123132
break;
124133
default:
125-
sms = 0;
126-
break;
134+
return -EINVAL;
127135
}
128136

129137
/* Store enable status */
130138
regmap_read(priv->regmap, TIM_CR1, &cr1);
131139

132140
regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);
133141

134-
/* TIMx_ARR register shouldn't be buffered (ARPE=0) */
135-
regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
136-
regmap_write(priv->regmap, TIM_ARR, priv->ceiling);
137-
138142
regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms);
139143

140144
/* Make sure that registers are updated */
@@ -185,11 +189,13 @@ static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
185189
if (ret)
186190
return ret;
187191

192+
if (ceiling > priv->max_arr)
193+
return -ERANGE;
194+
188195
/* TIMx_ARR register shouldn't be buffered (ARPE=0) */
189196
regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
190197
regmap_write(priv->regmap, TIM_ARR, ceiling);
191198

192-
priv->ceiling = ceiling;
193199
return len;
194200
}
195201

@@ -274,31 +280,36 @@ static int stm32_action_get(struct counter_device *counter,
274280
size_t function;
275281
int err;
276282

277-
/* Default action mode (e.g. STM32_COUNT_SLAVE_MODE_DISABLED) */
278-
*action = STM32_SYNAPSE_ACTION_NONE;
279-
280283
err = stm32_count_function_get(counter, count, &function);
281284
if (err)
282-
return 0;
285+
return err;
283286

284287
switch (function) {
288+
case STM32_COUNT_SLAVE_MODE_DISABLED:
289+
/* counts on internal clock when CEN=1 */
290+
*action = STM32_SYNAPSE_ACTION_NONE;
291+
return 0;
285292
case STM32_COUNT_ENCODER_MODE_1:
286293
/* counts up/down on TI1FP1 edge depending on TI2FP2 level */
287294
if (synapse->signal->id == count->synapses[0].signal->id)
288295
*action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
289-
break;
296+
else
297+
*action = STM32_SYNAPSE_ACTION_NONE;
298+
return 0;
290299
case STM32_COUNT_ENCODER_MODE_2:
291300
/* counts up/down on TI2FP2 edge depending on TI1FP1 level */
292301
if (synapse->signal->id == count->synapses[1].signal->id)
293302
*action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
294-
break;
303+
else
304+
*action = STM32_SYNAPSE_ACTION_NONE;
305+
return 0;
295306
case STM32_COUNT_ENCODER_MODE_3:
296307
/* counts up/down on both TI1FP1 and TI2FP2 edges */
297308
*action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
298-
break;
309+
return 0;
310+
default:
311+
return -EINVAL;
299312
}
300-
301-
return 0;
302313
}
303314

304315
static const struct counter_ops stm32_timer_cnt_ops = {
@@ -359,7 +370,7 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev)
359370

360371
priv->regmap = ddata->regmap;
361372
priv->clk = ddata->clk;
362-
priv->ceiling = ddata->max_arr;
373+
priv->max_arr = ddata->max_arr;
363374

364375
priv->counter.name = dev_name(dev);
365376
priv->counter.parent = dev;

drivers/iio/adc/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ config ADI_AXI_ADC
266266
select IIO_BUFFER
267267
select IIO_BUFFER_HW_CONSUMER
268268
select IIO_BUFFER_DMAENGINE
269+
depends on HAS_IOMEM
270+
depends on OF
269271
help
270272
Say yes here to build support for Analog Devices Generic
271273
AXI ADC IP core. The IP core is used for interfacing with
@@ -923,6 +925,7 @@ config STM32_ADC_CORE
923925
depends on ARCH_STM32 || COMPILE_TEST
924926
depends on OF
925927
depends on REGULATOR
928+
depends on HAS_IOMEM
926929
select IIO_BUFFER
927930
select MFD_STM32_TIMERS
928931
select IIO_STM32_TIMER_TRIGGER

drivers/iio/adc/ab8500-gpadc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ static int ab8500_gpadc_read_raw(struct iio_dev *indio_dev,
918918
return processed;
919919

920920
/* Return millivolt or milliamps or millicentigrades */
921-
*val = processed * 1000;
921+
*val = processed;
922922
return IIO_VAL_INT;
923923
}
924924

drivers/iio/adc/ad7949.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
9191
int ret;
9292
int i;
9393
int bits_per_word = ad7949_adc->resolution;
94-
int mask = GENMASK(ad7949_adc->resolution, 0);
94+
int mask = GENMASK(ad7949_adc->resolution - 1, 0);
9595
struct spi_message msg;
9696
struct spi_transfer tx[] = {
9797
{

drivers/iio/adc/qcom-spmi-vadc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ static const struct vadc_channels vadc_chans[] = {
597597
VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
598598

599599
VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
600-
VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
600+
VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
601601
VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
602602
VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
603603
VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)

drivers/iio/gyro/mpu3050-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,8 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
551551
MPU3050_FIFO_R,
552552
&fifo_values[offset],
553553
toread);
554+
if (ret)
555+
goto out_trigger_unlock;
554556

555557
dev_dbg(mpu3050->dev,
556558
"%04x %04x %04x %04x %04x\n",

drivers/iio/humidity/hid-sensor-humidity.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
struct hid_humidity_state {
1616
struct hid_sensor_common common_attributes;
1717
struct hid_sensor_hub_attribute_info humidity_attr;
18-
s32 humidity_data;
18+
struct {
19+
s32 humidity_data;
20+
u64 timestamp __aligned(8);
21+
} scan;
1922
int scale_pre_decml;
2023
int scale_post_decml;
2124
int scale_precision;
@@ -125,9 +128,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
125128
struct hid_humidity_state *humid_st = iio_priv(indio_dev);
126129

127130
if (atomic_read(&humid_st->common_attributes.data_ready))
128-
iio_push_to_buffers_with_timestamp(indio_dev,
129-
&humid_st->humidity_data,
130-
iio_get_time_ns(indio_dev));
131+
iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
132+
iio_get_time_ns(indio_dev));
131133

132134
return 0;
133135
}
@@ -142,7 +144,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev,
142144

143145
switch (usage_id) {
144146
case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY:
145-
humid_st->humidity_data = *(s32 *)raw_data;
147+
humid_st->scan.humidity_data = *(s32 *)raw_data;
146148

147149
return 0;
148150
default:

drivers/iio/imu/adis16400.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)
462462
if (ret)
463463
goto err_ret;
464464

465-
ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
466-
if (ret != 1) {
465+
if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) {
467466
ret = -EINVAL;
468467
goto err_ret;
469468
}

drivers/iio/light/hid-sensor-prox.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ struct prox_state {
2323
struct hid_sensor_common common_attributes;
2424
struct hid_sensor_hub_attribute_info prox_attr;
2525
u32 human_presence;
26+
int scale_pre_decml;
27+
int scale_post_decml;
28+
int scale_precision;
2629
};
2730

2831
/* Channel definitions */
@@ -93,8 +96,9 @@ static int prox_read_raw(struct iio_dev *indio_dev,
9396
ret_type = IIO_VAL_INT;
9497
break;
9598
case IIO_CHAN_INFO_SCALE:
96-
*val = prox_state->prox_attr.units;
97-
ret_type = IIO_VAL_INT;
99+
*val = prox_state->scale_pre_decml;
100+
*val2 = prox_state->scale_post_decml;
101+
ret_type = prox_state->scale_precision;
98102
break;
99103
case IIO_CHAN_INFO_OFFSET:
100104
*val = hid_sensor_convert_exponent(
@@ -234,6 +238,11 @@ static int prox_parse_report(struct platform_device *pdev,
234238
HID_USAGE_SENSOR_HUMAN_PRESENCE,
235239
&st->common_attributes.sensitivity);
236240

241+
st->scale_precision = hid_sensor_format_scale(
242+
hsdev->usage,
243+
&st->prox_attr,
244+
&st->scale_pre_decml, &st->scale_post_decml);
245+
237246
return ret;
238247
}
239248

0 commit comments

Comments
 (0)