Skip to content

Commit a563ae0

Browse files
committed
Merge tag 'staging-5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO driver fixes from Greg KH: "Here are a number of small IIO and staging driver fixes for 5.15-rc6. They include: - vc04_services bugfix for reported problem - r8188eu array underflow fix - iio driver fixes for a lot of tiny reported issues. All of these have been in linux-next for a while with no reported issues" * tag 'staging-5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: r8188eu: prevent array underflow in rtw_hal_update_ra_mask() staging: vc04_services: shut up out-of-range warning iio: light: opt3001: Fixed timeout error when 0 lux iio: adis16480: fix devices that do not support sleep mode iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSED iio: adis16475: fix deadlock on frequency set iio: ssp_sensors: add more range checking in ssp_parse_dataframe() iio: ssp_sensors: fix error code in ssp_print_mcu_debug() iio: adc: ad7793: Fix IRQ flag iio: adc: ad7780: Fix IRQ flag iio: adc: ad7192: Add IRQ flag iio: adc: aspeed: set driver data when adc probe. iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume() iio: adc: max1027: Fix the number of max1X31 channels iio: adc: max1027: Fix wrong shift with 12-bit devices iio: adc128s052: Fix the error handling path of 'adc128_probe()' iio: adc: rzg2l_adc: Fix -EBUSY timeout error return iio: accel: fxls8962af: return IRQ_HANDLED when fifo is flushed iio: dac: ti-dac5571: fix an error code in probe()
2 parents b9e42b3 + 37f1220 commit a563ae0

16 files changed

Lines changed: 52 additions & 18 deletions

File tree

drivers/iio/accel/fxls8962af-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ static irqreturn_t fxls8962af_interrupt(int irq, void *p)
738738

739739
if (reg & FXLS8962AF_INT_STATUS_SRC_BUF) {
740740
ret = fxls8962af_fifo_flush(indio_dev);
741-
if (ret)
741+
if (ret < 0)
742742
return IRQ_NONE;
743743

744744
return IRQ_HANDLED;

drivers/iio/adc/ad7192.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ static const struct ad_sigma_delta_info ad7192_sigma_delta_info = {
293293
.has_registers = true,
294294
.addr_shift = 3,
295295
.read_mask = BIT(6),
296+
.irq_flags = IRQF_TRIGGER_FALLING,
296297
};
297298

298299
static const struct ad_sd_calib_data ad7192_calib_arr[8] = {

drivers/iio/adc/ad7780.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
203203
.set_mode = ad7780_set_mode,
204204
.postprocess_sample = ad7780_postprocess_sample,
205205
.has_registers = false,
206-
.irq_flags = IRQF_TRIGGER_LOW,
206+
.irq_flags = IRQF_TRIGGER_FALLING,
207207
};
208208

209209
#define _AD7780_CHANNEL(_bits, _wordsize, _mask_all) \

drivers/iio/adc/ad7793.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = {
206206
.has_registers = true,
207207
.addr_shift = 3,
208208
.read_mask = BIT(6),
209-
.irq_flags = IRQF_TRIGGER_LOW,
209+
.irq_flags = IRQF_TRIGGER_FALLING,
210210
};
211211

212212
static const struct ad_sd_calib_data ad7793_calib_arr[6] = {

drivers/iio/adc/aspeed_adc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
183183

184184
data = iio_priv(indio_dev);
185185
data->dev = &pdev->dev;
186+
platform_set_drvdata(pdev, indio_dev);
186187

187188
data->base = devm_platform_ioremap_resource(pdev, 0);
188189
if (IS_ERR(data->base))

drivers/iio/adc/max1027.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
103103
.sign = 'u', \
104104
.realbits = depth, \
105105
.storagebits = 16, \
106-
.shift = 2, \
106+
.shift = (depth == 10) ? 2 : 0, \
107107
.endianness = IIO_BE, \
108108
}, \
109109
}
@@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
142142
MAX1027_V_CHAN(11, depth)
143143

144144
#define MAX1X31_CHANNELS(depth) \
145-
MAX1X27_CHANNELS(depth), \
146145
MAX1X29_CHANNELS(depth), \
147146
MAX1027_V_CHAN(12, depth), \
148147
MAX1027_V_CHAN(13, depth), \

drivers/iio/adc/mt6577_auxadc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = {
8282
MT6577_AUXADC_CHANNEL(15),
8383
};
8484

85+
/* For Voltage calculation */
86+
#define VOLTAGE_FULL_RANGE 1500 /* VA voltage */
87+
#define AUXADC_PRECISE 4096 /* 12 bits */
88+
8589
static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali)
8690
{
8791
return rawdata;
@@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev,
191195
}
192196
if (adc_dev->dev_comp->sample_data_cali)
193197
*val = mt_auxadc_get_cali_data(*val, true);
198+
199+
/* Convert adc raw data to voltage: 0 - 1500 mV */
200+
*val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE;
201+
194202
return IIO_VAL_INT;
195203

196204
default:

drivers/iio/adc/rzg2l_adc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int rzg2l_adc_hw_init(struct rzg2l_adc *adc)
401401
exit_hw_init:
402402
clk_disable_unprepare(adc->pclk);
403403

404-
return 0;
404+
return ret;
405405
}
406406

407407
static void rzg2l_adc_pm_runtime_disable(void *data)
@@ -570,8 +570,10 @@ static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev)
570570
return ret;
571571

572572
ret = clk_prepare_enable(adc->adclk);
573-
if (ret)
573+
if (ret) {
574+
clk_disable_unprepare(adc->pclk);
574575
return ret;
576+
}
575577

576578
rzg2l_adc_pwr(adc, true);
577579

drivers/iio/adc/ti-adc128s052.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,13 @@ static int adc128_probe(struct spi_device *spi)
171171
mutex_init(&adc->lock);
172172

173173
ret = iio_device_register(indio_dev);
174+
if (ret)
175+
goto err_disable_regulator;
174176

177+
return 0;
178+
179+
err_disable_regulator:
180+
regulator_disable(adc->reg);
175181
return ret;
176182
}
177183

drivers/iio/common/ssp_sensors/ssp_spi.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index,
137137
if (length > received_len - *data_index || length <= 0) {
138138
ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n",
139139
length, received_len);
140-
return length ? length : -EPROTO;
140+
return -EPROTO;
141141
}
142142

143143
ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]);
@@ -273,6 +273,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len)
273273
for (idx = 0; idx < len;) {
274274
switch (dataframe[idx++]) {
275275
case SSP_MSG2AP_INST_BYPASS_DATA:
276+
if (idx >= len)
277+
return -EPROTO;
276278
sd = dataframe[idx++];
277279
if (sd < 0 || sd >= SSP_SENSOR_MAX) {
278280
dev_err(SSP_DEV,
@@ -282,17 +284,22 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len)
282284

283285
if (indio_devs[sd]) {
284286
spd = iio_priv(indio_devs[sd]);
285-
if (spd->process_data)
287+
if (spd->process_data) {
288+
if (idx >= len)
289+
return -EPROTO;
286290
spd->process_data(indio_devs[sd],
287291
&dataframe[idx],
288292
data->timestamp);
293+
}
289294
} else {
290295
dev_err(SSP_DEV, "no client for frame\n");
291296
}
292297

293298
idx += ssp_offset_map[sd];
294299
break;
295300
case SSP_MSG2AP_INST_DEBUG_DATA:
301+
if (idx >= len)
302+
return -EPROTO;
296303
sd = ssp_print_mcu_debug(dataframe, &idx, len);
297304
if (sd) {
298305
dev_err(SSP_DEV,

0 commit comments

Comments
 (0)