Commit Graph

2147 Commits

Author SHA1 Message Date
Benjamin Björnsson
9e105d2037 tests: drivers: adc: adc_api: Remove mikroe adc click sheild
Remove shield, using this shild will require an overlay for
the particular board being used.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
7938f86f50 tests: drivers: adc: adc_api: Move compat atmel,sam-afec to DT
Move channel description to devicetree for atmel,sam-afec
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
89ed720f06 tests: drivers: adc: adc_api: Move compat atmel,sam0-adc to DT
Move channel description to devicetree for atmel,sam0-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
9024ffa0c7 tests: drivers: adc: adc_api: Move compat atmel,sam-adc to DT
Move channel description to devicetree for atmel,sam-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
b09423fce8 tests: drivers: adc: adc_api: Move compat gd,gd32-adc to DT
Move channel description to devicetree for gd,gd32-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
70b6a17a96 tests: drivers: adc: adc_api: Move compat telink,b91-adc to DT
Move channel description to devicetree for telink,b91-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
c3c9ce5e01 tests: drivers: adc: adc_api: Move compat nxp,kinetis-adc16 to DT
Move channel description to devicetree for nxp,kinetis-adc16
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
34dad8c55b tests: drivers: adc: adc_api: Move compat nordic,nrf-saadc to DT
Move channel description to devicetree for nordic,nrf-saadc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
64c2cd3230 tests: drivers: adc: adc_api: Move compat nordic,nrf-adc to DT
Move channel description to devicetree for nordic,nrf-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
9d397c2173 tests: drivers: adc: adc_api: Move compat st,stm32-adc to DT
Move channel description to devicetree for st,stm32-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
3219e1618f tests: drivers: adc: adc_api: Move compat nxp,kinetis-adc12 to DT
Move channel description to devicetree for nxp,kinetis-adc12
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
25ca362907 tests: drivers: adc: adc_api: Move compat microchip,xec-adc to DT
Move channel description to devicetree for microchip,xec-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
b2349d817c tests: drivers: adc: adc_api: Move compat nxp,lpc-lpadc to DT
Move channel description to devicetree for nxp,lpc-lpadc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
ad4e732a77 tests: drivers: adc: adc_api: Move compat nuvoton,npcx-adc to DT
Move channel description to devicetree for nuvoton,npcx-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
6e0ce6e81b tests: drivers: adc: adc_api: Move compat ti,cc32xx-adc to DT
Move channel description to devicetree for ti,cc32xx-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
0e1fb2fc23 tests: drivers: adc: adc_api: Move compat ti,cc13xx-cc26xx-adc to DT
Move channel description to devicetree for ti,cc13xx-cc26xx-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
a1b58c7217 tests: drivers: adc: adc_api: Move compat ite,it8xxx2-adc to DT
Move channel description to devicetree for ite,it8xxx2-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
4e93ede856 tests: drivers: adc: adc_api: Move compat nxp_mcux,12b1msps-sar to DT
Move channel description to devicetree for nxp_mcux,12b1msps-sar
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
3d93116b1c tests: drivers: adc: adc_api: Move compat raspberrypi,pico-adc to DT
Move channel description to devicetree for raspberrypi,pico-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
ef91d2f87c tests: drivers: adc: adc_api: Move compat espressif,esp32-adc to DT
Move channel description to devicetree for espressif,esp32-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
8382d119f9 tests: drivers: adc: adc_api: Move compat infineon,xmc4xxx-adc to DT
Move channel description to devicetree for infineon,xmc4xxx-adc
compatible to make the test more readable.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Benjamin Björnsson
5848200dc8 tests: drivers: adc: adc_api: Move test to devicetree
Move test to use adc_dt_spec for native posix board.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-14 09:57:51 +02:00
Keith Packard
1d5e644d12 samples, tests: Switch main return type from void to int
This applies the coccinelle script to another set of files:

   samples/bluetooth/bthome_sensor_template/src/main.c
   samples/boards/stm32/power_mgmt/standby_shutdown/src/main.c
   samples/drivers/smbus/src/main.c
   samples/drivers/virtualization/ivshmem/doorbell/src/ivshmem.c
   samples/fuel_gauge/max17048/src/main.c
   samples/hello_world/src/main.c
   samples/sensor/proximity_polling/src/main.c
   samples/subsys/logging/ble_backend/src/main.c
   tests/drivers/build_all/mfd/src/main.c

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Keith Packard
0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Henrik Brix Andersen
bd2651537c tests: drivers: can: api: test filters between CAN-FD/classic CAN modes
Test that filters are preserved when changing between CAN-FD mode and
classic CAN mode and vice versa.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-13 10:00:03 +02:00
Henrik Brix Andersen
702bc0d954 tests: drivers: can: api: fix comment
Fix comment describing CAN-FD format frame number 2.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-13 10:00:03 +02:00
Christian Spinnler
1fa3f71f76 tests: drivers: add nor-psram to memc test configuration
This enables running stm32-fmc-nor-psram enabled devices to run memc test

