Commit graph

23353 commits

Author SHA1 Message Date
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
Miguel Gazquez
3408694960 drivers: memc: fix Kconfig option MEMC_STM32
This commit fixes a bug with the declaration of the Kconfig option
MEMC_STM32.

The option is defined in two files:
- `drivers/memc/Kconfig.stm32`, wich depends on
   - `MEMC`
   - `DT_HAS_ST_STM32_FMC_ENABLED`
-`soc/st/stm32/Kconfig.defconfig`, wich depends on
   - `MEMC`
   - `SOC_FAMILY_STM32`

So, if you have `CONFIG_MEMC=y` in your Kconfig options and you are on a
STM32 SoC, `CONFIG_MEMC_STM32` will be enabled, even if there is no
STM32 FMC enabled.

This Kconfig option causes the driver for the STM32 FMC to be compiled,
regardless of the presence of an enabled node for the FMC.
However, the driver fails to compile if there is no FMC node in the
devicetree. So, if you compile a project with `CONFIG_MEMC=y` on a board
with an STM32 SoC and no enabled FMC, the build will fail.

This commit deletes the Kconfig declaration in the `Kconfig.defconfig`,
as it isn't useful and is the one provoking the bug.
It also add in the `Kconfig.stm32` the compatible `st,stm32h7-fmc`, wich
use the same driver and so need to be enabled by the same Kconfig
option.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2024-07-05 18:43:06 +02:00
Jared Kangas
34e4edc28a drivers: eeprom: emulator: correct improper exponentiation
The top-level driver comment states that a uint16_t is used to store
changes if the EEPROM size is smaller than 64kB, or uint32_t otherwise.
However, the 64kB threshold is represented as 2^16 in the actual code,
which is a bitwise XOR instead of an exponent. This causes a uint16_t
to be used only if the size is less than or equal to 18 bytes. Correct
this by using KB(64) instead of 2^16.

Signed-off-by: Jared Kangas <kangas.jd@gmail.com>
2024-07-05 09:18:31 +02:00
Dev Joshi
a9e6fa4b29 drivers: I2C_DW: Fix I2C scan example
Solves two identical issues listed below:

Issue 1: I2C scanner example for DesignWare hardware gets stuck
indefenitely resulting in system hang up.This is because DW I2C driver
does not handle 0 byte transfer correctly which is the case for I2C
scan example.

Fixed it by overwriting the msg length to 1 if it is 0 and the
buffer is not NULL.

Issue 2: Similarly, if the I2C pins are not pulled up (nothing connected
 to I2C pins), the DW hardware does not actually send the data
(assuming contention on the bus) hence not releasing the semaphore
resulting in calling thread waiting forever.

Fixed it by adding a timeout to k_sem_take call and return error if
cannot successfully acquire it.

Tested scenarios where nothing was connected on the bus and saw the
I2C scan example complete the whole scan command. Then connected
two different sensors on the I2C bus and saw both the address on the
console. Tested both the uses cases on Raspberry Pi Pico.

Fixes #70332.

Found that micropython tackles the same issue by implementing I2C scan
commands with Soft I2C because the same reason mentioned in Issue 1.

Signed-off-by: Dev Joshi <quic_devbhave@quicinc.com>
2024-07-04 08:23:43 +02:00
Armando Visconti
cd7119d292 drivers/sensor/st: ism330dhcx: fix gyro range setting
Fix ism330dhcx_gyro_fs_map[] and ism330dhcx_gyro_fs_sens[] arrays
initialization in order to be able to correctly convert from dps
to register raw value through the array index.

