Date(DD/MM/YY) | Comment | Version |
---|---|---|
24/08/23 | First Release | 1.0.0 |
- Acronyms, Terms and Abbreviations
- Description
- Component Runtime Execution Requirements
- Non-functional requirements
- Interface API Documentation
DS
- Device SettingsHAL
- Hardware Abstraction LayerAPI
- Application Programming InterfaceCaller
- Any user of the interface via theAPIs
CB
- Callback function (suffix)ARC
- Audio Return ChanneleARC
- Enhanced Audio Return ChannelSPDIF
- Sony/Philips Digital InterfaceHDMI
- High-Definition Multimedia InterfaceLE
- Loudness EquivalenceDRC
- Dynamic Range ControlMI
- Media IntelligentRF
- Radio FrequencydB
- DecibelMS12
- MultiStream 12AC4
- Audio Compression 4ms
- millisecondsCPU
- Central Processing UnitSoC
- System-on-Chip
The diagram below describes a high-level software architecture of the DS
Audio module.
%%{ init : { "theme" : "forest", "flowchart" : { "curve" : "linear" }}}%%
flowchart TD
y[Caller]<-->x[DEVICE SETTINGS AUDIO HAL];
x[DEVICE SETTINGS AUDIO HAL]<-->z[Audio SoC Driver];
style y fill:#99CCFF,stroke:#333,stroke-width:0.3px,align:left
style z fill:#fcc,stroke:#333,stroke-width:0.3px,align:left
style x fill:#9f9,stroke:#333,stroke-width:0.3px,align:left
This interface provides a set of APIs
to facilitate communication to the Audio SoC
Driver.
This interface provides control to enable or disable Audio Output ports like TV Internal Speakers, ARC
/eARC
, Headphones, SPDIF
and allows caller
to configure or retrieve various audio parameters like audio encoding, audio compression, dialog enhancement, dolby volume mode, intelligent equalizer, volume leveller, bass enhancer, DRC
mode, surround virtualizer, MI
steering, graphic equalizer, MS12
audio profile, stereo mode, audio gain, audio dB
, audio level, audio max and min dB
, audio delay, fader control, primary language and secondary language. It also provides APIs
to enable loop through, set audio ducking, enable LE
, get the Atmos capability of sink device
The component must adeptly manage resources to prevent issues like memory leaks and excessive utilization. It must also meet performance goals for response time, throughput, and resource use as per the platform's capabilities.
Failure to meet these requirements will likely result in undefined and unexpected behaviour.
Caller
must initialize by calling dsAudioPortInit()
before calling any other APIs
. The Caller
is expected to have complete control over the life cycle of the DS
Audio module.
This interface is not required to be thread safe. Any caller
invoking the APIs
must ensure calls are made in a thread safe manner. This interface is allowed to create internal threads for its operations without excessively consuming system resources. Any threads created by this interface must be handled gracefully and respective error codes must be returned if any corresponding API
fails.
This interface is required to support a single instantiation with a single process.
This interface is not required to allocate any memory. Any pointers created by the interface must be cleaned up upon termination.
Although this interface is not required to be involved in any of the power management operations, the state transitions must not affect its operation. e.g. on resumption from a low power state, the interface must operate as if no transition has occurred.
AudioPort provides the following asynchronous registration :
dsAudioOutRegisterConnectCB()
- Callback function to notify the audio port connection status to thecaller
dsAudioFormatUpdateRegisterCB()
- Callback function to notify the audio format update to thecaller
dsAudioAtmosCapsChangeRegisterCB()
- Callback function to notify the atmos capability update to thecaller
This interface is allowed to establish its own thread context for its operation, ensuring minimal impact on system resources. Additionally, this interface is responsible for releasing the resources it creates for its operation once the respective operation concludes.
This interface is not required to have any blocking calls. Synchronous calls must complete within a reasonable time period. Any call that can fail due to the lack of response from the connected device must have a timeout period and the function must return the relevant error code.
All the APIs
must return error synchronously as a return argument. HAL
is responsible for handling system errors (e.g. out of memory) internally.
There is no requirement for the interface to persist any setting information. Caller
is responsible to persist any settings related to this interface.
The following non-functional requirements will be supported by the module.
This interface is required to support DEBUG, INFO and ERROR messages. INFO and DEBUG should be disabled by default and enabled when required.
This interface will ensure optimal use of memory and CPU
according to the specific capabilities of the platform.
- This interface is required to perform static analysis, our preferred tool is Coverity.
- Have a zero-warning policy with regards to compiling. All warnings are required to be treated as errors.
- Copyright validation is required to be performed, e.g.: Black duck, and FossID.
- Use of memory analysis tools like Valgrind are encouraged, to identify leaks/corruptions.
HAL
Tests will endeavour to create worst case scenarios to assist investigations.- Improvements by any party to the testing suite are required to be fed back.
The HAL
implementation is expected to released under the Apache License 2.0.
The source code must build into a shared library for DS
as Audio is a part of DS
and must be named as libdshal.so. The build mechanism must be independent of Yocto.
- Any changes in the
APIs
must be reviewed and approved by the component architects. - Any modification must support backward compatibility for the generic operations like image upgrade and downgrade.
- This interface must return the dsERR_OPERATION_NOT_SUPPORTED error code, if any of the interface -
APIs
are not supported by the underlying hardware.
The configuration settings file (dsAudioSettings_template.h) for DS
Audio can be used for adding platform specific configurations. The sample file is available here.
API
documentation will be provided by Doxygen which will be generated from the header file.
The caller
is expected to have complete control over the life cycle of the HAL
-
Initialize the
DS
AudioHAL
using function:dsAudioPortInit()
before making any otherAPI
calls. IfdsAudioPortInit()
call fails, theHAL
must return the respective error code, so that thecaller
can retry the operation. -
Once the Audio Ports are initialized, Audio Output ports like TV Internal Speakers,
ARC
/eARC
, Headphones,SPDIF
can be enabled or disabled using Audio Port Handle based on Audio Settings Template. -
The following Audio functionalities are supported:
- Audio Encoding
- Audio Format
- Audio Compression
- Dialog Enhancement
- Dolby Volume Mode
- Audio Ducking
- Bass Enhancer
MI
SteeringLE
- Stereo Mode
- Audio Gain
- Loop Through
- Intelligent Equivalizer
- Dynamic Range Control
- Fader Control
MS12
capabilities- Audio Delay
- Audio Mixing
AC4
Primary LanguageAC4
Secondary Language
-
Callbacks can be set with:
dsAudioOutRegisterConnectCB()
- used when the audio port connection status changes`dsAudioFormatUpdateRegisterCB()
- used when the audio format changesdsAudioAtmosCapsChangeRegisterCB()
- used when the atmos capability changes
-
De-initialize the
Audio HAL
using the function:dsAudioPortTerm()
NOTE: The module would operate deterministically if the above call sequence is followed
%%{ init : { "theme" : "default", "flowchart" : { "curve" : "stepBefore" }}}%%
sequenceDiagram
participant Caller as Caller
participant HAL as DEVICE SETTINGS AUDIO HAL
participant Driver as SoC
Caller->>HAL:dsAudioPortInit()
Note over HAL: SoC initializes the Audio Ports
HAL->>Driver: Initializes the Audio Output Ports
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsGetAudioPort()
Note over HAL: API to get Audio Port Handle
HAL->>Driver: Get the Audio Port handle
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsEnableAudioPort()
Note over HAL: API to enable or disable specified Audio Output Port
HAL->>Driver:Specified Audio Port is enabled or disabled
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsAudio_SetMethods
Note over HAL: APIs to set the Audio related parameters
HAL->>Driver: Set the Audio Paramters using Audio Port Handle
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsAudio_GetMethods
Note over HAL: APIs to get the Audio related parameters
HAL->>Driver: Get the Audio Paramters using Audio Port Handle
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsSetAudioDucking()
Note over HAL: API to set the Audio Ducking level of specified Audio Port
HAL->>Driver:Set the Audio Ducking Level of Specified Audio Output Port
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsEnableLoopThru()
Note over HAL: API to set loop-through mode of the specified audio port
HAL->>Driver:Set the loop-through mode of Specified Audio Output Port
Caller->>HAL:dsGetHDMIARCPortId()
Note over HAL: API to get HDMI ARC Port ID of each platform
HAL->>Driver: Get the HDMI ARC Port ID
Driver-->>HAL:return
HAL-->>Caller:return
Caller->>HAL:dsAudioOutRegisterConnectCB()
Note over HAL: Registers the callback for when the audio port connection status changes
HAL-->>Caller:return
Caller->>HAL:dsAudioFormatUpdateRegisterCB()
Note over HAL: Registers the callback for when the audio format changes
HAL-->>Caller:return
Caller->>HAL:dsAudioAtmosCapsChangeRegisterCB()
Note over HAL: Registers the callback for when the atmos capability changes
HAL-->>Caller:return
Note over HAL: Audio Port connection status changed
Driver-->>HAL:return
HAL-->>Caller:dsAudioOutPortConnectCB_t callback returned
Note over HAL: Audio formate has changed
Driver-->>HAL:return
HAL-->>Caller:dsAudioFormatUpdateCB_t callback returned
Note over HAL: Atmos capabilities changed
Driver-->>HAL:return
HAL-->>Caller:dsAtmosCapsChangeCB_t callback returned
Caller ->>HAL:dsAudioTerm()
HAL ->> Driver:
Driver-->>HAL:return
HAL-->>Caller:return
LEGEND:
dsAudio_SetMethods: dsSetAudioEncoding(), dsSetAudioCompression(), dsSetDialogEnhancement(), dsSetDolbyVolumeMode(), dsSetIntelligentEqualizerMode(), dsSetVolumeLeveller(), dsSetBassEnhancer(), dsSetDRCMode(), dsSetSurroundVirtualizer(), dsSetMISteering(), dsSetGraphicEqualizerMode(), dsSetMS12AudioProfile(), dsSetStereoMode(), dsSetStereoAuto(), dsSetAudioGain(), dsSetAudioDB(), dsSetAudioLevel(), dsSetAudioDucking(), dsSetAudioMute(), dsSetAudioDelay(), dsSetAudioDelayOffset(), dsSetMS12AudioProfileSetttingsOverride(), dsSetAssociatedAudioMixing(), dsSetFaderControl(), dsSetPrimaryLanguage(), dsSetSecondaryLanguage()
dsAudio_GetMethods: dsGetAudioEncoding(), dsGetAudioFormat(), dsGetAudioCompression(), dsGetDialogEnhancement(), dsGetDolbyVolumeMode(), dsGetIntelligentEqualizerMode(), dsGetVolumeLeveller(), dsGetBassEnhancer(), dsGetDRCMode(), dsGetSurroundVirtualizer(), dsGetMISteering(), dsGetGraphicEqualizerMode(), dsGetMS12AudioProfileList(), dsGetMS12AudioProfile(), dsGetSupportedARCTypes(), dsGetStereoMode(), dsGetStereoAuto(), dsGetAudioGain(), dsGetAudioDB(), dsGetAudioLevel(), dsGetAudioMaxDB(), dsGetAudioMinDB(), dsGetAudioOptimalLevel(), dsGetAudioDelay(), dsGetAudioDelayOffset(), dsGetLEConfig(), dsGetAudioCapabilities(), dsGetMS12Capabilities(), dsGetAssociatedAudioMixing(), dsGetFaderControl(), dsGetPrimaryLanguage(), dsGetSecondaryLanguage()