Signed-off-by: Christian Spinnler <christian.spinnler@fau.de>
2023-04-12 17:44:06 +02:00
Gerard Marull-Paretas
a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Franciszek Zdobylak
ffe94b512f drivers: update overlays for HiFive Unmatched
HiFive Unmatched is using size and address cells of length 2. It has to
use different overlays (with reg properties of correct length).

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-04-12 13:05:55 +02:00
Franciszek Zdobylak
fb80eb5a2e tests: drivers: memc: add hifive_unmatched board
Add HiFive Unmatched board to memory controller tests.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-04-12 13:05:55 +02:00
Andriy Gelman
7a9490b316 tests: uart: uart_async_api: Re-enable tests on xmc45_relax_kit
drivers.uart.async_api.rtt test started failing on xmc45_relax_kit
after f423ec255f which set
CONFIG_SERIAL_SUPPORT_ASYNC=y if uart rtt is enabled. This conflicts
with the xmc4xxx uart driver which sets the same symbol conditionally
if the dma is enabled in the device tree. The conflict created some
warning during compilation causing the CI to fail.

All the uart_async tests were disabled in
71d0394752. This commit re-enables the
test on xmc45_relax_kit and only excludes the rtt test that's failing.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-04-12 08:59:20 +02:00
Peter Mitsis
100d7b2996 tests: Add filter to sys_mm_drv_api test
Adds a filter to the sys_mm_drv_api test to restrict it
it intel adsp mtl platforms.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-04-12 08:58:06 +02:00
Peter Mitsis
5c1b65cc4a tests: Add test for mm_drv_bank
Adds a test for verifying that the mm_drv_bank APIs properly
record data for mapped and unmapped pages.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-04-12 08:58:06 +02:00
Maureen Helm
163b209a0c tests: drivers: build_all: Add missing sensor driver trigger configs
Extends tests/drivers/build_all/sensor/ to include missing sensor driver
trigger configurations. We now build sensor drivers in all three trigger
modes: own thread, global thread, and none.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Maureen Helm
00205734d5 tests: drivers: sensor: Fix build with trigger enabled
Extending tests/drivers/build_all/sensor/ to include missing driver
trigger configurations revealed that some sensor drivers failed to build
with triggers enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Scott Worley
5c00a83b99 drivers: spi: Microchip XEC QMSPI-LDMA fix spi buffer usage
Zephyr SPI driver model for full-duplex operation assumes
data will be transmitted and received during each clock period.
The QMSPI driver for the XEC family also supported dual and
quad I/O use cases which are inherently half-duplex. To
support dual/quad the driver incorrectly processed spi buffers
as all transmit buffers first then all receive buffers. This
worked if only the SPI driver was used. It did not work with
the Zephyr flash SPI NOR driver which assumes SPI drivers
follow the SPI driver model. This commit implements a QMSPI
driver that follows the Zephyr SPI driver model resulting in
a slightly smaller driver. Dual/quad SPI transactions are
supported if the experimental SPI extended mode Zephyr
configuration flag is enabled. We also remove the QMSPI full duplex
driver added previously to support the flash SPI NOR driver.
Added board to spi loop-back test and spi_flash sample.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2023-04-11 16:57:56 +02:00
Weiwei Guo
08ece57b9e sensor: bmm150: Add I2C-base or SPI-base interface in build time
move DT_DRV_COMPAT to bmm150.h. so that can be decide which interface
to use.

