-
Notifications
You must be signed in to change notification settings - Fork 59
lib.sh: Set ALSA settings from a state file #1294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
780038d to
018d22b
Compare
2851a8c to
ed8ff16
Compare
marc-hb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No time to review and it's still a draft but this looks very useful!
c7b32b6 to
6ad42fa
Compare
|
SOFCI TEST |
| @@ -0,0 +1,35 @@ | |||
| state.sofsoundwire { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File MTLP_RVP_SDW.sh contain comment's why we set something, we should keep them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, the ALSA state file format has no custom comments, although alsactl seems to ignore them, if added carefully.
I think better to avoid parsing issues and just rely on the git log history to track changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, comments should be move to README file to preserve info why specific config was set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, comments should be move to README file to preserve info why specific config was set
in README it will be quickly out of sync .. let's try to add it to the .state file directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good git log is important but it should be focused and explaining why things CHANGED. It should ideally not be required to explain why things ARE the way they are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, git log should focus on explaining why something was changed. But there are cases where leaving comment in code is also important, for changes that could rise questions in future, or like here proposing whole new approach, comment in file can be quicker to find and understand than digging in git history.
|
For some unknown reason I just remembered that UCM was supposed to be tested interface, not ALSA states... Quoting internal issue sof-framework 635:
:-) |
@marc-hb, AFAIK this choice (state vs. ucm) has been discussed several months ago, and #1270 PoC was started focusing on the state method. At this point we need to sort out the currently used mechanism first, with its limitations known. |
|
btw, this PR has been already used to identify issues with misaligned configurations, so its merge will improve test execution on our CI. |
6ad42fa to
7cc12cc
Compare
|
SOFCI TEST |
|
@majunkier - do you have any other blocking comments ? |
| codec and loopback devices. | ||
|
|
||
| The `./alsa_settings/` directory contains custom ALSA configurations which | ||
| are currently applied at the SOF CI pipeline's hardware platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the default hardware configuration different and not enough? If this is by design (in other words, testing requires some "special sauce"), very briefly state why. If this is not design, clearly state that all these files are really "workarounds".
Either way, it's not good to be testing something different from regular users. So this deserves a bit of justification in either case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, It is a really good question what a 'regular user' can (or should) have as an environment to execute the tests.
I've changed the text a bit, hopefully it becomes more clear why we need these settings here as they currently are.
7cc12cc to
4786a83
Compare
| if [ -f "${ALSA_SETTINGS_FILE}.sh" ]; then | ||
| dlogc "${ALSA_SETTINGS_FILE}.sh" | ||
| "${ALSA_SETTINGS_FILE}".sh 2>&1 || rc=$? | ||
| [[ "${rc}" -ne 0 ]] && dloge "ALSA settings error=${rc}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should reset rc to zero first, otherwise this .sh message could be triggered by the previous . .state error despite the .sh running fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, added
| Please note that in some cases the settings are tuned to CI DUT 'harnesses': | ||
| external codecs with their versions, audio cards at loopback connections, etc. | ||
| In the future, most of these settings should be moved to the DUT's default config | ||
| out of the test case scope, so only the test-specific settings will remain here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a simple way to identify which setting is part of which category in each file using using some "standardized" comment convention and/or sections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good idea for future clean-up changes there.
set_alsa_settings() function now uses `alsactl restore` command,
to change ALSA controls from a custom state file first, if it is
present, and next - execute a bash script with amixer commands
if it is also present.
The state file is expected as `./alsa_settings/${PLATFORM}.state`
whereas the bash script remains as `./alsa_settings/${PLATFORM}.sh`
The custom state should be compatible with the platform's
default state, see set_alsa() function.
Co-authored-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
Co-authored-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Log difference between the current ALSA state and the restored ALSA state. Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Replace PTL platform ALSA settings done as bash script commands by their equivalent ALSA state files for: * PTLH_HDA_AIOC * PTLH_SDW_RT712 * PTLP_RVP_SDW The parameters in the state files are explicitly set even if the default values at the appropriate DUT are currently the same. Signed-off-by: Dmitrii Golovanov <dmitrii.golovaniov@intel.com> Co-authored-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
Replace MTL platform ALSA settings done as bash script commands by their equivalent ALSA state files for: * MTLP_RVP_HDA * MTLP_SDW_AIOC * MTLP_RVP_SDW The parameters in the state files are explicitly set even if the default values at the appropriate DUT are currently the same. Because of that, we can't 'reuse' MTLP_RVP_SDW state for MTLP_SDW_AIOC as before: these configurations have different id's whereas `amixer` had changed them referencing by name. In some cases, USB audio card settings are also included: it is needed to adjust loopback volume levels on a CI DUT. In the future these settings (actually most of the ALSA settings) should be migrated to the DUT's default configs and out of the test case scope, so only test-specific settings remain here. Signed-off-by: Dmitrii Golovanov <dmitrii.golovaniov@intel.com> Co-authored-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
Replace LNLM platform ALSA settings done as bash script commands by their equivalent ALSA state files for: * LNLM_RVP_HDA * LNLM_SDW_AIOC The parameters in the state files are explicitly set even if the default values at the appropriate DUT are currently the same. Signed-off-by: Dmitrii Golovanov <dmitrii.golovaniov@intel.com> Co-authored-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
Add README.md documentation for SOF test ALSA settings. Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Keep comments from the removed shell scripts adding them to the appropriate .state files: LNLM_SDW_AIOC.state MTLP_SWD_AIOC.state WARNING: these comments might be incompatible with `alsactl` tool in the future. Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
4786a83 to
8f201d1
Compare
|
|
SzymonRichert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR is to continue with #1284 and PoC #1270
Set ALSA settings from a state file and migrate PTL configurations to the new mechanism:
set_alsa_settings()function now usesalsactl restorecommand, to change ALSA controls from a custom state file first, if it is present, and next - execute a bash script with amixer commands, if it is also present.The state file is expected as
./alsa_settings/${PLATFORM}.statewhereas the bash script remains as./alsa_settings/${PLATFORM}.shThe custom state should be compatible with the platform's default state, see
set_alsa()function.Replace PTL platform ALSA settings done as bash script commands by their equivalent ALSA state files for:
The parameters in the state files are explicitly set even if the default values at the appropriate DUT are currently the same.
Log difference between the current ALSA state and the restored ALSA state.
Add
README.mddocumentation for the SOF test ALSA settings.