Commit Graph

687 Commits

Author SHA1 Message Date
Jean-Baptiste Maneyrol bbaae0c79e iio: imu: inv_icm42600: fix timestamp reset
Timestamp reset is not done in the correct place. It must be done
before enabling buffer. The reason is that interrupt timestamping
is always happening when the chip is on, even if the
corresponding sensor is off. When the sensor restarts, timestamp
is wrong if you don't do a reset first.

Fixes: ec74ae9fd3 ("iio: imu: inv_icm42600: add accurate timestamping")
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230509152202.245444-1-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-05-20 17:33:14 +01:00
Linus Torvalds cec24b8b6b Char/Misc drivers for 6.4-rc1
Here is the "big" set of char/misc and other driver subsystems for
 6.4-rc1.
 
 It's pretty big, but due to the removal of pcmcia drivers, almost breaks
 even for number of lines added vs. removed, a nice change.
 
 Included in here are:
   - removal of unused PCMCIA drivers (finally!)
   - Interconnect driver updates and additions
   - Lots of IIO driver updates and additions
   - MHI driver updates
   - Coresight driver updates
   - NVMEM driver updates, which required some OF updates
   - W1 driver updates and a new maintainer to manage the subsystem
   - FPGA driver updates
   - New driver subsystem, CDX, for AMD systems
   - lots of other small driver updates and additions
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZEp5Eg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ynSXgCg0kSw3vUYwpsnhAsQkoPw1QVA23sAn2edRCMa
 GEkPWjrROueCom7xbLMu
 =eR+P
 -----END PGP SIGNATURE-----

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

Pull char/misc drivers updates from Greg KH:
 "Here is the "big" set of char/misc and other driver subsystems for
  6.4-rc1.

  It's pretty big, but due to the removal of pcmcia drivers, almost
  breaks even for number of lines added vs. removed, a nice change.

  Included in here are:

   - removal of unused PCMCIA drivers (finally!)

   - Interconnect driver updates and additions

   - Lots of IIO driver updates and additions

   - MHI driver updates

   - Coresight driver updates

   - NVMEM driver updates, which required some OF updates

   - W1 driver updates and a new maintainer to manage the subsystem

   - FPGA driver updates

   - New driver subsystem, CDX, for AMD systems

   - lots of other small driver updates and additions

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'char-misc-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (196 commits)
  mcb-lpc: Reallocate memory region to avoid memory overlapping
  mcb-pci: Reallocate memory region to avoid memory overlapping
  mcb: Return actual parsed size when reading chameleon table
  kernel/configs: Drop Android config fragments
  virt: acrn: Replace obsolete memalign() with posix_memalign()
  spmi: Add a check for remove callback when removing a SPMI driver
  spmi: fix W=1 kernel-doc warnings
  spmi: mtk-pmif: Drop of_match_ptr for ID table
  spmi: pmic-arb: Convert to platform remove callback returning void
  spmi: mtk-pmif: Convert to platform remove callback returning void
  spmi: hisi-spmi-controller: Convert to platform remove callback returning void
  w1: gpio: remove unnecessary ENOMEM messages
  w1: omap-hdq: remove unnecessary ENOMEM messages
  w1: omap-hdq: add SPDX tag
  w1: omap-hdq: allow compile testing
  w1: matrox: remove unnecessary ENOMEM messages
  w1: matrox: use inline over __inline__
  w1: matrox: switch from asm to linux header
  w1: ds2482: do not use assignment in if condition
  w1: ds2482: drop unnecessary header
  ...
2023-04-27 12:07:50 -07:00
Linus Torvalds fc2e58b8b7 spi: Updates for v6.4
A fairly standard release for SPI with the exception of a change to the
 API for specifying chip selects done in preparation for supporting
 devices with more than one chip select, this required some mechanical
 changes throughout the tree which have been cooking in -next happily for
 a while.  There's also a new API to allow us to TPM chips on half duplex
 controllers.
 
 There's three commits in here that were mangled by a bad interaction
 between the alsa-devel mailing list software and b4, I didn't notice
 until there were merges on top with it being SPI not ALSA.  It seemed
 clear enough to not be worth going back and fixing.
 
  - Refactoring in preparation for supporting multiple chip selects for a
    single device, needed by some flash devices, which required a change
    in the SPI device API visible throughout the tree.
  - Support for hardware assisted interaction with SPI TPMs on half
    duplex controllers, implemented on nVidia Tedra210 QuadSPI.
  - Optimisation for large transfers on fsl-cpm devices.
  - Cleanups around device property use which fix some sisues with
    fwnode.
  - Use of both void remove() and devm_platform_.*ioremap_resource().
  - Support for AMD Pensando Elba, Amlogic A1, Cadence device mode,
    Intel MetorLake-S and StarFive J7110 QuadSPI.
 
 The final commit converting to DEV_PM_OPS() was applied late to fix a
 warning that was introduced by some of the earlier work.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmRIFQgACgkQJNaLcl1U
 h9BJOwf+JF2RySdn5g1LsyTndPZhLfw4iJgTHaMlnv5tiPHvYVYMM/mNMbMr5Znh
 Y2T0OUkzuRfOK273C+hItC1bTYFTa2cEbDb5dpmKBOZdQ3hjGsZQBvuH2bScUQ+a
 H7UgD3FYOJST6k6rRgZQxVMPePFrXAOaO1gmFWTR3v1EcEr2JeQnjZsmymFXcTnc
 CtPg9N3RvhVnq5aXuxSgQeyyKIjo4LJh/eZ2mexPIu0DeUq3MftaWwSwCXFIoeNC
 DMLA4mZWTgf/yt6JUALwLr+bIiJjb4qGjp3xGZ2wmX7zn73f9QQvuunKb1V4zbNF
 EdXLo2VjA9cZjsihenBaKeHnkfgNfA==
 =IRqY
 -----END PGP SIGNATURE-----

Merge tag 'spi-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "A fairly standard release for SPI with the exception of a change to
  the API for specifying chip selects done in preparation for supporting
  devices with more than one chip select, this required some mechanical
  changes throughout the tree which have been cooking in -next happily
  for a while.

  There's also a new API to allow us to support TPM chips on half duplex
  controllers.

  Summary:

   - Refactoring in preparation for supporting multiple chip selects for
     a single device, needed by some flash devices, which required a
     change in the SPI device API visible throughout the tree

   - Support for hardware assisted interaction with SPI TPMs on half
     duplex controllers, implemented on nVidia Tedra210 QuadSPI

   - Optimisation for large transfers on fsl-cpm devices

   - Cleanups around device property use which fix some sisues with
     fwnode

   - Use of both void remove() and devm_platform_.*ioremap_resource()

   - Support for AMD Pensando Elba, Amlogic A1, Cadence device mode,
     Intel MetorLake-S and StarFive J7110 QuadSPI"

* tag 'spi-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (185 commits)
  spi: bcm63xx: use macro DEFINE_SIMPLE_DEV_PM_OPS
  spi: tegra210-quad: Enable TPM wait polling
  spi: Add TPM HW flow flag
  spi: bcm63xx: remove PM_SLEEP based conditional compilation
  spi: cadence-quadspi: use macro DEFINE_SIMPLE_DEV_PM_OPS
  spi: spi-cadence: Add support for Slave mode
  spi: spi-cadence: Switch to spi_controller structure
  spi: cadence-quadspi: fix suspend-resume implementations
  spi: dw: Add support for AMD Pensando Elba SoC
  spi: dw: Add AMD Pensando Elba SoC SPI Controller
  spi: cadence-quadspi: Disable the SPI before reconfiguring
  spi: cadence-quadspi: Update the read timeout based on the length
  spi: spi-loopback-test: Add module param for iteration length
  spi: add support for Amlogic A1 SPI Flash Controller
  dt-bindings: spi: add Amlogic A1 SPI controller
  spi: fsl-spi: No need to check transfer length versus word size
  spi: fsl-spi: Change mspi_apply_cpu_mode_quirks() to void
  spi: fsl-cpm: Use 16 bit mode for large transfers with even size
  spi: fsl-spi: Re-organise transfer bits_per_word adaptation
  spi: fsl-spi: Fix CPM/QE mode Litte Endian
  ...
2023-04-27 11:02:26 -07:00
Jonathan Cameron dc3d25f22b iio: imu: lsm6dsx: Add ACPI mount matrix retrieval
DSDT ROTM method seen in the wild with SMO8B30 _HID.
Making assumption it is similar to that used for bmc150 plus
information from Darrell that the rotation is out by 90 degrees at boot.

