Commit graph

15409 commits

Author SHA1 Message Date
Henrik Brix Andersen
4f0cfdda80 drivers: can: document return value of 0 for can_get_max_bitrate()
Explicitly document that a return value of 0 from can_get_max_bitrate()
indicates success.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-31 16:22:16 +00:00
Ravi Dondaputi
546abe778d net: wifi_shell: Display correct security type in scan results
In status output, algos like WPA, WEP etc. are not being identified
in the scan results. Instead security mode is being displayed as
"UNKNOWN" for APs using these security modes.
Identify all such modes and display the security mode correctly.

Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
2023-03-31 09:20:29 +02:00
Szymon Czapracki
33bf1fa0c6 Bluetooth: audio: Expand AICS API
This commit adds new API functions for AICS
Setting automatic/manual only gain modes
Setting mute disabled
Use new functions in btp.vcp

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2023-03-31 09:20:15 +02:00
Keith Short
9b8c4ee847 emul: pi3usb9201: Create pi3usb9201 emulator
Create an emulator for the pi3usb9201 USB charging detector.

Signed-off-by: Keith Short <keithshort@google.com>
2023-03-30 17:34:36 -04:00
Keith Short
e0dd45ba31 bc12: API and 1st driver implementation.
Add portable-device mode to the Diodes PI3USB9201 USB charging detector.

Signed-off-by: Keith Short <keithshort@google.com>
2023-03-30 17:34:36 -04:00
René Beckmann
4978a651a7 lib: json: Use int32_t in examples
All examples in the header showcase the use of the type int in
structs that values should be parsed into (or serialized out of).
However, that is probably a bad idea if we consider the function
get_elem_size in the JSON library that calculates the field size:

static ptrdiff_t get_elem_size(const struct json_obj_descr *descr)
{
	switch (descr->type) {
	case JSON_TOK_NUMBER:
		return sizeof(int32_t);
	...
}

Hence, using int in structs on platforms where an int is not 32
bits wide (as rare as they may be) is probably a bad idea and will
lead to confusing errors and undefined behavior.

Signed-off-by: René Beckmann <rene.beckmann@grandcentrix.net>
2023-03-30 09:41:46 -04:00
Guillaume Gautier
8fbac84402 include: zephyr: dt-bindings: clock: add i2s domain clock to stm32 devices
Add I2S domain clock selection helpers for stm32fx families.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-03-30 13:47:55 +02:00
Emil Gydesen
630f6a7d82 Bluetooth: BAP: Store biginfo data in broadcast_sink->codec_qos
Store information from the biginfo in a
broadcast_sink->codec_qos struct, and add a reference to that struct
when syncing, so that the stream->qos contains a valid struct
with properly initialized information.

This also adds a guard for the codec_qos.latency as that
is not set nor used by the broadcast sink (as it is
not available).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-30 10:40:13 +00:00
Emil Gydesen
114e45eb2a Bluetooth: BAP: Broadcast Sink BASE contains presentation delay
The presentation delay is now properly stored in
the BASE struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-30 10:40:13 +00:00
Andrei Emeltchenko
1679faaa0e smbus: Move smbus_utils.h from includes to driver area
Move smbus_utils.h header from generic includes to the driver's area
in order to have in include/zephyr/drivers only smbus.h header.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-30 09:45:02 +00:00
Jordan Yates
db3d51bb7d pm: device_runtime: add zephyr,pm-device-runtime-auto
Add the `zephyr,pm-device-runtime-auto` flag to `pm.yaml` and
`struct pm_device`.

This flag is intended to signify to the boot system that device runtime
PM should be automatically enabled on the device after the init function
has run.

Only run `pm_device_runtime_auto_enable` function on a device if
initialisation succeeded. This prevents actions being run on devices
that are not ready.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-29 12:21:13 -04:00
Jordan Yates
f1111dd679 pm: device: move flags construction to a macro
Move the construction of the initial value of `struct pm_device` `flags`
to a dedicated macro. This makes it cleaner to add additional default
values.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-29 12:21:13 -04:00
Peter Mitsis
cc52e09a00 kernel: Remove unused K_END macro
Removes the unused K_END macro. This macro used to be used with the
long since removed semaphore groups functionality.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-03-29 09:46:41 -04:00
Ryan McClelland
62f22f8d3b drivers: i3c: i3c attach/detach api
There are some needs to attach and reattach i3c/i2c devices at runtime
Some I2C devices can have special registers where the address can be
changed at runtime. Also some I3C devices can be powered off at runtime
freeing up the address space they take up. These new APIs allow for these
to be changed at runtime. This also moves some config/data in to a common
i3c config/data structure which would allow the api to operate on to be
common for all I3C drivers.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland
1f757bc67f drivers: i3c: add SETNEWDA ccc helper function
This is a ccc helper function for setting a new dynamic addr for
a Target.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland
71c5ccb1ef drivers: i3c: add reattach_i3c_device api
Some I3C controllers have retaining registers which are used to contain
the DA of the i3c device. This needs to be updated every time the DA is
updated with SETNEWDA or SETDASA

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Manuel Argüelles
98d4faf099 arch: arm: cortex_a_r: implement cache API
Implement cache management APIs for Cortex-A/R AArch32 L1 caches.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-03-29 09:03:37 +02:00
Jordan Yates
c6191858c3 pm: device_runtime: PM unsupported is not an error
Returning an error code when PM is not supported for a device only makes
writing drivers harder, as instead of checking for failures with `< 0`,
they also need to check for `-ENOTSUP`.

From the point of view of a driver, an `-ENOTSUP` return value is
equivalent to success, as if the device it is trying to turn on doesn't
support PM, by definition it is already enabled. This is equivalent to
the API behaviour when `CONFIG_PM_DEVICE_RUNTIME=n`.

Whether a device supports PM or not can still be determined at runtime
by inspecting the return code of `pm_device_runtime_enable` if
necessary.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-28 17:36:32 -04:00
Jordan Yates
2ef95ecd8f pm: device_runtime: balanced power domain operations
Only run `pm_device_runtime_put` on the dependent domain if the original
claim operation succeeded. This fixes unbalanced operations when running
```
pm_device_runtime_get(dev);
pm_device_runtime_put(dev);
```
On a device that does not have PM enabled but does have a power domain.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-28 17:36:16 -04:00
Jordan Yates
4b2da59de5 device: fix counting supported devices
With the addition of #42105, `DEVICE_HANDLE_NULL` can exist in the
supported devices handle array. Stop counting supported devices if
this value is reached, as there are no more valid devices.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-28 17:36:16 -04:00
Patryk Duda
78ce5784eb drivers: flash: Add ex ops for STM32 option/control register block
Introduce flash extended operations that can be used to disable access
to option and control registers until reset. Disabling access to these
registers improves system security, because flash content (or protection
settings) can't be changed even when exploit was found.

On STM32 devices, registers can be locked until reset by writing wrong
key during unlock procedure. It triggers a bus fault, so during the
procedure we need to ignore faults and clear bus fault pending bit.

Please note that option register disabling was implemented for devices
that have OPTCR register (F2, F4, F7 and H7). Implementation on other
devices requires more testing, since documentation is not precise
enough. Disabling control register was implemented for devices that
have CR register.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Patryk Duda
d652da5acb drivers: flash: Introduce readout protection support for STM32F4
This patch adds flash readout protection support for STM32F4 devices
family. These devices can enable protection on entire flash content.

Readout protection functionality was exposed as vendor extended
operation. To change readout protection state, caller should provide a
structure which describes desired RDP state.

Enabling readout protection permanently or disabling readout protection
(changing from level 1 to level 0) is guarded by
CONFIG_FLASH_STM32_READOUT_PROTECTION_PERMANENT_ALLOW and
CONFIG_FLASH_STM32_READOUT_PROTECTION_DISABLE_ALLOW respectively.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Patryk Duda
b6078cc906 drivers: flash: Introduce write protection support for STM32F4
This patch adds sector write protection support for STM32F4 devices
family. These devices can protect flash content with sector precision.

Write protection functionality was exposed as vendor extended operation.
To change write protection state, caller should provide mask of enabled
and disabled sectors.

Function responsible for locking/unlocking option bytes was implemented
for all STM32 devices supported by this driver.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Francois Ramu
806cfbf365 include: bindings: reset definition for the new stm32h5 serie
Defines the RCC reset registers for the stm32h5cx devices
Note that all stm32h5x do not have all the bus registers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-28 15:07:51 +02:00
Francois Ramu
ff1969de3b include: clock: stm32h5 clock definitions for clock scheme
Defines the clocks for  the stm32H5 device.
The PLL is similar to the stm32U5 except for the mul-n from 8 to 420.
The HSI is similar to the stm32h7 with a prediv.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-28 15:07:51 +02:00
Mariusz Skamra
710103db1d Bluetooth: iso: Add bt_iso_server_unregister function
This adds function that unregisters previously registered ISO server.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Carlo Caione
f43c7367b1 arm64: Break circular dependency on syscall.h
Commit fbf851cdc4 is introducing a
dependency between util.h and time_units.h.

Now, the problem is that time_units.h is from one side included by
arm64/syscall.h (syscall.h -> lib_helpers.h -> cpu.h -> util.h) but on
the other side it is including syscall.h (time_units.h -> syscall.h).

Break the dependency at cpu.h level.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-03-28 15:05:54 +02:00
Jeppe Odgaard
40ec70fd2a drivers: sensor: mcux qdec single-phase option
Add binding and sensor attribute to allow single phase
mode where only one signal is required from the encoder.
The signal must be connected to Phase A input.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-27 22:13:56 +00:00
Luca Fancellu
0deeb5ff65 soc: include: fvp_aemv8r: Define device memory as device tree node
A recent change introduced the possibility to declare MPU memory
regions using the device tree and the framework described in
zephyr/linker/devicetree_regions.h.

So remove the device region declared in mpu_regions[] and the used
defines for the addresses, rename REGION_DEVICE_ATTR to REGION_IO_ATTR
in arm_mpu.h to be compatible with the framework and add a device tree
node to fvp_baser_aemv8r.dts to describe the device memory region.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2023-03-27 13:20:47 +00:00
Aleksandr Khromykh
9011a067f2 Bluetooth: Mesh: split rpr cli ack ctx for provisionning and scanning
PR adds 2 acknowledgment contexts to RPR client to handle
scanning and provisioning in parallel.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-03-27 13:20:33 +00:00
Alexander Mihajlovic
9d50b143ae dts: bindings: Add Pmod connector GPIO nexus
Add a GPIO nexus binding for Pmod interface connectors.
This commit also includes a header file with macros
that map signal names in the Pmod specification to
the corresponding indices in the GPIO nexus, meant for
use in devicetree files.

Signed-off-by: Alexander Mihajlovic <alexander@eub.se>
2023-03-27 09:51:08 +02:00
Fabian Blatz
6180f96799 serial: Add driver for emulated UART
The emulated UART controller will aid in automated
integration testing.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-03-27 09:50:44 +02:00
Bartosz Bilas
0b6bfbd9ea gpio: add gpio_add/remove callback dt functions
Add `gpio_add_callback_dt` and `gpio_remove_callback_dt` functions
that allow the user to pass `gpio_dt_spec` directly.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-03-25 04:07:59 -04:00
Andrei Emeltchenko
38fdba17c5 doc: smbus: Cleanup SMBus documentation
Fix typos and general improvements of the documentation.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-24 09:36:47 -04:00
Carles Cufi
7f0774397e Bluetooth: Clean up public header inclusion
A bit of cleanup in the public header files inclusion policy and
statements:

- Include only what is needed if possible
- Include in the right location
- Include in the right order

Fixes #55971.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-03-24 09:15:19 +00:00
Yuval Peress
fbf851cdc4 util.h: Add dependency on time_units.h
The WAIT_FOR macro uses the 'k_us_to_cyc_ceil32' function declared
in zephyr/sys/time_units.h. It should have been included.

Fixes #56006

Signed-off-by: Yuval Peress <peress@google.com>
2023-03-24 09:05:28 +01:00
Jay Vasanth
ff10046382 include: espi.h: Update OCB virtual wires mappings
update espi_vwire_signal enum to refer all platform specific
usage virtual wires to ESPI_VWIRE_SIGNAL_SLV_GPIO_x
Virtual wires used for USB-C port over current (OCB)
have been defined as macros mapped to the corresponding
espi_vwire_signal enum

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-23 11:58:26 -04:00
Anders Storrø
7ad7402f8e Bluetooth: Mesh: Change rpr cli @defgroup name
Change the documentation @defgroup tag for RPR client,
as it does not align with other parts of the RPR implementation.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-23 15:43:29 +01:00
Pieter De Gendt
6c0626215b devicetree: Add DT_INST_PROP_LEN_OR
Add the instance-based version of DT_PROP_LEN_OR.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-03-23 10:30:50 +01:00
Johann Fischer
9d91333a43 drivers: udc: simplify udc_submit_event()
Since we have a dedicated function for UDC_EVT_EP_REQUEST type
events, we can now simplify udc_submit_event() and remove
buf parameter.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer
ad81b3b797 drivers: udc: move transfer status to buffer info structure
This allows us to get the result of synchronous transfer without
any hacks, just from the net_buf structure.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Daniel DeGrasse
e587047dc6 drivers: adc: rewrite mcux LPADC driver
Rewrite MCUX LPADC driver, to better utilize hardware.
the following changes have been applied:
- channel numbers now correspond to hardware channel command slots,
  use "input_positive" and "input_negative" fields along with channel
  definitions in dt-bindings/adc/mcux-lpadc.h to select a channel
- the number of channel command slots available is configurable via
  CONFIG_LPADC_CHANNEL_COUNT
- Side A and side B channels are now supported
- differential channel mode is now supported
- ADC channels now are sampled via hardware, without additional
  software triggering

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-23 08:58:44 +00:00
Henrik Brix Andersen
d5672c9ee3 drivers: can: check timing parameters
Check the requested CAN timing parameters against the min/max values
supported by the driver and return an error if they are out of range.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-23 09:40:34 +01:00
Andy Sinclair
a00713bc45 drivers: regulator: Added initial voltage configuration
The regulator driver has a configured min/max range that is used
to limit set values, and to initialise the regulator.

A new init value has been added, so that the startup voltage can
be higher than the lowest permitted value.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-03-22 21:19:51 +01:00
Andrei Emeltchenko
14923f4131 smbus: Refactor callbacks API
The callbacks API was similar to gpio / espi callbacks API. Refactor
it to use more intuitive names for set / remove callbacks.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
2146b19cc7 smbus: Add Host Notify and smbalert API
Add API for SMBus Host Notify and SMBALERT.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
adff73d618 smbus: Introduce SMBus subsystem driver API
Introduces SMBus driver API for SMBus controllers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Magdalena Kasenberg
57784df5f0 LE Audio: Refactor server ASE callbacks to return rsp object
From now app layer is able to return explicit response code and
reason that will appear in ASE Control Point notification.

Fixes issues of ASCS/SR/SPE/BI-(07/08/09)-C PTS test cases, where
PTS was receiving wrong response codes and reasons.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-03-22 11:38:37 +01:00
Pavel Vasilyev
08f4a82038 Bluetooth: Mesh: Remove deprecated health API
Deprecated Health client and server API has been deprecated for two
releases: 3.2.0 and 3.3.0.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-22 09:35:01 +01:00
TOKITA Hiroshi
08606eac44 drivers: dma: rpi_pico: add support for RaspberryPi Pico DMA
Adding RaspberryPi Pico DMA driver.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-22 09:33:52 +01:00