ASoC: Intel: sof_sdw: Divide channels by num_cpus in capture#4134
ASoC: Intel: sof_sdw: Divide channels by num_cpus in capture#4134bardliao wants to merge 1 commit intothesofproject:topic/sof-devfrom
Conversation
|
@plbossart This PR is to fix the distortion issue of aggregated feedback. The issue is that when we do 4 channels capture, the 4 channels format will be applied to each cpu/codec dai. In other words, we will have 4 channels data on the 1st sdw link AND the 2nd sdw link. |
|
Humm, yes that makes sense @bardliao But I wonder if this isn't an ASoC framework issue really. maybe the dailink definition should have something like a flag or a mask that says how the channels are handled, which btw might be a way to solve the M:N mapping between cpu and codec dais that isn't allowed today. |
sound/soc/intel/boards/sof_sdw.c
Outdated
| return 0; | ||
|
|
||
| /* | ||
| * The captured data will be combined from each cpu dais if the dai |
There was a problem hiding this comment.
nit-pick: "each CPU DAI" not "dais"
The captured data will be combined from each cpu DAI if the dai link has more than one cpu DAIs. Therefore, the channel number should divide by num_cpus for each cpu/codec DAI. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
f9f3d91 to
a905bc1
Compare
hmm, adding a flag to inform ASoC framework may be a good idea. Let me see if I can find a good way to handle it. |
@plbossart Please see #4136 |
|
@bardliao, @plbossart, this is confusing and I'm not sure how to interpret the setup. Out of box when you play 4 channel, what does that means? On capture of 4 channel I see similar issue just the reverse. I think in ASoC the single CPU dai - multi-codec dai is well defined, tested and it is using tdm_mask to specify the number of channels and the place of those channels for each codec on the link, so the CPU send 4 channel and each CPU 'receives' two, but takes it from different slots. Same for capture, codecs sending 2 channels, placing them to specific slots and the CPU receives these combined channels. I have not used the multi-cpu - single codec type, but I think in that case ASoC would treat it that all CPU dai receives the same number of channels as a whole and I don't think there is a tdm_mask for the CPU side to be able to extract portions, like the other setup. I might over-simplify this, but probably a tdm_mask support on the CPU side is what we are missing to be able to describe the issue correctly in the core and handle it? |
For playback, we send identical data to each cpu/codec dai pair. So if we play 4 channels, they are 4 channels for each codec.
That would be an issue indeed. |
|
@ujfalusi the notion of TDM mask is based on the notion of the same type of data multiplexed. There's nothing that tells us that the mask is related to a channel, just that the slot is used. Also in SoundWire the channels for different streams may have different depth, e.g. the capture channel may use 24 buts but the IV feedback 12. Think of SoundWire as an extension of TDM where the limitation to have the same data type is removed. Also you don't need to have the same number of slots on TX and RX. So basically I don't think we can use TDM notions here. |
|
@plbossart, playback and capture tdm_slot is separate, they don't need to be identical. I'm coming from i2s world, yes, but I think the very same issue present there with just a different terminology. |
not really, there is no way for the 2 parties to agree on what the contents of each slot might be. |
you have 2 CPU dais and 2 codecs. They all share the same signal lines, one of them is the clock provider (or it is something which always runs, does not matter). Sure, in I2S the components cannot 'agree', they are told to use this and that format (by the link description, machine driver). Side note: there are I2S codecs 'abusing' the TDM bus in a funky way that they reserve a slot or two for commands in the audio stream, some goes as far is to allow firmware download via TDM... much faster than i2c would be, or allow IQ param updates sent alongside the audio stream. |
|
The idea of let's mix audio and commands in a TDM stream gone away pretty quickly, never got upstream support. |
|
@ujfalusi when we use multiple cpu-dais for a SoundWire stream, it's because the codecs are connected on separate links - which do not share clock or data lines. Example: two separate amplifiers on two different links |
@ujfalusi To be more specific, a clock line per cpu dai. So, for the 2 cpu/codec dais case, the cpu/codec will use all slots on the link. |
|
@ujfalusi I seriously considered your's proposal to use Given that we don't know the channel mapping when we call |
|
set_tdm_slot() is not a good match for SoundWire capabilities. We should not even try to use it, it's be an horrible overload of both concept and code. |
@plbossart How about current solution? Or #4136? |
|
@bardliao I think we should solve multiple problems at the same time: The mapping at the dailink level should be implemented in ASoC soc-pcm.c, and the configuration in sof_sdw.c IMHO. |
I will implement the N:M mapping. Close this PR for now. |
The captured data will be combined from each cpu dais if the dai link has more than one cpu dais. Therefore, the channel number should divide by num_cpus for each cpu/codec dai.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com