8162 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
6ffc565c24 IIO: 1st set of fixes for 6.13 cycle.
The usual mixed back of fixes for ancient and recent bugs
 
 A number of these were from an audit by Javier Carrasco of places
 we may leak stack data via holes in structures passed to userspace that
 were not explicitly zeroed. Very helpful effort after we found a similar
 bug in review of new code.
 
 This affected:
 - dummy driver
 - kionix,kmx61
 - murrata,zpa2326
 - rockchip,saradc
 - rohm,bh1745
 - veml,vcnl4035
 - ti,ads1119
 - ti,ads8688
 - ti,tmp0006
 
 Other fixes:
 
 core,inkern
 - Underflow fo reference count issue in error path of iio_channel_get_all()
   for devices we haven't yet gotten.
 tests
 - Kconfig typo fix so it's possible to tell what test is being enabled.
 - Check for allocation failures.
 
 adi,ad4695
 - Ensure timing requirement wrt to final clock edge vs next conversion
   signal are met by adding an additional SPI transfer.
 adi,ad7124
 - Ensure channels are disabled at probe to avoid wrong data if channel 0
   is not the first one read.
 adi,ad7173
 - Fix handing of multiple devices by not editing a single static
   structure and instead making a per instance copy.
 adi,ad9467
 - Fix handing of multiple devices by not editing a single static
   structure and instead making a per instance copy.
 adi,ad9832
 - Off by one error on input verification for phase control
 adi,ad9834
 - Off by one error on input verification for phase control.
 atmel,at91
 - In an error path don't use a variable that hasn't been initialized yet.
 invensense,icm42600
 - SPI burst write does not work for some icm426000 chips, disable it.
 - Ensure correct handling of timestamps after resume.
 st,sensors
 - Add back accidentally dropped IIS2MDC compatible in binding doc.
 st,stm32-dfsdm:
 - label property was accidentally made a required property. Make it optional
   again to fix use of older DT.
 ti,ads1119
 - Use a fixed size for the channel data rather than an integer, bringing
   the code inline with the advertised 16 bit channel size and avoiding
   userspace misinterpreting the data.
 ti,ads124s08
 - Use _cansleep gpio calls as no reason to prevent sleeping and it
   was stopping a new board design working (trivial fix).
 ti,ads1298
 - Add a check on failure of devm_kasprintf()
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmdaAfERHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FojDng/+OFybX06zLefGBaCvitsax+JPjnznZc5t
 pHWaCR8Wm5cWeky7fEnYS1uS2mlgAro9HmGCy1MErcDQJZs/sYMN6oMynPwbFr1t
 gtJomIFEewVbR3QXMefW1sYtuYoIBxAJp/Rf8QyHjDZJGKazHi9RwRicFbMB5wQu
 f+ngG7JloaL2uXEjymsmlgOQZwBAQYvGe5hwyh++E0yY/zyf6sO6Cku5h7tiqiy7
 TCV31Q+/43OvC/+pemt+fUmzPh0Y0tHSXDwLXT0dSzm7y2ND57lnHL14MPDZTXCJ
 o1BgYhVBUsLydMs2MCZsv8BtoUln7IoH2gH2pl4fWbye0U4/eL1i+rO4SXDaXXeX
 U48qTHEOE+P1pY3/0NSnOOAfvFnY+hLp+X0G/ZDTcWUXE7QCSwza1JNcTEoEPOm3
 dlltX1FSyu18i4AN71tyJNCUv44jL/uGWp+wbPj8YoMbMGVCRB6QmjT3a3Nux99l
 Js8s+oVLKgzjqtJZYCxgUgwx3bC7MEnrvUMN9F6Awm1C9vbk8sLqo3o4iE+wfUZJ
 t7xAmLYs5+MtiMJUo3+GanvTQUSpLtBsZ3Q1YBfc6O7yf2GCL18TbZad1Y4OQibq
 God5ajeChBrEtUiqOvm4+2Dk5vJcBC9ficp7YhSmyy9iz+rHbkZ4kZhW+KiChYHm
 /UTK9S4uXeQ=
 =r/KU
 -----END PGP SIGNATURE-----

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

Jonathan writes:

IIO: 1st set of fixes for 6.13 cycle.

The usual mixed back of fixes for ancient and recent bugs

A number of these were from an audit by Javier Carrasco of places
we may leak stack data via holes in structures passed to userspace that
were not explicitly zeroed. Very helpful effort after we found a similar
bug in review of new code.

This affected:
- dummy driver
- kionix,kmx61
- murrata,zpa2326
- rockchip,saradc
- rohm,bh1745
- veml,vcnl4035
- ti,ads1119
- ti,ads8688
- ti,tmp0006

Other fixes:

core,inkern
- Underflow fo reference count issue in error path of iio_channel_get_all()
  for devices we haven't yet gotten.
tests
- Kconfig typo fix so it's possible to tell what test is being enabled.
- Check for allocation failures.

adi,ad4695
- Ensure timing requirement wrt to final clock edge vs next conversion
  signal are met by adding an additional SPI transfer.
adi,ad7124
- Ensure channels are disabled at probe to avoid wrong data if channel 0
  is not the first one read.
adi,ad7173
- Fix handing of multiple devices by not editing a single static
  structure and instead making a per instance copy.
adi,ad9467
- Fix handing of multiple devices by not editing a single static
  structure and instead making a per instance copy.
adi,ad9832
- Off by one error on input verification for phase control
adi,ad9834
- Off by one error on input verification for phase control.
atmel,at91
- In an error path don't use a variable that hasn't been initialized yet.
invensense,icm42600
- SPI burst write does not work for some icm426000 chips, disable it.
- Ensure correct handling of timestamps after resume.
st,sensors
- Add back accidentally dropped IIS2MDC compatible in binding doc.
st,stm32-dfsdm:
- label property was accidentally made a required property. Make it optional
  again to fix use of older DT.
ti,ads1119
- Use a fixed size for the channel data rather than an integer, bringing
  the code inline with the advertised 16 bit channel size and avoiding
  userspace misinterpreting the data.
ti,ads124s08
- Use _cansleep gpio calls as no reason to prevent sleeping and it
  was stopping a new board design working (trivial fix).
ti,ads1298
- Add a check on failure of devm_kasprintf()

* tag 'iio-fixes-for-6.13a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (27 commits)
  iio: adc: ti-ads1119: fix sample size in scan struct for triggered buffer
  iio: temperature: tmp006: fix information leak in triggered buffer
  iio: inkern: call iio_device_put() only on mapped devices
  iio: adc: ad9467: Fix the "don't allow reading vref if not available" case
  iio: adc: at91: call input_free_device() on allocated iio_dev
  iio: adc: ad7173: fix using shared static info struct
  iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()
  iio: adc: ti-ads1119: fix information leak in triggered buffer
  iio: pressure: zpa2326: fix information leak in triggered buffer
  iio: adc: rockchip_saradc: fix information leak in triggered buffer
  iio: imu: kmx61: fix information leak in triggered buffer
  iio: light: vcnl4035: fix information leak in triggered buffer
  iio: light: bh1745: fix information leak in triggered buffer
  iio: adc: ti-ads8688: fix information leak in triggered buffer
  iio: dummy: iio_simply_dummy_buffer: fix information leak in triggered buffer
  iio: test: Fix GTS test config
  dt-bindings: iio: st-sensors: Re-add IIS2MDC magnetometer
  iio: adc: ti-ads1298: Add NULL check in ads1298_init
  iio: adc: stm32-dfsdm: handle label as an optional property
  iio: adc: ad4695: fix buffered read, single sample timings
  ...
