Commit graph

12757 commits

Author SHA1 Message Date
Krzysztof Chruscinski 5f60164a0f logging: Prevent redundant thread wake up
Fix a bug introduced by 658123bb21 where if all backends were
ready prior to logging thread loop, thread was periodically
waken up for no reason. Fix is setting timeout to K_FOREVER
if all backends are ready after the initialization.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-11 18:05:35 +00:00
Krzysztof Chruscinski 60ca7899c7 logging: Initialize backends with autostart flag set
Added check which ensures that only backends with autostart
flag set are enabled automatically by the logging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-07-11 18:05:35 +00:00
Pieter De Gendt a727b8aaac debug: coredump: flash backend: add query/command to get raw data
Add a new coredump query and command type to retrieve the raw data
stored to the flash backend

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-11 18:04:05 +00:00
Mariusz Skamra a3904bd991 Bluetooth: audio: Fix PACS location chrc properties
If the characteristic is non-writtable, the BT_GATT_CHRC_WRITE property
flag shall be unset. Moreover, threre is no point to set
BT_GATT_PERM_WRITE_ENCRYPT permission flag as well if the attribute has
no `write` callback set anyway.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-07-11 16:04:42 +00:00
Carlo Caione 1e74f1bff5 arch: Introduce S2RAM interface
Add a new API used by arch to implement suspend-to-RAM (S2RAM).

The API is composed by a single function to save the CPU context on
suspend.

A CPU context is the arch-specific set of registers that must be
preserved on power-off (in retained RAM) to be able to resume the
execution from the point it was suspended without going through the
whole kernel startup stage.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 15:26:26 +02:00
Vinayak Kariappa Chettimada b397a950c5 Bluetooth: Controller: Fix missing reset of coded PHY scanning
When switching from Extended Scanning by Extended
Advertising HCI commands back to Legacy Scanning after a
HCI reset it is required that the coded PHY scanning
context is reset.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-11 14:15:13 +02:00
Vinayak Kariappa Chettimada 265731b971 Bluetooth: Controller: Fix Extended Scan Address Resolution
Fix Extended Scanning Address Resolution that incorrectly
checked for Bit Count Comparison which is not to be checked
when explicit resolution is performed in the Rx ISR.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-11 13:53:19 +02:00
Vinayak Kariappa Chettimada 918585263e Bluetooth: Controller: Use maximum Adv PDU size time reservation
Use the maximum advertising PDU size time reservation
consider the Advertising Data could be updated from zero to
maximum support size. If maximum time reservation is
disabled then time reservation corresponding to the
Advertising Data present at the time of the start/enable
of Advertising is used.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-11 13:34:29 +02:00
Vinayak Kariappa Chettimada fab4511164 Bluetooth: Controller: Fix overlapping advertising events
When multiple advertising sets are support then use advanced
scheduling implementation to place multiple auxiliary PDUs
and periodic advertising PDUs in a non-overlapping schedule.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-11 13:34:29 +02:00
Anas Nashif 32c22cc63a ztest: generate symbols for tests
This will help with parsing testcases in test binaries.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-11 11:56:39 +02:00
Jordan Yates 8a2eed6cbd pm: device_runtime: use atomic_test_bit
Use `atomic_test_bit` when checking pm flags instead of manually using
bitwise operations.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-11 11:33:26 +02:00
Jordan Yates ab0bf48660 pm: device: store power state in all scenarios
Update the internal power state tracking for `PM_DEVICE_ACTION_TURN_ON`
and `PM_DEVICE_ACTION_TURN_OFF` even when the transition function fails.
Just because the driver couldn't perform some action does not mean the
device is still powered/unpowered.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-11 11:33:26 +02:00
Jordan Yates caca393aad pm: device: more complete state checking
Add state checking to every transition to ensure that the device is in
the state we think it is before running the action.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-11 11:33:26 +02:00
Kiril Petrov a4557a46b8 net: lwm2m: Pass client_ctx to observe callback
In case LWM2M cient wants to change attrs of observed obj,
it needs pointer to client_ctx.

