Merge tag 'char-misc-6.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
"Here are a bunch of tiny char/misc/other driver fixes for 6.4-rc5 that
resolve a number of reported issues. Included in here are:

- iio driver fixes

- fpga driver fixes

- test_firmware bugfixes

- fastrpc driver tiny bugfixes

- MAINTAINERS file updates for some subsystems

All of these have been in linux-next this past week with no reported
issues"

* tag 'char-misc-6.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (34 commits)
test_firmware: fix the memory leak of the allocated firmware buffer
test_firmware: fix a memory leak with reqs buffer
test_firmware: prevent race conditions by a correct implementation of locking
firmware_loader: Fix a NULL vs IS_ERR() check
MAINTAINERS: Vaibhav Gupta is the new ipack maintainer
dt-bindings: fpga: replace Ivan Bornyakov maintainership
MAINTAINERS: update Microchip MPF FPGA reviewers
misc: fastrpc: reject new invocations during device removal
misc: fastrpc: return -EPIPE to invocations on device removal
misc: fastrpc: Reassign memory ownership only for remote heap
misc: fastrpc: Pass proper scm arguments for secure map request
iio: imu: inv_icm42600: fix timestamp reset
iio: adc: ad_sigma_delta: Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag
dt-bindings: iio: adc: renesas,rcar-gyroadc: Fix adi,ad7476 compatible value
iio: dac: mcp4725: Fix i2c_master_send() return value handling
iio: accel: kx022a fix irq getting
iio: bu27034: Ensure reset is written
iio: dac: build ad5758 driver when AD5758 is selected
iio: addac: ad74413: fix resistance input processing
iio: light: vcnl4035: fixed chip ID check
...

