Repository navigation
ASoC: SOF: add support for multi-dai and multi-configs per dai #1785
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| #ifndef __INCLUDE_SOUND_SOF_DAI_H__ | ||
| #define __INCLUDE_SOUND_SOF_DAI_H__ | ||
|
|
||
| #include <sound/sof/channel_map.h> | ||
| #include <sound/sof/header.h> | ||
| #include <sound/sof/dai-intel.h> | ||
| #include <sound/sof/dai-imx.h> | ||
|
|
@@ -50,23 +51,31 @@ enum sof_ipc_dai_type { | |
| SOF_DAI_INTEL_SSP, /**< Intel SSP */ | ||
| SOF_DAI_INTEL_DMIC, /**< Intel DMIC */ | ||
| SOF_DAI_INTEL_HDA, /**< Intel HD/A */ | ||
| SOF_DAI_INTEL_ALH, /**< Intel ALH */ | ||
| SOF_DAI_IMX_SAI, /**< i.MX SAI */ | ||
| SOF_DAI_IMX_ESAI, /**< i.MX ESAI */ | ||
| SOF_DAI_INTEL_ALH, /**< Intel ALH */ | ||
| SOF_DAI_IMX_SAI, /**< i.MX SAI */ | ||
| SOF_DAI_IMX_ESAI, /**< i.MX ESAI */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look like whitespace is changed.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will fix. |
||
| SOF_DAI_MULTIDAI = 0xFFFF /**< config with multiple elements of the same dai type */ | ||
| }; | ||
|
|
||
| /* general purpose DAI configuration */ | ||
| struct sof_ipc_dai_config { | ||
| struct sof_ipc_cmd_hdr hdr; | ||
| uint32_t type; /**< DAI type - enum sof_ipc_dai_type */ | ||
|
|
||
| uint16_t type; /**< DAI type - enum sof_ipc_dai_type */ | ||
| uint16_t subdai_type; /**< only used in multi-dai cases */ | ||
| uint32_t dai_index; /**< index of this type dai */ | ||
|
|
||
| /* physical protocol and clocking */ | ||
| uint16_t format; /**< SOF_DAI_FMT_ */ | ||
| uint16_t reserved16; /**< alignment */ | ||
|
|
||
| /* we can either have multiple sub-DAIs or multiple configs, not both */ | ||
| uint16_t num_payloads; /**< number of configs or number of sub-DAIs */ | ||
|
|
||
| uint16_t config_index; /**< index in dai_data */ | ||
|
|
||
| /* reserved for future use */ | ||
| uint32_t reserved[8]; | ||
| uint32_t reserved16; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be uint16_t reserved16?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gah, yes. merge mistake. |
||
| uint32_t reserved[7]; | ||
|
|
||
| /* HW specific data */ | ||
| union { | ||
|
|
@@ -76,7 +85,13 @@ struct sof_ipc_dai_config { | |
| struct sof_ipc_dai_alh_params alh; | ||
| struct sof_ipc_dai_esai_params esai; | ||
| struct sof_ipc_dai_sai_params sai; | ||
| }; | ||
| } dai_data[0]; | ||
|
|
||
| /* | ||
| * multi-dai stream maps. The ext_id used needs to match subdai_index | ||
| * in each _params structure above | ||
| */ | ||
| struct sof_ipc_stream_map stream_map; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused. This struct sof_ipc_dai_config is a part of the ABI, right? Isn't this change changing the size of the struct in some unclear way? Before we had a union above - i.e. the size that it took was equal to that of the largest member. Now it's a 0-size array, so, that size is 0. And instead you're adding a new struct after that... And 0-size arrays in the middle of a struct can have weird consequences... I'm really confused.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ack, this is completely broken indeed. i started a parallel thread to remove all variable arrays from IPC structs. |
||
| } __packed; | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ static int sdw_params_stream(struct device *dev, | |
| config.hdr.cmd = SOF_IPC_GLB_DAI_MSG | SOF_IPC_DAI_CONFIG; | ||
| config.type = SOF_DAI_INTEL_ALH; | ||
| config.dai_index = (link_id << 8) | (d->id); | ||
| config.alh.stream_id = alh_stream_id; | ||
| config.dai_data[0].alh.stream_id = alh_stream_id; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @plbossart Hmm, is this really safe? I mean definition now has a zero-length array and config size is set with sizeof(). I would except the sizeof to change with this patch.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree with @kv2019i - very strange and unclear what you're trying to do with that 0-size array of unions in the middle of a struct... |
||
|
|
||
| /* send message to DSP */ | ||
| ret = sof_ipc_tx_message(sdev->ipc, | ||
|
|
@@ -98,7 +98,7 @@ static int sdw_free_stream(struct device *dev, | |
| config.hdr.cmd = SOF_IPC_GLB_DAI_MSG | SOF_IPC_DAI_CONFIG; | ||
| config.type = SOF_DAI_INTEL_ALH; | ||
| config.dai_index = (link_id << 8) | d->id; | ||
| config.alh.stream_id = 0xFFFF; /* invalid value on purpose */ | ||
| config.dai_data[0].alh.stream_id = 0xFFFF; /* invalid value on purpose */ | ||
|
|
||
| /* send message to DSP */ | ||
| ret = sof_ipc_tx_message(sdev->ipc, | ||
|
|
||
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.
Do I understand this correctly, that
hdrcan be removed from this structs because these structs are never sent as a complete IPC message but only always embedded in larger structs with their own header? So, having this header in them was actually pointless from the beginning? This is a good and significant change. I'd say this change deserves a separate patch if this my understanding is correct...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.
yes indeed, it was useless. This used to be a separate patch, not sure what I did with git.