Commit graph

24538 commits

Author SHA1 Message Date
Marcio Ribeiro
3416f9ab47 drivers: adc: esp32: fix invalid width mask and calibration
Fixed WIDTH_MASK invalid values and use HW calibration.

Fixes #72983
Fixes #73798
Fixes #73400

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2024-07-12 06:25:53 -04:00
Luis Ubieda
9c516db69c sensor: coverity-fix: Simplify unsigned comparison
- VEML7700 - Coverity CID 363733, GH: #74759.
- VEML7700 - CID 363719, GH: #74755.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-12 05:56:30 -04:00
Fin Maaß
de82190e13 drivers: clock_control: litex: remove redundant entry
remove litex,sys-clock-frequency from litex,clk,
because we already define that in the clock-frequency of cpu0.
This can be accessed via
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-07-12 05:49:01 -04:00
Ben Marsh
74c871dce2 build: Prefix missed generated syscall includes
PR #63973 namespaced generated headers with zephyr/, including generated
syscall headers.

Since then, some new generated syscall header includes have been added
without the zephyr/ prefix, breaking builds when
CONFIG_LEGACY_GENERATED_INCLUDE_PATH is disabled.

This commit adds the zephyr/ prefix to includes for generated syscall
headers where it has been missed.

Signed-off-by: Ben Marsh <ben.marsh@helvar.com>
2024-07-11 18:24:58 -04:00
Sylvio Alves
43a559080b soc: esp32s2: fix wifi clock gate
ESP32-S2 Wi-Fi clock is not initialized properly, causing
instability when scanning or connecting to a SSID.

Fixes #74899
Fixes #74417

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-07-11 16:19:55 -04:00
Brett Witherspoon
f320535f84 drivers: dac: dac_ad569x: Add bit shift for 14/12-bit variants
The 14/12-bit variants (AD5692R/AD5691R) require the data to be in the
upper bits of the two byte data field of the write command. See table 12
and the associated footnotes in the AD5693R/AD5692R/AD5691R/AD5693
datasheet.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2024-07-11 09:37:12 +02:00
Alberto Escolar Piedras
0cf89bb8b4 drivers/spi/spi_xlnx_axi_quadspi: Build fix w CONFIG_SPI_ASYNC
Fix a build error when CONFIG_SPI_ASYNC is set.
The issue was detected by CI

```
spi_xlnx_axi_quadspi.c: In function 'xlnx_quadspi_isr':
spi_xlnx_axi_quadspi.c:489:21: error: 'ctx' undeclared
  489 |                 if (ctx->asynchronous) {
      |                     ^~~
```

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-07-10 19:13:46 -04:00
Declan Snyder
6ac0d8bf84 drivers: mdio_nxp_enet: Fix busy wait
Fix the busy wait in the MDIO driver that was causing timing
problems in systems with real time requirements performing tasks
more frequently than about a millisecond.

Restructure the code to be less redundant and change the busy wait
kconfig to microseconds instead of millliseconds. Also actually signal
to the mdio driver that it can use the interrupt instead of busy
waiting, this seems to have been forgotten.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-07-10 19:13:27 -04:00
Ryan Erickson
7bef3fd8af modem: hl7800: set RX socket remote address
Set the remote address of received sockets.
This is necessary for services that rely on the remote address.
DNS relies on the remote address to be set properly.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2024-07-10 16:16:03 -04:00
Jordan Yates
063d2ff6ec watchdog: cmsdk_apb: only support a single channel
The CMSDK watchdog hardware only supports a single timeout channel.
Return the documented error if more than one timeout is requested to be
installed.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-10 14:39:36 +02:00
Jordan Yates
9138763430 watchdog: cmsdk_apb: validate timeout window
Validate the maximum timeout window, as required by the API tests.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-10 14:39:36 +02:00
Jordan Yates
74f3b587fc watchdog: cmsdk_apb: fix period calculation
The previous calculation was multiplying the timeout in milliseconds
by the clock frequency, giving a cycle count 1000x larger than it should
be.

Fix the calculation and rename `reload_s` to `reload_cycles`, as the
cycle count is what this actually contains.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-10 14:39:36 +02:00
Rahul Goyal
f1e38e73d7 Drivers: max17048: updated voltage parameter output
present output shows voltage in mV.
updated output shows voltage in uV.

