Commit graph

81527 commits

Author SHA1 Message Date
Manimaran A
85a70c9847 drivers: pwm: mchp: Low power mode enabled
Updated the driver with low power feature

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-07-20 10:42:19 +00:00
Sean Nyekjaer
25d496949f drivers: pwm: pwm_stm32: reset timer using RCC before initialization
If a timer is left running on an stm32mp1, (most likely) on the next run
the timer is stuck.
A simple timer reset before initialization fixes the issue.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:36:10 +00:00
Sean Nyekjaer
63fa033d11 drivers: pwm: pwm_stm32: add macro for using DT_INST_PARENT()
Make device init more readable by adding a macro

Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:36:10 +00:00
Jamie McCrae
35f380510c doc: release: 3.5: Add note on MCUmgr SMP version 2 error conversion
Adds a note on the new MCUmgr SMP version 2 to legacy MCUmgr error
type conversion feature.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 10:35:14 +00:00
Jamie McCrae
ecfbabd213 mgmt: mcumgr: Make SMP version 2 to legacy error lookup extensible
Replaces the manual lookup function with a lookup function which
is provided when registering MCUmgr handlers which can be used to
find the function to translate error codes, allowing out of tree
MCUmgr handlers to provide error translation handlers.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 10:35:14 +00:00
Gerard Marull-Paretas
f603061938 soc: xtensa: intel_adsp: cavs: fix PM hooks guards
The PM hooks were guarded with CONFIG_PM_POLICY_CUSTOM, however, they
need to be guarded (if file is always compiled) with CONFIG_PM. In fact,
CONFIG_PM_POLICY_CUSTOM requires to implement a custom policy hook,
something this module did not provide.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
55f5a75c58 pm: remove unnecessary __weak from pm_state_set/pm_exit_post_ops
Remove unnecessary __weak attribute from power management functions.
These functions are now defined once, globally, and mandatory for
systems that support CONFIG_PM.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
e1eedd1a9f pm: require pm_state_set/pm_exit_post_ops
Any system supporting PM must now implement
pm_state_set/pm_exit_post_ops. Before this change any platform could
enable CONFIG_PM=y, even though it did nothing, ie, no power savings at
all.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
b3fa2eec45 pm: remove dummy pm_state_set/pm_state_exit_post_ops
Dummy inline functions are useful to avoid ifdeffery in code when a
certain option is not available. pm_state_set/pm_state_exit_post_ops,
are only called from the PM subsystem, so never called if CONFIG_PM=n,
that is, never surrounded with ifdeffery.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
bddf2d9dc0 tests: pm: select HAS_PM
Some tests provide their own PM hooks, adapted for testing purposes. Add
a new option to select HAS_PM, so that CONFIG_PM can be enabled.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
3d2194f11e pm: introduce HAS_PM
Add a new Kconfig option that has to be selected by SoCs providing PM
hooks. This option will be now required to enable CONFIG_PM. Before this
change, CONFIG_PM could always be enabled, regardless of SoC providing
any kind of low-power support.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Gerard Marull-Paretas
26bf349ab1 pm: drop HAS_NO_PM
Remove HAS_NO_PM option, in preparation for a new HAS_PM option
(inverted logic).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-07-20 10:33:00 +00:00
Benjamin Cabé
660c5f5c98 doc: mqtt: Add missing Doxygen comments
Completed the documentation of the mqtt.h header file.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-20 06:17:04 -04:00
Benjamin Cabé
d48c3396cb fs: doc: fs_interface doxygen fixes
Fixed Doxygen docs for structs

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-20 06:05:05 -04:00
Benjamin Cabé
485ebbbebd fs: doc: Document fs.h structs and macros
Fixed Doxygen docs for structs and added missing docs for a few
macros and enums.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-20 06:05:05 -04:00
Benjamin Cabé
ae7efcade2 fs: doc: Document fs_file_system_t methods
Fully document all the methods in the File System interface structure

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-20 06:05:05 -04:00
Benjamin Cabé
5b78a386e9 fs: doc: Fix fs_file_system_t documentation
Properly document the fs_file_system_t structure

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-20 06:05:05 -04:00
Benjamin Cabé
69c3659507 fs: nvs: doc: Provide useful brief descs
Provide useful descriptions for NVS API.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-20 06:05:05 -04:00
Erwan Gouriou
32efdf9239 drivers: counter: stm32: Review use const TIM_TypeDef on few series
A recent Cube update moved C0/L1/WBA to use const TIM_TypeDef
Align counter driver implementation.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-20 09:20:57 +00:00
Francois Ramu
256b0c5bfb tests: lib: c_lib testcase running with 32KB min ram
Limit the testcase to targets with more than 32KB RAM
Because of the CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE 8192,
the RAM used by the testcase on a too small target might fail
at runtime. For example on a nucleo_l073rz target:
    RAM:       15292 B        20 KB     74.67%

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-07-20 04:40:57 -04:00
Nicolas Pitre
13a6c45452 kernel: crude k_busy_wait() implementation
This allows for builds with CONFIG_SYS_CLOCK_EXISTS=n in which case
busy waits are achieved with a crude CPU loop. If ever accuracy is
needed even with such a configuration then implementing arch_busy_wait()
should be considered.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-19 21:42:41 -04:00
Nicolas Pitre
b157031468 kernel: split k_busy_wait() out of timeout.c
This will allow for builds with CONFIG_SYS_CLOCK_EXISTS=n. For now this
is only the code move.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-19 21:42:41 -04:00
Chen Caidy
0635e2690e net: gptp: fix announce message byte order
Linuxptp report UTC offset is 9472 seconds, is a byte order issue,
The right value is 37. Also fixed offset_scaled_log_var byte order.