2024-12-16 16:29:55 +01:00
Linus Torvalds
553c89ec31 24 hotfixes. 17 are cc:stable. 15 are MM and 9 are non-MM.
The usual bunch of singletons - please see the relevant changelogs for
 details.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZ1U/QwAKCRDdBJ7gKXxA
 jnE7AQC0eyNNvaL5pLCIxN/Vmr8YeuWP1dldgI29TjrH/JKjSQEAihZNqVZYjoIT
 Gf7Y+IKnc4LbfAXcTe+MfJFeDexM5AU=
 =U5LQ
 -----END PGP SIGNATURE-----

Merge tag 'mm-hotfixes-stable-2024-12-07-22-39' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
 "24 hotfixes.  17 are cc:stable.  15 are MM and 9 are non-MM.

  The usual bunch of singletons - please see the relevant changelogs for
  details"

* tag 'mm-hotfixes-stable-2024-12-07-22-39' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (24 commits)
  iio: magnetometer: yas530: use signed integer type for clamp limits
  sched/numa: fix memory leak due to the overwritten vma->numab_state
  mm/damon: fix order of arguments in damos_before_apply tracepoint
  lib: stackinit: hide never-taken branch from compiler
  mm/filemap: don't call folio_test_locked() without a reference in next_uptodate_folio()
  scatterlist: fix incorrect func name in kernel-doc
  mm: correct typo in MMAP_STATE() macro
  mm: respect mmap hint address when aligning for THP
  mm: memcg: declare do_memsw_account inline
  mm/codetag: swap tags when migrate pages
  ocfs2: update seq_file index in ocfs2_dlm_seq_next
  stackdepot: fix stack_depot_save_flags() in NMI context
  mm: open-code page_folio() in dump_page()
  mm: open-code PageTail in folio_flags() and const_folio_flags()
  mm: fix vrealloc()'s KASAN poisoning logic
  Revert "readahead: properly shorten readahead when falling back to do_page_cache_ra()"
  selftests/damon: add _damon_sysfs.py to TEST_FILES
  selftest: hugetlb_dio: fix test naming
  ocfs2: free inode when ocfs2_get_init_inode() fails
  nilfs2: fix potential out-of-bounds memory access in nilfs_find_entry()
  ...
2024-12-08 11:26:13 -08:00
Javier Carrasco
54d394905c iio: adc: ti-ads1119: fix sample size in scan struct for triggered buffer
This device returns signed, 16-bit samples as stated in its datasheet
(see 8.5.2 Data Format). That is in line with the scan_type definition
for the IIO_VOLTAGE channel, but 'unsigned int' is being used to read
and push the data to userspace.

Given that the size of that type depends on the architecture (at least
2 bytes to store values up to 65535, but its actual size is often 4
bytes), use the 's16' type to provide the same structure in all cases.

Fixes: a9306887eba4 ("iio: adc: ti-ads1119: Add driver")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://patch.msgid.link/20241202-ti-ads1119_s16_chan-v1-1-fafe3136dc90@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-08 16:59:13 +00:00
Javier Carrasco
2f43d5200c iio: temperature: tmp006: fix information leak in triggered buffer
The 'scan' local struct is used to push data to user space from a
triggered buffer, but it has a hole between the two 16-bit data channels
and the timestamp. This hole is never initialized.

Initialize the struct to zero before using it to avoid pushing
uninitialized information to userspace.

Fixes: 91f75ccf9f03 ("iio: temperature: tmp006: add triggered buffer support")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241204-iio_memset_scan_holes-v2-1-3f941592a76d@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-08 16:51:35 +00:00
Joe Hattori
64f43895b4 iio: inkern: call iio_device_put() only on mapped devices
In the error path of iio_channel_get_all(), iio_device_put() is called
on all IIO devices, which can cause a refcount imbalance. Fix this error
by calling iio_device_put() only on IIO devices whose refcounts were
previously incremented by iio_device_get().

Fixes: 314be14bb893 ("iio: Rename _st_ functions to loose the bit that meant the staging version.")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20241204111342.1246706-1-joe@pf.is.s.u-tokyo.ac.jp
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-08 16:49:09 +00:00
Christophe JAILLET
bbf6b6d53e iio: adc: ad9467: Fix the "don't allow reading vref if not available" case
The commit in Fixes adds a special case when only one possible scale is
available.
If several scales are available, it sets the .read_avail field of the
struct iio_info to ad9467_read_avail().

However, this field already holds this function pointer, so the code is a
no-op.

Use another struct iio_info instead to actually reflect the intent
described in the commit message. This way, the structure to use is selected
at runtime and they can be kept as const.

This is safer because modifying static structs that are shared between all
instances like this, based on the properties of a single instance, is
asking for trouble down the road.

Fixes: b92f94f74826 ("iio: adc: ad9467: don't allow reading vref if not available")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/cc65da19e0578823d29e11996f86042e84d5715c.1733503146.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:57:19 +00:00
Joe Hattori
de6a73bad1 iio: adc: at91: call input_free_device() on allocated iio_dev
Current implementation of at91_ts_register() calls input_free_deivce()
on st->ts_input, however, the err label can be reached before the
allocated iio_dev is stored to st->ts_input. Thus call
input_free_device() on input instead of st->ts_input.

Fixes: 84882b060301 ("iio: adc: at91_adc: Add support for touchscreens without TSMR")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20241207043045.1255409-1-joe@pf.is.s.u-tokyo.ac.jp
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:28:39 +00:00
David Lechner
36a44e05cd iio: adc: ad7173: fix using shared static info struct
Fix a possible race condition during driver probe in the ad7173 driver
due to using a shared static info struct. If more that one instance of
the driver is probed at the same time, some of the info could be
overwritten by the other instance, leading to incorrect operation.

To fix this, make the static info struct const so that it is read-only
and make a copy of the info struct for each instance of the driver that
can be modified.

Reported-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Fixes: 76a1e6a42802 ("iio: adc: ad7173: add AD7173 driver")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Tested-by: Guillaume Ranquet <granquet@baylibre.com>
Link: https://patch.msgid.link/20241127-iio-adc-ad7313-fix-non-const-info-struct-v2-1-b6d7022b7466@baylibre.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:42 +00:00
Fabio Estevam
2a8e34096e iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()
Using gpiod_set_value() to control the reset GPIO causes some verbose
warnings during boot when the reset GPIO is controlled by an I2C IO
expander.

As the caller can sleep, use the gpiod_set_value_cansleep() variant to
fix the issue.

Tested on a custom i.MX93 board with a ADS124S08 ADC.

Cc: stable@kernel.org
Fixes: e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Link: https://patch.msgid.link/20241122164308.390340-1-festevam@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:42 +00:00
Javier Carrasco
75f339d3ec iio: adc: ti-ads1119: fix information leak in triggered buffer
The 'scan' local struct is used to push data to user space from a
triggered buffer, but it has a hole between the sample (unsigned int)
and the timestamp. This hole is never initialized.

Initialize the struct to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: a9306887eba4 ("iio: adc: ti-ads1119: Add driver")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-2-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:42 +00:00
Javier Carrasco
6007d10c52 iio: pressure: zpa2326: fix information leak in triggered buffer
The 'sample' local struct is used to push data to user space from a
triggered buffer, but it has a hole between the temperature and the
timestamp (u32 pressure, u16 temperature, GAP, u64 timestamp).
This hole is never initialized.

Initialize the struct to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-3-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:42 +00:00
Javier Carrasco
3872459136 iio: adc: rockchip_saradc: fix information leak in triggered buffer
The 'data' local struct is used to push data to user space from a
triggered buffer, but it does not set values for inactive channels, as
it only uses iio_for_each_active_channel() to assign new values.