Signed-off-by: Rahul Goyal <goyalrahul1516@gmail.com>
2024-07-10 11:36:28 +02:00
Frank Lin
6fc525cc20 drivers: serial: uart_cdns: fix interrupt driven
Fix interrupt driven for shell

Signed-off-by: Frank Lin <linfrank@meta.com>
2024-07-09 19:45:18 -04:00
Brett Witherspoon
cb8db004d7 drivers: dac: dac_ad569x: Fix reset error return
The intention here appears to be to return an error. Use an early return
to implement this.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2024-07-09 19:43:23 -04:00
Kevin Wang
6cb8956a08 drivers: watchdog: Refine the atcwdt200 driver's code.
Remove the reset vector setting from driver layer,
the reset vector is more suitable to be set at the board layer.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2024-07-09 17:21:28 -04:00
Luis Ubieda
00a3be90d7 sensor: icm42688: Use RTIO workq on icm42688_submit
To make its execution path non-blocking from the caller's perspective.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Luis Ubieda
8d0c2f15df sensor: bme280: Use RTIO workq on bme280_submit
To make its execution path non-blocking from the caller's perspective.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Luis Ubieda
5521fc4410 sensor: bma4xx: Use RTIO workq on bma4xx_submit
To make its execution path non-blocking from the caller's perspective.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Luis Ubieda
59e8919da7 sensor: akm09918c: Use RTIO workq on akm09918c_submit
To make its execution path non-blocking from the caller's perspective.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Luis Ubieda
aff6e31ec4 sensor: fallback: Decouple RTIO request using RTIO workqueues service
Incorporate RTIO workqueues to turn sensor_submit_callback into an
asynchronous request.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Luis Ubieda
cc139b85df sensor: Enable RTIO Semaphores for Async API
In order to decouple the read request from its implementation, we need
to be able to yield to potential lower-priority threads, which is not
possible with k_yield() itself. As such, using RTIO Consume semaphore
enables us to achieve this.

This patch also refactors blocking API (sensor_read) to also block upon
consumption, so as not to require RTIO_SUBMIT_SEM enabled.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 17:21:05 -04:00
Devansh Tanna
6d4fba1f86 drivers: cc13xx_cc26xx: pwm: enable pwm(gpt) in sleep/deepsleep mode
- enabled GPT(PWM) peripheral for sleep/deepsleep mode in init_pwm()
- Fixed: undefined behaviour when using k_sleep()

Signed-off-by: Devansh Tanna <devansht0210@gmail.com>
2024-07-09 17:20:46 -04:00
Benjamin Cabé
95caf476f1 drivers: ptp_clock_nxp_enet: add module_dev to driver config
c8d8dce755 introduced a regression whereby driver config should hold
module device pointer, except it didn't.
This commit adds module_dev to the driver config.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-07-09 17:20:12 -04:00
Jean Nanchen
77f9f0e965 drivers: sensor: maxim: max31865: Fix fault bit clearing
Ensures D1 sets and D5, D3, D2 reset, preventing undefined states.

Signed-off-by: Jean Nanchen <jean.nanchen@gmail.com>
2024-07-09 15:38:19 -04:00
Thomas Stranger
b5d3dea894 drivers: sensor: ds18b20: indicate error for missing response
When multiple devices are on the bus, and no slave matches
the sent rom, the master receives only ones.
This should be handled explicitly and the error reporting
should not rely on the crc mismatch of the scratchpad.

Note: Make sure that the sensor configuration is loaded to the
eeprom (copy scratchpad), otherwise the resolution will not match
the expectations in case a node looses power and recovers.
As in that case the configuration will not be applied again.
Also the sensor may still report the power on reset value
of +85°C just after the sensor powered up.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-07-09 15:37:58 -04:00
Thomas Stranger
6fd767d6e4 drivers: sensor: ds18b20: verify scratchpad write
Verify that the scratchpad write was successful by
reading back the configuration.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-07-09 15:37:58 -04:00
Thomas Stranger
53e3936a2e drivers: sensor: ds18b20: verify crc of scratchpad.
After each read of the scratchpad the crc of the data
is checked and in case of a mismatch an error is returned.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-07-09 15:37:58 -04:00
Thomas Stranger
f4acf390dd drivers: sensor: ds18b20: cleanup header/includes
- Move the content of the header file into the source file,
and drop unnecessary includes.
- Also, drop the bus access function.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-07-09 15:37:58 -04:00
Brett Witherspoon
97190d76ec drivers: dac: dac_ad56xx: Fix channel range check
An off by one error in the channel range check results in an out of
bound access to the channel lookup array.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2024-07-09 15:31:58 -04:00
Omer Gozderesi
1fc97561ed config: esp32: configurable UART FIFO thresholds
The existing configuration of the ESP32 UART FIFO thresholds
was fixed, leading to inefficiencies in handling
Modbus RTU packages exceeding this size.
This commit introduces two new Kconfig options,
allowing users to adjust the esp32 fifo thresholds as needed.
fixes #74311