Signed-off-by: Chen Caidy <chen@caidy.cc>
2023-07-19 21:42:05 -04:00
Chen Caidy
413eceeddb net: gptp: fix follow_up message correction_field
According to IEEE802.1AS Table 11-6 and 10.6.2.2.9,
802.1AS using peer-to-peer delay mechanism, two-step clock,
Grand master clock should keep this correction_field as zero.

Signed-off-by: Chen Caidy <chen@caidy.cc>
2023-07-19 21:42:05 -04:00
Chen Caidy
762df873b4 net: gptp: fix follow_up message timestamp
According to IEEE802.1AS 11.4.4.2.1, we need fill
preciseOriginTimestamp as syncEventEgressTimestamp.

In this follow_up message, prec_orig_ts need to filled
from net_pkt_timestamp(sync) for best accuracy. state machine
is software trigger with insufficient precision.

After this change, a grand master endpoint sync accuracy
increase from 3.5ms to 580ns with mimxrt1050_evk board.

Signed-off-by: Chen Caidy <chen@caidy.cc>
2023-07-19 21:42:05 -04:00
Chen Caidy
90b322761a drivers: ethernet: mcux: improve receive timestamp accuracy
When ENET_ENHANCEDBUFFERDESCRIPTOR_MODE enabled,
MAC will automatic capture receive nanosecond from 1588TMR
and return back to ENET_ReadFrame. It is a highest accuracy
recv timestamp_ns, we do not need manually read from 1588TMR.

By this change, receive timestamp accuracy increase
from 20us to 200ns above.

Signed-off-by: Chen Caidy <chen@caidy.cc>
2023-07-19 21:42:05 -04:00
Benjamin Cabé
5f9e698da4 canbus: isotp: doc: Document isotp_tx_callback_t
Added missing Doxygen doc for isotp_tx_callback_t

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-19 21:41:39 -04:00
Wojciech Sipak
545943310b drivers: pinctrl: remove unneeded TODO from Kconfig
This TODO seems to be no longer needed here.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-19 21:32:44 -04:00
Benjamin Cabé
0d81be3d70 doc: kernel: Fix Doxygen comments for stats.h
Cleanup doxygen documentation by adding missing comments + enabling
docs for fields guarded by CONFIG_SCHED_THREAD_USAGE_ANALYSIS.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-19 21:08:59 -04:00
Benjamin Cabé
897cd59cfe lib: base64: doc: Promote to Utilities doc section
Have base64 helpers show up in the Modules>Utilities section of the doc.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-19 21:07:12 -04:00
Benjamin Cabé
d3db8899c8 lib: bitarray: doc: Add to Data Structures in docs
Promote Bit Array API to Modules > Utilities > Data Structures.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-19 21:06:43 -04:00
Jeremy Bettis
d72c4344ed twister: Support --coverage-formats on lcov also
When using twister to generate coverage with the coverage tool lcov,
allow using --coverage-formats to pick if you want lcov or html,
defaulting to both. Picking html will also use lcov, since that is
required for geninfo.  This will allow callers to avoid the potentially
slow and disk intensive html reports if they only wanted the lcov info
file.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-07-19 21:00:10 -04:00
Lukasz Mrugala
48fef88038 scripts: pylib: twister: twisterlib: environment: TwisterEnv fixes
Fixes Issue #60522 by guarding member access against None parameters.
Shortens the init by using the if...else assignment.
Fixes two typos.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2023-07-19 20:47:29 -04:00
Kamil Galik
385ad46a39 boards/xtensa: Skip cleaning intermediate binaries up
This commit removes `CONFIG_CLEANUP_INTERMEDIATE_FILES` y-selection from
some Xtensa board configs. Y-selecting this option causes `west spdx` to
fail, due to reasons described in `CONFIG_CLEANUP_INTERMEDIATE_FILES` help
string.

