Commit graph zephyr/drivers/sensor/nxp
Author SHA1 Message Date
Felix Wang
cae5334d28 drivers: sensor: nxp: eqdc_mcux: migrate to mux subsystem
The mux subsystem redefines the "nxp,inputmux" binding as a mux
controller (#mux-control-cells / #mux-state-cells), which collided with
the EQDC driver's use of the same compatible through a
"specifier-space: inputmux" phandle-array. Reconcile the two by moving
the EQDC PHASEA/PHASEB input routing onto the generic mux model:

- nxp,mcxa156 / nxp,mcxa344 / nxp,mcxaxx6: switch the inputmux node
  from #inputmux-cells to #mux-control-cells / #mux-state-cells so it
  validates against the new binding (nxp,mcxa153 was already done).
- nxp,mcux-eqdc.yaml: drop the local inputmux-connections property and
  include mux-consumer.yaml; routing is now described with "mux-states".
- eqdc_mcux: drop the direct fsl_inputmux HAL calls and apply the
  routing through mux_state_apply(), guarded by device_is_ready(). The
  mux controllers init at priority 40, before the sensor at 90, so they
  are ready at EQDC init time.
- Migrate the frdm_mcxa153/156/266/344/346/366 QDEC sample overlays to
  the mux-states syntax.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-08-03 15:00:55 -04:00
Felix Wang
e51dc855d4 drivers: sensor: nxp: qdec_mcux: migrate to mux subsystem
Drop the direct MCUX_XBARA HAL coupling in the QDEC driver in
favour of the new generic mux subsystem: the driver now selects
CONFIG_MUX, defines mux states from a "mux-states" devicetree
property and applies them at init time via mux_state_apply(),
which makes it agnostic to the underlying mux hardware.

Update the nxp,mcux-qdec binding to include mux-consumer.yaml,
augment the i.MX RT10xx XBAR nodes with CCM clock phandles plus
the new #mux-control-cells / #mux-state-cells declarations, and
migrate the MIMXRT1050-EVK QDEC overlay to the mux-states syntax.

Add the matching XBAR clock support to the i.MX CCM clock driver
(IMX_CCM_XBAR1_CLK / IMX_CCM_XBAR2_CLK gate/ungate, guarded by
CONFIG_MUX_NXP_XBAR) so the XBAR controllers referenced by those
nodes can be clocked.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-08-03 15:00:55 -04:00
Felix Wang
5c727a83d1 drivers: sensor: nxp: qdc_mcux: migrate to mux subsystem
Drop the direct INPUTMUX_AttachSignal() coupling in the QDC driver
in favour of the new generic mux subsystem: the driver now selects
CONFIG_MUX, defines mux states from a "mux-states" devicetree
property, and applies them at init time via mux_state_apply().
This makes the driver mux-hardware-agnostic.

Update the nxp,mcux-qdc binding to use mux-consumer.yaml, expose
the inputmux0 node on the MCXNx4x family DTSI, and migrate the
FRDM-MCXN947 / MCXN5xx-EVK QDC overlays to the new mux-states
syntax.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-08-03 15:00:55 -04:00
Benjamin Cabé
64fd17543c drivers: sensor: nxp_pmc_tmpsns: Fix ADC sequence buffer size
buffer_size was set to the size of the whole data struct instead of
the uint16_t buffer member. Use sizeof of the member.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:46 +02:00
Benjamin Cabé
f57c2f82a3 drivers: sensor: fxas21002: Fix out-of-bounds SPI command buffer
The SPI read command buffer was 2 bytes but described with a length
of 3, reading past the stack array and clocking out an indeterminate
byte. Size the buffer to match.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:46 +02:00
Benjamin Cabé
1fce583536 drivers: sensor: fxos8700: Fix motion threshold value
The trigger setup wrote the FF_MT_THS register address (0x17) as the
threshold instead of the maximum. Write FXOS8700_FF_MT_THS_MASK as
the comment describes.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-23 16:19:46 +02:00
Felix Wang
a961b551c5 drivers: sensor: nxp: add MCUX eQDC driver
Add a sensor driver for the NXP MCUX Enhanced Quadrature Decoder (EQDC)
using the fsl_eqdc HAL. The PHASEA/PHASEB decoder inputs are routed
through the on-chip INPUTMUX, described by an "inputmux-connections"
phandle-array following the nxp,inputmux convention.

The driver exposes SENSOR_CHAN_ROTATION, SENSOR_CHAN_RPM,
SENSOR_CHAN_ENCODER_COUNT and SENSOR_CHAN_ENCODER_REVOLUTIONS; the last
channel is added to the sensor API. Velocity uses the EQDC period
measurement (POSDH/POSDPERH), so a prescaler keeps the 16-bit period
counter from saturating at the sample rate.

A single-phase-mode property selects single-phase decode (one count per
PHASEA pulse, with the direction taken from PHASEB) instead of the
default quadrature X4 decoding, with the counts-per-revolution scaling
adjusted accordingly.

Co-authored-by: bnina-ayoub <ouba.bnina@gmail.com>
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-07-03 10:05:43 +02:00
Jilay Pandya
242e4d6a70 drivers: nxp,mcux-qdc use min/max
use min/max instead of BUILD_ASSERT for counts-per-revolution
and filter-sample-period

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2026-06-02 20:22:38 +02:00
Zhaoxiang Jin
9bf8689eb7 drivers: nxp_pmc_tmpsns: get calibration data using NVMEM
Read the temperature sensor calibration value through the
NVMEM API instead of the legacy ROM OTP API. The calibration
data is exposed by the OCOTP node as an NVMEM cell, so the
driver no longer depends on fsl_romapi_otp.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-07 18:04:59 -05:00
Bartlomiej Fijal
7a1e78e0b3 drivers: sensor: nxp_pmc_tmpsns: fix invalid member access in init
config->adc is of type 'const struct device *', assigned via
DEVICE_DT_GET(). It has no '.dev' member — that field exists only
in 'struct adc_dt_spec'.

The LOG_ERR_DEVICE_NOT_READY() call in lpadc_temp40_init() was
using config->adc.dev, causing a compile error on all platforms
that select NXP_PMC_TMPSNS:

  error: 'config->adc' is a pointer; did you mean to use '->'?

Remove the spurious '.dev' dereference. LOG_ERR_DEVICE_NOT_READY()
accepts 'const struct device *' directly, so passing config->adc
is correct and consistent with the device_is_ready() call on the
line above.

Signed-off-by: Bartlomiej Fijal <StaryAnoda@Gmail.com>
2026-04-29 16:33:03 -04:00
Bartlomiej Fijal
a0dbdc2073 drivers: sensor: nxp_lpadc_temp40: fix invalid member access in init
config->adc is of type 'const struct device *', assigned via
DEVICE_DT_GET(). It has no '.dev' member — that field exists only
in 'struct adc_dt_spec'.

The LOG_ERR_DEVICE_NOT_READY() call in lpadc_temp40_init() was
using config->adc.dev, causing a compile error on all platforms
that select NXP_LPADC_TEMP40:

  error: 'config->adc' is a pointer; did you mean to use '->'?

Remove the spurious '.dev' dereference. LOG_ERR_DEVICE_NOT_READY()
accepts 'const struct device *' directly, so passing config->adc
is correct and consistent with the device_is_ready() call on the
line above.

Signed-off-by: Bartlomiej Fijal <StaryAnoda@Gmail.com>
2026-04-29 16:32:52 -04:00
Maureen Helm
43d6f06f1e drivers: sensor: use LOG_ERR_DEVICE_NOT_READY macro
Unify all "device not ready" error messages across sensor drivers with
the LOG_ERR_DEVICE_NOT_READY macro, following the pattern established
for input drivers in commit 31b5866.

This improves consistency and makes device readiness errors easier to
grep across the codebase. Using the standardized macro ensures device
names are properly formatted with null-safety checks.

Image size impact (tests/drivers/build_all/sensor on native_sim,
building 211 sensor drivers):
- Before: 1,033 KB (text: 961 KB)
- After:  1,036 KB (text: 964 KB)
- Change: +2.5 KB (+0.25%), text: +2.5 KB

The small size increase is due to the macros adding null-safety checks
and dynamic device name formatting, which generates slightly more code
than some of the simpler static log strings used by drivers previously.

Assisted-by: Claude:claude-sonnet-4.5
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2026-04-24 15:36:33 -04:00
Pisit Sawangvonganan
4f9a85e80a drivers: fix typo in (rtc, sdhc, sensor)
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `drivers/rtc`
- `drivers/sdhc`
- `drivers/sensor`

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-03-27 20:21:24 -04:00
Felix Wang
7a27272c46 drivers: sensor: nxp: Add QDC MCUX driver
Add driver support for NXP MCUX Quadrature Decoder (QDC) sensor.
The driver provides:
- Position tracking via SENSOR_CHAN_ROTATION channel
- Configurable counts per revolution
- Single phase and normal decoder work modes
- Input filtering with configurable count and sample period
- INPUTMUX integration for flexible signal routing
- Modulo count mode support

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-03-10 22:22:28 +01:00
Zhaoxiang Jin
510253d12a drivers: sensor: mcux_lpcmp: Removed redundant help information
Removed redundant help information

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-01-05 16:06:37 +01:00
Zhaoxiang Jin
af536abe7d dts: drivers: remove nxp,sensor-lpcmp.yaml
1. Removed nxp,sensor-lpcmp.yaml and merged its
properties into nxp,lpcmp.yaml. Now a single
dt-binding (compatible: nxp,lpcmp) is shared
by two drivers: the sensor API-based LPCMP
driver and the comparator API-based LPCMP driver.

2. Updated the driver and samples accordingly.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-01-05 16:06:37 +01:00
Zhaoxiang Jin
ab23a9f012 drivers: sensor: nxp: Add NXP tempsense driver
Add a new driver for the NXP TempSense temperature
sensor found in various NXP MCUs, such as the MCX
family. The driver reads temperature data from the
TempSense peripheral and provides it via the Zephyr
sensor API.

The TempSense peripheral details can be found in the
NXP MCXE31x reference manual chapter 78.
reference manual can be found at:
https://www.nxp.com/webapp/Download?colCode=MCXE31XRM

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-12-31 10:58:50 +00:00
Zhaoxiang Jin
f85158fea5 drivers: sensor: mark mcux_lpcmp as deprecated
We are planning to implement a new lpcmp driver based on the
comparator API and deprecate the current sensor-based driver.
We now mark the mcux_lpcmp as deprecated.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-12-23 09:32:53 +01:00
Zhaoxiang Jin
7371e94ec7 dts: bindings: rename nxp,lpcmp.yaml to nxp,sensor-lpcmp.yaml
We are planning to implement a new LPCMP driver based on the
comparator API and deprecate the current sensor-based driver.
We would like to use the nxp,lpcmp binding for the new
comparator-based driver implementation. To avoid naming conflicts,
we are renaming the current sensor binding to nxp,sensor-lpcmp.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-12-23 09:32:53 +01:00
Sylvio Alves
f8d2e00a0e includes: remove duplicated entries in zephyr-tree
Remove duplicated #include directives within the same
preprocessor scope across the Zephyr tree.

Duplicates inside different #ifdef branches are preserved
as they may be intentional.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-12-17 13:57:38 -05:00
Zhaoxiang Jin
c6033d58e5 drivers: sensor: pmc_tmpsns: Reduce floating-point operations
Reduce floating-point operations in the nxp_pmc_tmpsns.
Provide new calculation method without floating-point operations.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-10-20 19:18:36 -04:00
Zhaoxiang Jin
44bc475309 drivers: sensor: Enable NXP pmc tmpsns driver
This commit introduced NXP pmc temperature sensor
(pmc-tmpsns) driver.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-10-20 19:18:36 -04:00
Declan Snyder
570b445a61 drivers: Convert to use SPI macro without delay parameters
Convert all drivers and other consumers to use SPI macros without the
delay parameters.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-10-01 14:39:36 +03:00
Anders Bjørn Nedergaard
18bff321be drivers: sensor: temperature: Add i.MX RT die temperature sensor
Added driver for i.MX RT118X die temperature sensor

Signed-off-by: Anders Bjørn Nedergaard <abn@polytech.com>
2025-09-12 16:06:31 -04:00
Declan Snyder
5ae654eeef modules: hal_nxp: Removed unused HAS_MCUX_* configs
Remove the configs that are not actually used for anything anymore or
never were, or that are redundant with other configs, and don't have any
code changes outside of Kconfig to remove.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-15 10:10:32 +03:00
Zhaoxiang Jin
1564438d17 drivers: acmp: Updated driver to be compatible with nxp_rt7xx
1. Fixed the bug that DAC value was set incorrectly.
2. The MIMXRT700 does not have windowed mode and
'enableSample' controls, code added for compatibility
on this platform.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-07-24 16:56:55 +01:00
Peter Wang
aa7618ba59 sensor: add nxp_lpadc_temp40 temperature sensor driver
1. add nxp_lpadc_temp40 temperature sensor driver
2. tested with frdm_mcxa166 and frdm_mcxa276 board

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2025-06-27 09:53:28 -05:00
Bjarki Arge Andreasen
3198db1b12 drivers: sensor: nxp: p3t1755: impl pm device runtime
Implement pm device runtime for p3t1755 sensor.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-26 18:51:26 -10:00
Benjamin Cabé
d5af2f7dde drivers: sensors: fxls8974: fix compilation error in fxls8974_transceive
SPI code wasn't tested in CI so this compilation error was missed.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-20 16:23:25 +02:00
Peter van der Perk
49e33d38c1 drivers: sensor: qdec_tpm: Add QDEC support for NXP TPM
Allows to run the NXP Timer/PWM Module (TPM) in Quadrature
Decoder Mode.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-05-22 02:21:39 +02:00
Zhaoxiang Jin
7ed7cd191a modules: hal_nxp: Move hal_nxp glue layer to zephyr repo
Move hal_nxp glue layer to zephyr repo.
Fix build warnings and failures caused by hal_nxp upgrade.
Update manifest to contain hal_nxp changes.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-03-26 16:26:34 +01:00
Emilio Benavente
5e35836922 boards: nxp: mcxw7x: Add FXLS8964 Sensor Support
Added FXLS8964 Accel Sensor Support for the
mcxw71 and mcxw72 devices.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2025-03-07 19:48:18 +01:00
David Leach
50a044a33d drivers: sensor: fxls8974: fix size misalignment memory access
Coverity identified out-of-bounds access. A uint8_t being cast to
an enum is undefined in that the enum can be allocated 4bytes.

Change the internal function to use the base type of the variable,
uint8_t to avoid potential compiler size alignement problems.

Fixes #81927

Signed-off-by: David Leach <david.leach@nxp.com>
2025-02-07 02:24:17 +01:00
Tarang Raval
e338c7a807 drivers: sensor: fxls8974: remove redundant error check
The function fxls8974_get_temp_data always returns zero, indicating
success.Therefore, the error checking if condition is unnecessary and
can be removed.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
2025-01-17 23:07:40 +01:00
Lucien Zhao
c0b21f4a30 drivers: sensor: nxp: add code judge whether read back correctly
find a sensor driver bug don't judge the data whether read back
correctly, deal with buffer data directly.

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2024-12-18 01:01:37 +01:00
Pieter De Gendt
a553af738d drivers: sensor: Place API into iterable section
Add wrapper DEVICE_API macro to all sensor_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:04:55 +00:00
Mahesh Mahadevan
38f06aa4bf drivers: sensor: p3t1755: Driver for NXP digital temperature sensor
Added driver for the NXP P3T1755 digital temperature sensor.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-10-25 08:53:56 +02:00
Michal Smola
ab3bf82efe drivers: sensor: nxp kinetis temp: Remove depends on kinetis
Remove Kconfig dependency on SOC_FAMILY_KINETIS as the temperature
sensor is available also on MCX family.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-10-24 14:05:00 +02:00
Luis Ubieda
d557ee36d5 sensor: tree-wide: Enforce dependency of int-gpios with Trigger feature
We need int-gpios defined to use trigger functionality. Enforced with
the Kconfig parameter.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-10-22 20:41:43 +02:00
Emilio Benavente
82a192c8a9 boards: nxp: Removing CONFIG_PINCTRL from the boards defconfig
The Drivers using Pinctrl should be turning Pinctrl on
this should not be the responsibility of the board. This
commit removes CONFIG_PINCTRL from the boards side for nxp boards.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-10-15 19:09:45 -04:00
Mahesh Mahadevan
1f0a15fa08 drivers: sensor: Fix NXP LPCMP driver
Fix Build failure due to undefined variable.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-10-14 13:01:13 +02:00
Bjarki Arge Andreasen
4e55597527 drivers: sensor: mcux_acmp: update dts binding and adapt driver
Update the devicetree binding for the nxp,kinetis-acmp comparator and
move the binding to dts/bindings/comparator.

The update to the binding includes:
- Remove unused io-channel-cells property
- Remove unused sensor-device include
- Adding missing properties dac config, discrete mode config, and
  input configs.
- Rename properties to exclude redundant vendor prefix since props in
  this binding are not inhereted, and as such, don't need to be
  namespaced.
- Deprecate the old names of the renamed properties

The sensor based device driver has been updated to support both the
deprecated and new property names. This allows it to use both
nxp,enable-sample and filter-enable-sample for example.

Additionally, remove the unused io-channel-cells properties from
in-tree nodes of compatible = "nxp,kinetis-acmp"

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-10-10 20:24:52 -04:00
Bjarki Arge Andreasen
e0363f252d sensor: mcux_acmp: namespace driver and kconfigs
The mcux_acmp will get support by the comparator subsystem. To avoid
namespace clashes, namespace the driver, kconfigs and use the
MCUX_ACMP config solely to select the MCUX SDK driver.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-10-10 20:24:52 -04:00
Lucien Zhao
62e5805c57 drivers: sensor: mcux_acmp: update mcux_acmp drivers
add MCUX_ACMP_HAS_HYSTCTR macro to adapt feature if IP
don't exist HYSTCTR bit

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2024-09-04 21:27:28 +02:00
Krystof Sadlik
928d025201 drivers: sensor: fxls8974: Added driver for this accelerometer
Added driver for the fxls8974 accelerometer which is present on the
mimxrt1040_evk board.

Signed-off-by: Krystof Sadlik <krystof.sadlik@nxp.com>
2024-08-19 10:00:34 -04:00
Anke Xiao
643e464c76 modules: Kconfig.mcux: remove HAS_MCUX_ACMP
Remove the ‘HAS_MCUX_ACMP’ Kconfig, and also remove it from
driver and soc Kconfig files. It is not needed since we already
depend on 'ACMP' enabled in the dt file, the 'HAS_MCUX_ACMP'
kconfig is a relic of the past before devicetree was stable.

Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
2024-08-01 12:37:23 +02:00
Zhaoxiang Jin
0507021009 drivers: sensor/nxp: Add NXP LPCMP driver
Add NXP LPCMP driver

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-05-31 09:51:29 -05:00
Henrik Brix Andersen
59402fd82e drivers: sensor: nxp: kinetis: temp: fix memset() length
Use the correct buffer size when calling memset().

Fixes: #73093

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-05-21 16:41:58 -04:00
Henrik Brix Andersen
0a49b788a4 drivers: sensors: nxp: kinetis: temp: select CONFIG_ADC
The NXP Kinetis temperature sensor depends on CONFIG_ADC. Make the driver
Kconfig select CONFIG_ADC to get better CI coverage (enabling the driver
when CONFIG_SENSOR is enabled without depending on CONFIG_ADC=y).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-05-21 16:41:58 -04:00
Maureen Helm
1cfa6d918a drivers: sensor: nxp: Move to vendor subdirectory
Organizes sensor drivers by vendor to distribute maintainership
responsibilities.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2024-04-08 09:14:06 -04:00