Initialize the struct to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: 4e130dc7b413 ("iio: adc: rockchip_saradc: Add support iio buffers")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-4-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:42 +00:00
Javier Carrasco
6ae053113f iio: imu: kmx61: fix information leak in triggered buffer
The 'buffer' local array is used to push data to user space from a
triggered buffer, but it does not set values for inactive channels, as
it only uses iio_for_each_active_channel() to assign new values.

Initialize the array to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: c3a23ecc0901 ("iio: imu: kmx61: Add support for data ready triggers")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-5-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:42 +00:00
Javier Carrasco
47b43e53c0 iio: light: vcnl4035: fix information leak in triggered buffer
The 'buffer' local array is used to push data to userspace from a
triggered buffer, but it does not set an initial value for the single
data element, which is an u16 aligned to 8 bytes. That leaves at least
4 bytes uninitialized even after writing an integer value with
regmap_read().

Initialize the array to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: ec90b52c07c0 ("iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-6-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Javier Carrasco
b62fbe3b8e iio: light: bh1745: fix information leak in triggered buffer
The 'scan' local struct is used to push data to user space from a
triggered buffer, but it does not set values for inactive channels, as
it only uses iio_for_each_active_channel() to assign new values.

Initialize the struct to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: eab35358aae7 ("iio: light: ROHM BH1745 colour sensor")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-7-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Javier Carrasco
2a7377ccfd iio: adc: ti-ads8688: fix information leak in triggered buffer
The 'buffer' local array is used to push data to user space from a
triggered buffer, but it does not set values for inactive channels, as
it only uses iio_for_each_active_channel() to assign new values.

Initialize the array to zero before using it to avoid pushing
uninitialized information to userspace.

Cc: stable@vger.kernel.org
Fixes: 61fa5dfa5f52 ("iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-8-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Javier Carrasco
333be433ee iio: dummy: iio_simply_dummy_buffer: fix information leak in triggered buffer
The 'data' array is allocated via kmalloc() and it is used to push data
to user space from a triggered buffer, but it does not set values for
inactive channels, as it only uses iio_for_each_active_channel()
to assign new values.

Use kzalloc for the memory allocation to avoid pushing uninitialized
information to userspace.

Cc: stable@vger.kernel.org
Fixes: 415f79244757 ("iio: Move IIO Dummy Driver out of staging")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-9-0cb6e98d895c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Matti Vaittinen
fbeba4364c iio: test: Fix GTS test config
The test config contained a copy-paste error. The IIO GTS helper test
was errorneously titled as "Test IIO formatting functions" in the
menuconfig.

Change the title of the tests to reflect what is tested.

Fixes: cf996f039679 ("iio: test: test gain-time-scale helpers")
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://patch.msgid.link/Z0gt5R86WdeK73u2@mva-rohm
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Charles Han
bcb394bb28 iio: adc: ti-ads1298: Add NULL check in ads1298_init
devm_kasprintf() can return a NULL pointer on failure. A check on the
return value of such a call in ads1298_init() is missing. Add it.

Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://patch.msgid.link/20241118090208.14586-1-hanchunchao@inspur.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Olivier Moysan
ad8479ac08 iio: adc: stm32-dfsdm: handle label as an optional property
The label property is defined as optional in the DFSDM binding.
Parse the label property only when it is defined in the device tree.

Fixes: 3208fa0cd919 ("iio: adc: stm32-dfsdm: adopt generic channels bindings")
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20241114102459.2497178-1-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Trevor Gamblin
dddfd0c489 iio: adc: ad4695: fix buffered read, single sample timings
Modify ad4695_buffer_preenable() by adding an extra SPI transfer after
each data read to help ensure that the timing requirement between the
last SCLK rising edge and the next CNV rising edge is met. This requires
a restructure of the buf_read_xfer array in ad4695_state. Also define
AD4695_T_SCK_CNV_DELAY_NS to use for each added transfer. Without this
change it is possible for the data to become corrupted on sequential
buffered reads due to the device not properly exiting conversion mode.

Similarly, make adjustments to ad4695_read_one_sample() so that timings
are respected, and clean up the function slightly in the process.

Fixes: 6cc7e4bf2e08 ("iio: adc: ad4695: implement triggered buffer")
Co-developed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Tested-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241113-tgamblin-ad4695_improvements-v2-1-b6bb7c758fc4@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Jean-Baptiste Maneyrol
65a60a5901 iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
Currently suspending while sensors are one will result in timestamping
continuing without gap at resume. It can work with monotonic clock but
not with other clocks. Fix that by resetting timestamping.

Fixes: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241113-inv_icm42600-fix-timestamps-after-suspend-v1-1-dfc77c394173@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:23:41 +00:00
Jean-Baptiste Maneyrol
c0f866de4c iio: imu: inv_icm42600: fix spi burst write not supported
Burst write with SPI is not working for all icm42600 chips. It was
only used for setting user offsets with regmap_bulk_write.

Add specific SPI regmap config for using only single write with SPI.

Fixes: 9f9ff91b775b ("iio: imu: inv_icm42600: add SPI driver for inv_icm42600 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241112-inv-icm42600-fix-spi-burst-write-not-supported-v2-1-97690dc03607@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:22:54 +00:00
Carlos Song
fa13ac6cdf iio: gyro: fxas21002c: Fix missing data update in trigger handler
The fxas21002c_trigger_handler() may fail to acquire sample data because
the runtime PM enters the autosuspend state and sensor can not return
sample data in standby mode..

Resume the sensor before reading the sample data into the buffer within the
trigger handler. After the data is read, place the sensor back into the
autosuspend state.

Fixes: a0701b6263ae ("iio: gyro: add core driver for fxas21002c")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20241116152945.4006374-1-Frank.Li@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:13:25 +00:00
Pei Xiao
aaa90d0751 iio: test : check null return of kunit_kmalloc in iio_rescale_test_scale
kunit_kmalloc may fail, return value might be NULL and will cause
NULL pointer dereference.Add KUNIT_ASSERT_NOT_ERR_OR_NULL fix it.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Fixes: 8e74a48d17d5 ("iio: test: add basic tests for the iio-rescale driver")
Link: https://patch.msgid.link/ecd56a85e54a96c2f0313c114075a21a76071ea2.1730259869.git.xiaopei01@kylinos.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:13:25 +00:00
Uwe Kleine-König
4be339af33 iio: adc: ad7124: Disable all channels at probe time
When during a measurement two channels are enabled, two measurements are
done that are reported sequencially in the DATA register. As the code
triggered by reading one of the sysfs properties expects that only one
channel is enabled it only reads the first data set which might or might
not belong to the intended channel.

To prevent this situation disable all channels during probe. This fixes
a problem in practise because the reset default for channel 0 is
enabled. So all measurements before the first measurement on channel 0
(which disables channel 0 at the end) might report wrong values.

Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels")
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20241104101905.845737-2-u.kleine-koenig@baylibre.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-12-07 17:13:25 +00:00
Jakob Hauser
f1ee5483e4 iio: magnetometer: yas530: use signed integer type for clamp limits
In the function yas537_measure() there is a clamp_val() with limits of
-BIT(13) and BIT(13) - 1.  The input clamp value h[] is of type s32.  The
BIT() is of type unsigned long integer due to its define in
include/vdso/bits.h.  The lower limit -BIT(13) is recognized as -8192 but
expressed as an unsigned long integer.  The size of an unsigned long
integer differs between 32-bit and 64-bit architectures.  Converting this
to type s32 may lead to undesired behavior.

Additionally, in the calculation lines h[0], h[1] and h[2] the unsigned
long integer divisor BIT(13) causes an unsigned division, shifting the
left-hand side of the equation back and forth, possibly ending up in large
positive values instead of negative values on 32-bit architectures.

To solve those two issues, declare a signed integer with a value of
BIT(13).

There is another omission in the clamp line: clamp_val() returns a value
and it's going nowhere here.  Self-assign it to h[i] to make use of the
clamp macro.

Finally, replace clamp_val() macro by clamp() because after changing the
limits from type unsigned long integer to signed integer it's fine that
way.

Link: https://lkml.kernel.org/r/11609b2243c295d65ab4d47e78c239d61ad6be75.1732914810.git.jahau@rocketmail.com
Fixes: 65f79b501030 ("iio: magnetometer: yas530: Add YAS537 variant")
Signed-off-by: Jakob Hauser <jahau@rocketmail.com>

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202411230458.dhZwh3TT-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202411282222.oF0B4110-lkp@intel.com/
Reviewed-by: David Laight <david.laight@aculab.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-12-05 19:54:48 -08:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Linus Torvalds
2eff01ee28 Char/Misc/IIO/Whatever driver subsystem updates for 6.13-rc1
Here is the "big and hairy" char/misc/iio and other small driver
 subsystem updates for 6.13-rc1.  Sorry for doing this at the end of the
 merge window, conference and holiday travel got in the way on my side
 (hence the 5am pull request emails...)
 
 Loads of things in here, and even a fun merge conflict!
   - rust misc driver bindings and other rust changes to make misc
     drivers actually possible.  I think this is the tipping point,
     expect to see way more rust drivers going forward now that these
     bindings are present.  Next merge window hopefully we will have pci
     and platform drivers working, which will fully enable almost all
     driver subsystems to start accepting (or at least getting) rust
     drivers.  This is the end result of a lot of work from a lot of
     people, congrats to all of them for getting this far, you've proved
     many of us wrong in the best way possible, working code :)
   - IIO driver updates, too many to list individually, that subsystem
     keeps growing and growing...
   - Interconnect driver updates
   - nvmem driver updates
   - pwm driver updates
   - platform_driver::remove() fixups, loads of them
   - counter driver updates
   - misc driver updates (keba?)
   - binder driver updates and fixes
   - loads of other small char/misc/etc driver updates and additions,
     full details in the shortlog.
 
 Note, there is a semi-hairy rust merge conflict when pulling this.  The
 resolution has been in linux-next for a while and can be seen here:
 	https://lore.kernel.org/all/20241111173459.2646d4af@canb.auug.org.au/
 
 All of these have been in linux-next for a while, with no other reported
 issues other than that merge conflict.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ0lGpg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykKHQCgvI4Muu2tpdINBVe24Zc8S3ozg0AAnRNg3F7r
 ikneftUDYtuviSGU/Rs8
 =CW+i
 -----END PGP SIGNATURE-----

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

Pull char/misc/IIO/whatever driver subsystem updates from Greg KH:
 "Here is the 'big and hairy' char/misc/iio and other small driver
  subsystem updates for 6.13-rc1.

  Loads of things in here, and even a fun merge conflict!

   - rust misc driver bindings and other rust changes to make misc
     drivers actually possible.

     I think this is the tipping point, expect to see way more rust
     drivers going forward now that these bindings are present. Next
     merge window hopefully we will have pci and platform drivers
     working, which will fully enable almost all driver subsystems to
     start accepting (or at least getting) rust drivers.

     This is the end result of a lot of work from a lot of people,
     congrats to all of them for getting this far, you've proved many of
     us wrong in the best way possible, working code :)

   - IIO driver updates, too many to list individually, that subsystem
     keeps growing and growing...

   - Interconnect driver updates

   - nvmem driver updates

   - pwm driver updates

   - platform_driver::remove() fixups, loads of them

   - counter driver updates

   - misc driver updates (keba?)

   - binder driver updates and fixes

   - loads of other small char/misc/etc driver updates and additions,
     full details in the shortlog.

  All of these have been in linux-next for a while, with no other
  reported issues other than that merge conflict"

* tag 'char-misc-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (401 commits)
  mei: vsc: Fix typo "maintstepping" -> "mainstepping"
  firmware: Switch back to struct platform_driver::remove()
  misc: isl29020: Fix the wrong format specifier
  scripts/tags.sh: Don't tag usages of DEFINE_MUTEX
  fpga: Switch back to struct platform_driver::remove()
  mei: vsc: Improve error logging in vsc_identify_silicon()
  mei: vsc: Do not re-enable interrupt from vsc_tp_reset()
  dt-bindings: spmi: qcom,x1e80100-spmi-pmic-arb: Add SAR2130P compatible
  dt-bindings: spmi: spmi-mtk-pmif: Add compatible for MT8188
  spmi: pmic-arb: fix return path in for_each_available_child_of_node()
  iio: Move __private marking before struct element priv in struct iio_dev
  docs: iio: ad7380: add adaq4370-4 and adaq4380-4
  iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4
  iio: adc: ad7380: use local dev variable to shorten long lines
  iio: adc: ad7380: fix oversampling formula
  dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts
  bus: mhi: host: pci_generic: Use pcim_iomap_region() to request and map MHI BAR
  bus: mhi: host: Switch trace_mhi_gen_tre fields to native endian
  misc: atmel-ssc: Use of_property_present() for non-boolean properties
  misc: keba: Add hardware dependency
  ...
2024-11-29 11:58:27 -08:00
Linus Torvalds
364eeb79a2 Locking changes for v6.13 are:
- lockdep:
     - Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING (Sebastian Andrzej Siewior)
     - Add lockdep_cleanup_dead_cpu() (David Woodhouse)
 
  - futexes:
     - Use atomic64_inc_return() in get_inode_sequence_number() (Uros Bizjak)
     - Use atomic64_try_cmpxchg_relaxed() in get_inode_sequence_number() (Uros Bizjak)
 
  - RT locking:
     - Add sparse annotation PREEMPT_RT's locking (Sebastian Andrzej Siewior)
 
  - spinlocks:
     - Use atomic_try_cmpxchg_release() in osq_unlock() (Uros Bizjak)
 
  - atomics:
     - x86: Use ALT_OUTPUT_SP() for __alternative_atomic64() (Uros Bizjak)
     - x86: Use ALT_OUTPUT_SP() for __arch_{,try_}cmpxchg64_emu() (Uros Bizjak)
 
  - KCSAN, seqlocks:
     - Support seqcount_latch_t (Marco Elver)
 
  - <linux/cleanup.h>:
     - Add if_not_cond_guard() conditional guard helper (David Lechner)
     - Adjust scoped_guard() macros to avoid potential warning (Przemek Kitszel)
     - Remove address space of returned pointer (Uros Bizjak)
 
  - WW mutexes:
     - locking/ww_mutex: Adjust to lockdep nest_lock requirements (Thomas Hellström)
 
  - Rust integration:
     - Fix raw_spin_lock initialization on PREEMPT_RT (Eder Zulian)
 
  - miscellaneous cleanups & fixes:
     - lockdep: Fix wait-type check related warnings (Ahmed Ehab)
     - lockdep: Use info level for initial info messages (Jiri Slaby)
     - spinlocks: Make __raw_* lock ops static (Geert Uytterhoeven)
     - pvqspinlock: Convert fields of 'enum vcpu_state' to uppercase (Qiuxu Zhuo)
     - iio: magnetometer: Fix if () scoped_guard() formatting (Stephen Rothwell)
     - rtmutex: Fix misleading comment (Peter Zijlstra)
     - percpu-rw-semaphores: Fix grammar in percpu-rw-semaphore.rst (Xiu Jianfeng)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmc7AkQRHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1hGqQ/+KWR5arkoJjH/Nf5IyezYitOwqK7YAdJk
 mrWoZcez0DRopNTf8yZMv1m8jyx7W9KUQumEO/ghqJRlBW+AbxZ1t99kmqWI5Aw0
 +zmhpyo06JHeMYQAfKJXX3iRt2Rt59BPHtGzoop6b0e2i55+uPE+DZTNm2+FwCV9
 4vxmfpYyg5/sJB9/v5b0N9TTDe9a8caOHXU5F+HA1yWuxMmqFuDFIcpKrgS/sUeP
 NelOLbh2L3UOPWP6tRRfpajxCQTmRoeZOQQv0L9dd3jYpyQOCesgKqOhqNTCU8KK
 qamTPig2N00smSLp6I/OVyJ96vFYZrbhyq0kwMayaafAU7mB8lzcfUj+8qP0c90k
 1PROtD1XpF3Nobp1F+YUp3sQxEGdCgs+9VeLWWObv2b/Vt3MDZijdEiC/3OkRAUh
 LPCfl/ky41BmT8AlaxRDjkyrN7hH4oUOkGUdVx6yR389J0OR9MSwEX9qNaMw8bBg
 1ALvv9+OR3QhTWyG30PGqUf3Um230oIdWuWxwFrhaoMmDVEVMRZQMtvQahi5hDYq
 zyX79DKWtExEe/f2hY1m/6eNm6st5HE7X7scOba3TamQzvOzJkjzo7XoS2yeUAjb
 eByO2G0PvTrA0TFls6Hyrl6db5OW5KjQnVWr6W3fiWL5YIdh0SQMkWeaGVvGyfy8
 Q3vhk7POaZo=
 =BvPn
 -----END PGP SIGNATURE-----

Merge tag 'locking-core-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull locking updates from Ingo Molnar:
 "Lockdep:
   - Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING (Sebastian Andrzej
     Siewior)
   - Add lockdep_cleanup_dead_cpu() (David Woodhouse)

  futexes:
   - Use atomic64_inc_return() in get_inode_sequence_number() (Uros
     Bizjak)
   - Use atomic64_try_cmpxchg_relaxed() in get_inode_sequence_number()
     (Uros Bizjak)

  RT locking:
   - Add sparse annotation PREEMPT_RT's locking (Sebastian Andrzej
     Siewior)

  spinlocks:
   - Use atomic_try_cmpxchg_release() in osq_unlock() (Uros Bizjak)

  atomics:
   - x86: Use ALT_OUTPUT_SP() for __alternative_atomic64() (Uros Bizjak)
   - x86: Use ALT_OUTPUT_SP() for __arch_{,try_}cmpxchg64_emu() (Uros
     Bizjak)

  KCSAN, seqlocks:
   - Support seqcount_latch_t (Marco Elver)

  <linux/cleanup.h>:
   - Add if_not_guard() conditional guard helper (David Lechner)
   - Adjust scoped_guard() macros to avoid potential warning (Przemek
     Kitszel)
   - Remove address space of returned pointer (Uros Bizjak)

  WW mutexes:
   - locking/ww_mutex: Adjust to lockdep nest_lock requirements (Thomas
     Hellström)

  Rust integration:
   - Fix raw_spin_lock initialization on PREEMPT_RT (Eder Zulian)

  Misc cleanups & fixes:
   - lockdep: Fix wait-type check related warnings (Ahmed Ehab)
   - lockdep: Use info level for initial info messages (Jiri Slaby)
   - spinlocks: Make __raw_* lock ops static (Geert Uytterhoeven)
   - pvqspinlock: Convert fields of 'enum vcpu_state' to uppercase
     (Qiuxu Zhuo)
   - iio: magnetometer: Fix if () scoped_guard() formatting (Stephen
     Rothwell)
   - rtmutex: Fix misleading comment (Peter Zijlstra)
   - percpu-rw-semaphores: Fix grammar in percpu-rw-semaphore.rst (Xiu
     Jianfeng)"