If CLEANUP_INTERMEDIATE_FILES is y-selected, build files are removed from
the `cfgTarget.target.artifacts` list. This in turn causes the
`addBuildFile` function to nod add them to `pkg`, so `pkg.targetBuildFile`
is `None` in `scripts/west_commands/zspdx/walker.py`. This causes the `west
spdx` command to fail.

Signed-off-by: Kamil Galik <kgalik@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-07-19 20:46:51 -04:00
Filip Kokosinski
7388a07701 kconfig: expand the CLEANUP_INTERMEDIATE_FILES symbol description
Y-selecting CLEANUP_INTERMEDIATE_FILES negatively impacts tools/commands
that depend on the build artifacts being present. One such case is the
`west spdx` command used for Software Bill of Material generation.

If CLEANUP_INTERMEDIATE_FILES is y-selected, build files are removed from
the `cfgTarget.target.artifacts` list. This in turn causes the
`addBuildFile` function to nod add them to `pkg`, so `pkg.targetBuildFile`
is `None` in `scripts/west_commands/zspdx/walker.py`.

This commit expands the help message for the CLEANUP_INTERMEDIATE_FILES
symbol to inform the user of the possible negative impact of selecting this
symbol.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-07-19 20:46:51 -04:00
Erwan Gouriou
30d73df1d5 MAINTAINERS: Add Kconfig.zephyr to Kconfig subsystem
Top file Kconfig.zephyr didn't belong to any maintained area.
Add it to Kconfig

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-19 20:39:14 -04:00
Anas Nashif
3a24476fb7 tests: kernel: fix some test identifiers
Fixed few test identifiers and tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-07-19 18:07:49 -04:00
Peter Mitsis
aa4f24694e test: Enhance benchmark latency reporting
Enhances the reporting of the benchmark latency failures in the
following ways:

1. The failing test is now clearly identified
2. Failures follow the general reporting pattern

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-07-19 17:51:36 -04:00
Peter Mitsis
fe922d30f9 test: refactor benchmark latency PRINT_F() macro
Reduces the stack usage. Also separates the formatting of both the
cycle and nsec printing by pre-printing them to string.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-07-19 17:51:36 -04:00
Peter Mitsis
5c93b92a77 test: benchmark latency macro parameter names
Changes the names of parameters to the PRINT_STATS() and
PRINT_STATS_AVG() macros to be something more meaningful.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-07-19 17:51:36 -04:00
Fabio Baltieri
ebb1fa585f dma: iproc_pax_v2: delay initialization after pcie
The Broadcom pcie setup has a devicetree dependency like:

/pcie/paxdma -> /pcie/pcie -> /soc/pl330

Add a separate init symbol for iproc_pax_v2 so that these gets
initialized in order, fixes this error:

$ west build -p -b bcm958402m2_m7 tests/kernel/common \
	-DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /pcie/paxdma@4e100800 POST_KERNEL 40 < \
	/pcie/pcie@4e100000 POST_KERNEL 50

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-19 20:22:03 +00:00
Fabio Baltieri
20e7c6db6c video: mcux_csi: set a dedicated init priority for video_mcux_csi
Set a dedicated priority for the video_mcux_csi instead of using the
default kernel device init priority. This allows initializing the device
in a sequence that matches the devicetree hirearchy compared to mt9m114.

Fixes the error:

ERROR: /soc/csi@402bc000 POST_KERNEL 50 <
	/soc/i2c@403f0000/mt9m114@48 POST_KERNEL 60