For example:
On observer add, wants to change pmin for some obj path to 1s:

static void observe_cb(enum lwm2m_observe_event event,
		struct lwm2m_obj_path *path, void *user_data)
{
	struct lwm2m_ctx *ctx = (struct lwm2m_ctx *) user_data;

	switch (event) {
	case LWM2M_OBSERVE_EVENT_OBSERVER_ADDED:
		lwm2m_engine_update_observer_min_period(ctx, "3347", 1);
	...
}

Signed-off-by: Kiril Petrov <retfie@gmail.com>
2022-07-11 09:32:18 +00:00
Vinayak Kariappa Chettimada e027f0671a Bluetooth: Controller: Fix missing recv fifo reset
Fix missing recv fifo reset on HCI reset. This fix handles a
scenario where in Rx Prio thread has enqueued a node rx, Tx
thread handles HCI Reset Command, and Rx thread wakes up
from call to k_fifo_get to handle invalid node rx. The
changes here ensure Rx thread does not get any invalid node
rx post HCI Reset Command handled in Tx thread.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-07-11 11:28:07 +02:00
Kamil Piszczek 1eb9d36d46 bluetooth: add api for changing rpa timeout in runtime
Added a new Bluetooth API and Kconfig option for overriding the RPA
timeout in runtime.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-07-11 09:27:07 +00:00
Kamil Piszczek 8bdf363c0c bluetooth: adv: add rpa timeout callback to extended advertising api
Added a new callback to the Bluetooth Extended Advertising callback
structure. It notifies the application that the RPA validity of the
advertising set has timed out. The user can use this callback to
synchronize the advertising payload update with the RPA rotation.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-07-11 09:27:07 +00:00
Kamil Piszczek 4e924b6b1f bluetooth: id: sync advertising set start after rpa rotation
Synced the start of the advertising sets after each RPA rotation
in the Bluetooth identity module.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-07-11 09:27:07 +00:00
Daniel Leung d0d6e1181c logging: backend: notify when process thread finishes one cycle
This adds the bits to allow the process thread to notify
backends when it has finished processing pending log messages.

This allows, for example, flash-based backends to group writing
log messages to storage to limit wear, since log_output_flush()
is called per message. Also the backend does not have to resort
to using timer to periodically flush its buffer to storage,
avoiding waking up the device when there are no messages.
Another use of this is for backends requiring DMA transfers.
Grouping all pending log messages into one DMA transfer is
sometimes preferrable.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-07-11 11:09:31 +02:00
Simen S. Røstad 92eb309918 net: lib: lwm2m: Give Kconfig choices symbol names
Give Kconfig choices symbols names so that they can be redefined in
applications that wants to alter the choice's default value without
setting it in the project configuration.

Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
2022-07-11 11:03:41 +02:00
Robert Lubos 815ebc316e net: openthread: Move glue code into module directory
Move OpenThread's glue code along with the Kconfig files that configure
OpenThread stack itself into module directory.

Update the maintainers file to reflect this change.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-07-11 11:00:12 +02:00
Pawel Osypiuk 7fcfd54423 usb: device: cdc_acm: suspend transfers when RX path runs out of buffer
Suspend CDC ACM class OUT transfers when RX path runs out
of ring buffer.

Signed-off-by: Pawel Osypiuk <pawelosyp@gmail.com>
2022-07-11 10:31:12 +02:00
Yudong Zhang 47ea15edcd shell: mqtt: fix call to bin2hex
Fixes: f2affbd973 ("os: lib: bin2hex: fix memory overwrite")
Signed-off-by: Yudong Zhang <mtwget@gmail.com>
2022-07-11 10:30:05 +02:00
Yudong Zhang 73c4d70614 mgmt: hawkbit: fix call to bin2hex
Fixes: f2affbd973 ("os: lib: bin2hex: fix memory overwrite")
Signed-off-by: Yudong Zhang <mtwget@gmail.com>
2022-07-11 10:30:05 +02:00
Yudong Zhang 0c4d614824 mgmt: updatehub: fix call to bin2hex
We noticed that in the master branch, updatehub fails to start.
That is because of the behaviour change in bin2hex caused by
commit f2affbd ("os: lib: bin2hex: fix memory overwrite").

Fixes: f2affbd973 ("os: lib: bin2hex: fix memory overwrite")
Signed-off-by: Yudong Zhang <mtwget@gmail.com>
2022-07-11 10:30:05 +02:00
Emil Gydesen 4b953eabf8 Bluetooth: Audio: Moved ASCS metadata verification to higher layer
Instead of rejecting metadata at the BAP layer, we now
expect the higher layer to provide the verification.

The reason for this is that the higher layer may be better
equiped at determining which metadata it supports.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen e1114bf3dd Bluetooth: Audio: Add CAP acceptor set member support
The CAP acceptor can now be a set member. This allows
the CAP acceptor to register a CSIS instance and include
it in the CAS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen 9298c0f96f Bluetooth: Audio: Add CAP acceptor CCID check for TBS
Add bt_cap_acceptor_ccid_exist that verifies that CCIDs
from the CAP initiator are valid on the initiator based
on what we have previously discovered.

Verification from MCS is still a TODO.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen e712a2462b Bluetooth: Audio: Add get_by_ccid for TBS
This is needed for the CAP acceptor to properly
verify the CCID_List in the metadata.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen 539ffe296e Bluetooth: Audio: Add stream context validation for CAP acceptor
When the CAP acceptor role is enable, ASCS will verify
that the stream context type supplied by the client
matches the PACS available context.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen 6eb67b9b6a Bluetooth: Audio: ASCS verify metadata type
Add a check to verify metadata type in the
update metadata procedure handler.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen aab98d6b1c Bluetooth: Audio: Add ASCS Metadata verification before copy
Verify the metadata before copying it. This will allow the
unicast server to verify the data and potentially
reject it without modifying existing metadata.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
Emil Gydesen 2c6358c9c9 Bluetooth: Audio: Add CAP acceptor
Adding the CAP Acceptor role, which is a quite simple
role. The role instantiates the Common Audio Service (CAS)

The role will later be expanded to properly support
the use the Coordinated Set Member role via CSIS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:08:45 +00:00
YanBiao Hao 06b246c04c Bluetooth: Mesh: cfg cli async status callback
Relay Status, Netkey Status, Appkey Status,
Mod App Status, Node Identity Status, LPN
PollTimeout Status,

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2022-07-08 20:01:02 +00:00
YanBiao Hao b197f089b3 Bluetooth: Mesh: fix mod sub status async mod id
fix mod sub status async mod id

Signed-off-by: YanBiao Hao <haoyanbiao@xiaomi.com>
2022-07-08 20:01:02 +00:00
Emil Gydesen 1b9c2e22b2 Bluetooth: Audio: Add CONFIG_BT_AUDIO_DEBUG_STREAM_DATA
Add the CONFIG_BT_AUDIO_DEBUG_STREAM_DATA Kconfig option
to better debug bt_audio_stream without drowning the log
in the data being sent.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:00:33 +00:00
Emil Gydesen 1add19c834 Bluetooth: ISO: Add BT_DEBUG_ISO_DATA Kconfig
Add the BT_DEBUG_ISO_DATA so that ISO can easier be debugged
without the logs being drowned in the ISO data being sent
and received (which is typically at a low interval like 10ms).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-08 20:00:33 +00:00
Tom Burdick 572ccd531d intel_adsp: Use device tree to enable/disable each HDA driver
Uses the dt_compat_enabled Kconfig preprocessor to set defaults
for each HDA driver.

Each direction is uniquely selectable which can be useful when building
with SOF where only some directions may wish to be enabled at any given
time.

By default, given the device tree (intel_cavs.dtsi) only the host
directions are enabled but an overlay may adjust that as needed.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-08 14:33:06 -04:00
Kumar Gala c3d65b7f6b emul: espi: Remove unused struct element
espi_label struct element wasn't used anywhere so remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 10:53:02 +02:00
Asbjørn Sæbø 15e025fd20 Bluetooth: Audio: Use common function for discovery complete
Use the same function at discovery complete, whether discovery failed
or succeeded.
Rename the discovery_failure() to discovery_complete(), and use that
also when discovery completes successfully.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-07-08 09:36:18 +02:00
Asbjørn Sæbø 0142bf9484 Bluetooth: Audio: MCC - serialized subscription after discovery
The media control client used to subscribe to GMCS characteristics as
the characteristics were discovered, in effect queuing ATT requests.

Since then, the ATT MTU exchange has become automatic, leading to
larger ATT MTUs and more discovered characteristics per ATT response,
which again lead to the client enqueuing more subscriptions and
running out of buffers, with discovery failing as a result.

This commit moves the subscription to GMCS characteristics to a
separate sequence, so that it happens serially after discovery, rather
than in parallel with the discovery.

- Remove separate discovery parameters for the characteristics - they
  are no longer needed.
- Add a subscription callback and a couple of subscription functions

The subscription for characteristics for the included OTS has not been
modified.  Only two of these are subscribed to, and doing that is
currently not a problem.  And I need to better understand the
interaction with OTS and how these subscriptipons are used.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>

Refactor subscription to get chaining into callback
2022-07-08 09:36:18 +02:00
Asbjørn Sæbø d4b612c615 Bluetooth: Audio: MCC - warn on subscription failure
Add warning if subscription to characteristics fails.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-07-08 09:36:18 +02:00
Asbjørn Sæbø 6c2b8e6e65 Bluetooth: Audio: MCC - refactor subscription
Move subscription to characteristics to separate function.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-07-08 09:36:18 +02:00
Asbjørn Sæbø 542e99b859 Bluetooth: Audio: Media - refactor include discovery start
Move the start of discovery of included services to a separate
function, in preparation for rewriting discovery.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-07-08 09:36:18 +02:00
Erik Brockhoff daf327de40 bluetooth: controller: Fixing feature API re. non standard bool typedef
When bool is typedef'ed to for instance char the cast from 64 bits
is not so good. Now using an explicit 'cast' to true/false

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-07-08 09:36:00 +02:00
Erik Brockhoff 3fbfb6537e bluetooth: controller: Implements Peripheral CIS Create Procedure
Implements PDU flow and unittest of CIS Create on Peripheral
Hooks CIS Create into the controller and fixes a few minor
things in ull to allow for running with NEW LLCP
Also handles CONFIG based comilation of CIS Create

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-07-08 09:36:00 +02:00
Erik Brockhoff 6cf357bd9d bluetooth: controller: Integrate CIS Terminate with controller
Hooks the CIS terminate into the controller and fixes a few minor
things in ull_conn(_iso).c
Also handles CONFIG based comilation of CIS_TERMINATE
also fixes a minor issue in helpers_pdu

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-07-08 09:36:00 +02:00
Erik Brockhoff 22ddc01f36 bluetooth: controller: CIS Terminate Procedure PDU flow and unittest
Implementing PDU flow and unittest for PDU flow of CIS Terminate.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-07-08 09:36:00 +02:00
Andrei Emeltchenko 5b633db288 ztest: Add Z_TEST_SKIP_IFNDEF macro
Add macro Z_TEST_SKIP_IFNDEF which is used when you want to skip test
if configuration option is not enabled.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-07 15:07:02 -04:00
Adrian Bonislawski b3beafcbac logging: cavs_hda: Allow format timestamp
LOG_BACKEND_CAVS_HDA supports LOG_BACKEND_FORMAT_TIMESTAMP

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-07-07 17:58:56 +00:00