* tag 'locking-core-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (29 commits)
  locking/Documentation: Fix grammar in percpu-rw-semaphore.rst
  iio: magnetometer: fix if () scoped_guard() formatting
  rust: helpers: Avoid raw_spin_lock initialization for PREEMPT_RT
  kcsan, seqlock: Fix incorrect assumption in read_seqbegin()
  seqlock, treewide: Switch to non-raw seqcount_latch interface
  kcsan, seqlock: Support seqcount_latch_t
  time/sched_clock: Broaden sched_clock()'s instrumentation coverage
  time/sched_clock: Swap update_clock_read_data() latch writes
  locking/atomic/x86: Use ALT_OUTPUT_SP() for __arch_{,try_}cmpxchg64_emu()
  locking/atomic/x86: Use ALT_OUTPUT_SP() for __alternative_atomic64()
  cleanup: Add conditional guard helper
  cleanup: Adjust scoped_guard() macros to avoid potential warning
  locking/osq_lock: Use atomic_try_cmpxchg_release() in osq_unlock()
  cleanup: Remove address space of returned pointer
  locking/rtmutex: Fix misleading comment
  locking/rt: Annotate unlock followed by lock for sparse.
  locking/rt: Add sparse annotation for RCU.
  locking/rt: Remove one __cond_lock() in RT's spin_trylock_irqsave()
  locking/rt: Add sparse annotation PREEMPT_RT's sleeping locks.
  locking/pvqspinlock: Convert fields of 'enum vcpu_state' to uppercase
  ...