found using:

$ west build -p -b mimxrt1064_evk samples/subsys/video/capture \
		-DCONFIG_CHECK_INIT_PRIORITIES=y

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-19 18:00:20 +00:00
Mike J. Chen
7839eb524c drivers: dma: dma_lpc: fix bug with transfer size/width
Fix for bug:
https://github.com/zephyrproject-rtos/zephyr/issues/59802

The DMA controller only supports one transfer size, but
the Zephyr DMA driver api allows specifying a source_data_size
and dest_data_size which might be different. An old
version was always using dest_data_size for the transfer
size (variable is called "width"), but a recent change
made the driver use the MIN for the source and dest data
sizes. The MIN choice breaks the I2S driver because it
always set source_data_size to 1, but dest_data_size was
typically 4 for like two-channel 16-bit PCM data. So the
old driver worked using dest_data_size, but the new driver
broke I2S using MIN since source_data_size was 1.

To prevent confusion, change the DMA driver to assert that
source_data_size and dest_data_size are the same.

Also assert that the source_address and dest_address for
each block_config are properly aligned for the transfer size,
since that is a documentated requirement for the DMA controller.

Also rename max_xfer to max_xfer-bytes to be more clear what
the units are, and use this value in many places that
are comparing block_size in bytes rather than converting
block_size to words by dividing by width and
then comparing to NXP_LPC_DMA_MAX_XFER.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Mike J. Chen
04f488accf drivers: spi: mcux_flexcomm: fix DMA bug for 2-byte transfers
The MCUX DMA controller only supports a single data_size
for a DMA transfer, not separate ones for source and
dest. An older version of the DMA driver used
dest_data_size as the DMA transfer size, but the
current one uses MIN(dest/source) as the trasnfer
size, which breaks case when SPI wants to do 2-byte
transfers.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Mike J. Chen
f882d31ea7 drivers: i2s: mcux_flexcomm: fix multiple bugs
Fix for bugs described in:
https://github.com/zephyrproject-rtos/zephyr/issues/59803

1. the size argument passed to i2s_write() was being ignored.
   change the code so that the size is queued with the
   tx mem_block and the dma transfer is configured with this
   size.

2. change how CONFIG_I2S_MCUX_FLEXCOMM_RX_BLOCK_COUNT and
   CONFIG_I2S_MCUX_FLEXCOMM_TX_BLOCK_COUNT are used so that
   the queue buffers are allocated correctly when the two
   config values are not the same

3. set source_data_size and dest_data_size to be the same
   since the DMA controller can only set one size per
   DMA transfer. the driver was already computing a dest_data_size
   but always passing 1 for the source_data_size.
   For I2S RX case, I think source_data_size should be
   set to the expected FIFO read size instead of dest_data_size.

Also some smaller improvements like:
* don't allocate two dma_blocks for tx in the static dev_mem
  when it only needs one
* memset both rx_dma_blocks together instead of separtely
* set dma_cfg block_count for tx and rx statically instead
  of at runtime

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Benedikt Schmidt
0d33ecd56a drivers: adc: configurable wait for completion timeout
Depending on the ADC implementation it might happen that
the driver is waiting on an external interrupt. If this interrupt
gets lost, for instance due to a race condition with an external
port expander, the system will get stuck.
Making this configurable allows the user to recover from such
an error.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-07-19 15:22:33 +00:00
Erwan Gouriou
feef931fbb drivers: counter: stm32: Use const TIM_TypeDef on stm32f2 series
A recent factorisation moved F2 to non const TIM_TypeDef.
This is an error, move it back to const TIM_TypeDef.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-19 14:31:31 +00:00
Christopher Friedt
d53bbffb71 MAINTAINERS: add cfriedt as kernel collaborator
I sometimes do kernel-y things too.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-19 09:06:40 -05:00
Christopher Friedt
b5f8c7154d tests: posix: barrier: use consistent test names
Test names were changed recently to change
"test_posix_pthread_..." to "test_..." for brevity.

Make the same change to "test_posix_pthread_barrier".

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-19 09:11:29 -04:00
Christopher Friedt
797a9afd89 MAINTAINERS: remove cfriedt as GPIO collaborator
Unfortunately, I need to reclaim a bit more bandwidth.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-07-19 07:57:13 -04:00