Signed-off-by: Omer Gozderesi <omer.gozderesi@enda.com>

config: esp32:  configurable UART FIFO thresholds

The existing configuration of the ESP32 UART FIFO thresholds
was fixed, leading to inefficiencies in handling
Modbus RTU packages exceeding this size.
This commit introduces two new Kconfig options,
allowing users to adjust the esp32 fifo thresholds as needed.
fixes #74311
Signed-off-by: Omer Gozderesi <omer.gozderesi@enda.com>
2024-07-09 15:24:02 -04:00
Marcin Niestroj
c368c332c4 drivers: wifi: esp_at: fix UDP socket setup
Right now AT+CIPSTART command is called with both "remote port" and "local
port" being set to the same number. This means that for outgoing UDP
traffic (e.g. when resolving DNS or when reaching out some application
server with CoAP over UDP) always the same outgoing port is used. Such
behavior is wrong, since by default a random outgoing port should be used.

Reusing the same port confuses server implementation that is reached out,
since especially in context of DTLS over UDP, outgoing port defines TLS
context/session to be used. Such servers often ignore TLS packets from new
sessions (e.g. after device reboot) and result in failed DTLS connection
attempts.

Commit dbf3d6e911 ("drivers: esp_at: implement bind() and recvfrom() for
UDP sockets") added support for "server-side listening" for incoming
traffic on UDP sockets, which introduced broken behavior of using the same
remote and local port.

In esp_bind() implementation assign newly intorduced 'src' member, instead
of reusing 'dst'. Don't call AT+CIPSTART yet at this stage, as in case of
connect() Zephyr syscall esp_bind() (via bind_default() helper function) is
called implicitly to assign random generated local port, so remote port is
yet to be assigned. Check in esp_recv() whether socket was already
connected (i.e. esp_connect() was called) and if not, invoke
AT+CIPSTART (via _sock_connect()) to start listening on "server-side" UDP
socket.

This patch fixes broken behavior of always reusing the same local port for
outgoing UDP traffic. Instead, randomly generated (by Zephyr net_context
subsys) local port is used. Additionally bind() and recvfrom()
implementation (to handle server-side UDP sockets) is improved, so that
binding to 0.0.0.0 (on any interface) is possible.

Fixes: dbf3d6e911 ("drivers: esp_at: implement bind() and recvfrom() for
  UDP sockets")
Fixes: 424ea9f5e4 ("drivers: wifi: esp_at: do not connect socket on
  bind(INADDR_ANY)")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-09 19:06:12 +02:00
Luis Ubieda
95e299ad39 sensor: lis2dux12: fix: CID 363712: Initialize mode-fs
Following the same pattern used in `lis2dux12_sample_fetch_accel`.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 19:05:03 +02:00
Henrik Brix Andersen
09d189cb71 drivers: can: loopback: increase default TX thread stack size
Increase the default TX thread stack size for the CAN loopback driver from
256 to 512 bytes as the former has shown to be too little when using the
loopback driver on real hardware.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-07-09 17:18:34 +02:00
Henrik Brix Andersen
7a25fbb2d7 drivers: can: loopback: set TX thread name
Set TX thread name to aid in debugging.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-07-09 17:18:34 +02:00
Luis Ubieda
05f8b9c54b sensor: lps22hh: Prevent overwriting values that weren't overwritten
Previously both temperature and pressure were updated regardless of
which one was requested.

Fixes CID: 392519, GH: 74779.
Fixes CID: 392497, GH: 74777.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-07-09 11:51:16 +02:00
Jared Kangas
c0fd916fbc drivers: sensor: wsen_itds: fix device ID mismatch return value
During initialization, zero is returned if an unexpected device ID is
read because the returned variable is not written to after a previous
non-zero check. Return -EIO instead to indicate an error occurred.

Detected with the following Coccinelle script:

        @@
        identifier I;
        @@

        *if (I) {
             ...
             return ...;
         }

         if (...) {
             ... when != I
                 when any
        *    return I;
         }

Signed-off-by: Jared Kangas <kangas.jd@gmail.com>
2024-07-09 08:56:04 +02:00
Sylvio Alves
6ade0cf715 wifi: esp32: fix memory leak
In case where the system is overloaded, net stack buffer
could fail to allocate next packet. That scenario requires
wifi internal Wi-Fi driver to free current rx buffer. This is
currently not being called. This fixes it by making sure
esp_wifi_internal_free_rx_buffer() is called in all scenarios.

Fixes #63043

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-07-08 20:41:16 -04:00
Glenn Andrews
1c19d43564 Driver: i2c_ll_stm32_v2: Remove log msg on boot
Converts the `<inf> i2c_ll_stm32_v2: I2C TIMING` message
displayed by the driver to a LOG_DBG. Also makes an actual
error message a LOG_ERR instead of a LOG_DBG.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
2024-07-08 20:40:54 -04:00
Tom Burdick
983ee54dfd sensors: ICM42688 read/writes chain callbacks
RTIO expects the CHAINED flag to be set when ordering of operations is
important. The callbacks in the icm42688 stream handling were not
chained into, meaning the callbacks would have occured immediately
rather than *after* the SPI reads/writes.

Update all the spi transactions to chain into the desired callbacks in
the driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-07-08 17:18:16 -04:00
Zhaoxiang Jin
630203de97 drivers: lpadc: Update lpadc driver to use the latest feature
Updated nxp lpadc driver, because the phandle type property
'nxp,reference-supply' was removed, and a new phandle-array
type property 'nxp,references' added.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-07-08 14:57:55 -04:00
Sylvio Alves
5196bdf964 drivers: eth: esp32: fix build to enable statistics
When CONFIG_NET_STATISTICS=y is enabled, build fails
due to wrong interface pointer.

Fixes #75515

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-07-08 14:55:47 -04:00
Nazar Palamar
bf17ba9d43 driver: spi: psoc6: fix build error in driver
fix build error related to pinctrl.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-07-08 15:51:21 +02:00
Nils Larsen
dcfc3e7872 drivers: gpio: imx rt11xx: fix wrong gpio pull disable mask
Fixes: #75390
A wrong bit mask (wrong: IOMUXC_SW_PAD_CTL_PAD_PUS_MASK = 0x8) was used.
That bit mask is for PUE/PUS-type gpio registers, but this is the
section for registers with alternative PULL (PDRV) type layout.
Right bit mask: IOMUXC_SW_PAD_CTL_PAD_PULL_MASK

Signed-off-by: Nils Larsen <nils.larsen@posteo.de>
2024-07-08 09:30:15 +02:00
Jordan Yates
0010dec4f0 watchdog: wdt_nrfx: don't zero init static
Don't zero initialise the static data structure, as statics are
explicitly initialised to 0 per the C standard, and checkpatch normally
complains about the pattern.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-08 09:25:24 +02:00
Jordan Yates
23afa2124f watchdog: wdt_nrfx: install return error if enabled
Return the documented error if `wdt_install_timeout` is called after
`wdt_setup`, instead of triggering the state assertion inside of
`nrfx_wdt_channel_alloc`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-08 09:25:24 +02:00
Jordan Yates
7fe440121f watchdog: wdt_nrfx: feed return error when not enabled
Return an error code if `wdt_feed` is called before `wdt_setup`, instead
of triggering the state assertion inside of `nrfx_wdt_channel_feed`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-07-08 09:25:24 +02:00
Marcin Niestroj
2e956c239b drivers: wifi: esp_at: check if MAC address was parsed successfully
Log an error when MAC address was not parsed successfully.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-05 18:45:47 +02:00
Marcin Niestroj
4150765549 drivers: wifi: esp_at: use memcpy() to copy SSID
Target SSID buffer might not be NULL terminated, so use memcpy() instead of
strncpy() for copying it from temporary (AT response fragment) buffer.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-05 18:45:29 +02:00
Marcin Niestroj
f15c4e3adb drivers: nsos: fix resource leak in nsos_adapt_accept() error path
Close file descriptor returned by accept() in error path of
nsos_adapt_accept(), so that file descriptor is not leaked.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-05 18:44:13 +02:00