define struct bmm150_bus_io interface for bmm150_i2c.c and bmm150_spi.c
in bmm150.h.

redefined bus operation interface in bmm150.c, this allow the driver
to decide which interface to use during construction.

Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
2023-04-11 11:26:47 +02:00
Fabio Baltieri
b76ac9a851 input: convert the kscan_sdl driver from kscan to input
Convert the SDL driver to use the input subsystem. This is specifically
meant to emulate touchscreen drivers, so it's setup to send triplet of
x, y, touch for touch-on events and just touch off on touch off events.

Renamed the driver to input-sdl-touch since now we can also develop an
sdl driver for simulating key events.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-04-11 09:34:23 +02:00
Al Semjonovs
5d4352f322 sensor: Generic driver for NTC Thermistor
Driver for NTC Thermistors attached to ADC

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-04-07 16:23:17 -05:00
Al Semjonovs
9fa35bc9a0 adc: Add TI ADS7052 SPI driver
Add driver for TI ADS7052.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-04-07 16:23:17 -05:00
Kamil Serwus
71d0394752 sam: atsamc2x: dmac enable, fix uart-async
Enable dmac driver for C2x in dtsi file.
Fix tests for atsamc21n_xpro board by adding
overlay.

Signed-off-by: Kamil Serwus <kserwus@gmail.com>
2023-04-07 18:58:24 +02:00
Thomas Stranger
d312ce97c9 tests: drivers: adc: adc_api: add definitions for nucleo_h563zi
Adds the necessary definitions for the nucleo_h563zi to be able to run
the adc_api test on the ADC1 channel 15 (on pa3).

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-04-07 13:14:21 +00:00
Thomas Stranger
2bdb7c0516 tests: drivers: dac_api: add definitions for nucleo_h563zi
Adds the necessary definitions for the nucleo_h563zi to be able to run
tests/drivers/dac/dac_api.
Channel2 of the DAC is used for testing.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-04-07 13:14:21 +00:00
Nick Ward
734993d3bb tests: drivers: build_all: sensor: add MCP90X
Add MCP90X temperature sensor to build all test

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-04-07 13:30:59 +02:00
Jeppe Odgaard
4f0c084e34 tests: drivers: watchdog: Add TI TPS382x test
Added test for ti,tps382x in wdt_basic_api.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-04-07 13:30:13 +02:00
Tomasz Bursztyka
8a322cb56d tests/disk: Add NVMe disk to disk_performance
On Qemu x86_64 it is possible to emulate an NVMe controller and disk on
the PCIe bus, so let's add this case here to verify how the newly added
NVMe controller and disk driver perform, relatively to the host.
This will prove to be useful to evaluate the optimization to be made, or
the possible regression that could happen on future changes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Tomasz Bursztyka
0ef6d05a38 tests/disk: Add NVMe disk to disk_access
On Qemu x86_64 it is possible to emulate an NVMe controller and disk on
the PCIe bus, so let's add this case here to verify that the newly added
NVMe controller and disk driver works fine.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
TOKITA Hiroshi
3c4e842c90 tests: spi: spi_loopback: add interrupt and DMA tests for rpi_pico
Add interrupt and DMA tests for rpi_pico boards.
Add tests for combination of cases of DMA, interrupt and
DMA is not enabled by dts.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-04-07 13:20:16 +02:00
Siyuan Cheng
6433e204b9 test: spi: update fast test frequecny for em_starterkit
Async test failed in fast test due to too fast spi frequency.
Now it is lowered to 2500000Hz.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-04-07 13:15:59 +02:00
Caspar Friedrich
ba66f41e21 samples: w1: Update scanner example for ds2482-800 bus driver
The scanner example for 1-wire now supports the DS2482-800 multi channel
bus master.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2023-04-07 13:11:54 +02:00