Fix: #72617

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-07-04 08:19:03 +02:00
Armando Visconti
50ad2e05dc drivers/sensor/st: ism330dhcx: fix odr setting
Loop inside the odr array until we find the first
value which is "<=" (amd not "==") the argument.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-07-04 08:19:03 +02:00
Furkan Akkiz
abef5a3c86 drivers: serial: uart_max32: Fixing bugs and code optimizations
- Defined 'api_configure' function outside of
'CONFIG_UART_USE_RUNTIME_CONFIGURE' macro because it is the only
configuration function and used in device initialization function.
- Removed unnecessary 'IF_ENABLED' part.

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
2024-07-04 08:17:27 +02:00
Marcin Niestroj
248e54f9c1 drivers: nsos: add missing 'break' in switch statements
There are 2-level switch statements (one switch inside another) which were
not properly terminated with 'break' statements, leading to implicit
fallthrough. Fix that.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-07-03 17:00:28 -04:00
Alessandro Manganaro
375bf0b835 drivers: bluetooth: hci: hci_stm32wba.c
Providing setup implementation for
STM32WBA BLE HCI driver

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2024-07-03 15:06:48 -04:00
Alessandro Manganaro
2c42032ef4 drivers: bluetooth: hci: Kconfig
Enabling BT_HCI_SET_PUBLIC_ADDR option for
STM32WBA BLE HCI driver

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2024-07-03 15:06:48 -04:00
Nazar Palamar
af04e0d3fa drivers: wifi/airoc: Update cb_search to check SSID length
Issue:
When there are two similar SSIDs (e.g. MySSID and MySSID_Guest),
the current implementation may use the wrong (truncated) SSID
for the connection. See issue#74910 for details.

Fix:
Updated airoc_wifi_scan_cb_search to filter all SSID where
length is different than the user-entered SSID.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-07-03 15:05:57 -04:00
Jared Kangas
8ec3c045f8 drivers: adc: lmp90xxx: fix checksum mismatch return value
During channel reads, zero is returned on CRC mismatches: the returned
error variable is not written to after a previous non-zero check. Return
-EIO to mirror other drivers' checksum validation behaviors.

Signed-off-by: Jared Kangas <kangas.jd@gmail.com>
2024-07-03 15:29:07 +02:00
Fabio Baltieri
36d90be198 drivers: udc_stm32: only check for HS_SPEED if defined
Seems like not all stm32 devices define USBD_HS_SPEED in the HAL, only
check for USBD_HS_SPEED if defined. Fixes a build failure with the new
stack on F1 MCUs.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-07-02 19:23:35 -04:00
Benjamin Bigler
81556d6150 drivers: ethernet: phy_mii: check if there is a mdio config
In fixed-link mode, mdio remains unconfigured. This results in a null
pointer dereference, triggering a bus fault

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2024-07-02 14:18:46 +02:00
Xudong Zheng
19c1f9f6c5 drivers: serial: pl011: add support for hardware flow control
Flow control will be enabled for UART if hw-flow-control is set.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2024-07-01 16:08:23 -04:00
Johann Fischer
6aaad0a5cd drivers: udc_stm32: handle ZLP flag
A function, such as CDC ECM, can set the ZLP flag to handle a
class-specific protocol. This is not to be confused with the ZLP role in
control transfers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-01 16:06:26 -04:00
Johann Fischer
de728c393b drivers: udc_stm32: implement driver API to get actual device speed
Implement driver API to get actual device speed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-07-01 16:06:26 -04:00
Guillaume Gautier
c93d6b8559 drivers: adc: stm32: apply extended calibration on u5
Some STM32U5 can apply an extended calibration to enhance the ADC
performance.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-07-01 09:06:22 -04:00
Guillaume Gautier
aa670f7e4a drivers: adc: stm32: check ldo ready bit
For STM32H7, U5 and WBA, check the LDORDY bit of the ADC ISR register
after enabling the internal regulator. This method is safer than the
delay.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-07-01 09:06:22 -04:00
Hao Luo
faa5fa1ab0 drivers: i2c: bugfix for ambiq i2c driver
Added k_sem_give for error return case.
Changed enabled interrupt bits.

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-07-01 09:06:05 -04:00
Benjamin Cabé
f19446f35d drivers: ethernet: stm32: fix PTP on STM32F7
As of recent update of stm32f7 HAL to cube version V1.17.2
the workaround for misspelled HAL_ETH_PTP_CONFIGURATED macro
is not needed anymore, and causes PTP support to fail to compile.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-07-01 09:04:43 -04:00
Tim Lin
c79432e108 drivers/input: it8xxx2: Add critical section to prevent race conditions
The KBS_KSOH1 register contains both keyboard and GPIO output settings.
Not all bits are for the keyboard will be driven, so a critical section
is needed to prevent race conditions.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2024-07-01 09:04:14 -04:00
Ian Morris
2c34da96f0 drivers: clock_control: ra: fix issue with setting memwait cycles
Setting the number of memory wait cycles must take place while the clock
is set to 32MHz or less. This patch ensure the MEMWAIT register is
changed before the clock is changed from its default value (of 8MHz).
Note that in order to set MEMWAIT to 1 the power control mode must be
set to high speed (which is why the lines of code interacting with the
OPCCR register have also been moved).

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2024-07-01 09:17:54 +02:00
Chang Feng
971a0d1d93 driver: spi: gd32: fix spi reg clear wrong flag
SPI DMATEN and DMAREN flags are in SPI_CTL1 register. fixed wrong register.