2024-11-19 12:43:11 -08:00
Stephen Rothwell
9a884bdb6e iio: magnetometer: fix if () scoped_guard() formatting
Add mising braces after an if condition that contains scoped_guard().

This style is both preferred and necessary here, to fix warning after
scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
scoped_guard() macros to avoid potential warning") to have if-else inside
of the macro. Current (no braces) use in af8133j_set_scale() yields
the following warnings:
af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20241108154258.21411-1-przemyslaw.kitszel@intel.com
2024-11-11 11:49:47 +01:00
Greg Kroah-Hartman
5de07b8a24 IIO: 2nd set of new device support, features and cleanup for 6.13
Alongside new drivers and device support there are several large
 cleanups going on across the IIO tree and we see part of some of those
 in this pull request.
 
 Merged char-misc-next at point of 6.12-rc6 merge to avoid a
 conflict with a fix for the ad7380 merged earlier this cycle.
 Note that I previously messed this merge up and had to reconstruct
 it this morning so a coherent pull request was possible. The new
 stuff is all the same as has been in linux-next for some time with
 the exception of the kernel-doc related __private ordering fix
 that went in yesterday.
 
 New device support
 ==================
 
 adi,ad7380
 - Support for adaq4370-4 and adaq4370 quad channel ADCs.
 adi,ad7606
 - Various cleanups preceeding support of AD7607, AD7608 and AD7609 ADCs.
 adi,ad7779
 - New driver supproting AD7770, AD7771 and AD7779 ADCs.
 allegro,als31300
 - New driver for this 3D Linear Hall Effect sensor.
 bosch,bmi270
 - Add support BMI260 which is similar but requires a different firmware image.
 bosch,smi240
 - New driver for this IMU.
 ti,opt3001
 - Add support opt3002 light sensor which has a wider spectral range than
   the opt3001.
 vishay,veml3235
 - New driver for this ambient light sensor.
 
 Features
 ========
 
 hid-sensors
 - Add support Human Proximity Range and Attention detection (requiring
   a new classification style channel type)
 adi,ad3552r
 - Add backend support and related platform driver to support use
   with an FPGA IP to allow QSPI + DDR bus operation and much higher
   data aquisition rates.  (various rework preceeded this feature)
 adi,ad7606
 - Various cleanup prior to enabling use with an IIO Backend and PWM trigger
   enabling much higher speed data capture.
 bosch,bme680
 - Support control of preheat current
 - Support triggered buffer capture
 - Add SCALE and RAW channels (needed to enable the buffered capture).
 bosch,bmp280
 - Enable sleeping to save power.
 - Add interrupt support for bmp3xx and bmp5xx devices. Also update bmp085
   to new approach.
 - Enable data ready trigger.
 bosch,bmi270
 - Add triggered buffer support
 - Add scale and sampling frequency control.
 vishay,veml6070
 - Support integration time via DT binding for an external resistor value.
 
 Cleanup and minor fixes
 =======================
 
 core
 - Fix a longstanding issue with event codes for differential channels.
   Note that not all drivers are yet fixed, but macros have been added
   to avoid potential repeats of this in future.
 - Tidy up handling in iio_read_acpi_mount matrix.
 - Mark iio_dev::priv with __private. Later move the marking before the
   field name to avoid a kernel-doc issue.
 treewide
 - Drop some pointless default n entries in Kconfig.
 - Add an iio_get_acpi_device_name_and_data() handler to replace some
   commonly repeated code.
 - simplify use of 'state' in write_event_config() callback  as it is
   effectively a boolean. Once done make it a boolean (lots of drivers
   were updated to enable this)
 - some more use of devm_regulator_get_enable_read_voltage( to replace
   open coded versions.  Where this enables it convert all of remove
   handling to devm based and drop the remove callback.
 - check returns from devm_mutex_init()
 accel drivers
 - Use aligned_s64 instead of s64 __aligned(8)
 adi,ad5791
 - Add some missing GPIOs and power supplies that presumably were always
   hard wired on previous boards.
 - Refactor to use chip_info in device id tables.
 - Convert probe entirely to devm based simplify code and allowing remove()
   callback to be dropped.
 adi,ad7192
 - Check return from spi_get_device_match_data()
 adi,ad74413r
 - Don't keep an unnecessary copy of the gpio after probe.
 - Use devm_regulator_get_enable_read_voltage() instead of open coding.
 - Apply cleanup.h approach to reduce complexity.
 adi,dac8460
 - Fix a wrong compaitble ID due to a stray space.
 - Add an spi_device_id table.
 bosch,bmc150
 - Drop some likely false ACPI IDs.
 - Drop left over unused ACPI specific code.
 bosch,bme680
 - Add mising regmap.h include.
 - Reduce excessive sleep on startup.
 - Drop some cammelcase usage.
 - Use fsleep
 - Generalize read functions to allow for reuse.
 - Use s16 variable to avoid some incorrect casting
 bosch,bmg150
 - Drop some likely false ACPI IDs.
 bosch,bmi270
 - Drop unused FREQUENCY and SCALE attributes that always returned an
   error (they wil be back impelmented correctly).
 - Factor out the chip specific data into a structure to enable simple
   support for additional devices.
 isil,isl29018
 - Drop ACPI_PTR() and CONFIG_ACPI guards as not worth the trouble for very
   minor saving.
 invensense,mpu6050
 - Use much simpler test for ACPI firmware.
 kionix,kxcjk-1013
 - Drop unnecessary ACPI entry in the i2c_device_id table.
 - Drop support KX022-1020 to fix a bug that was introduced with that change.
   Hopefully a fixed version will replace it soon.
 - Drop CONFIG guards for PM in favor of pm_ptr() and the compiler removing
   dead code.
 - Switch from enum to chip_info structure and add ODR times to that structure.
 - Deduplicate one of those ODR structures
 - Drop ACPI_PTR() and move ID table out of config guards.
 - Minor additional cleanup.
 liteon,ltr401
 - Drop some likely false ACPI Ids and add LTER0303 which is know to be in use.
 microchip,pac1934
 - Use much simpler test for ACPI firmware.
 vishay,veml6070
 - Use unsigned int instead of just unsigned.
 - Use FIELD_PREP to make setting of field value explicit.
 
 Various other minor fixes to documentation
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmcvP28RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fogomg//T0m278O+R8YWTeYjlU8iLBxLcahOR9Zz
 lB9XKp48lrqjy8ziWu7NilHMkWyTaoof+V5rAYqs8KjVzTZniAFEs2FMy05bDCIP
 iXxEolVGDjY3qXFbN/dUXXte4T6u5rZIzzdJGzRySduW2hGYNjmcQ7tMsGSJ1Jo8
 tCi5NBxZuhZ7Bqk1UJvy8o9I9oloQqvLLv0japFVwZuNsSRgbjHLKC0o8gY9UOuY
 sCDSneBlhUxZRHRr1E6aswYJltNQZYTVNRJikwg+Iogbwix+ltFjKMKWdledoXqE
 Fu00B9YgHIpdw/g/QUYgBKJmY0vIAPq26O8vYIf4jcVN9sf9uVkFMKUtB81LL52B
 T73G/Plz7iGzJX/UpnuHWzbG1rax+qHwxcNgShrwumYmXZTaHyxJ42zH4R+zQ8gZ
 vBw8jVfOfXwkD+CRw8pvVrwflyro4E+fSExjbEmxvyFh281tr1Rj8z4y3ROOdEUb
 W8iRGWuanMTfFvCicBfUiTYJMG8zYhM290g85ayWVOVhTvEgTwA/fwLt6GPM6szG
 xL4KRo1RYaR2GmYxkibJ+cyrZIUeAgjPaHl3jtjkCAGUfmlKvKEeKuuAGHfZ+0fa
 GpK/pljddg3HM3UaRKBSBcqasaytpwkYW/xibQkLNNkzE1X4/7HQyxdtNoxzLt4J
 Sx9d+IN0pmM=
 =tB/u
 -----END PGP SIGNATURE-----

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

Jonathan writes:

IIO: 2nd set of new device support, features and cleanup for 6.13

Alongside new drivers and device support there are several large
cleanups going on across the IIO tree and we see part of some of those
in this pull request.

Merged char-misc-next at point of 6.12-rc6 merge to avoid a
conflict with a fix for the ad7380 merged earlier this cycle.
Note that I previously messed this merge up and had to reconstruct
it this morning so a coherent pull request was possible. The new
stuff is all the same as has been in linux-next for some time with
the exception of the kernel-doc related __private ordering fix
that went in yesterday.

New device support
==================

adi,ad7380
- Support for adaq4370-4 and adaq4370 quad channel ADCs.
adi,ad7606
- Various cleanups preceeding support of AD7607, AD7608 and AD7609 ADCs.
adi,ad7779
- New driver supproting AD7770, AD7771 and AD7779 ADCs.
allegro,als31300
- New driver for this 3D Linear Hall Effect sensor.
bosch,bmi270
- Add support BMI260 which is similar but requires a different firmware image.
bosch,smi240
- New driver for this IMU.
ti,opt3001
- Add support opt3002 light sensor which has a wider spectral range than
  the opt3001.
vishay,veml3235
- New driver for this ambient light sensor.

Features
========

hid-sensors
- Add support Human Proximity Range and Attention detection (requiring
  a new classification style channel type)
adi,ad3552r
- Add backend support and related platform driver to support use
  with an FPGA IP to allow QSPI + DDR bus operation and much higher
  data aquisition rates.  (various rework preceeded this feature)
adi,ad7606
- Various cleanup prior to enabling use with an IIO Backend and PWM trigger
  enabling much higher speed data capture.
bosch,bme680
- Support control of preheat current
- Support triggered buffer capture
- Add SCALE and RAW channels (needed to enable the buffered capture).
bosch,bmp280
- Enable sleeping to save power.
- Add interrupt support for bmp3xx and bmp5xx devices. Also update bmp085
  to new approach.
- Enable data ready trigger.
bosch,bmi270
- Add triggered buffer support
- Add scale and sampling frequency control.
vishay,veml6070
- Support integration time via DT binding for an external resistor value.

Cleanup and minor fixes
=======================

core
- Fix a longstanding issue with event codes for differential channels.
  Note that not all drivers are yet fixed, but macros have been added
  to avoid potential repeats of this in future.
- Tidy up handling in iio_read_acpi_mount matrix.
- Mark iio_dev::priv with __private. Later move the marking before the
  field name to avoid a kernel-doc issue.
treewide
- Drop some pointless default n entries in Kconfig.
- Add an iio_get_acpi_device_name_and_data() handler to replace some
  commonly repeated code.
- simplify use of 'state' in write_event_config() callback  as it is
  effectively a boolean. Once done make it a boolean (lots of drivers
  were updated to enable this)
- some more use of devm_regulator_get_enable_read_voltage( to replace
  open coded versions.  Where this enables it convert all of remove
  handling to devm based and drop the remove callback.
- check returns from devm_mutex_init()
accel drivers
- Use aligned_s64 instead of s64 __aligned(8)
adi,ad5791
- Add some missing GPIOs and power supplies that presumably were always
  hard wired on previous boards.
- Refactor to use chip_info in device id tables.
- Convert probe entirely to devm based simplify code and allowing remove()
  callback to be dropped.
adi,ad7192
- Check return from spi_get_device_match_data()
adi,ad74413r
- Don't keep an unnecessary copy of the gpio after probe.
- Use devm_regulator_get_enable_read_voltage() instead of open coding.
- Apply cleanup.h approach to reduce complexity.
adi,dac8460
- Fix a wrong compaitble ID due to a stray space.
- Add an spi_device_id table.
bosch,bmc150
- Drop some likely false ACPI IDs.
- Drop left over unused ACPI specific code.
bosch,bme680
- Add mising regmap.h include.
- Reduce excessive sleep on startup.
- Drop some cammelcase usage.
- Use fsleep
- Generalize read functions to allow for reuse.
- Use s16 variable to avoid some incorrect casting
bosch,bmg150
- Drop some likely false ACPI IDs.
bosch,bmi270
- Drop unused FREQUENCY and SCALE attributes that always returned an
  error (they wil be back impelmented correctly).
- Factor out the chip specific data into a structure to enable simple
  support for additional devices.
isil,isl29018
- Drop ACPI_PTR() and CONFIG_ACPI guards as not worth the trouble for very
  minor saving.
invensense,mpu6050
- Use much simpler test for ACPI firmware.
kionix,kxcjk-1013
- Drop unnecessary ACPI entry in the i2c_device_id table.
- Drop support KX022-1020 to fix a bug that was introduced with that change.
  Hopefully a fixed version will replace it soon.
- Drop CONFIG guards for PM in favor of pm_ptr() and the compiler removing
  dead code.
- Switch from enum to chip_info structure and add ODR times to that structure.
- Deduplicate one of those ODR structures
- Drop ACPI_PTR() and move ID table out of config guards.
- Minor additional cleanup.
liteon,ltr401
- Drop some likely false ACPI Ids and add LTER0303 which is know to be in use.
microchip,pac1934
- Use much simpler test for ACPI firmware.
vishay,veml6070
- Use unsigned int instead of just unsigned.
- Use FIELD_PREP to make setting of field value explicit.

Various other minor fixes to documentation

* tag 'iio-for-6.13b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (153 commits)
  iio: Move __private marking before struct element priv in struct iio_dev
  docs: iio: ad7380: add adaq4370-4 and adaq4380-4
  iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4
  iio: adc: ad7380: use local dev variable to shorten long lines
  iio: adc: ad7380: fix oversampling formula
  dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts
  iio: chemical: bme680: Add support for preheat current
  iio: chemical: bme680: Add triggered buffer support
  iio: chemical: bme680: Add SCALE and RAW channels
  iio: chemical: bme680: refactorize set_mode() mode
  iio: events: make IIO_EVENT_CODE macro private
  iio: accel: mma9553: use specialized event code macros
  iio: dummy: use specialized event code macros
  iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper
  iio: events.h: add event identifier macros for differential channel
  iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver
  dt-bindings: iio: magnetometer: document the Allegro MicroSystems ALS31300 3-D Linear Hall Effect Sensor
  dt-bindings: vendor-prefixes: Add Allegro MicroSystems, Inc
  iio: light: apds9960: remove useless return
  iio: light: apds9960: convert als_int and pxs_int to bool
  ...
2024-11-09 14:34:48 +01:00
Julien Stephan
c904e6dcf4 iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4
adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
acquisition signal chain μModule solutions compatible with the ad738x
family, with the following differences:

- pin selectable gain in front of each 4 adc
- internal reference is 3V derived from refin-supply (5V)
- additional supplies

This implies that IIO_CHAN_INFO_SCALE can not be shared by type for
these new devices.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241030-ad7380-add-adaq4380-4-support-v4-4-864ff02babae@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-09 10:41:55 +00:00
Julien Stephan
9bb0e49a22 iio: adc: ad7380: use local dev variable to shorten long lines
Use local dev variable in the probe function to shorten long lines.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241030-ad7380-add-adaq4380-4-support-v4-3-864ff02babae@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-09 10:41:40 +00:00
Julien Stephan
0e1168f8f2 iio: adc: ad7380: fix oversampling formula
The formula in the datasheet for oversampling time conversion seems to
be valid when device is at full speed using the maximum number of SDO
lines. The driver currently support only 1 SDO line. The correct formula
is: t_convert = T_CONVERT_0_NS + T_CONVERT_X_NS*(x -
1)*num_channel/number_of_sdo_lines.
It will produce larger delays than what is currently set, but some devices
actually require it.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241030-ad7380-add-adaq4380-4-support-v4-2-864ff02babae@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-09 10:41:13 +00:00
Jonathan Cameron
e459ca0aec Merge commit '9365f0de4303f82ed4c2db1c39d3de824b249d80' into HEAD
Merge v6.12-rc6 via char-misc-next to get some fixes needed for next few
patches in IIO.
2024-11-09 10:39:52 +00:00
Greg Kroah-Hartman
389c4245f5 IIO: 3rd set of fixes for the 6.12 cycle
Usual mixed bag of new issues from this cycle and ancient bugs
 recently noticed.
 
 core
 - Fix wrong fwnode handle if __fwnode_iio_channel_get_by_name()
   looks at parents of the provider node.
 core,backend
 - Fix a wrong pointer error check.
 gts library
 - Fix plausible corner case where the value returned was not set.
 - Avoid near infinite loop if the size of the table is 0.
   (neither are an issue for current drivers).
 adi,ad4000
 - Fix reading of unsigned channels that were returning garbage.
 adi,ad7780
 - Prevent a division by zero.
 adi,ad7923
 - Fix buffer overflows in arrays that were not resized when devices
   with more channels were added to the driver.
 adi,adxl380
 - Check only for negative error codes rather than including the
   positive channel read values in an error check.
 invense,common
 - Fix an issue where changing the sampling rate to another value and
   back again whilst the FIFO was off would not update things correctly.
 kionix,kx022a
 - Fix failure to sign extend value read from device.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmctBygRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fog9gQ/8CdpYJWoK2qnXiWkNQdLR4vqd3RKnQ8ch
 046D26kNoQNDEdT/lSKKvZdGaZmcMg2SqK3VpCJCPc08uuqIZoRbMcv6WkhdP5iK
 besdoaqkyEQaCnR+o0annbDq+hADN0uwe398WbIKMmKxU6nUPTwLkJTTroCnP8pn
 juAi4Elvhz93LhgVPuDtzuMxFAI4gRz8LPfv1WdIIyMitwO8j7ILjjab3Jy+1Rfr
 8n8HwZolS74iSY9qLc7kaipCRb4He+Q6/+c011ym9g8E8ge8KO1huxOn0FnIsWXv
 g/qLsmnEMy56ypguf0uStNHN9f7AXHlqC1xiScnkZXsbP4CFakaL3M8hBbOiw13S
 u/ylhYkxSqCsjZ/oNlTaDtnZrL/ZaHlSTBcsqEu3JRHkG9bJCgLQl2IfTS5Px65Y
 JEj5OGu9nEDi5lPGOUqgJgmLuxSNEMtHqqvqTAp0kk4McM/BocW0ldEaZy7cokCb
 Tb/auEK4sGssdhJM8Nq+wH6mHfjn0IL38sBHNyP640kFNRMG1WnVDICzFGsC3ldL
 TLsczCulnVdr8xhK5vl2irqjnVKzjSFgXZg5jB/29N0V4re/b6pOh8LWm3Ze5hQZ
 sR0rkXI7FkDaNk7Ifb/Pe2XCbU2IjgAvf3dyZxO/E1UuLAz+spa0WjImghHCT5P8
 e9WcX1hoKbg=
 =4pCM
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-6.12c' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO: 3rd set of fixes for the 6.12 cycle

Usual mixed bag of new issues from this cycle and ancient bugs
recently noticed.

core
- Fix wrong fwnode handle if __fwnode_iio_channel_get_by_name()
  looks at parents of the provider node.
core,backend
- Fix a wrong pointer error check.
gts library
- Fix plausible corner case where the value returned was not set.
- Avoid near infinite loop if the size of the table is 0.
  (neither are an issue for current drivers).
adi,ad4000
- Fix reading of unsigned channels that were returning garbage.
adi,ad7780
- Prevent a division by zero.
adi,ad7923
- Fix buffer overflows in arrays that were not resized when devices
  with more channels were added to the driver.
adi,adxl380
- Check only for negative error codes rather than including the
  positive channel read values in an error check.
invense,common
- Fix an issue where changing the sampling rate to another value and
  back again whilst the FIFO was off would not update things correctly.
kionix,kx022a
- Fix failure to sign extend value read from device.

* tag 'iio-fixes-for-6.12c' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()
  iio: accel: adxl380: fix raw sample read
  iio: accel: kx022a: Fix raw read format
  iio: gts: fix infinite loop for gain_to_scaletables()
  iio: gts: Fix uninitialized symbol 'ret'
  iio: adc: ad4000: fix reading unsigned data
  ad7780: fix division by zero in ad7780_write_raw()
  iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer
  iio: backend: fix wrong pointer passed to IS_ERR()
  iio: invensense: fix multiple odr switch when FIFO is off
2024-11-08 16:46:34 +01:00
Greg Kroah-Hartman
9365f0de43 Merge 6.12-rc6 into char-misc-next
We need the char/misc/iio fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-05 09:36:29 +01:00
Vasileios Amoiridis
56686ac80b iio: chemical: bme680: Add support for preheat current
Add functionality to inject a specified amount of current to the heating
plate before the start of the gas measurement to allow the sensor to reach
faster to the requested temperature.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241102131311.36210-5-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
Vasileios Amoiridis
80b9f3a80e iio: chemical: bme680: Add triggered buffer support
Add triggered buffer and soft timestamp support. The available scan mask
enables all the channels of the sensor in order to follow the operation of
the sensor. The sensor basically starts to capture from all channels
as long as it enters into FORCED mode.

The bulk read, reads a total of 15 registers from the sensor, 0x1D..0x2B.
Even though some of those registers are not reported in the register map
of the device, this is how the BME680 Sensor API [1] proposes to do it.
This allows to have one bulk read instead of multiple ones.

Link: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L1200
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241102131311.36210-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
Vasileios Amoiridis
f51171ce22 iio: chemical: bme680: Add SCALE and RAW channels
Add SCALE,RAW channels to the device. Even though PROCESSED should be
kept for backwards compatibility add comment to avoid using it if the
value is not actually reported in IIO values.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241102131311.36210-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
Vasileios Amoiridis
4865ee12c8 iio: chemical: bme680: refactorize set_mode() mode
Refactorize the set_mode() function to use an external enum that
describes the possible modes of the BME680 device instead of using
true/false variables for selecting SLEEPING/FORCED mode.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241102131311.36210-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
David Lechner
dff100b0f3 iio: accel: mma9553: use specialized event code macros
Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE
instead of IIO_EVENT_CODE.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-2-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
David Lechner
c4d4f112bb iio: dummy: use specialized event code macros
Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE
instead of IIO_EVENT_CODE.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-1-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
Julien Stephan
7f4f3c4e97 iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper
The IIO_DIFF_EVENT_CODE macro helper was introduced to provide a more
specific alternative to the generic IIO_EVENT_CODE macro for handling
differential channels. This commit updates the code to use
IIO_DIFF_EVENT_CODE for better clarity and maintainability.

However, the current implementation incorrectly sets both chan1 and
chan2 to 0. To maintain compatibility and avoid breaking existing
user space applications, this behavior is preserved for now.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-iio-add-macro-for-even-identifier-for-differential-channels-v1-2-b452c90f7ea6@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:45 +00:00
Neil Armstrong
3c9b6fd741 iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver
The Allegro MicroSystems ALS31300 is a 3-D Linear Hall Effect Sensor
mainly used for 3D head-on motion sensing applications.

The device is configured over I2C, and as part of the Sensor data the
temperature core is also provided.

While the device provides an IRQ gpio, it depends on a configuration
programmed into the internal EEPROM, thus only the default mode is
supported and buffered input via trigger is also supported to allow
streaming values with the same sensing timestamp.

The device can be configured with different sensitivities in factory,
but the sensitivity value used to calculate value into the Gauss
unit is not available from registers, thus the sensitivity is provided
by the compatible/device-id string which is based on the part number
as described in the datasheet page 2.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-3-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:44 +00:00
Julien Stephan
e44a4e6c21 iio: light: apds9960: remove useless return
return 0 statement at the end of apds9960_read_event_config is useless.
Remove it.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-15-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:44 +00:00
Julien Stephan
6921a89dc1 iio: light: apds9960: convert als_int and pxs_int to bool
Since the write_event_config callback now uses a bool for the state
parameter, update type of als_int and pxs_int to bool.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-14-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:44 +00:00
Julien Stephan
86b8843ee2 iio: light: apds9306: simplifies if branch in apds9306_write_event_config
Simplifies the regmap_wite if branch in apds9306_write_event_config.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-13-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:44 +00:00
Julien Stephan
ad531aa484 iio: light: apds9300: use bool for event state
Since the write_event_config callback now uses a bool for the state
parameter, update apds9300_set_intr_state accordingly and change intr_en
to bool.

Also update apds9300_set_power_state and power_state for consistency.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-12-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03 20:33:44 +00:00