- Notifications
You must be signed in to change notification settings - Fork 8.2k
intel_adsp: dmic: Refactoring of blob parsing function #60172
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
ef37a85 to 2d33c77 Compare drivers/dai/intel/dmic/dmic_nhlt.c Outdated
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 agree that using a reserved bit could be just warning. But exceed of a max value like BFTH feels like it should be an error because it results to incorrect operation.
drivers/dai/intel/dmic/dmic.c Outdated
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 don't think this is a code improvement. Are you sure?
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.
Introduction of the PDM_CHANNEL_REGS_SIZE allows to remove a few switches, so I think this is an improvement.
drivers/dai/intel/dmic/dmic.c Outdated
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.
Simplify !! ?
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.
Instead of two variables with the same value, we have one, so this is a simplification. In fact, double negation is unnecessary because the comparison returns a boolean value. I will fix it.
Definitions of a configuration blob structures were separated from the main drivers header file and moved to a dedicated file to improve code readability. Removed unnecessary nhlt_pdm_fir_coeffs structure. The nhlt_pdm_ctrl_cfg structure was extended with nhlt_pdm_ctrl_fir_cfg and fir coefficients. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Moved code fragments responsible for logging and verification of the configuration register values from the dai_dmic_set_config_nhlt function to a separate functions. Behavior of the code verifying the correctness of register values has been changed so that it only displays warnings. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
All PDM controllers have the same set of registers. Their definitions have been merged to simplify the code. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Added reading of a necessary register values in dai_nhlt_dmic_dai_params_get function to simplify its parameter list. The code that calculates dai_params has been moved to it to simplify the dai_dmic_set_config_nhlt function. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
The while loop in the code fragments waiting for a bit to be cleared has been replaced with the WAIT_FOR macro call. Added a warning in the case of timeout. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Created dai_dmic_start_fifo_packers function corresponding to an already existing dai_dmic_stop_fifo_packers. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
All fir filters have an identical set of registers so their definitions were combined to simplify the code. From the dai_dmic_set_config_nhlt function, a duplicate piece of code responsible for configuring fir was separated into a new function. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
More verbose variable pdm_idx was used instead of n. The series of references to the array of pdm base addresses has been replaced with a pdm_base variable. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Added reading of a necessary register values in dai_nhlt_dmic_dai_params_get function to simplify its parameter list. The code that calculates dai_params has been moved to it to simplify the dai_dmic_set_config_nhlt function. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Created set of new functions for configure fir coefficients with support for packed format. This allowed to make the dai_dmic_set_config_nhlt function simpler. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
d3bd045 to cf7621e Compare
|
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.
Thanks @softwarecki , looks good and test PR also passes. I'd like @singalsu to approve this series before merge, otherwise good to go.
| p_mfir = FIELD_GET(FIR_CONFIG_FIR_DECIMATION, val) + 1; | ||
| | ||
| rate_div = p_clkdiv * p_mcic * p_mfir; | ||
| LOG_ERR("dai_index = %d, rate_div = %d, p_clkdiv = %d, p_mcic = %d, p_mfir = %d", |
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.
@softwarecki why are these LOG_ERR()? They seem printed every time:
This delays thesofproject/sof-test#1075 once more...
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.
@marc-hb oops, it should be LOG_INF
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.
ops, it should be LOG_INF
Fix submitted: #67567
Fix the log level of two LOG_ERR() statements which should have always been LOG_INF(). As confirmed by the author Adrian in zephyrproject-rtos#60172 Fixes commit 3fbaed4 ("dai: intel: ace: dmic: Refactor of dai_nhlt_dmic_dai_params_get function") Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Fix the log level of two LOG_ERR() statements which should have always been LOG_INF(). As confirmed by the author Adrian in zephyrproject-rtos#60172 Fixes commit 3fbaed4 ("dai: intel: ace: dmic: Refactor of dai_nhlt_dmic_dai_params_get function") Signed-off-by: Marc Herbert <marc.herbert@intel.com> (cherry picked from commit 8042e73)
Fix the log level of two LOG_ERR() statements which should have always been LOG_INF(). As confirmed by the author Adrian in zephyrproject-rtos#60172 Fixes commit 3fbaed4 ("dai: intel: ace: dmic: Refactor of dai_nhlt_dmic_dai_params_get function") Signed-off-by: Marc Herbert <marc.herbert@intel.com> (cherry picked from commit 8042e73)
juimonen hasn't reviewed any PRs or engaged in any Zephyr activity since July 2023. Recent activities: - review: Review on 'drivers: dai: doc: Cleanup Doxygen documentation' zephyrproject-rtos#60514 (2023-07-18T11:01:00Z) - review: Review on 'intel_adsp: dmic: Refactoring of blob parsing function' zephyrproject-rtos#60172 (2023-07-18T10:35:52Z) - review: Review on 'drivers: intel: ssp: delay initialization after dma' zephyrproject-rtos#60304 (2023-07-18T10:01:58Z) Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
juimonen hasn't reviewed any PRs or engaged in any Zephyr activity since July 2023. Recent activities: - review: Review on 'drivers: dai: doc: Cleanup Doxygen documentation' zephyrproject-rtos#60514 (2023-07-18T11:01:00Z) - review: Review on 'intel_adsp: dmic: Refactoring of blob parsing function' zephyrproject-rtos#60172 (2023-07-18T10:35:52Z) - review: Review on 'drivers: intel: ssp: delay initialization after dma' zephyrproject-rtos#60304 (2023-07-18T10:01:58Z) Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
juimonen hasn't reviewed any PRs or engaged in any Zephyr activity since July 2023. Recent activities: - review: Review on 'drivers: dai: doc: Cleanup Doxygen documentation' #60514 (2023-07-18T11:01:00Z) - review: Review on 'intel_adsp: dmic: Refactoring of blob parsing function' #60172 (2023-07-18T10:35:52Z) - review: Review on 'drivers: intel: ssp: delay initialization after dma' #60304 (2023-07-18T10:01:58Z) Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Definitions of a configuration blob structures were moved from the main drivers header file to a dedicated file.
Moved code fragments responsible for logging and verification of the configuration register values from the dai_dmic_set_config_nhlt function to a separate functions. Behavior of the code verifying the correctness of register values has been changed so that it only displays warnings.
All PDM controllers have the same set of registers. Their definitions have been merged to simplify the code. The same was done for FIR filters registers.
Code responsible for configuring fir was separated into a new function. Created set of new functions for configure fir coefficients with support for packed format.
Added reading of a necessary register values in dai_nhlt_dmic_dai_params_get function to simplify its parameter list. The code that calculates dai_params has been moved to it to simplify the dai_dmic_set_config_nhlt function.