-
Notifications
You must be signed in to change notification settings - Fork 132
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
board_helpers: support DAI link ID customization #4736
Conversation
sound/soc/intel/boards/sof_ssp_amp.c
Outdated
sof_ssp_amp_card.dai_link = dai_links; | ||
if (ctx->ssp_mask_hdmi_in) { | ||
/* the topology supports HDMI-IN uses fixed BE ID for DAI links */ | ||
ctx->link_id_overwrite = NO_CODEC_LINK_IDS; |
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.
Hmm, what if ctx->ssp_mask_hdmi_in
is true, but ctx->amp_type
!= CODEC_NONE
? In that case, the second be_id will still be SPK_BE_ID
, right?
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 this case, amp's BE ID will always be SPK_BE_ID regardless the number of HDMI-IN links.
e89d7be
to
2e97e34
Compare
SOFCI TEST |
2e97e34
to
37d797b
Compare
sound/soc/intel/boards/sof_ssp_amp.c
Outdated
SOF_LINK_BT_OFFLOAD, \ | ||
SOF_LINK_NONE) | ||
|
||
#define NO_CODEC_LINK_IDS SOF_LINK_ORDER(HDMI_IN_BE_ID, \ |
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.
Sorry, I am not following what this 'NO_CODEC' means?
We already have a nocodec mode, but then we don't use this machine driver at all.
I guess I must be missing a lot of context on what you are trying to do @brentlu
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.
It just means the boards without headphone codec. Sorry for the confusing with the nocodec mode. I will rename the macros.
37d797b
to
c548a23
Compare
It's designed for sof_ssp_amp.c where id field of each BE dai link is a fixed value. Like the id of DMIC01 link is always 3 even when AMP BE link (id=2) is absent. To pass the id number of each BE DAI link to intel-board-helper module, a variable link_id_overwrite is added to sof_card_private structure. The link_id_overwrite will store the id number of all BE DAI links in one 64-bit variable. To simplify the implementation, we leverage the macro SOF_LINK_ORDER to encode id numbers so each link has 4 bit space for the id number. #define SSP_AMP_LINK_IDS SOF_LINK_ORDER(HDMI_IN_BE_ID, |
You need to use u64 is you assume a 64-bit variable, and add a description of the encoding in the commit message and the structure. |
I checked the code again and realized only 28 bits are used, so I left the variable type unchanged. Extra comment is added to commit message and structure. |
Add an new field link_id_overwrite to sof_card_private structure to support machine drivers which DAI link ID is fixed number or discontinue (i.e. no-codec boards). If this field is zero, DAI array index will be used as link ID. Otherwise the value extracted from link_id_overwrite will be used. The field link_id_overwrite is supposed to be initialized by SOF_LINK_IDS macro like following example. ctx->link_id_overwrite = SOF_LINK_IDS(HEADPHONE_BE_ID, \ DMIC01_BE_ID, \ DMIC16K_BE_ID, \ IDISP_HDMI_BE_ID, \ SPK_BE_ID, \ BT_OFFLOAD_BE_ID, \ HDMI_IN_BE_ID) An exception is that, if you use link_order_overwrite to overwrite DAI link order, then you need to use the same order to build link_id_overwrite variable as well. Signed-off-by: Brent Lu <[email protected]>
Use intel_board module to generate DAI link array and update num_links field in snd_soc_card structure. Signed-off-by: Brent Lu <[email protected]>
Since there is a helper function to generate entire DAI link array, we switch individual dai link helpers to static function. No functional change in this commit. Signed-off-by: Brent Lu <[email protected]>
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.
sounds good but @bardliao must approve and merge
To support boards in driver sof_ssp_amp, we add a new field "link_id_overwrite" to sof_card_private structure so machine driver could specify the ID for each DAI link (just like the way to specify the link order in link_order_overwrite).