Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
DAI Interface. More...
Data Structures | |
struct | dai_properties |
DAI properties. More... | |
struct | dai_config |
Main DAI config structure. More... | |
struct | dai_ts_cfg |
DAI timestamp configuration. More... | |
struct | dai_ts_data |
DAI timestamp data. More... | |
Macros | |
#define | DAI_FORMAT_CLOCK_PROVIDER_MASK 0xf000 |
Used to extract the clock configuration from the format attribute of struct dai_config. | |
#define | DAI_FORMAT_PROTOCOL_MASK 0x000f |
Used to extract the protocol from the format attribute of struct dai_config. | |
#define | DAI_FORMAT_CLOCK_INVERSION_MASK 0x0f00 |
Used to extract the clock inversion from the format attribute of struct dai_config. | |
Functions | |
static int | dai_probe (const struct device *dev) |
Probe operation of DAI driver. | |
static int | dai_remove (const struct device *dev) |
Remove operation of DAI driver. | |
static int | dai_config_set (const struct device *dev, const struct dai_config *cfg, const void *bespoke_cfg) |
Configure operation of a DAI driver. | |
static int | dai_config_get (const struct device *dev, struct dai_config *cfg, enum dai_dir dir) |
Fetch configuration information of a DAI driver. | |
static const struct dai_properties * | dai_get_properties (const struct device *dev, enum dai_dir dir, int stream_id) |
Fetch properties of a DAI driver. | |
static int | dai_trigger (const struct device *dev, enum dai_dir dir, enum dai_trigger_cmd cmd) |
Send a trigger command. | |
static int | dai_ts_config (const struct device *dev, struct dai_ts_cfg *cfg) |
Configures timestamping in attached DAI. | |
static int | dai_ts_start (const struct device *dev, struct dai_ts_cfg *cfg) |
Starts timestamping. | |
static int | dai_ts_stop (const struct device *dev, struct dai_ts_cfg *cfg) |
Stops timestamping. | |
static int | dai_ts_get (const struct device *dev, struct dai_ts_cfg *cfg, struct dai_ts_data *tsd) |
Gets timestamp. | |
DAI Interface.
The DAI API provides support for the standard I2S (SSP) and its common variants. It supports also DMIC, HDA and SDW backends. The API has a config function with bespoke data argument for device/vendor specific config. There are also optional timestamping functions to get device specific audio clock time.
#define DAI_FORMAT_CLOCK_INVERSION_MASK 0x0f00 |
#include <zephyr/drivers/dai.h>
Used to extract the clock inversion from the format attribute of struct dai_config.
#define DAI_FORMAT_CLOCK_PROVIDER_MASK 0xf000 |
#include <zephyr/drivers/dai.h>
Used to extract the clock configuration from the format attribute of struct dai_config.
#define DAI_FORMAT_PROTOCOL_MASK 0x000f |
#include <zephyr/drivers/dai.h>
Used to extract the protocol from the format attribute of struct dai_config.
enum dai_clock_inversion |
#include <zephyr/drivers/dai.h>
DAI clock inversion.
Some applications may require a different clock polarity (FSYNC/BCLK) compared to the default one chosen based on the protocol.
enum dai_clock_provider |
#include <zephyr/drivers/dai.h>
DAI clock configurations.
This is used to describe all of the possible clock-related configurations w.r.t the DAI and the codec.
enum dai_dir |
#include <zephyr/drivers/dai.h>
DAI Direction.
Enumerator | |
---|---|
DAI_DIR_TX | Transmit data. |
DAI_DIR_RX | Receive data. |
DAI_DIR_BOTH | Both receive and transmit data. |
enum dai_protocol |
#include <zephyr/drivers/dai.h>
DAI protocol.
The communication between the DAI and the CODEC may use different protocols depending on the scenario.
enum dai_state |
#include <zephyr/drivers/dai.h>
Interface state.
enum dai_trigger_cmd |
#include <zephyr/drivers/dai.h>
Trigger command.
enum dai_type |
#include <zephyr/drivers/dai.h>
Types of DAI.
The type of the DAI. This ID type is used to configure bespoke DAI HW settings.
DAIs have a lot of physical link feature variability and therefore need different configuration data to cater for different use cases. We usually need to pass extra bespoke configuration prior to DAI start.
Enumerator | |
---|---|
DAI_LEGACY_I2S | Legacy I2S compatible with i2s.h. |
DAI_INTEL_SSP | Intel SSP. |
DAI_INTEL_DMIC | Intel DMIC. |
DAI_INTEL_HDA | Intel HD/A. |
DAI_INTEL_ALH | Intel ALH. |
DAI_IMX_SAI | i.MX SAI |
DAI_IMX_ESAI | i.MX ESAI |
DAI_AMD_BT | Amd BT. |
DAI_AMD_SP | Amd SP. |
DAI_AMD_DMIC | Amd DMIC. |
DAI_MEDIATEK_AFE | Mtk AFE. |
DAI_INTEL_SSP_NHLT | nhlt ssp |
DAI_INTEL_DMIC_NHLT | nhlt ssp |
DAI_INTEL_HDA_NHLT | nhlt Intel HD/A |
DAI_INTEL_ALH_NHLT | nhlt Intel ALH |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Fetch configuration information of a DAI driver.
dev | Pointer to the device structure for the driver instance |
cfg | Pointer to the config structure to be filled by the instance |
dir | Stream direction: RX or TX as defined by DAI_DIR_* |
0 | if success, negative if invalid parameters or DAI un-configured |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Configure operation of a DAI driver.
The dir parameter specifies if Transmit (TX) or Receive (RX) direction will be configured by data provided via cfg parameter.
The function can be called in NOT_READY or READY state only. If executed successfully the function will change the interface state to READY.
If the function is called with the parameter cfg->frame_clk_freq set to 0 the interface state will be changed to NOT_READY.
dev | Pointer to the device structure for the driver instance. |
cfg | Pointer to the structure containing configuration parameters. |
bespoke_cfg | Pointer to the structure containing bespoke config. |
0 | If successful. |
-EINVAL | Invalid argument. |
-ENOSYS | DAI_DIR_BOTH value is not supported. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Fetch properties of a DAI driver.
dev | Pointer to the device structure for the driver instance |
dir | Stream direction: RX or TX as defined by DAI_DIR_* |
stream_id | Stream id: some drivers may have stream specific properties, this id specifies the stream. |
Pointer | to the structure containing properties, or NULL if error or no properties |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Probe operation of DAI driver.
The function will be called to power up the device and update for example possible reference count of the users. It can be used also to initialize internal variables and memory allocation.
dev | Pointer to the device structure for the driver instance. |
0 | If successful. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Remove operation of DAI driver.
The function will be called to unregister/unbind the device, for example to power down the device or decrease the usage reference count.
dev | Pointer to the device structure for the driver instance. |
0 | If successful. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Send a trigger command.
dev | Pointer to the device structure for the driver instance. |
dir | Stream direction: RX, TX, or both, as defined by DAI_DIR_*. The DAI_DIR_BOTH value may not be supported by some drivers. For those, triggering need to be done separately for the RX and TX streams. |
cmd | Trigger command. |
0 | If successful. |
-EINVAL | Invalid argument. |
-EIO | The trigger cannot be executed in the current state or a DMA channel cannot be allocated. |
-ENOMEM | RX/TX memory block not available. |
-ENOSYS | DAI_DIR_BOTH value is not supported. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Configures timestamping in attached DAI.
dev | Component device. |
cfg | Timestamp config. |
Optional method.
0 | If successful. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Gets timestamp.
dev | Component device. |
cfg | Timestamp config. |
tsd | Receives timestamp data. |
Optional method.
0 | If successful. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Starts timestamping.
dev | Component device. |
cfg | Timestamp config. |
Optional method
0 | If successful. |
|
inlinestatic |
#include <zephyr/drivers/dai.h>
Stops timestamping.
dev | Component device. |
cfg | Timestamp config. |
Optional method.
0 | If successful. |