+1 -1
Documentation/devicetree/bindings/fpga/lattice,sysconfig.yaml
··· 7 7 title: Lattice Slave SPI sysCONFIG FPGA manager 8 8 9 9 maintainers: 10 - - Ivan Bornyakov <i.bornyakov@metrotek.ru> 10 + - Vladimir Georgiev <v.georgiev@metrotek.ru> 11 11 12 12 description: | 13 13 Lattice sysCONFIG port, which is used for FPGA configuration, among others,
+1 -1
Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml
··· 7 7 title: Microchip Polarfire FPGA manager. 8 8 9 9 maintainers: 10 - - Ivan Bornyakov <i.bornyakov@metrotek.ru> 10 + - Vladimir Georgiev <v.georgiev@metrotek.ru> 11 11 12 12 description: 13 13 Device Tree Bindings for Microchip Polarfire FPGA Manager using slave SPI to
+7
Documentation/devicetree/bindings/iio/adc/nxp,imx8qxp-adc.yaml
··· 39 39 power-domains: 40 40 maxItems: 1 41 41 42 + vref-supply: 43 + description: | 44 + External ADC reference voltage supply on VREFH pad. If VERID[MVI] is 45 + set, there are additional, internal reference voltages selectable. 46 + VREFH1 is always from VREFH pad. 47 + 42 48 "#io-channel-cells": 43 49 const: 1 44 50 ··· 78 72 assigned-clocks = <&clk IMX_SC_R_ADC_0>; 79 73 assigned-clock-rates = <24000000>; 80 74 power-domains = <&pd IMX_SC_R_ADC_0>; 75 + vref-supply = <&reg_1v8>; 81 76 #io-channel-cells = <1>; 82 77 }; 83 78 };
+1 -1
Documentation/devicetree/bindings/iio/adc/renesas,rcar-gyroadc.yaml
··· 90 90 of the MAX chips to the GyroADC, while MISO line of each Maxim 91 91 ADC connects to a shared input pin of the GyroADC. 92 92 enum: 93 - - adi,7476 93 + - adi,ad7476 94 94 - fujitsu,mb88101a 95 95 - maxim,max1162 96 96 - maxim,max11100
+2 -2
MAINTAINERS
··· 10115 10115 F: Documentation/process/kernel-docs.rst 10116 10116 10117 10117 INDUSTRY PACK SUBSYSTEM (IPACK) 10118 - M: Samuel Iglesias Gonsalvez <siglesias@igalia.com> 10118 + M: Vaibhav Gupta <vaibhavgupta40@gmail.com> 10119 10119 M: Jens Taprogge <jens.taprogge@taprogge.org> 10120 10120 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 10121 10121 L: industrypack-devel@lists.sourceforge.net ··· 13837 13837 13838 13838 MICROCHIP POLARFIRE FPGA DRIVERS 13839 13839 M: Conor Dooley <conor.dooley@microchip.com> 13840 - R: Ivan Bornyakov <i.bornyakov@metrotek.ru> 13840 + R: Vladimir Georgiev <v.georgiev@metrotek.ru> 13841 13841 L: linux-fpga@vger.kernel.org 13842 13842 S: Supported 13843 13843 F: Documentation/devicetree/bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml
+1 -1
drivers/base/firmware_loader/main.c
··· 812 812 char *outbuf; 813 813 814 814 alg = crypto_alloc_shash("sha256", 0, 0); 815 - if (!alg) 815 + if (IS_ERR(alg)) 816 816 return; 817 817 818 818 sha256buf = kmalloc(SHA256_DIGEST_SIZE, GFP_KERNEL);
+1 -1
drivers/iio/accel/kionix-kx022a.c
··· 1048 1048 data->ien_reg = KX022A_REG_INC4; 1049 1049 } else { 1050 1050 irq = fwnode_irq_get_byname(fwnode, "INT2"); 1051 - if (irq <= 0) 1051 + if (irq < 0) 1052 1052 return dev_err_probe(dev, irq, "No suitable IRQ\n"); 1053 1053 1054 1054 data->inc_reg = KX022A_REG_INC5;
+2 -2
drivers/iio/accel/st_accel_core.c
··· 1291 1291 1292 1292 adev = ACPI_COMPANION(indio_dev->dev.parent); 1293 1293 if (!adev) 1294 - return 0; 1294 + return -ENXIO; 1295 1295 1296 1296 /* Read _ONT data, which should be a package of 6 integers. */ 1297 1297 status = acpi_evaluate_object(adev->handle, "_ONT", NULL, &buffer); 1298 1298 if (status == AE_NOT_FOUND) { 1299 - return 0; 1299 + return -ENXIO; 1300 1300 } else if (ACPI_FAILURE(status)) { 1301 1301 dev_warn(&indio_dev->dev, "failed to execute _ONT: %d\n", 1302 1302 status);
+11 -1
drivers/iio/adc/ad4130.c
··· 1817 1817 .unprepare = ad4130_int_clk_unprepare, 1818 1818 }; 1819 1819 1820 + static void ad4130_clk_del_provider(void *of_node) 1821 + { 1822 + of_clk_del_provider(of_node); 1823 + } 1824 + 1820 1825 static int ad4130_setup_int_clk(struct ad4130_state *st) 1821 1826 { 1822 1827 struct device *dev = &st->spi->dev; ··· 1829 1824 struct clk_init_data init; 1830 1825 const char *clk_name; 1831 1826 struct clk *clk; 1827 + int ret; 1832 1828 1833 1829 if (st->int_pin_sel == AD4130_INT_PIN_CLK || 1834 1830 st->mclk_sel != AD4130_MCLK_76_8KHZ) ··· 1849 1843 if (IS_ERR(clk)) 1850 1844 return PTR_ERR(clk); 1851 1845 1852 - return of_clk_add_provider(of_node, of_clk_src_simple_get, clk); 1846 + ret = of_clk_add_provider(of_node, of_clk_src_simple_get, clk); 1847 + if (ret) 1848 + return ret; 1849 + 1850 + return devm_add_action_or_reset(dev, ad4130_clk_del_provider, of_node); 1853 1851 } 1854 1852 1855 1853 static int ad4130_setup(struct iio_dev *indio_dev)
+2 -6
drivers/iio/adc/ad7192.c
··· 897 897 __AD719x_CHANNEL(_si, _channel1, -1, _address, NULL, IIO_VOLTAGE, \ 898 898 BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info) 899 899 900 - #define AD719x_SHORTED_CHANNEL(_si, _channel1, _address) \ 901 - __AD719x_CHANNEL(_si, _channel1, -1, _address, "shorted", IIO_VOLTAGE, \ 902 - BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info) 903 - 904 900 #define AD719x_TEMP_CHANNEL(_si, _address) \ 905 901 __AD719x_CHANNEL(_si, 0, -1, _address, NULL, IIO_TEMP, 0, NULL) 906 902 ··· 904 908 AD719x_DIFF_CHANNEL(0, 1, 2, AD7192_CH_AIN1P_AIN2M), 905 909 AD719x_DIFF_CHANNEL(1, 3, 4, AD7192_CH_AIN3P_AIN4M), 906 910 AD719x_TEMP_CHANNEL(2, AD7192_CH_TEMP), 907 - AD719x_SHORTED_CHANNEL(3, 2, AD7192_CH_AIN2P_AIN2M), 911 + AD719x_DIFF_CHANNEL(3, 2, 2, AD7192_CH_AIN2P_AIN2M), 908 912 AD719x_CHANNEL(4, 1, AD7192_CH_AIN1), 909 913 AD719x_CHANNEL(5, 2, AD7192_CH_AIN2), 910 914 AD719x_CHANNEL(6, 3, AD7192_CH_AIN3), ··· 918 922 AD719x_DIFF_CHANNEL(2, 5, 6, AD7193_CH_AIN5P_AIN6M), 919 923 AD719x_DIFF_CHANNEL(3, 7, 8, AD7193_CH_AIN7P_AIN8M), 920 924 AD719x_TEMP_CHANNEL(4, AD7193_CH_TEMP), 921 - AD719x_SHORTED_CHANNEL(5, 2, AD7193_CH_AIN2P_AIN2M), 925 + AD719x_DIFF_CHANNEL(5, 2, 2, AD7193_CH_AIN2P_AIN2M), 922 926 AD719x_CHANNEL(6, 1, AD7193_CH_AIN1), 923 927 AD719x_CHANNEL(7, 2, AD7193_CH_AIN2), 924 928 AD719x_CHANNEL(8, 3, AD7193_CH_AIN3),
+4
drivers/iio/adc/ad_sigma_delta.c
··· 584 584 init_completion(&sigma_delta->completion); 585 585 586 586 sigma_delta->irq_dis = true; 587 + 588 + /* the IRQ core clears IRQ_DISABLE_UNLAZY flag when freeing an IRQ */ 589 + irq_set_status_flags(sigma_delta->spi->irq, IRQ_DISABLE_UNLAZY); 590 + 587 591 ret = devm_request_irq(dev, sigma_delta->spi->irq, 588 592 ad_sd_data_rdy_trig_poll, 589 593 sigma_delta->info->irq_flags | IRQF_NO_AUTOEN,
+3 -4
drivers/iio/adc/imx93_adc.c
··· 236 236 { 237 237 struct imx93_adc *adc = iio_priv(indio_dev); 238 238 struct device *dev = adc->dev; 239 - long ret; 240 - u32 vref_uv; 239 + int ret; 241 240 242 241 switch (mask) { 243 242 case IIO_CHAN_INFO_RAW: ··· 252 253 return IIO_VAL_INT; 253 254 254 255 case IIO_CHAN_INFO_SCALE: 255 - ret = vref_uv = regulator_get_voltage(adc->vref); 256 + ret = regulator_get_voltage(adc->vref); 256 257 if (ret < 0) 257 258 return ret; 258 - *val = vref_uv / 1000; 259 + *val = ret / 1000; 259 260 *val2 = 12; 260 261 return IIO_VAL_FRACTIONAL_LOG2; 261 262
+51 -2
drivers/iio/adc/mt6370-adc.c
··· 19 19 20 20 #include <dt-bindings/iio/adc/mediatek,mt6370_adc.h> 21 21 22 + #define MT6370_REG_DEV_INFO 0x100 22 23 #define MT6370_REG_CHG_CTRL3 0x113 23 24 #define MT6370_REG_CHG_CTRL7 0x117 24 25 #define MT6370_REG_CHG_ADC 0x121 ··· 28 27 #define MT6370_ADC_START_MASK BIT(0) 29 28 #define MT6370_ADC_IN_SEL_MASK GENMASK(7, 4) 30 29 #define MT6370_AICR_ICHG_MASK GENMASK(7, 2) 30 + #define MT6370_VENID_MASK GENMASK(7, 4) 31 31 32 32 #define MT6370_AICR_100_mA 0x0 33 33 #define MT6370_AICR_150_mA 0x1 ··· 49 47 #define ADC_CONV_TIME_MS 35 50 48 #define ADC_CONV_POLLING_TIME_US 1000 51 49 50 + #define MT6370_VID_RT5081 0x8 51 + #define MT6370_VID_RT5081A 0xA 52 + #define MT6370_VID_MT6370 0xE 53 + 52 54 struct mt6370_adc_data { 53 55 struct device *dev; 54 56 struct regmap *regmap; ··· 61 55 * from being read at the same time. 62 56 */ 63 57 struct mutex adc_lock; 58 + unsigned int vid; 64 59 }; 65 60 66 61 static int mt6370_adc_read_channel(struct mt6370_adc_data *priv, int chan, ··· 105 98 return ret; 106 99 } 107 100 101 + static int mt6370_adc_get_ibus_scale(struct mt6370_adc_data *priv) 102 + { 103 + switch (priv->vid) { 104 + case MT6370_VID_RT5081: 105 + case MT6370_VID_RT5081A: 106 + case MT6370_VID_MT6370: 107 + return 3350; 108 + default: 109 + return 3875; 110 + } 111 + } 112 + 113 + static int mt6370_adc_get_ibat_scale(struct mt6370_adc_data *priv) 114 + { 115 + switch (priv->vid) { 116 + case MT6370_VID_RT5081: 117 + case MT6370_VID_RT5081A: 118 + case MT6370_VID_MT6370: 119 + return 2680; 120 + default: 121 + return 3870; 122 + } 123 + } 124 + 108 125 static int mt6370_adc_read_scale(struct mt6370_adc_data *priv, 109 126 int chan, int *val1, int *val2) 110 127 { ··· 154 123 case MT6370_AICR_250_mA: 155 124 case MT6370_AICR_300_mA: 156 125 case MT6370_AICR_350_mA: 157 - *val1 = 3350; 126 + *val1 = mt6370_adc_get_ibus_scale(priv); 158 127 break; 159 128 default: 160 129 *val1 = 5000; ··· 181 150 case MT6370_ICHG_600_mA: 182 151 case MT6370_ICHG_700_mA: 183 152 case MT6370_ICHG_800_mA: 184 - *val1 = 2680; 153 + *val1 = mt6370_adc_get_ibat_scale(priv); 185 154 break; 186 155 default: 187 156 *val1 = 5000; ··· 282 251 MT6370_ADC_CHAN(TEMP_JC, IIO_TEMP, 12, BIT(IIO_CHAN_INFO_OFFSET)), 283 252 }; 284 253 254 + static int mt6370_get_vendor_info(struct mt6370_adc_data *priv) 255 + { 256 + unsigned int dev_info; 257 + int ret; 258 + 259 + ret = regmap_read(priv->regmap, MT6370_REG_DEV_INFO, &dev_info); 260 + if (ret) 261 + return ret; 262 + 263 + priv->vid = FIELD_GET(MT6370_VENID_MASK, dev_info); 264 + 265 + return 0; 266 + } 267 + 285 268 static int mt6370_adc_probe(struct platform_device *pdev) 286 269 { 287 270 struct device *dev = &pdev->dev; ··· 316 271 priv->dev = dev; 317 272 priv->regmap = regmap; 318 273 mutex_init(&priv->adc_lock); 274 + 275 + ret = mt6370_get_vendor_info(priv); 276 + if (ret) 277 + return dev_err_probe(dev, ret, "Failed to get vid\n"); 319 278 320 279 ret = regmap_write(priv->regmap, MT6370_REG_CHG_ADC, 0); 321 280 if (ret)
+5 -5
drivers/iio/adc/mxs-lradc-adc.c
··· 757 757 758 758 ret = mxs_lradc_adc_trigger_init(iio); 759 759 if (ret) 760 - goto err_trig; 760 + return ret; 761 761 762 762 ret = iio_triggered_buffer_setup(iio, &iio_pollfunc_store_time, 763 763 &mxs_lradc_adc_trigger_handler, 764 764 &mxs_lradc_adc_buffer_ops); 765 765 if (ret) 766 - return ret; 766 + goto err_trig; 767 767 768 768 adc->vref_mv = mxs_lradc_adc_vref_mv[lradc->soc]; 769 769 ··· 801 801 802 802 err_dev: 803 803 mxs_lradc_adc_hw_stop(adc); 804 - mxs_lradc_adc_trigger_remove(iio); 805 - err_trig: 806 804 iio_triggered_buffer_cleanup(iio); 805 + err_trig: 806 + mxs_lradc_adc_trigger_remove(iio); 807 807 return ret; 808 808 } 809 809 ··· 814 814 815 815 iio_device_unregister(iio); 816 816 mxs_lradc_adc_hw_stop(adc); 817 - mxs_lradc_adc_trigger_remove(iio); 818 817 iio_triggered_buffer_cleanup(iio); 818 + mxs_lradc_adc_trigger_remove(iio); 819 819 820 820 return 0; 821 821 }
+5 -5
drivers/iio/adc/palmas_gpadc.c
··· 547 547 int adc_chan = chan->channel; 548 548 int ret = 0; 549 549 550 - if (adc_chan > PALMAS_ADC_CH_MAX) 550 + if (adc_chan >= PALMAS_ADC_CH_MAX) 551 551 return -EINVAL; 552 552 553 553 mutex_lock(&adc->lock); ··· 595 595 int adc_chan = chan->channel; 596 596 int ret = 0; 597 597 598 - if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 598 + if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 599 599 return -EINVAL; 600 600 601 601 mutex_lock(&adc->lock); ··· 684 684 int adc_chan = chan->channel; 685 685 int ret; 686 686 687 - if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 687 + if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 688 688 return -EINVAL; 689 689 690 690 mutex_lock(&adc->lock); ··· 710 710 int adc_chan = chan->channel; 711 711 int ret; 712 712 713 - if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 713 + if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 714 714 return -EINVAL; 715 715 716 716 mutex_lock(&adc->lock); ··· 744 744 int old; 745 745 int ret; 746 746 747 - if (adc_chan > PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 747 + if (adc_chan >= PALMAS_ADC_CH_MAX || type != IIO_EV_TYPE_THRESH) 748 748 return -EINVAL; 749 749 750 750 mutex_lock(&adc->lock);
+32 -29
drivers/iio/adc/stm32-adc.c
··· 2006 2006 * to get the *real* number of channels. 2007 2007 */ 2008 2008 ret = device_property_count_u32(dev, "st,adc-diff-channels"); 2009 - if (ret < 0) 2010 - return ret; 2011 - 2012 - ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32)); 2013 - if (ret > adc_info->max_channels) { 2014 - dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n"); 2015 - return -EINVAL; 2016 - } else if (ret > 0) { 2017 - adc->num_diff = ret; 2018 - num_channels += ret; 2009 + if (ret > 0) { 2010 + ret /= (int)(sizeof(struct stm32_adc_diff_channel) / sizeof(u32)); 2011 + if (ret > adc_info->max_channels) { 2012 + dev_err(&indio_dev->dev, "Bad st,adc-diff-channels?\n"); 2013 + return -EINVAL; 2014 + } else if (ret > 0) { 2015 + adc->num_diff = ret; 2016 + num_channels += ret; 2017 + } 2019 2018 } 2020 2019 2021 2020 /* Optional sample time is provided either for each, or all channels */ ··· 2036 2037 struct stm32_adc_diff_channel diff[STM32_ADC_CH_MAX]; 2037 2038 struct device *dev = &indio_dev->dev; 2038 2039 u32 num_diff = adc->num_diff; 2040 + int num_se = nchans - num_diff; 2039 2041 int size = num_diff * sizeof(*diff) / sizeof(u32); 2040 2042 int scan_index = 0, ret, i, c; 2041 2043 u32 smp = 0, smps[STM32_ADC_CH_MAX], chans[STM32_ADC_CH_MAX]; ··· 2063 2063 scan_index++; 2064 2064 } 2065 2065 } 2066 - 2067 - ret = device_property_read_u32_array(dev, "st,adc-channels", chans, 2068 - nchans); 2069 - if (ret) 2070 - return ret; 2071 - 2072 - for (c = 0; c < nchans; c++) { 2073 - if (chans[c] >= adc_info->max_channels) { 2074 - dev_err(&indio_dev->dev, "Invalid channel %d\n", 2075 - chans[c]); 2076 - return -EINVAL; 2066 + if (num_se > 0) { 2067 + ret = device_property_read_u32_array(dev, "st,adc-channels", chans, num_se); 2068 + if (ret) { 2069 + dev_err(&indio_dev->dev, "Failed to get st,adc-channels %d\n", ret); 2070 + return ret; 2077 2071 } 2078 2072 2079 - /* Channel can't be configured both as single-ended & diff */ 2080 - for (i = 0; i < num_diff; i++) { 2081 - if (chans[c] == diff[i].vinp) { 2082 - dev_err(&indio_dev->dev, "channel %d misconfigured\n", chans[c]); 2073 + for (c = 0; c < num_se; c++) { 2074 + if (chans[c] >= adc_info->max_channels) { 2075 + dev_err(&indio_dev->dev, "Invalid channel %d\n", 2076 + chans[c]); 2083 2077 return -EINVAL; 2084 2078 } 2079 + 2080 + /* Channel can't be configured both as single-ended & diff */ 2081 + for (i = 0; i < num_diff; i++) { 2082 + if (chans[c] == diff[i].vinp) { 2083 + dev_err(&indio_dev->dev, "channel %d misconfigured\n", 2084 + chans[c]); 2085 + return -EINVAL; 2086 + } 2087 + } 2088 + stm32_adc_chan_init_one(indio_dev, &channels[scan_index], 2089 + chans[c], 0, scan_index, false); 2090 + scan_index++; 2085 2091 } 2086 - stm32_adc_chan_init_one(indio_dev, &channels[scan_index], 2087 - chans[c], 0, scan_index, false); 2088 - scan_index++; 2089 2092 } 2090 2093 2091 2094 if (adc->nsmps > 0) { ··· 2309 2306 2310 2307 if (legacy) 2311 2308 ret = stm32_adc_legacy_chan_init(indio_dev, adc, channels, 2312 - num_channels); 2309 + timestamping ? num_channels - 1 : num_channels); 2313 2310 else 2314 2311 ret = stm32_adc_generic_chan_init(indio_dev, adc, channels); 2315 2312 if (ret < 0)
+1 -1
drivers/iio/addac/ad74413r.c
··· 1007 1007 1008 1008 ret = ad74413r_get_single_adc_result(indio_dev, chan->channel, 1009 1009 val); 1010 - if (ret) 1010 + if (ret < 0) 1011 1011 return ret; 1012 1012 1013 1013 ad74413r_adc_to_resistance_result(*val, val);
+1 -1
drivers/iio/dac/Makefile
··· 17 17 obj-$(CONFIG_AD5592R) += ad5592r.o 18 18 obj-$(CONFIG_AD5593R) += ad5593r.o 19 19 obj-$(CONFIG_AD5755) += ad5755.o 20 - obj-$(CONFIG_AD5755) += ad5758.o 20 + obj-$(CONFIG_AD5758) += ad5758.o 21 21 obj-$(CONFIG_AD5761) += ad5761.o 22 22 obj-$(CONFIG_AD5764) += ad5764.o 23 23 obj-$(CONFIG_AD5766) += ad5766.o
+14 -2
drivers/iio/dac/mcp4725.c
··· 47 47 struct mcp4725_data *data = iio_priv(i2c_get_clientdata( 48 48 to_i2c_client(dev))); 49 49 u8 outbuf[2]; 50 + int ret; 50 51 51 52 outbuf[0] = (data->powerdown_mode + 1) << 4; 52 53 outbuf[1] = 0; 53 54 data->powerdown = true; 54 55 55 - return i2c_master_send(data->client, outbuf, 2); 56 + ret = i2c_master_send(data->client, outbuf, 2); 57 + if (ret < 0) 58 + return ret; 59 + else if (ret != 2) 60 + return -EIO; 61 + return 0; 56 62 } 57 63 58 64 static int mcp4725_resume(struct device *dev) ··· 66 60 struct mcp4725_data *data = iio_priv(i2c_get_clientdata( 67 61 to_i2c_client(dev))); 68 62 u8 outbuf[2]; 63 + int ret; 69 64 70 65 /* restore previous DAC value */ 71 66 outbuf[0] = (data->dac_value >> 8) & 0xf; 72 67 outbuf[1] = data->dac_value & 0xff; 73 68 data->powerdown = false; 74 69 75 - return i2c_master_send(data->client, outbuf, 2); 70 + ret = i2c_master_send(data->client, outbuf, 2); 71 + if (ret < 0) 72 + return ret; 73 + else if (ret != 2) 74 + return -EIO; 75 + return 0; 76 76 } 77 77 static DEFINE_SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, 78 78 mcp4725_resume);
+5 -5
drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
··· 275 275 { 276 276 struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev); 277 277 struct device *dev = regmap_get_device(st->map); 278 + struct inv_icm42600_timestamp *ts = iio_priv(indio_dev); 278 279 279 280 pm_runtime_get_sync(dev); 281 + 282 + mutex_lock(&st->lock); 283 + inv_icm42600_timestamp_reset(ts); 284 + mutex_unlock(&st->lock); 280 285 281 286 return 0; 282 287 } ··· 380 375 struct device *dev = regmap_get_device(st->map); 381 376 unsigned int sensor; 382 377 unsigned int *watermark; 383 - struct inv_icm42600_timestamp *ts; 384 378 struct inv_icm42600_sensor_conf conf = INV_ICM42600_SENSOR_CONF_INIT; 385 379 unsigned int sleep_temp = 0; 386 380 unsigned int sleep_sensor = 0; ··· 389 385 if (indio_dev == st->indio_gyro) { 390 386 sensor = INV_ICM42600_SENSOR_GYRO; 391 387 watermark = &st->fifo.watermark.gyro; 392 - ts = iio_priv(st->indio_gyro); 393 388 } else if (indio_dev == st->indio_accel) { 394 389 sensor = INV_ICM42600_SENSOR_ACCEL; 395 390 watermark = &st->fifo.watermark.accel; 396 - ts = iio_priv(st->indio_accel); 397 391 } else { 398 392 return -EINVAL; 399 393 } ··· 418 416 /* if FIFO is off, turn temperature off */ 419 417 if (!st->fifo.on) 420 418 ret = inv_icm42600_set_temp_conf(st, false, &sleep_temp); 421 - 422 - inv_icm42600_timestamp_reset(ts); 423 419 424 420 out_unlock: 425 421 mutex_unlock(&st->lock);
+32 -10
drivers/iio/industrialio-gts-helper.c
··· 337 337 return ret; 338 338 } 339 339 340 + static void iio_gts_us_to_int_micro(int *time_us, int *int_micro_times, 341 + int num_times) 342 + { 343 + int i; 344 + 345 + for (i = 0; i < num_times; i++) { 346 + int_micro_times[i * 2] = time_us[i] / 1000000; 347 + int_micro_times[i * 2 + 1] = time_us[i] % 1000000; 348 + } 349 + } 350 + 340 351 /** 341 352 * iio_gts_build_avail_time_table - build table of available integration times 342 353 * @gts: Gain time scale descriptor ··· 362 351 */ 363 352 static int iio_gts_build_avail_time_table(struct iio_gts *gts) 364 353 { 365 - int *times, i, j, idx = 0; 354 + int *times, i, j, idx = 0, *int_micro_times; 366 355 367 356 if (!gts->num_itime) 368 357 return 0; ··· 389 378 } 390 379 } 391 380 } 392 - gts->avail_time_tables = times; 393 - /* 394 - * This is just to survive a unlikely corner-case where times in the 395 - * given time table were not unique. Else we could just trust the 396 - * gts->num_itime. 397 - */ 398 - gts->num_avail_time_tables = idx; 381 + 382 + /* create a list of times formatted as list of IIO_VAL_INT_PLUS_MICRO */ 383 + int_micro_times = kcalloc(idx, sizeof(int) * 2, GFP_KERNEL); 384 + if (int_micro_times) { 385 + /* 386 + * This is just to survive a unlikely corner-case where times in 387 + * the given time table were not unique. Else we could just 388 + * trust the gts->num_itime. 389 + */ 390 + gts->num_avail_time_tables = idx; 391 + iio_gts_us_to_int_micro(times, int_micro_times, idx); 392 + } 393 + 394 + gts->avail_time_tables = int_micro_times; 395 + kfree(times); 396 + 397 + if (!int_micro_times) 398 + return -ENOMEM; 399 399 400 400 return 0; 401 401 } ··· 705 683 return -EINVAL; 706 684 707 685 *vals = gts->avail_time_tables; 708 - *type = IIO_VAL_INT; 709 - *length = gts->num_avail_time_tables; 686 + *type = IIO_VAL_INT_PLUS_MICRO; 687 + *length = gts->num_avail_time_tables * 2; 710 688 711 689 return IIO_AVAIL_LIST; 712 690 }
+20 -6
drivers/iio/light/rohm-bu27034.c
··· 231 231 232 232 static const struct regmap_range bu27034_volatile_ranges[] = { 233 233 { 234 + .range_min = BU27034_REG_SYSTEM_CONTROL, 235 + .range_max = BU27034_REG_SYSTEM_CONTROL, 236 + }, { 234 237 .range_min = BU27034_REG_MODE_CONTROL4, 235 238 .range_max = BU27034_REG_MODE_CONTROL4, 236 239 }, { ··· 1170 1167 1171 1168 switch (mask) { 1172 1169 case IIO_CHAN_INFO_INT_TIME: 1173 - *val = bu27034_get_int_time(data); 1174 - if (*val < 0) 1175 - return *val; 1170 + *val = 0; 1171 + *val2 = bu27034_get_int_time(data); 1172 + if (*val2 < 0) 1173 + return *val2; 1176 1174 1177 - return IIO_VAL_INT; 1175 + return IIO_VAL_INT_PLUS_MICRO; 1178 1176 1179 1177 case IIO_CHAN_INFO_SCALE: 1180 1178 return bu27034_get_scale(data, chan->channel, val, val2); ··· 1233 1229 ret = bu27034_set_scale(data, chan->channel, val, val2); 1234 1230 break; 1235 1231 case IIO_CHAN_INFO_INT_TIME: 1236 - ret = bu27034_try_set_int_time(data, val); 1232 + if (!val) 1233 + ret = bu27034_try_set_int_time(data, val2); 1234 + else 1235 + ret = -EINVAL; 1237 1236 break; 1238 1237 default: 1239 1238 ret = -EINVAL; ··· 1275 1268 int ret, sel; 1276 1269 1277 1270 /* Reset */ 1278 - ret = regmap_update_bits(data->regmap, BU27034_REG_SYSTEM_CONTROL, 1271 + ret = regmap_write_bits(data->regmap, BU27034_REG_SYSTEM_CONTROL, 1279 1272 BU27034_MASK_SW_RESET, BU27034_MASK_SW_RESET); 1280 1273 if (ret) 1281 1274 return dev_err_probe(data->dev, ret, "Sensor reset failed\n"); 1282 1275 1283 1276 msleep(1); 1277 + 1278 + ret = regmap_reinit_cache(data->regmap, &bu27034_regmap); 1279 + if (ret) { 1280 + dev_err(data->dev, "Failed to reinit reg cache\n"); 1281 + return ret; 1282 + } 1283 + 1284 1284 /* 1285 1285 * Read integration time here to ensure it is in regmap cache. We do 1286 1286 * this to speed-up the int-time acquisition in the start of the buffer
+3
drivers/iio/light/vcnl4035.c
··· 8 8 * TODO: Proximity 9 9 */ 10 10 #include <linux/bitops.h> 11 + #include <linux/bitfield.h> 11 12 #include <linux/i2c.h> 12 13 #include <linux/module.h> 13 14 #include <linux/pm_runtime.h> ··· 43 42 #define VCNL4035_ALS_PERS_MASK GENMASK(3, 2) 44 43 #define VCNL4035_INT_ALS_IF_H_MASK BIT(12) 45 44 #define VCNL4035_INT_ALS_IF_L_MASK BIT(13) 45 + #define VCNL4035_DEV_ID_MASK GENMASK(7, 0) 46 46 47 47 /* Default values */ 48 48 #define VCNL4035_MODE_ALS_ENABLE BIT(0) ··· 415 413 return ret; 416 414 } 417 415 416 + id = FIELD_GET(VCNL4035_DEV_ID_MASK, id); 418 417 if (id != VCNL4035_DEV_ID_VAL) { 419 418 dev_err(&data->client->dev, "Wrong id, got %x, expected %x\n", 420 419 id, VCNL4035_DEV_ID_VAL);
+3 -2
drivers/iio/magnetometer/tmag5273.c
··· 296 296 return ret; 297 297 298 298 ret = tmag5273_get_measure(data, &t, &x, &y, &z, &angle, &magnitude); 299 - if (ret) 300 - return ret; 301 299 302 300 pm_runtime_mark_last_busy(data->dev); 303 301 pm_runtime_put_autosuspend(data->dev); 302 + 303 + if (ret) 304 + return ret; 304 305 305 306 switch (chan->address) { 306 307 case TEMPERATURE:
+23 -8
drivers/misc/fastrpc.c
··· 316 316 if (map->table) { 317 317 if (map->attr & FASTRPC_ATTR_SECUREMAP) { 318 318 struct qcom_scm_vmperm perm; 319 + int vmid = map->fl->cctx->vmperms[0].vmid; 320 + u64 src_perms = BIT(QCOM_SCM_VMID_HLOS) | BIT(vmid); 319 321 int err = 0; 320 322 321 323 perm.vmid = QCOM_SCM_VMID_HLOS; 322 324 perm.perm = QCOM_SCM_PERM_RWX; 323 325 err = qcom_scm_assign_mem(map->phys, map->size, 324 - &map->fl->cctx->perms, &perm, 1); 326 + &src_perms, &perm, 1); 325 327 if (err) { 326 328 dev_err(map->fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", 327 329 map->phys, map->size, err); ··· 789 787 goto map_err; 790 788 } 791 789 792 - map->phys = sg_dma_address(map->table->sgl); 793 - map->phys += ((u64)fl->sctx->sid << 32); 790 + if (attr & FASTRPC_ATTR_SECUREMAP) { 791 + map->phys = sg_phys(map->table->sgl); 792 + } else { 793 + map->phys = sg_dma_address(map->table->sgl); 794 + map->phys += ((u64)fl->sctx->sid << 32); 795 + } 794 796 map->size = len; 795 797 map->va = sg_virt(map->table->sgl); 796 798 map->len = len; ··· 804 798 * If subsystem VMIDs are defined in DTSI, then do 805 799 * hyp_assign from HLOS to those VM(s) 806 800 */ 801 + u64 src_perms = BIT(QCOM_SCM_VMID_HLOS); 802 + struct qcom_scm_vmperm dst_perms[2] = {0}; 803 + 804 + dst_perms[0].vmid = QCOM_SCM_VMID_HLOS; 805 + dst_perms[0].perm = QCOM_SCM_PERM_RW; 806 + dst_perms[1].vmid = fl->cctx->vmperms[0].vmid; 807 + dst_perms[1].perm = QCOM_SCM_PERM_RWX; 807 808 map->attr = attr; 808 - err = qcom_scm_assign_mem(map->phys, (u64)map->size, &fl->cctx->perms, 809 - fl->cctx->vmperms, fl->cctx->vmcount); 809 + err = qcom_scm_assign_mem(map->phys, (u64)map->size, &src_perms, dst_perms, 2); 810 810 if (err) { 811 811 dev_err(sess->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d", 812 812 map->phys, map->size, err); ··· 1904 1892 req.vaddrout = rsp_msg.vaddr; 1905 1893 1906 1894 /* Add memory to static PD pool, protection thru hypervisor */ 1907 - if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { 1895 + if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { 1908 1896 struct qcom_scm_vmperm perm; 1909 1897 1910 1898 perm.vmid = QCOM_SCM_VMID_HLOS; ··· 2349 2337 struct fastrpc_invoke_ctx *ctx; 2350 2338 2351 2339 spin_lock(&user->lock); 2352 - list_for_each_entry(ctx, &user->pending, node) 2340 + list_for_each_entry(ctx, &user->pending, node) { 2341 + ctx->retval = -EPIPE; 2353 2342 complete(&ctx->work); 2343 + } 2354 2344 spin_unlock(&user->lock); 2355 2345 } 2356 2346 ··· 2363 2349 struct fastrpc_user *user; 2364 2350 unsigned long flags; 2365 2351 2352 + /* No invocations past this point */ 2366 2353 spin_lock_irqsave(&cctx->lock, flags); 2354 + cctx->rpdev = NULL; 2367 2355 list_for_each_entry(user, &cctx->users, user) 2368 2356 fastrpc_notify_users(user); 2369 2357 spin_unlock_irqrestore(&cctx->lock, flags); ··· 2384 2368 2385 2369 of_platform_depopulate(&rpdev->dev); 2386 2370 2387 - cctx->rpdev = NULL; 2388 2371 fastrpc_channel_ctx_put(cctx); 2389 2372 } 2390 2373
+1 -1
include/linux/iio/iio-gts-helper.h
··· 135 135 /** 136 136 * iio_gts_find_sel_by_int_time - find selector matching integration time 137 137 * @gts: Gain time scale descriptor 138 - * @gain: HW-gain for which matching selector is searched for 138 + * @time: Integration time for which matching selector is searched for 139 139 * 140 140 * Return: a selector matching given integration time or -EINVAL if 141 141 * selector was not found.
+65 -20
lib/test_firmware.c
··· 45 45 bool sent; 46 46 const struct firmware *fw; 47 47 const char *name; 48 + const char *fw_buf; 48 49 struct completion completion; 49 50 struct task_struct *task; 50 51 struct device *dev; ··· 176 175 177 176 for (i = 0; i < test_fw_config->num_requests; i++) { 178 177 req = &test_fw_config->reqs[i]; 179 - if (req->fw) 178 + if (req->fw) { 179 + if (req->fw_buf) { 180 + kfree_const(req->fw_buf); 181 + req->fw_buf = NULL; 182 + } 180 183 release_firmware(req->fw); 184 + req->fw = NULL; 185 + } 181 186 } 182 187 183 188 vfree(test_fw_config->reqs); ··· 360 353 return len; 361 354 } 362 355 356 + static inline int __test_dev_config_update_bool(const char *buf, size_t size, 357 + bool *cfg) 358 + { 359 + int ret; 360 + 361 + if (kstrtobool(buf, cfg) < 0) 362 + ret = -EINVAL; 363 + else 364 + ret = size; 365 + 366 + return ret; 367 + } 368 + 363 369 static int test_dev_config_update_bool(const char *buf, size_t size, 364 370 bool *cfg) 365 371 { 366 372 int ret; 367 373 368 374 mutex_lock(&test_fw_mutex); 369 - if (kstrtobool(buf, cfg) < 0) 370 - ret = -EINVAL; 371 - else 372 - ret = size; 375 + ret = __test_dev_config_update_bool(buf, size, cfg); 373 376 mutex_unlock(&test_fw_mutex); 374 377 375 378 return ret; ··· 390 373 return snprintf(buf, PAGE_SIZE, "%d\n", val); 391 374 } 392 375 393 - static int test_dev_config_update_size_t(const char *buf, 376 + static int __test_dev_config_update_size_t( 377 + const char *buf, 394 378 size_t size, 395 379 size_t *cfg) 396 380 { ··· 402 384 if (ret) 403 385 return ret; 404 386 405 - mutex_lock(&test_fw_mutex); 406 387 *(size_t *)cfg = new; 407 - mutex_unlock(&test_fw_mutex); 408 388 409 389 /* Always return full write size even if we didn't consume all */ 410 390 return size; ··· 418 402 return snprintf(buf, PAGE_SIZE, "%d\n", val); 419 403 } 420 404 421 - static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg) 405 + static int __test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg) 422 406 { 423 407 u8 val; 424 408 int ret; ··· 427 411 if (ret) 428 412 return ret; 429 413 430 - mutex_lock(&test_fw_mutex); 431 414 *(u8 *)cfg = val; 432 - mutex_unlock(&test_fw_mutex); 433 415 434 416 /* Always return full write size even if we didn't consume all */ 435 417 return size; 418 + } 419 + 420 + static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg) 421 + { 422 + int ret; 423 + 424 + mutex_lock(&test_fw_mutex); 425 + ret = __test_dev_config_update_u8(buf, size, cfg); 426 + mutex_unlock(&test_fw_mutex); 427 + 428 + return ret; 436 429 } 437 430 438 431 static ssize_t test_dev_config_show_u8(char *buf, u8 val) ··· 496 471 mutex_unlock(&test_fw_mutex); 497 472 goto out; 498 473 } 499 - mutex_unlock(&test_fw_mutex); 500 474 501 - rc = test_dev_config_update_u8(buf, count, 502 - &test_fw_config->num_requests); 475 + rc = __test_dev_config_update_u8(buf, count, 476 + &test_fw_config->num_requests); 477 + mutex_unlock(&test_fw_mutex); 503 478 504 479 out: 505 480 return rc; ··· 543 518 mutex_unlock(&test_fw_mutex); 544 519 goto out; 545 520 } 546 - mutex_unlock(&test_fw_mutex); 547 521 548 - rc = test_dev_config_update_size_t(buf, count, 549 - &test_fw_config->buf_size); 522 + rc = __test_dev_config_update_size_t(buf, count, 523 + &test_fw_config->buf_size); 524 + mutex_unlock(&test_fw_mutex); 550 525 551 526 out: 552 527 return rc; ··· 573 548 mutex_unlock(&test_fw_mutex); 574 549 goto out; 575 550 } 576 - mutex_unlock(&test_fw_mutex); 577 551 578 - rc = test_dev_config_update_size_t(buf, count, 579 - &test_fw_config->file_offset); 552 + rc = __test_dev_config_update_size_t(buf, count, 553 + &test_fw_config->file_offset); 554 + mutex_unlock(&test_fw_mutex); 580 555 581 556 out: 582 557 return rc; ··· 677 652 678 653 mutex_lock(&test_fw_mutex); 679 654 release_firmware(test_firmware); 655 + if (test_fw_config->reqs) 656 + __test_release_all_firmware(); 680 657 test_firmware = NULL; 681 658 rc = request_firmware(&test_firmware, name, dev); 682 659 if (rc) { ··· 779 752 mutex_lock(&test_fw_mutex); 780 753 release_firmware(test_firmware); 781 754 test_firmware = NULL; 755 + if (test_fw_config->reqs) 756 + __test_release_all_firmware(); 782 757 rc = request_firmware_nowait(THIS_MODULE, 1, name, dev, GFP_KERNEL, 783 758 NULL, trigger_async_request_cb); 784 759 if (rc) { ··· 823 794 824 795 mutex_lock(&test_fw_mutex); 825 796 release_firmware(test_firmware); 797 + if (test_fw_config->reqs) 798 + __test_release_all_firmware(); 826 799 test_firmware = NULL; 827 800 rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOUEVENT, name, 828 801 dev, GFP_KERNEL, NULL, ··· 887 856 test_fw_config->buf_size); 888 857 if (!req->fw) 889 858 kfree(test_buf); 859 + else 860 + req->fw_buf = test_buf; 890 861 } else { 891 862 req->rc = test_fw_config->req_firmware(&req->fw, 892 863 req->name, ··· 928 895 929 896 mutex_lock(&test_fw_mutex); 930 897 898 + if (test_fw_config->reqs) { 899 + rc = -EBUSY; 900 + goto out_bail; 901 + } 902 + 931 903 test_fw_config->reqs = 932 904 vzalloc(array3_size(sizeof(struct test_batched_req), 933 905 test_fw_config->num_requests, 2)); ··· 949 911 req->fw = NULL; 950 912 req->idx = i; 951 913 req->name = test_fw_config->name; 914 + req->fw_buf = NULL; 952 915 req->dev = dev; 953 916 init_completion(&req->completion); 954 917 req->task = kthread_run(test_fw_run_batch_request, req, ··· 1032 993 1033 994 mutex_lock(&test_fw_mutex); 1034 995 996 + if (test_fw_config->reqs) { 997 + rc = -EBUSY; 998 + goto out_bail; 999 + } 1000 + 1035 1001 test_fw_config->reqs = 1036 1002 vzalloc(array3_size(sizeof(struct test_batched_req), 1037 1003 test_fw_config->num_requests, 2)); ··· 1054 1010 for (i = 0; i < test_fw_config->num_requests; i++) { 1055 1011 req = &test_fw_config->reqs[i]; 1056 1012 req->name = test_fw_config->name; 1013 + req->fw_buf = NULL; 1057 1014 req->fw = NULL; 1058 1015 req->idx = i; 1059 1016 init_completion(&req->completion);