Signed-off-by: Chang Feng <chang_196700@hotmail.com>
2024-07-01 09:16:22 +02:00
Andreas Klinger
ac4878e9d0 drivers: gnss: gnss_u_blox_m10: fix compiler warning
Fix warning on implicit declaration of function 'malloc' when compiling
gnss_u_blox_m10.c.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2024-07-01 09:14:12 +02:00
Jukka Rissanen
3b72fe557e drivers: eth: e1000: Use double with PTP clock
Instead of mixing floats and doubles, convert the code to
use double so that we avoid float->double conversion warning
from compiler.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-06-29 05:50:04 -04:00
Johann Fischer
155ef4bd1d drivers: udc_stm32: disable control endpoints in udc_disable()
Disable control endpoints in udc_disable() implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-28 20:56:47 -04:00
Johann Fischer
a01ab79685 drivers: udc_kinetis: add missing return statement
Add the missing return statement to the branch where no slabs are
available.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-28 20:56:47 -04:00
Adrien MARTIN
fd90c9ba21 drivers: spi: gecko: propagate spi config error
This commit catch the return code of the spi_config function and
early returns on error so that high level spi transfer api gets
the error too.

Signed-off-by: Adrien MARTIN <adrienmar@kickmaker.net>
2024-06-28 21:53:22 +02:00
Ioannis Damigos
6cc5478530 bme280: Update decoder to decode channels correctly
Update bme280 sensor driver decoder to decode
correctly the requested channels.

Fixes issue #74927

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-28 12:22:54 -04:00
Johann Fischer
06086ce771 drivers: udc_dwc: remove rwup flag
The driver does not implement host_wakeup, remove rwup capability flag.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-28 07:21:29 -04:00
Jordan Yates
91f8c1aea9 everywhere: replace #if IS_ENABLED() as per docs
Replace `#if IS_ENABLED()` with `#if defined()` as recommended by the
documentation of `IS_ENABLED`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-28 07:20:32 -04:00
Cong Nguyen Huu
41418f5266 drivers: nxp_s32_canxl: add CANXL MRU handler
Add CANXL MRU handler, use the same RX, TX IRQ number.
Update the error priority that is lower priority than
the the tx_rx_mru priority incase the error interrupt
happens continuously, mru interrupt priority must be
higher to get report error counter. Otherwise the mru
interrupt can be delayed by error interrupt and
never call to MRU handler. This fixes #75022.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2024-06-28 07:20:20 -04:00
Nerijus Bendžiūnas
31ad324120 drivers: i2c: stm32: remove redundant new line
LOG_* adds "\n" by itself.

Fixes redundant lines during startup:

```
[00:00:00.100,000] <inf> i2c_ll_stm32_v2: I2C TIMING = 0xb0f6343d

[00:00:00.100,000] <inf> i2c_ll_stm32_v2: I2C TIMING = 0xb0f6343d

[00:00:00.100,000] <inf> i2c_ll_stm32_v2: I2C TIMING = 0xb0f6343d

[00:00:00.100,000] <inf> i2c_ll_stm32_v2: I2C TIMING = 0xb0f6343d

[00:00:00.100,000] <inf> flash_stm32_qspi: Reading SFDP
```

Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@astrolightspace.com>
2024-06-28 08:56:09 +02:00
Sven Ginka
1b09d5a883 drivers: sam_can: fixed MCAN Register Base Address
Before that fix, the default mrba was used; added
DMA Base Address to DTSI. Fixes #68472

Signed-off-by: Sven Ginka <sven.ginka@gmail.com>
2024-06-27 17:56:04 -04:00
Fabio Baltieri
96815be5f7 input: pinnacle: fix return value check for WAIT_FOR
WAIT_FOR returns type in this case is a boolean, use a boolean as
variable and check.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-06-27 15:16:05 -04:00