Method (ROTM, 0, NotSerialized)
{
    Name (RBUF, Package (0x03)
    {
        "0 -1 0",
        "1 0 0",
        "0 0 1"
    })
    Return (RBUF) /* \_SB_.PCI0.I2C5.DEV_.ROTM.RBUF */
}

Reported-by: Darrell Kavanagh <darrell.kavanagh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Tested-by: Darrell Kavanagh <darrell.kavanagh@gmail.org>
Link: https://lore.kernel.org/r/20230130201018.981024-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-04-13 11:37:20 +01:00
Jonathan Cameron bd66b6acd2 iio: imu: lsm6dsx: Support SMO8B30 ACPI ID for LSM6DS3TR-C
ID seen in the wild and it is a valid ST micro ID.
An offset of 1 for the device ID enum is needed when adding support for
retrieving the ID from device_get_match_data() to allow detection of
NULL pointer and fallback to i2c_device_id table.

DSDT chunk cropped for relevant parts.

   Scope (_SB.PCI0.I2C5)
    {
        Device (DEV)
        {
            Name (_HID, EisaId ("SMO8B30"))  // _HID: Hardware ID
            Name (_CID, EisaId ("SMO8B30"))  // _CID: Compatible ID
            Name (_UID, Zero)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (RBUF, ResourceTemplate ()
                {
                    I2cSerialBusV2 (0x006A, ControllerInitiated, 0x00061A80,
                        AddressingMode7Bit, "\\_SB.PCI0.I2C5",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                })
                Return (RBUF) /* \_SB_.PCI0.I2C5.DEV_._CRS.RBUF */
            }

            Method (ROTM, 0, NotSerialized)
            {
                Name (RBUF, Package (0x03)
                {
                    "0 -1 0",
                    "1 0 0",
                    "0 0 1"
                })
                Return (RBUF) /* \_SB_.PCI0.I2C5.DEV_.ROTM.RBUF */
            }
...

Link: https://lore.kernel.org/all/20230129182441.082f29d0@jic23-huawei/
Reported-by: Darrell Kavanagh <darrell.kavanagh@gmail.com>
Tested-by: Darrell Kavanagh <darrell.kavanagh@gmail.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20230130201018.981024-2-jic23@kernel.org
2023-04-12 21:02:55 +01:00
Greg Kroah-Hartman fba51482b6 1st set of IIO new device support, features and cleanups for the 6.4 cycle.
New device support
 * bosch,bmp280
   - Add support for BMP580 - includes significant refactoring and general
     driver cleanup + support for non-volatile memory for trimming and config
     parameters.
 * rohm BU27034
   - New driver for this 3 channel ambient light sensor.
   - New support library for devices where both integration time and
     amplifier gain are configurable.  In these cases a scale change
     may require changing bother underlying values. This library module
     provides code to help with this.
 * st,accel
   - Add support for IIS328DQ (ID only as compatible wtih LIS331DL)
 * st,lsm6dsx
   - Add support for ASM330LHB automotive MEMS sensor.
 * ti,ads1100, ads1000
   - New driver for these 16 bit ADCs.
 * ti,tmp117
   - Add support for older tmp116 device. Includes some general driver cleanup.
 
 Staging driver drops
 * adi,ade7854
   - Driver was a very long way from compliant with IIO infrastructure and ABI.
     If anyone wants a non staging version of this driver they are better off
     starting from scratch. Hence drop it and the associated meter.h header.
 
 Features
 * adi,ad7441r
   - Add DT binding to set sink current for digital input.
 * semtech,sx9324,9360
   - Support older register mapping from firmware designed for windows.
 
 Core improvements.
 * Move iio_trigger_poll() docs to next to the implementation and add a note
   on expected caller context.
 * Rename iio_trigger_poll_chained() to iio_trigger_poll_nested() so
   as to use more standard / common terminology.
 * Improve main ABI docs references to offset and scale for raw values by
   making them consistent and clear.
 
 Cleanups and minor fixes:
 * adi,ad5592r
   - Add GPIO names - useful for debug.
 * adi,ad7441r
   - Fix current input, loop powered mode configuration setup.
 * adi,adis16475
   - Fix wrong commented value for minimum advised lower rate.
 * adi,admv1013
   - Use devm_clk_get_enabled() to reduce boilerplate.
 * adi,ads1210
   - Fix wrong bits for writing config register (late fix and has
     been broken a long time so not rushed upstream)
 * amlogic,meson-saradc
   - Improve cleanup in error handling if BL30 handshake fails.
 * apex-embedded,stx104
   - Migrate to regmap and use regmap_read_poll_timeout() to neatly handle
     retries.
   - Add local mutex to close various races.
   - Use define U16_MAX rather than value for limit.
   - Improve code readability with minor reorganization.
 * atmel,ad91-sama5d2
   - Drop trivial dead code.
 * kionix,kx022a
   - Drop unused structure element.
 * linear,ltc2983
   - Reorganize bindings doc to enable unevaluatedProperties to be set
     in one place for all child nodes.
   - Make binding for adi,custom-thermocouple accept signed values.
 * maxim,max44000
   - Add OF Device matching (of_match_table was not correctly set).
 * maxim,max5522
   - Missing static
 * measurement-computing,cio-dac
   - Fix wrong part name in comments.
   - Migrate to regmap.
   - Improve includes by replacing bitops.h with more direct bits.h
 * qcom,pm8xxx-xoadc
   - Remove a check that can never fail.
 * renesas,rcar-gyroadc
   - DT binding documentation improvements.
   - Tidy up an unused warning with __maybe_unused.
 * semtech,sx_common
   - Drop docs for a structure element that doesn't exist.
 * semtech,sx9500
   - Drop ACPI_PTR() and of_match_ptr() protections that just complicate
     the code / block some firmware registration types that would otherwise
     work.
 * sensiron,sps30
   - Comment formatting tidy up.
 * st,sensors
   - Drop duplicate text in DT binding.
 * st,stm32-adc
   - Add some missing static markings.
 * ti,ads1100
   - Use correct return code in dev_err_probe() call.
 * x-powers,axp20x_adc - precursor series to simplify addition of AXP192.
   - General code cleanup / minor refactoring for better readabilty of code.
   - Switch from boolean value to mask for adc_en2 field to avoid hard coding
     a mask that will be different in AXP192
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmQ0QiIRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Foh8dhAAlUDsEWKoYc2DMXs//UVh5ortcD/tVMDj
 +Oe6c92vTvZaritF9JN5fS5oO48d2Qx7VC8mIZvsCgLdloYtM8qns8KwPU8W589j
 Mdaq2e/p+CCVLxn+RttiINk7C/okXmc6nh21TABYgaHbi1Yzu0LooTobrdd5GHZX
 l+5n8diTgebkKWLKHtR/Wo0hZVdFtrxOb+bP6Lu+yjwUhlvmnuC18OPthDHBwss1
 3nWL5sAR8DWKTKPwmWl1pnn5fuZXxAnxYhsgzMiC/dNrv4GfjV76xFvwdFG97Qc4
 Qifo/t6AM6g7HplfRjtdGXGnew8RBj9jzw3W8NUzb/7UF0ywF+6KHBrgWVKLumsW
 uGsLGQsOoCVmycnppUZSZV0eI5qT+WS6GT0XucB3wlUriS56YgpMU/RVo9iE8yUd
 VqjacBJrh1SUIPQKXAGb1dlrfgxGRUFcDxea/XuqzXZIn4U3JM1wb0awIlfcrTNm
 4EdVH9r6lwU/7KcrVC10iZz5ZMFy15wNmCl4+Sn56QNIekXYMXFCHsoZs64UMuhU
 leczQdEp/wEG1p0mWdrpC4aEsMfK27RSbTh8AS3LiPHqI9FD+Jg+wULF6wpMIHvY
 rm4kxlznTdKsYOiHsOkYXCi06kS5k2SqQHtbKS3jiSsCw30eX6xzVjG8szivFIS5
 KEKqxRs1BxM=
 =xxs6
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-6.4a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanups for the 6.4 cycle.

New device support
* bosch,bmp280
  - Add support for BMP580 - includes significant refactoring and general
    driver cleanup + support for non-volatile memory for trimming and config
    parameters.
* rohm BU27034
  - New driver for this 3 channel ambient light sensor.
  - New support library for devices where both integration time and
    amplifier gain are configurable.  In these cases a scale change
    may require changing bother underlying values. This library module
    provides code to help with this.
* st,accel
  - Add support for IIS328DQ (ID only as compatible wtih LIS331DL)
* st,lsm6dsx
  - Add support for ASM330LHB automotive MEMS sensor.
* ti,ads1100, ads1000
  - New driver for these 16 bit ADCs.
* ti,tmp117
  - Add support for older tmp116 device. Includes some general driver cleanup.

Staging driver drops
* adi,ade7854
  - Driver was a very long way from compliant with IIO infrastructure and ABI.
    If anyone wants a non staging version of this driver they are better off
    starting from scratch. Hence drop it and the associated meter.h header.

Features
* adi,ad7441r
  - Add DT binding to set sink current for digital input.
* semtech,sx9324,9360
  - Support older register mapping from firmware designed for windows.

Core improvements.
* Move iio_trigger_poll() docs to next to the implementation and add a note
  on expected caller context.
* Rename iio_trigger_poll_chained() to iio_trigger_poll_nested() so
  as to use more standard / common terminology.
* Improve main ABI docs references to offset and scale for raw values by
  making them consistent and clear.

Cleanups and minor fixes:
* adi,ad5592r
  - Add GPIO names - useful for debug.
* adi,ad7441r
  - Fix current input, loop powered mode configuration setup.
* adi,adis16475
  - Fix wrong commented value for minimum advised lower rate.
* adi,admv1013
  - Use devm_clk_get_enabled() to reduce boilerplate.
* adi,ads1210
  - Fix wrong bits for writing config register (late fix and has
    been broken a long time so not rushed upstream)
* amlogic,meson-saradc
  - Improve cleanup in error handling if BL30 handshake fails.
* apex-embedded,stx104
  - Migrate to regmap and use regmap_read_poll_timeout() to neatly handle
    retries.
  - Add local mutex to close various races.
  - Use define U16_MAX rather than value for limit.
  - Improve code readability with minor reorganization.
* atmel,ad91-sama5d2
  - Drop trivial dead code.
* kionix,kx022a
  - Drop unused structure element.
* linear,ltc2983
  - Reorganize bindings doc to enable unevaluatedProperties to be set
    in one place for all child nodes.
  - Make binding for adi,custom-thermocouple accept signed values.
* maxim,max44000
  - Add OF Device matching (of_match_table was not correctly set).
* maxim,max5522
  - Missing static
* measurement-computing,cio-dac
  - Fix wrong part name in comments.
  - Migrate to regmap.
  - Improve includes by replacing bitops.h with more direct bits.h
* qcom,pm8xxx-xoadc
  - Remove a check that can never fail.
* renesas,rcar-gyroadc
  - DT binding documentation improvements.
  - Tidy up an unused warning with __maybe_unused.
* semtech,sx_common
  - Drop docs for a structure element that doesn't exist.
* semtech,sx9500
  - Drop ACPI_PTR() and of_match_ptr() protections that just complicate
    the code / block some firmware registration types that would otherwise
    work.
* sensiron,sps30
  - Comment formatting tidy up.
* st,sensors
  - Drop duplicate text in DT binding.
* st,stm32-adc
  - Add some missing static markings.
* ti,ads1100
  - Use correct return code in dev_err_probe() call.
* x-powers,axp20x_adc - precursor series to simplify addition of AXP192.
  - General code cleanup / minor refactoring for better readabilty of code.
  - Switch from boolean value to mask for adc_en2 field to avoid hard coding
    a mask that will be different in AXP192

* tag 'iio-for-6.4a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (63 commits)
  MAINTAINERS: Add ROHM BU27034
  iio: light: ROHM BU27034 Ambient Light Sensor
  dt-bindings: iio: light: Support ROHM BU27034
  MAINTAINERS: Add IIO gain-time-scale helpers
  iio: light: Add gain-time-scale helpers
  doc: Make sysfs-bus-iio doc more exact
  iio: dac: set variable max5522_channels storage-class-specifier to static
  dt-bindings: iio: temperature: ltc2983: Make 'adi,custom-thermocouple' signed
  dt-bindings: iio: temperature: ltc2983: Fix child node unevaluated properties
  iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll
  iio: addac: stx104: Migrate to the regmap API
  iio: addac: stx104: Improve indentation in stx104_write_raw()
  iio: addac: stx104: Use define rather than hardcoded limit for write val
  iio: addac: stx104: Fix race condition when converting analog-to-digital
  iio: addac: stx104: Fix race condition for stx104_write_raw()
  dt-bindings: iio: st-sensors: Fix repeated text
  staging: iio: resolver: ads1210: fix config mode
  iio: adc: ti-ads1100: fix error code in probe()
  iio: accel: add support for IIS328DQ variant
  dt-bindings: iio: st-sensors: Add IIS328DQ accelerometer
  ...
2023-04-12 09:45:34 +02:00
Greg Kroah-Hartman 4bffd2c7a3 1st set of IIO fixes for 6.3
Usual mixed bag:
 
 - core - output buffers
   Fix return of bytes written when only some succeed.
   Fix O_NONBLOCK handling to not block.
 
 - adi,ad7791
   Fix IRQ type.  Not confirmed to have any impact but good to correct it anyway
 
 - adi,adis16400
   Missing CONFIG_CRC32
 
 - capella,cm32181
   Unregister 2nd I2C client if one is used.
 
 - cio-dac
   Fix bitdepth for range check on write.
 
 - linear,ltc2497
   Fix a wrong shift of the LSB introduced when switching to be24 handling.
 
 - maxim,max11410
   Fix handling of return code in read_poll_timeout()
 
 - qcom,spmi-adc
   Fix an accidental change of channel name to include the reg value from OF.
 
 - ti,palmas
   Fix a null dereference on remove due to wrong function used to get the
   drvdata.
 
 - ti,ads7950
   Mark GPIO as can sleep.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmQgfMMRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoiFqBAAisoI3rSjyelYy4+EfafRPFzzyGQPhuUk
 UYgjzhXfBVIRvAtjqM/tgWSXoFHEWZznC07Kelz8ErXrDkTEIR10YnqaQ1OoH57c
 58Es93Y0+W5xnHyNuNc36+fAjgSARFDRkD84utu4Q7sxrLDN18f2CpYspC0XAVG5
 4RXXl8W9RXQ+0hcLQIYwXtwl1fdThPqtAOLj4/0awNPdPnsg5ZWrgzK8yfS2IJwz
 M7ilBlkey1K6F+7KhmmGz6IRxsE1zCzAh8AzvIcQYIT5zgYi2xYZg1rAaSCyd4ti
 kR1sieDyWx9sAWunprfC64uCjXvze50lpXxa0CLRK9estrcEyKcAC/ZtVD+5MF9g
 NlD2IrlJ78ol0TrWjK5QKMED0BaNetxO2cCZNBnyX99ESsUJCXHlSyUYkHHt0p3e
 /myd8ap5T8B/6yiqT5uxnZFvxPLmJ17Cm9vtONf0X/H6Dpaf7B+otjjecNiSKV+w
 9careBV3EU0D2upGpkuD4Dfc2H+NJzaAeTbtKjo7mkUgdpluhTlgRYnG/w85z2Tk
 8KSlMcrGUfBbxi4R3WrJkXeHZIRto+YDeH+uzr7BvAHc5nPCY9LGxS9TE/Mosr+A
 ncBIm/yoPItO7G0xDpknVjI0k2ncbo6zwd798VO7Xx1UIvRd4It/FSjXQsHS/wU0
 T2XPtIBpGPM=
 =8wF1
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-6.3a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus

Jonathan writes:

1st set of IIO fixes for 6.3

Usual mixed bag:

- core - output buffers
  Fix return of bytes written when only some succeed.
  Fix O_NONBLOCK handling to not block.

- adi,ad7791
  Fix IRQ type.  Not confirmed to have any impact but good to correct it anyway

- adi,adis16400
  Missing CONFIG_CRC32

- capella,cm32181
  Unregister 2nd I2C client if one is used.

- cio-dac
  Fix bitdepth for range check on write.

- linear,ltc2497
  Fix a wrong shift of the LSB introduced when switching to be24 handling.

- maxim,max11410
  Fix handling of return code in read_poll_timeout()

- qcom,spmi-adc
  Fix an accidental change of channel name to include the reg value from OF.

- ti,palmas
  Fix a null dereference on remove due to wrong function used to get the
  drvdata.

- ti,ads7950
  Mark GPIO as can sleep.

* tag 'iio-fixes-for-6.3a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: adc: ti-ads7950: Set `can_sleep` flag for GPIO chip
  iio: adc: palmas_gpadc: fix NULL dereference on rmmod
  iio: adc: max11410: fix read_poll_timeout() usage
  iio: dac: cio-dac: Fix max DAC write value check for 12-bit
  iio: light: cm32181: Unregister second I2C client if present
  iio: accel: kionix-kx022a: Get the timestamp from the driver's private data in the trigger_handler
  iio: adc: ad7791: fix IRQ flags
  iio: buffer: make sure O_NONBLOCK is respected
  iio: buffer: correctly return bytes written in output buffers
  iio: light: vcnl4000: Fix WARN_ON on uninitialized lock
  iio: adis16480: select CONFIG_CRC32
  drivers: iio: adc: ltc2497: fix LSB shift
  iio: adc: qcom-spmi-adc5: Fix the channel name
2023-03-28 13:30:55 +02:00
Lorenzo Bianconi 18462d0801 iio: imu: st_lsm6dsx: add support to ASM330LHB
Add support to STM ASM330LHB (acc + gyro) automotive Mems sensor.
The ASM330LHB sensor can use ASM330LHH as fallback device since it
implements all the ASM330LHB features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/asm330lhb.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/a1d675457da7aa9e979d8cabea410e942e015e71.1678100533.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-03-12 15:56:44 +00:00
Amit Kumar Mahapatra 0183f81fce
iio: imu: Replace all spi->chip_select and spi->cs_gpiod references with function call
Supporting multi-cs in spi drivers would require the chip_select & cs_gpiod
members of struct spi_device to be an array. But changing the type of these
members to array would break the spi driver functionality. To make the
transition smoother introduced four new APIs to get/set the
spi->chip_select & spi->cs_gpiod and replaced all spi->chip_select and
spi->cs_gpiod references with get or set API calls.
While adding multi-cs support in further patches the chip_select & cs_gpiod
members of the spi_device structure would be converted to arrays & the
"idx" parameter of the APIs would be used as array index i.e.,
spi->chip_select[idx] & spi->cs_gpiod[idx] respectively.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230310173217.3429788-4-amit.kumar-mahapatra@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-11 12:34:03 +00:00
Lorenzo Bianconi db3c490503 iio: imu: st_lsm6dsx: discard samples during filters settling time
During digital filters settling time the driver is expected to drop
samples since they can be corrupted. Introduce the capability to drop
a given number of samples according to the configured ODR.
Add sample_to_discard for LSM6DSM-like sensors since new generation
devices (e.g. LSM6DSO) support DRDY mask where corrupted samples are
masked in hw with values greather than 0x7ffd so the driver can easily
discard them.
I have not added sample_to_discard support for LSM6DS3 or LSM6DS3H since
I do not have any sample for testing at the moment.

Reported-by: Philippe De Muyter <phdm@macqel.be>
Tested-by: Philippe De Muyter <phdm@macqel.be>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/21dcd94935c147ef9b1da4984b3da6264ee9609e.1677496295.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-03-11 12:18:29 +00:00
Nuno Sá e2b39db176 iio: imu: adis16475: correct copy paste mistake in comment block
The minimal advised lower rate for adis16475 compatible devices is
1900HZ and not 4000HZ. Set that right in the comments so that it does
not generate any confusion.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230213153208.1027602-1-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-03-11 12:18:28 +00:00
Greg Kroah-Hartman d38e781ea0 Linux 6.2-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmPgG/geHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGidAH/j0pUbmniNM3aft8
 5O1XxltlOZgqxju8OQhkiuX9VnQuuSeTNhAuj6jfcQOLpXDvlKsVfrpBxEfXalML
 yead9QAy/OT3hNGQxifMQzGbsmaWH1kgxxnv2lKo2eNP5KYZ+rec+IgtQhgX9quN
 q/N/ymd2/ju9AEOVRYwG1PD1EiIwTd3xPfBZl4Z35J+Ym+6NRrlXmN6J9LwslXmJ
 /P4cwgdf9/TuYAB96EshRHsZ4Tk/Gxkn15uyhLaWBmrZ/LAF5JGbClEfFlCWgjwv
 F5SGv3F+O6HSv49W9a24XtenE+3tw78AbCdqKZyzbb2whhv1eY99vKSbGnCahc/y
 O0VBP/g=
 =YoPk
 -----END PGP SIGNATURE-----

Merge 6.2-rc7 into char-misc-next

We need the char-misc driver fixes in here as other patches depend on
them.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-06 08:35:30 +01:00
Arnd Bergmann d9b540ee46 iio: adis16480: select CONFIG_CRC32
In rare randconfig builds, the missing CRC32 helper causes
a link error:

ld.lld: error: undefined symbol: crc32_le
>>> referenced by usercopy_64.c
>>>               vmlinux.o:(adis16480_trigger_handler)

Fixes: 941f130881 ("iio: adis16480: support burst read function")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230131094616.130238-1-arnd@kernel.org
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-02-02 17:01:37 +00:00
Tom Rix c612bcb75f iio: imu: fix spdx format
checkpatch reports
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
FILE: drivers/iio/imu/bno055/bno055_ser_trace.c:1:
+//SPDX-License-Identifier: GPL-2.0

Add a space

Fixes: 2eef5a9cc6 ("iio: imu: add BNO055 serdev driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230124194301.656518-1-trix@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-28 16:22:46 +00:00
Philippe De Muyter d354a2ee39 iio: imu: st_lsm6dsx: add 'mount_matrix' sysfs entry to gyro channel.
Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/1673874434-30750-3-git-send-email-Philippe.DeMuyter@macq.eu
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-21 18:17:25 +00:00
Philippe De Muyter 677a33b51f iio: imu: st_lsm6dsx: fix naming of 'struct iio_info' in st_lsm6dsx_shub.c.
We need the name 'st_lsm6dsx_ext_info' for the actual 'iio_chan_spec_ext_info'.
Rename the 'st_lsm6dsx_ext_info' in st_lsm6dsx_shub.c to 'st_lsm6dsx_shub_info'.
For consistency, replace also 'ext' by 'shub' in 'st_lsm6dsx_ext_attributes'
and 'st_lsm6dsx_ext_attribute_group'.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/1673874434-30750-2-git-send-email-Philippe.DeMuyter@macq.eu
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-21 18:17:25 +00:00
Carlos Song 2acd031347 iio: imu: fxos8700: fix MAGN sensor scale and unit
+/-1200uT is a MAGN sensor full measurement range. Magnetometer scale
is the magnetic sensitivity parameter. It is referenced as 0.1uT
according to datasheet and magnetometer channel unit is Gauss in
sysfs-bus-iio documentation. Gauss and uTesla unit conversion
relationship as follows: 0.1uT = 0.001Gs.

Set magnetometer scale and available magnetometer scale as fixed 0.001Gs.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20230118074227.1665098-5-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-21 18:15:19 +00:00
Carlos Song ff5e2cd92f iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN
FXOS8700_CTRL_ODR_MIN is not used but value is probably wrong.

Remove it for a good readability.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20230118074227.1665098-4-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-21 18:15:09 +00:00
Carlos Song eb6d8f8705 iio: imu: fxos8700: fix failed initialization ODR mode assignment
The absence of correct offset leads a failed initialization ODR mode
assignment.

Select MAX ODR mode as the initialization ODR mode by field mask and
FIELD_PREP.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20230118074227.1665098-3-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-21 18:14:59 +00:00
Carlos Song 78ad6864e9 iio: imu: fxos8700: fix incorrect ODR mode readback
The absence of a correct offset leads an incorrect ODR mode
readback after use a hexadecimal number to mark the value from
FXOS8700_CTRL_REG1.

Get ODR mode by field mask and FIELD_GET clearly and conveniently.
And attach other additional fix for keeping the original code logic
and a good readability.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20230118074227.1665098-2-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-21 18:14:48 +00:00
Vladimir Oltean c9c1d6d820 iio: imu: st_lsm6dsx: fix build when CONFIG_IIO_TRIGGERED_BUFFER=m
The following kernel linkage error:

st_lsm6dsx_core.o: in function `st_lsm6dsx_sw_buffers_setup':
st_lsm6dsx_core.c:2578: undefined reference to `devm_iio_triggered_buffer_setup_ext'

is caused by the fact that the object owning devm_iio_triggered_buffer_setup_ext()
(drivers/iio/buffer/industrialio-triggered-buffer.o) is allowed to be
built as module when its user (drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c)
is built-in.

The st_lsm6dsx driver already has a "select IIO_BUFFER", so add another
select for IIO_TRIGGERED_BUFFER, to make that option follow what is set
for the st_lsm6dsx driver. This is similar to what other iio drivers do.

Fixes: 2cfb2180c3 ("iio: imu: st_lsm6dsx: introduce sw trigger support")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20230103130348.1733467-1-vladimir.oltean@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-01-08 12:14:45 +00:00
Carlos Song 9d61c18205 iio: imu: fxos8700: fix ACCEL measurement range selection
When device is in active mode, it fails to set an ACCEL full-scale
range(2g/4g/8g) in FXOS8700_XYZ_DATA_CFG. This is not align with the
datasheet, but it is a fxos8700 chip behavior.

Keep the device in standby mode before setting ACCEL full-scale range
into FXOS8700_XYZ_DATA_CFG in chip initialization phase and setting
scale phase.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20221208071911.2405922-6-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:20:04 +00:00
Carlos Song a53f945879 iio: imu: fxos8700: fix IMU data bits returned to user space
ACCEL output data registers contain the X-axis, Y-axis, and Z-axis
14-bit left-justified sample data and MAGN output data registers
contain the X-axis, Y-axis, and Z-axis 16-bit sample data. The ACCEL
raw register output data should be divided by 4 before sent to
userspace.

Apply a 2 bits signed right shift to the raw data from ACCEL output
data register but keep that from MAGN sensor as the origin.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20221208071911.2405922-5-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:20:04 +00:00
Carlos Song 37a94d86d7 iio: imu: fxos8700: fix incomplete ACCEL and MAGN channels readback
The length of ACCEL and MAGN 3-axis channels output data is 6 byte
individually. However block only read 3 bytes data into buffer from
ACCEL or MAGN output data registers every time. It causes an incomplete
ACCEL and MAGN channels readback.

Set correct value count for regmap_bulk_read to get 6 bytes ACCEL and
MAGN channels readback.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20221208071911.2405922-4-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:20:04 +00:00
Carlos Song c68b44bc7d iio: imu: fxos8700: fix swapped ACCEL and MAGN channels readback
Because ACCEL and MAGN channels data register base address is
swapped the accelerometer and magnetometer channels readback is
swapped.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20221208071911.2405922-3-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:20:04 +00:00
Carlos Song 429e1e8ec6 iio: imu: fxos8700: fix map label of channel type to MAGN sensor
FXOS8700 is an IMU sensor with ACCEL sensor and MAGN sensor.
Sensor type is indexed by corresponding channel type in a switch.
IIO_ANGL_VEL channel type mapped to MAGN sensor has caused confusion.

Fix the mapping label of "IIO_MAGN" channel type instead of
"IIO_ANGL_VEL" channel type to MAGN sensor.

Fixes: 84e5ddd5c4 ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20221208071911.2405922-2-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:20:03 +00:00
Colin Ian King 5d1c74b155 iio: imu: kmx61: Fix spelling mistake "Errow" -> "Error"
There is a spelling mistake in a dev_err message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20221209233202.222083-1-colin.i.king@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-12-28 17:19:46 +00:00
Greg Kroah-Hartman 75621ae307 2nd set of IIO new device support, cleanups etc for 6.2
Includes a few late breaking fixes for old issues.
 
 Contains a large set of conversions from i2c probe() to probe_new()
 as part of an attempt to finally get rid of the old style probe().
 
 New devices support
 * adi,ad74115
   - New driver for this complex input/output device with 16 bit ADCs,
     14 bit DACs amongst other features.
   - A few tidy ups / removal of unused data patches followed.
 * adi,adf4377
   - New driver for this dual output integer-N phased locked loop and VCO
     chip.
 * maxim,max30208
   - New driver for this high accuracy digital temperature sensor.
 * st,lsm6dsx
   - Support for LSM6DS016IS (chip specific data)
   - Support for ISM330IS (id entry only)
 
 Minor cleanups etc
 * adi,adis
   - Fix a deadlock on device instance specific mutex.
   - Tidy up by calling unlocked form of __adis_initial_startup() in all
     cases and dropping the locked version.
 * adi,ad4130
   - Reference spi-peripehral-props.yaml in the dt-binding.
 * adi,ad74413r
   - Fix a bug brought on by integer promotion of signed value to unsigned type.
   - Add an spi_device_id table to allow module autoloading to work.
   - Add support for reset pin.
 * adi,ad7606_par
   - devm_platform_get_and_ioremap_resource() instead of opencoding.
 * adi,ad7923
   - Add dt-bindings docs for ad7927 via a fallback to ad7928 and do similar
     for ad7924.
 * adi,ltc2983
   - Drop a now unneeded $ref for -nanoamp property as dt-schema no covers this
     unit.
 * maxim,max11410
   - Fix mask due to repeated use of VREFN instead of one of them being VREFP.
 * qcom,spmi-iadc
   - Add fallback compatibles to dt-binding.
 * renesas,rzg2l
   - Document use for RZ/Five SoC.
 * st,stm32-adc
   - Improved calibration support with error logging and a debugfs
     interface to read back the result.
 * ti,adc128s052
   - Fix an issue with missing data members in the adc128_of_match table that
     meant all device were being handled as adc128s052 ADCs.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmOCXq8RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoiLcBAArDMAWec2CUMnbiRqoXKnjuGy1ruTD2mA
 qQgmnR60koLxQ6Fhl9HDFpfqcQnKszCUGYyrhHhOwFBl1s7MdPrZ5yHWWJw4ie8w
 EyEPoRk9K8Qcc9anrl3IFjhjtrj/cY8FBLKkFDl9x5xaEkTeaNPLkjf8YPez3y0f
 YxdpwKWgxAxsS2xCEd4E4bHye2XLs4B3MXgb6buE2eHvNCrXUMSXuPMw33PbMym/
 sAqlNzr/Q+W28QSkzXjAhK3s8jd5KxavtAUMZROoUhBc0Wvw2Jln+pC2i/APMGTN
 Z6VkRk7wkRViwzcBFjkis+vnK1xFaPWHkjHQrS68IHhSjw6obYeNe2T/upWuJBQ+
 pGfUr2UwOAjLaqXE3vQjCae0AcS8Tf1Oa/ZMKAAyBcVsdZRdgIRx5qtxeHHWHWGJ
 XKZGeZohHPlCZkYqhTEvkJVknKDM1heQNh0e43P3GajprfSqoRvWUL6mbtAjYKNF
 TvHACNQ+ru8NdmC9c1dVEhZOnHZ82mnus5/fEFLsaeu/bxyvhablp3ANp++rqAPx
 UnCM4W3tWHZ/HjdsHN3PjaW0e53LUO8Yy01mktmVO4NsOoGl3X//uoRYPnQchFbs
 AStMr/ojGg2duZgwQm0JBva3wBlATdCEHKGRZ4fYoB7bXsHq6gzJCnBpjyRt1vRG
 kHpSBNiOvVk=
 =AUOr
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-6.2b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

2nd set of IIO new device support, cleanups etc for 6.2

Includes a few late breaking fixes for old issues.

Contains a large set of conversions from i2c probe() to probe_new()
as part of an attempt to finally get rid of the old style probe().

New devices support
* adi,ad74115
  - New driver for this complex input/output device with 16 bit ADCs,
    14 bit DACs amongst other features.
  - A few tidy ups / removal of unused data patches followed.
* adi,adf4377
  - New driver for this dual output integer-N phased locked loop and VCO
    chip.
* maxim,max30208
  - New driver for this high accuracy digital temperature sensor.
* st,lsm6dsx
  - Support for LSM6DS016IS (chip specific data)
  - Support for ISM330IS (id entry only)

Minor cleanups etc
* adi,adis
  - Fix a deadlock on device instance specific mutex.
  - Tidy up by calling unlocked form of __adis_initial_startup() in all
    cases and dropping the locked version.
* adi,ad4130
  - Reference spi-peripehral-props.yaml in the dt-binding.
* adi,ad74413r
  - Fix a bug brought on by integer promotion of signed value to unsigned type.
  - Add an spi_device_id table to allow module autoloading to work.
  - Add support for reset pin.
* adi,ad7606_par
  - devm_platform_get_and_ioremap_resource() instead of opencoding.
* adi,ad7923
  - Add dt-bindings docs for ad7927 via a fallback to ad7928 and do similar
    for ad7924.
* adi,ltc2983
  - Drop a now unneeded $ref for -nanoamp property as dt-schema no covers this
    unit.
* maxim,max11410
  - Fix mask due to repeated use of VREFN instead of one of them being VREFP.
* qcom,spmi-iadc
  - Add fallback compatibles to dt-binding.
* renesas,rzg2l
  - Document use for RZ/Five SoC.
* st,stm32-adc
  - Improved calibration support with error logging and a debugfs
    interface to read back the result.
* ti,adc128s052
  - Fix an issue with missing data members in the adc128_of_match table that
    meant all device were being handled as adc128s052 ADCs.

* tag 'iio-for-6.2b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (178 commits)
  iio: addac: ad74413r: fix blank line after declaration warning
  iio: addac: ad74115: remove unused ad74115_dac_slew_rate_hz_tbl
  dt-bindings: iio: imu: st_lsm6dsx: add ism330is
  iio: imu: st_lsm6dsx: add support to ISM330IS
  iio: frequency: adf4377: add support for ADF4377
  dt-bindings: iio: frequency: add adf4377 doc
  dt-bindings: iio: adc: ad4130: use spi-peripheral-props.yaml
  dt-bindings: iio: temperature: ltc2983: drop $ref for -nanoamp properties
  dt-bindings: iio: adc: renesas,rzg2l-adc: Document RZ/Five SoC
  iio: adc128s052: add proper .data members in adc128_of_match table
  iio: adc: stm32-adc: add debugfs to read raw calibration result
  iio: adc: stm32-adc: improve calibration error log
  iio: adc: stm32-adc: smart calibration support
  iio: addac: ad74413r: add support for reset-gpio
  dt-bindings: iio: ad74413r: add optional reset-gpios
  iio: addac: ad74413r: add spi_device_id table
  dt-bindings: iio/adc: qcom,spmi-iadc: use double compatibles
  dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is
  iio: imu: st_lsm6dsx: add support to LSM6DSO16IS
  iio: addac: add AD74115 driver
  ...
2022-11-27 14:40:05 +01:00
Greg Kroah-Hartman 56d784d177 1st set of IIO new device support, feature and cleanup for 6.2 (take2)
We have finally managed to take the mlock mutex entirely private so as
 to avoid it being used for multiple purposes.  Now it is just used to
 protect device mode transitions (typically to and from buffered capture).
 
 Includes merge of an immutable i2c branch to get the new
 i2c_client_get_device_id() (thanks to Wolfram for providing the branch).
 
 Based on rc3 to pick up some precursor fixes from early in the cycle and
 avoid an unnecessarily messy history.
 
 New device support
 * adi,ad4310
   - New driver to support this very flexible measurement device including
     a 24 bit ADC. Later fix for documentation build issue.
 * adi,adxl355
   - Add support of the ADXL359 accelerometer.
 * adi,ltc2983
   - Support additional variants of the temperatures sensor:
     LTC2984 with an EEPROM
     LTC2985, LTC2986 with only 10 channels.
 * invensense,icm42600
   - Add support for icm42631 (needed only ID and WHOAMI)
 * kionix,kx022a
   - New driver for this 3 axis accelerometer.
 * maxim,max11401
   - New driver to support this 24-bit 10 channel ADC.
     Includes some new ABI to support configuration of notch filters.
 * mediatek,mt6370
   - Add new driver to support the ADC part of the mt6370.
 * st,lsm6dsx
   - Add support for LSM6DSV accelerometer and gyroscope. Simple additional
     of chip specific data and IDs.
   - Add support for LSM6DSV16X accelerometer and gyroscope.  Compatible with
     features currently implemented for the LSM6DSV.
 * st,stm32-adc
   - Add support for stm32pm13x SoCs.
 
 core / subsystem wide:
  - Add new IIO_STATIC_CONST_DEVICE_ATTR() which is a dance necessary to
    allow for the wrapping of attributes in the code that duplicates them
    for multiple buffers.
  - Harden against future issues with expectation that all buffer attributes
    are iio_dev_attrs by changing the code to take an array of pointers
    of the correct type.
  - Last transitions of drivers to local locks rather than missuses of mlock.
  - Add an iio_device_claim_buffer_mode() callback to avoid a race in the
    max30100 driver without directly using mlock.
  - Move mlock to the opaque IIO device structure to prevent misuse.
  - Add missing spi_device_id tables to support auto loading of modules.
  - Update some ADI maintainers in DT bindings.
  - A few more moves of bus drivers and core module sets to export
    name spaces.
  - Extensive use of new devm_regulator_get_enable() and friends.
  - Switch a bunch of i2c drivers to probe_new() including the bmp280
    which makes use of the new i2c_client_get_device_id() helper to
    simplify this change.
 
 dt-bindings:
  - More use of spi-peripheral-props.yaml.
 
 Features
 * freescale,mpl115
   - Use runtime PM to implement shutdown GPIO support.
 * melexis,mlx90632
   - More sophisticated runtime power management
   - Provide access to sampling frequency.
   - Trivial follow up fixes.
 * microchip,mcp3911
   - Support control of PGA.
 * st,lsm6dsx
   - Add support for software triggers for cases where the IRQ lines
     are not wired up.
 * vishay,vcnl4000
   - Add control of integration time.
 
 Minor cleanups and fixes
 * adi,ad4130
   - Improve ABI documentation formatting.
   - Kconfig dependency fixup.
 * adi,ad5758
   - Minor dt binding fix.
 * adi,ad9834
   - Tidy up line breaks.
 * adi,ade7854
   - Minor improvement in code clarity by replacing a ternary.
 * adi,admv8818
   - Harden code against hardware returning wrong values.
 * adi,adxl355
   - Warn only if unknown device ID detected to allow for fall back
     device tree compatibles on future devices.
 * adi,ltc2983
   - dt-bindings clarifications and general improvements.
   - Ensure DMA safe buffer for bulk writes without relying on current
     regmap implementation choices.
 * avago,adps9960
   - Fix up a disconnect between event enable attributes and what was
     enabled.
 * bosch,bma400
   - Switch to dev_err_probe() from open coded EPROBE_DEFER handling.
 * cosmic,cc10001
   - Fully devm managed probe() and related tidying up.
 * meas,ms5611
   - Add an example of spi-max-frequency.
 * meleixs,mlx90632
   - Tidy up confusing error return value.
   - Style improvements.
 * multiplexer
   - Switch to dev_err_probe() from open coded EPROBE_DEFER handling.
 * qcom,spmi-vadc
   - Minor dt binding improvements.
 * rockchip,saradc
   - Add ID for rv1126.
 * semtech,sx9360
   - Add SAMM0208 ACPI ID. Doesn't appear to be a valid vendor prefix
     but is in the wild.
 * st,lsm6dsx
   - Factor out common code as _device_set_enable().
   - Fix up wrong docs after LSM6DSV addition.
 * st,stm32-adc
   - Manage the min sampling time on all internal channels.
 * trig,sysfs
   - Improve error labels.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmN+fI4RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogY1Q/7BTdKLbRuFoE4aK9AABv+m4w91s+RlBg6
 eXRw3Gt4IHHht7gIUVZByYztyoKkmW3RzsPafIlfJJkWAsiBpv6gXTW2h6UvjHg8
 SW3k91oVk5iLEeTaUSfJqxHCXX+VRYanyeti53MkpUvR2QUgAengP11N6bWmNXav
 D6OFGSTn9QpJ0XRmEmfxXt3pt/Miuz7GT2sN5ut1ZvTgN0wZ2aMMdEa8w3UQvxoN
 +Iu0Z3kRtltbw5zqTTdJfXPHS3K1I+361zTT6E4KDVun2939C3Tzw6ziy6MIsng+
 nysaMbZTc5MmdIDPYtSlIV+i4S4DyqvAKsv5PBqqbD3oQfo8AkmnyY6Hdygbv23O
 vK23x19GYcpgLQ42C0g+LFUYxJOJMnMiOocISq8V7Df9+CQRNnk4e7s8MvmhAXmu
 VrOT1VDEL8bJFeukiMRtVTsDo/KRHOWUjEi+1dxJ7aOqry8FGrlR4L+ZtjbMTnmw
 V+7CN0euOdpiDV6jJwmXHQvLWlG3wgq7ZHHj6toaFtq8FI4OaQiA7Ko5WuBLTBxw
 V0jtK/Fru77P0aR7dAd5ck6Rwek8N2rSuOvpucLmImt9asZP3uzoM/LRmtv4Gzjq
 Dp8koqSwx6YMtMAHmXgB/2GkSoOV7eByvIkYCoFCxEp2tst+mIOKSQPDKP8PKuRd
 VBSmvuEilis=
 =Fo38
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-6.2a-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, feature and cleanup for 6.2 (take2)

We have finally managed to take the mlock mutex entirely private so as
to avoid it being used for multiple purposes.  Now it is just used to
protect device mode transitions (typically to and from buffered capture).

Includes merge of an immutable i2c branch to get the new
i2c_client_get_device_id() (thanks to Wolfram for providing the branch).

Based on rc3 to pick up some precursor fixes from early in the cycle and
avoid an unnecessarily messy history.

New device support
* adi,ad4310
  - New driver to support this very flexible measurement device including
    a 24 bit ADC. Later fix for documentation build issue.
* adi,adxl355
  - Add support of the ADXL359 accelerometer.
* adi,ltc2983
  - Support additional variants of the temperatures sensor:
    LTC2984 with an EEPROM
    LTC2985, LTC2986 with only 10 channels.
* invensense,icm42600
  - Add support for icm42631 (needed only ID and WHOAMI)
* kionix,kx022a
  - New driver for this 3 axis accelerometer.
* maxim,max11401
  - New driver to support this 24-bit 10 channel ADC.
    Includes some new ABI to support configuration of notch filters.
* mediatek,mt6370
  - Add new driver to support the ADC part of the mt6370.
* st,lsm6dsx
  - Add support for LSM6DSV accelerometer and gyroscope. Simple additional
    of chip specific data and IDs.
  - Add support for LSM6DSV16X accelerometer and gyroscope.  Compatible with
    features currently implemented for the LSM6DSV.
* st,stm32-adc
  - Add support for stm32pm13x SoCs.

core / subsystem wide:
 - Add new IIO_STATIC_CONST_DEVICE_ATTR() which is a dance necessary to
   allow for the wrapping of attributes in the code that duplicates them
   for multiple buffers.
 - Harden against future issues with expectation that all buffer attributes
   are iio_dev_attrs by changing the code to take an array of pointers
   of the correct type.
 - Last transitions of drivers to local locks rather than missuses of mlock.
 - Add an iio_device_claim_buffer_mode() callback to avoid a race in the
   max30100 driver without directly using mlock.
 - Move mlock to the opaque IIO device structure to prevent misuse.
 - Add missing spi_device_id tables to support auto loading of modules.
 - Update some ADI maintainers in DT bindings.
 - A few more moves of bus drivers and core module sets to export
   name spaces.
 - Extensive use of new devm_regulator_get_enable() and friends.
 - Switch a bunch of i2c drivers to probe_new() including the bmp280
   which makes use of the new i2c_client_get_device_id() helper to
   simplify this change.

dt-bindings:
 - More use of spi-peripheral-props.yaml.

Features
* freescale,mpl115
  - Use runtime PM to implement shutdown GPIO support.
* melexis,mlx90632
  - More sophisticated runtime power management
  - Provide access to sampling frequency.
  - Trivial follow up fixes.
* microchip,mcp3911
  - Support control of PGA.
* st,lsm6dsx
  - Add support for software triggers for cases where the IRQ lines
    are not wired up.
* vishay,vcnl4000
  - Add control of integration time.

Minor cleanups and fixes
* adi,ad4130
  - Improve ABI documentation formatting.
  - Kconfig dependency fixup.
* adi,ad5758
  - Minor dt binding fix.
* adi,ad9834
  - Tidy up line breaks.
* adi,ade7854
  - Minor improvement in code clarity by replacing a ternary.
* adi,admv8818
  - Harden code against hardware returning wrong values.
* adi,adxl355
  - Warn only if unknown device ID detected to allow for fall back
    device tree compatibles on future devices.
* adi,ltc2983
  - dt-bindings clarifications and general improvements.
  - Ensure DMA safe buffer for bulk writes without relying on current
    regmap implementation choices.
* avago,adps9960
  - Fix up a disconnect between event enable attributes and what was
    enabled.
* bosch,bma400
  - Switch to dev_err_probe() from open coded EPROBE_DEFER handling.
* cosmic,cc10001
  - Fully devm managed probe() and related tidying up.
* meas,ms5611
  - Add an example of spi-max-frequency.
* meleixs,mlx90632
  - Tidy up confusing error return value.
  - Style improvements.
* multiplexer
  - Switch to dev_err_probe() from open coded EPROBE_DEFER handling.
* qcom,spmi-vadc
  - Minor dt binding improvements.
* rockchip,saradc
  - Add ID for rv1126.
* semtech,sx9360
  - Add SAMM0208 ACPI ID. Doesn't appear to be a valid vendor prefix
    but is in the wild.
* st,lsm6dsx
  - Factor out common code as _device_set_enable().
  - Fix up wrong docs after LSM6DSV addition.
* st,stm32-adc
  - Manage the min sampling time on all internal channels.
* trig,sysfs
  - Improve error labels.

* tag 'iio-for-6.2a-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (146 commits)
  iio: pressure: bmp280: convert to i2c's .probe_new()
  iio: imu: st_lsm6dsx: fix LSM6DSV sensor description
  iio: adc: ad4130: depend on GPIOLIB
  staging: iio: meter: replace ternary operator by if condition
  iio: light: apds9960: Fix iio_event_spec structures
  dt-bindings: iio: imu: Add inv_icm42600 documentation
  iio: imu: inv_icm42600: Add support for icm42631
  dt-bindings: iio: adc: rockchip-saradc: Add saradc for rv1126
  dt-bindings: iio: dac: adi,ad5758: Drop 'contains' from 'adi,dc-dc-mode'
  dt-bindings: iio: imu: st_lsm6dsx: add lsm6dsv16x
  iio: imu: st_lsm6dsx: add support to LSM6DSV16X
  iio: proximity: sx9360: Add a new ACPI hardware ID
  iio: temperature: mlx90632: Add missing static marking on devm_pm_ops
  iio: temperature: mlx90632: Add error handling for devm_pm_runtime_enable()
  iio: temperature: ltc2983: support more parts
  dt-bindings: iio: temperature: ltc2983: support more parts
  dt-bindings: iio: temperature: ltc2983: use generic node name in example
  dt-bindings: iio: temperature: ltc2983: describe broken mux delay property
  dt-bindings: iio: temperature: ltc2983: refine descriptions
  dt-bindings: iio: temperature: ltc2983: change default excitation for custom thermistors
  ...
2022-11-25 18:35:16 +01:00
Lorenzo Bianconi 3a042fda88 iio: imu: st_lsm6dsx: add support to ISM330IS
Add support to STM ISM330IS (accelerometer and gyroscope) Mems sensor.
The ISM330IS sensor can use LSM6DSO16IS as fallback device since it
implements all the ISM330IS features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/ism330is.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/4cd1614060e06f49cd92f5930d8fd40117c07920.1669279604.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-24 19:23:23 +00:00
Lorenzo Bianconi f35e1ee9cb iio: imu: st_lsm6dsx: add support to LSM6DSO16IS
Add support to STM LSM6DSO16IS (accelerometer and gyroscope) Mems sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dso16is.pdf
Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/df6a9d4653cd69f7204190f8b6a9b618fd48bd23.1668605631.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:50:37 +00:00
Ramona Bolboaca 40fd61b069 iio: imu: adis16400: Call '__adis_initial_startup()' in probe
Call '__adis_initial_startup()' instead of its locked variant in
'adis16400_probe()'.
The locks are not needed at this point.

Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20221122082757.449452-7-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:37:51 +00:00
Ramona Bolboaca 99c05e4283 iio: adis: add '__adis_enable_irq()' implementation
Add '__adis_enable_irq()' implementation which is the unlocked
version of 'adis_enable_irq()'.
Call '__adis_enable_irq()' instead of 'adis_enable_irq()' from
'__adis_intial_startup()' to keep the expected unlocked functionality.

This fix is needed to remove a deadlock for all devices which are
using 'adis_initial_startup()'. The deadlock occurs because the
same mutex is acquired twice, without releasing it.
The mutex is acquired once inside 'adis_initial_startup()', before
calling '__adis_initial_startup()', and once inside
'adis_enable_irq()', which is called by '__adis_initial_startup()'.
The deadlock is removed by calling '__adis_enable_irq()', instead of
'adis_enable_irq()' from within '__adis_initial_startup()'.

Fixes: b600bd7eb3 ("iio: adis: do not disabe IRQs in 'adis_init()'")
Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20221122082757.449452-2-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:37:50 +00:00
Uwe Kleine-König b7dbc0aecb iio: imu: st_lsm6dsx: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-112-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:20:27 +00:00
Uwe Kleine-König 4bf718bc3b iio: imu: kmx61: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-111-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:20:26 +00:00
Uwe Kleine-König 4f218ae01c iio: imu: inv_mpu6050: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-110-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:20:18 +00:00
Uwe Kleine-König 4fee985aaf iio: imu: fxos8700_i2c: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-109-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:01:42 +00:00
Uwe Kleine-König 97202c5504 iio: imu: bmi160/bmi160_i2c: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-108-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:01:42 +00:00
Lorenzo Bianconi d94fbd9231 iio: imu: st_lsm6dsx: fix LSM6DSV sensor description
Fix sensor ODR description for LSM6DSV/LSM6DSVX

Fixes: a1c6d631ff ("iio: imu: st_lsm6dsx: add support to LSM6DSV")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/653e14bf79bb88d8581d2bc42da2f784caaf3776.1668417770.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 20:00:46 +00:00
Jay Greco c896b9f092 iio: imu: inv_icm42600: Add support for icm42631
Add the required WHOAMI and device_id definitions to support the
icm42631.

Signed-off-by: Jay Greco <grecojay@amazon.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20221110192933.13616-2-grecojay@amazon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:58:45 +00:00
Lorenzo Bianconi 46975081f7 iio: imu: st_lsm6dsx: add support to LSM6DSV16X
Add support to STM LSM6DSV16X (accelerometer and gyroscope) Mems sensor.
The LSM6DSV16X sensor can use LSM6DSV as fallback device since it
implements all the LSM6DSV16X features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dsv16x.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/284b251f861dff30c399e5736a843c8e3a497249.1667745215.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:58:44 +00:00
Lorenzo Bianconi a1c6d631ff iio: imu: st_lsm6dsx: add support to LSM6DSV
Add support to STM LSM6DSV (accelerometer and gyroscope)
Mems sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dsv.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/aad879e7af0fe583bbf043a2b93e32fade79fa19.1667216004.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:44:04 +00:00
Lorenzo Bianconi 2cfb2180c3 iio: imu: st_lsm6dsx: introduce sw trigger support
There are some hw configuration where irq0 and/or irq1 pins are not
connected to the SPI or I2C/I3C controller. In order to avoid polling
the output register introduce iio-sw trigger support when irq line is
not available (or hw FIFO is not supported).

Suggested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/93ae6ff1150b531a9d7a4d3d1b1adb8383613717.1666955685.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:44:04 +00:00
Jonathan Cameron 9e855d77b1 iio: st_sensors: core and lsm9ds0 switch to devm_regulator_bulk_get_enable()
These drivers only turns the power on at probe and off via a custom
devm_add_action_or_reset() callback. The two regulators were handled
separately so also switch to bulk registration.
The new devm_regulator_bulk_get_enable() replaces all this boilerplate
code.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20221016163409.320197-8-jic23@kernel.org
2022-11-23 19:44:01 +00:00
Matti Vaittinen 6900cdbfb9 iio: imu: st_lsm6dsx: Simplify using devm_regulator_*get_enable()
Use devm_regulator_bulk_get_enable() instead of open coded bulk-get,
bulk-enable, add-action-to-disable-at-detach - pattern.

A functional change (which seems like a bugfix) is that if
regulator_bulk_get fails, the enable is not attempted.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/876e58428cec056d51070e49eff559e2d7c23b12.1660934107.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:44:00 +00:00
Jonathan Cameron 62bfa12c87 iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace
As these exports are only relevant to core module and users in the
bus specific modules, move them out of the main kernel namespace.

Includes using EXPORT_NS_GPL_DEV_PM_OPS() and the simplifications that
brings by allowing the compiler to remove unused struct dev_pm_ops
and callbacks without needing explicit __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: Linus Walleij <linus.walleij@linaro.org>

--
Dropped Linus' tag as the new patch is significantly different.

v2: Switch to more flexible version of EXPORT* macro from Paul.
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20220925155719.3316280-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:44:00 +00:00
Jonathan Cameron ef5a5ef29c iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace
As these exports are only relevant to core module and users in the
bus specific modules, move them out of the main kernel namespace.

Includes using EXPORT_NS_GPL_DEV_PM_OPS() and the simplifications that
brings by allowing the compiler to remove unused struct dev_pm_ops
and callbacks without needing explicit __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>

--
EXPORT_NS_GPL_DEV_PM_OPS()

v2: Switch to Paul's more flexible version of the
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20220925155719.3316280-5-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:44:00 +00:00
Lorenzo Bianconi cd83c5c100 iio: imu: st_lsm6dsx: introduce st_lsm6dsx_device_set_enable routine
Introduce st_lsm6dsx_device_set_enable utility routine and remove
duplicated code used to enable/disable sensors

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/e3fbe5d4a3bed41130908669f745f78c8505cf47.1665399959.git.lorenzo@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-23 19:43:59 +00:00
Dan Carpenter dd4753f88f iio: imu: bno055: uninitialized variable bug in bno055_trigger_handler()
This bug is basically harmless, although it will trigger a runtime warning
if you use KMSan.  On the first iteration through the loop, the
"best_delta" variable is uninitialized so re-order the condition to
prevent reading uninitialized memory.

Fixes: 4aefe1c2bd ("iio: imu: add Bosch Sensortec BNO055 core driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/Y0kuaO9PQkSQja+A@kili
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-11-01 08:48:13 +00:00
Linus Torvalds a09476668e Char/Misc and other driver changes for 6.1-rc1
Here is the large set of char/misc and other small driver subsystem
 changes for 6.1-rc1.  Loads of different things in here:
   - IIO driver updates, additions, and changes.  Probably the largest
     part of the diffstat
   - habanalabs driver update with support for new hardware and features,
     the second largest part of the diff.
   - fpga subsystem driver updates and additions
   - mhi subsystem updates
   - Coresight driver updates
   - gnss subsystem updates
   - extcon driver updates
   - icc subsystem updates
   - fsi subsystem updates
   - nvmem subsystem and driver updates
   - misc driver updates
   - speakup driver additions for new features
   - lots of tiny driver updates and cleanups
 
 All of these have been in the linux-next tree for a while with no
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCY0GQmA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ylyVQCeNJjZ3hy+Wz8WkPSY+NkehuIhyCIAnjXMOJP8
 5G/JQ+rpcclr7VOXlS66
 =zVkU
 -----END PGP SIGNATURE-----

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

Pull char/misc and other driver updates from Greg KH:
 "Here is the large set of char/misc and other small driver subsystem
  changes for 6.1-rc1. Loads of different things in here:

   - IIO driver updates, additions, and changes. Probably the largest
     part of the diffstat

   - habanalabs driver update with support for new hardware and
     features, the second largest part of the diff.

   - fpga subsystem driver updates and additions

   - mhi subsystem updates

   - Coresight driver updates

   - gnss subsystem updates

   - extcon driver updates

   - icc subsystem updates

   - fsi subsystem updates

   - nvmem subsystem and driver updates

   - misc driver updates

   - speakup driver additions for new features

   - lots of tiny driver updates and cleanups

  All of these have been in the linux-next tree for a while with no
  reported issues"

* tag 'char-misc-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (411 commits)
  w1: Split memcpy() of struct cn_msg flexible array
  spmi: pmic-arb: increase SPMI transaction timeout delay
  spmi: pmic-arb: block access for invalid PMIC arbiter v5 SPMI writes
  spmi: pmic-arb: correct duplicate APID to PPID mapping logic
  spmi: pmic-arb: add support to dispatch interrupt based on IRQ status
  spmi: pmic-arb: check apid against limits before calling irq handler
  spmi: pmic-arb: do not ack and clear peripheral interrupts in cleanup_irq
  spmi: pmic-arb: handle spurious interrupt
  spmi: pmic-arb: add a print in cleanup_irq
  drivers: spmi: Directly use ida_alloc()/free()
  MAINTAINERS: add TI ECAP driver info
  counter: ti-ecap-capture: capture driver support for ECAP
  Documentation: ABI: sysfs-bus-counter: add frequency & num_overflows items
  dt-bindings: counter: add ti,am62-ecap-capture.yaml
  counter: Introduce the COUNTER_COMP_ARRAY component type
  counter: Consolidate Counter extension sysfs attribute creation
  counter: Introduce the Count capture component
  counter: 104-quad-8: Add Signal polarity component
  counter: Introduce the Signal polarity component
  counter: interrupt-cnt: Implement watch_validate callback
  ...
2022-10-08 08:56:37 -07:00