Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull staging/IIO fixes from Greg KH:
"Here are a few small staging and IIO fixes for various reported
issues.

All of them are tiny, the majority being iio driver fixes for small
issues, and one staging driver fix for a memory corruption issue.

All have been in linux-next with no reported issues"

* tag 'staging-4.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: ncpfs: memory corruption in ncp_read_kernel()
iio: st_pressure: st_accel: pass correct platform data to init
Revert "iio: accel: st_accel: remove redundant pointer pdata"
iio: adc: meson-saradc: unlock on error in meson_sar_adc_lock()
dt-bindings: iio: adc: sd-modulator: fix io-channel-cells
iio: adc: stm32-dfsdm: fix multiple channel initialization
iio: adc: stm32-dfsdm: fix clock source selection
iio: adc: stm32-dfsdm: fix call to stop channel
iio: adc: stm32-dfsdm: fix compatible data use
iio: chemical: ccs811: Corrected firmware boot/application mode transition

+50 -25
+2 -2
Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.txt
··· 3 3 Required properties: 4 4 - compatible: should be "ads1201", "sd-modulator". "sd-modulator" can be use 5 5 as a generic SD modulator if modulator not specified in compatible list. 6 - - #io-channel-cells = <1>: See the IIO bindings section "IIO consumers". 6 + - #io-channel-cells = <0>: See the IIO bindings section "IIO consumers". 7 7 8 8 Example node: 9 9 10 10 ads1202: adc@0 { 11 11 compatible = "sd-modulator"; 12 - #io-channel-cells = <1>; 12 + #io-channel-cells = <0>; 13 13 };
+6 -1
drivers/iio/accel/st_accel_core.c
··· 920 920 int st_accel_common_probe(struct iio_dev *indio_dev) 921 921 { 922 922 struct st_sensor_data *adata = iio_priv(indio_dev); 923 + struct st_sensors_platform_data *pdata = 924 + (struct st_sensors_platform_data *)adata->dev->platform_data; 923 925 int irq = adata->get_irq_data_ready(indio_dev); 924 926 int err; 925 927 ··· 948 946 &adata->sensor_settings->fs.fs_avl[0]; 949 947 adata->odr = adata->sensor_settings->odr.odr_avl[0].hz; 950 948 951 - err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data); 949 + if (!pdata) 950 + pdata = (struct st_sensors_platform_data *)&default_accel_pdata; 951 + 952 + err = st_sensors_init_sensor(indio_dev, pdata); 952 953 if (err < 0) 953 954 goto st_accel_power_off; 954 955
+3 -1
drivers/iio/adc/meson_saradc.c
··· 462 462 regmap_read(priv->regmap, MESON_SAR_ADC_DELAY, &val); 463 463 } while (val & MESON_SAR_ADC_DELAY_BL30_BUSY && timeout--); 464 464 465 - if (timeout < 0) 465 + if (timeout < 0) { 466 + mutex_unlock(&indio_dev->mlock); 466 467 return -ETIMEDOUT; 468 + } 467 469 } 468 470 469 471 return 0;
+21 -18
drivers/iio/adc/stm32-dfsdm-adc.c
··· 54 54 struct stm32_dfsdm *dfsdm; 55 55 const struct stm32_dfsdm_dev_data *dev_data; 56 56 unsigned int fl_id; 57 - unsigned int ch_id; 58 57 59 58 /* ADC specific */ 60 59 unsigned int oversamp; ··· 383 384 { 384 385 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); 385 386 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id]; 386 - struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[adc->ch_id]; 387 + struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel]; 387 388 unsigned int sample_freq = adc->sample_freq; 388 389 unsigned int spi_freq; 389 390 int ret; ··· 418 419 return len; 419 420 } 420 421 421 - static int stm32_dfsdm_start_conv(struct stm32_dfsdm_adc *adc, bool dma) 422 + static int stm32_dfsdm_start_conv(struct stm32_dfsdm_adc *adc, 423 + const struct iio_chan_spec *chan, 424 + bool dma) 422 425 { 423 426 struct regmap *regmap = adc->dfsdm->regmap; 424 427 int ret; 425 428 unsigned int dma_en = 0, cont_en = 0; 426 429 427 - ret = stm32_dfsdm_start_channel(adc->dfsdm, adc->ch_id); 430 + ret = stm32_dfsdm_start_channel(adc->dfsdm, chan->channel); 428 431 if (ret < 0) 429 432 return ret; 430 433 431 434 ret = stm32_dfsdm_filter_configure(adc->dfsdm, adc->fl_id, 432 - adc->ch_id); 435 + chan->channel); 433 436 if (ret < 0) 434 437 goto stop_channels; 435 438 ··· 465 464 466 465 regmap_update_bits(regmap, DFSDM_CR1(adc->fl_id), 467 466 DFSDM_CR1_RCONT_MASK, 0); 468 - stm32_dfsdm_stop_channel(adc->dfsdm, adc->fl_id); 467 + stm32_dfsdm_stop_channel(adc->dfsdm, chan->channel); 469 468 470 469 return ret; 471 470 } 472 471 473 - static void stm32_dfsdm_stop_conv(struct stm32_dfsdm_adc *adc) 472 + static void stm32_dfsdm_stop_conv(struct stm32_dfsdm_adc *adc, 473 + const struct iio_chan_spec *chan) 474 474 { 475 475 struct regmap *regmap = adc->dfsdm->regmap; 476 476 ··· 484 482 regmap_update_bits(regmap, DFSDM_CR1(adc->fl_id), 485 483 DFSDM_CR1_RCONT_MASK, 0); 486 484 487 - stm32_dfsdm_stop_channel(adc->dfsdm, adc->ch_id); 485 + stm32_dfsdm_stop_channel(adc->dfsdm, chan->channel); 488 486 } 489 487 490 488 static int stm32_dfsdm_set_watermark(struct iio_dev *indio_dev, ··· 611 609 static int stm32_dfsdm_postenable(struct iio_dev *indio_dev) 612 610 { 613 611 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); 612 + const struct iio_chan_spec *chan = &indio_dev->channels[0]; 614 613 int ret; 615 614 616 615 /* Reset adc buffer index */ ··· 621 618 if (ret < 0) 622 619 return ret; 623 620 624 - ret = stm32_dfsdm_start_conv(adc, true); 621 + ret = stm32_dfsdm_start_conv(adc, chan, true); 625 622 if (ret) { 626 623 dev_err(&indio_dev->dev, "Can't start conversion\n"); 627 624 goto stop_dfsdm; ··· 638 635 return 0; 639 636 640 637 err_stop_conv: 641 - stm32_dfsdm_stop_conv(adc); 638 + stm32_dfsdm_stop_conv(adc, chan); 642 639 stop_dfsdm: 643 640 stm32_dfsdm_stop_dfsdm(adc->dfsdm); 644 641 ··· 648 645 static int stm32_dfsdm_predisable(struct iio_dev *indio_dev) 649 646 { 650 647 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); 648 + const struct iio_chan_spec *chan = &indio_dev->channels[0]; 651 649 652 650 if (adc->dma_chan) 653 651 dmaengine_terminate_all(adc->dma_chan); 654 652 655 - stm32_dfsdm_stop_conv(adc); 653 + stm32_dfsdm_stop_conv(adc, chan); 656 654 657 655 stm32_dfsdm_stop_dfsdm(adc->dfsdm); 658 656 ··· 734 730 if (ret < 0) 735 731 goto stop_dfsdm; 736 732 737 - ret = stm32_dfsdm_start_conv(adc, false); 733 + ret = stm32_dfsdm_start_conv(adc, chan, false); 738 734 if (ret < 0) { 739 735 regmap_update_bits(adc->dfsdm->regmap, DFSDM_CR2(adc->fl_id), 740 736 DFSDM_CR2_REOCIE_MASK, DFSDM_CR2_REOCIE(0)); ··· 755 751 else 756 752 ret = IIO_VAL_INT; 757 753 758 - stm32_dfsdm_stop_conv(adc); 754 + stm32_dfsdm_stop_conv(adc, chan); 759 755 760 756 stop_dfsdm: 761 757 stm32_dfsdm_stop_dfsdm(adc->dfsdm); ··· 769 765 { 770 766 struct stm32_dfsdm_adc *adc = iio_priv(indio_dev); 771 767 struct stm32_dfsdm_filter *fl = &adc->dfsdm->fl_list[adc->fl_id]; 772 - struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[adc->ch_id]; 768 + struct stm32_dfsdm_channel *ch = &adc->dfsdm->ch_list[chan->channel]; 773 769 unsigned int spi_freq = adc->spi_freq; 774 770 int ret = -EINVAL; 775 771 ··· 976 972 } 977 973 ch->scan_type.realbits = 24; 978 974 ch->scan_type.storagebits = 32; 979 - adc->ch_id = ch->channel; 980 975 981 976 return stm32_dfsdm_chan_configure(adc->dfsdm, 982 977 &adc->dfsdm->ch_list[ch->channel]); ··· 1004 1001 } 1005 1002 ch->info_mask_separate = BIT(IIO_CHAN_INFO_SAMP_FREQ); 1006 1003 1007 - d_ch = &adc->dfsdm->ch_list[adc->ch_id]; 1004 + d_ch = &adc->dfsdm->ch_list[ch->channel]; 1008 1005 if (d_ch->src != DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) 1009 1006 adc->spi_freq = adc->dfsdm->spi_master_freq; 1010 1007 ··· 1045 1042 return -ENOMEM; 1046 1043 1047 1044 for (chan_idx = 0; chan_idx < num_ch; chan_idx++) { 1048 - ch->scan_index = chan_idx; 1049 - ret = stm32_dfsdm_adc_chan_init_one(indio_dev, ch); 1045 + ch[chan_idx].scan_index = chan_idx; 1046 + ret = stm32_dfsdm_adc_chan_init_one(indio_dev, &ch[chan_idx]); 1050 1047 if (ret < 0) { 1051 1048 dev_err(&indio_dev->dev, "Channels init failed\n"); 1052 1049 return ret;
+10 -2
drivers/iio/adc/stm32-dfsdm-core.c
··· 83 83 { 84 84 struct dfsdm_priv *priv = container_of(dfsdm, struct dfsdm_priv, dfsdm); 85 85 struct device *dev = &priv->pdev->dev; 86 - unsigned int clk_div = priv->spi_clk_out_div; 86 + unsigned int clk_div = priv->spi_clk_out_div, clk_src; 87 87 int ret; 88 88 89 89 if (atomic_inc_return(&priv->n_active_ch) == 1) { ··· 99 99 goto disable_clk; 100 100 } 101 101 } 102 + 103 + /* select clock source, e.g. 0 for "dfsdm" or 1 for "audio" */ 104 + clk_src = priv->aclk ? 1 : 0; 105 + ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), 106 + DFSDM_CHCFGR1_CKOUTSRC_MASK, 107 + DFSDM_CHCFGR1_CKOUTSRC(clk_src)); 108 + if (ret < 0) 109 + goto disable_aclk; 102 110 103 111 /* Output the SPI CLKOUT (if clk_div == 0 clock if OFF) */ 104 112 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), ··· 282 274 283 275 dfsdm->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "dfsdm", 284 276 dfsdm->base, 285 - &stm32h7_dfsdm_regmap_cfg); 277 + dev_data->regmap_cfg); 286 278 if (IS_ERR(dfsdm->regmap)) { 287 279 ret = PTR_ERR(dfsdm->regmap); 288 280 dev_err(&pdev->dev, "%s: Failed to allocate regmap: %d\n",
+3
drivers/iio/chemical/ccs811.c
··· 133 133 if (ret < 0) 134 134 return ret; 135 135 136 + if ((ret & CCS811_STATUS_FW_MODE_APPLICATION)) 137 + return 0; 138 + 136 139 if ((ret & CCS811_STATUS_APP_VALID_MASK) != 137 140 CCS811_STATUS_APP_VALID_LOADED) 138 141 return -EIO;
+1 -1
drivers/iio/pressure/st_pressure_core.c
··· 640 640 press_data->sensor_settings->drdy_irq.int2.addr)) 641 641 pdata = (struct st_sensors_platform_data *)&default_press_pdata; 642 642 643 - err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data); 643 + err = st_sensors_init_sensor(indio_dev, pdata); 644 644 if (err < 0) 645 645 goto st_press_power_off; 646 646
+4
drivers/staging/ncpfs/ncplib_kernel.c
··· 981 981 goto out; 982 982 } 983 983 *bytes_read = ncp_reply_be16(server, 0); 984 + if (*bytes_read > to_read) { 985 + result = -EINVAL; 986 + goto out; 987 + } 984 988 source = ncp_reply_data(server, 2 + (offset & 1)); 985 989 986 990 memcpy(target, source, *bytes_read);