Skip to content

ASoC: SOF: topology: fix cpu_dai_name for links with multi cpu DAIs - #2832

Merged
plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
ranj063:fix/multi-cpu-dai
Apr 14, 2021
Merged

plbossart merged 2 commits into
thesofproject:topic/sof-devfrom
ranj063:fix/multi-cpu-dai

Conversation

@ranj063

@ranj063 ranj063 commented Apr 8, 2021 •

Copy link
Copy Markdown
Collaborator

Use the correct cpu_dai_name when a link has multiple cpu
DAIs.

Fixes #2821

Comment thread sound/soc/sof/topology.c Outdated
if (link->num_cpus == 1)
dai->cpu_dai_name = link->cpus->dai_name;
else
dai->cpu_dai_name = link->cpus[j++].dai_name;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only "dai->cpu_dai_name = link->cpus[j++].dai_name;" can work ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha thats what I had but that will increment j for HDA DAIs and it wont work.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we test if (j < link->num_cpus)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes fixed!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so does this mean that if .num_cpus > 1 then the number of DAI widgets must not exceed it, but if .num_cpus == 1 then we can have an arbitrary number of DAI widgets?

@keqiaozhang

Copy link
Copy Markdown

Confirmed that this PR can fix issue #2821.

@ranj063
ranj063 force-pushed the fix/multi-cpu-dai branch from 965fff5 to 51658a5 Compare April 9, 2021 03:23
bardliao
bardliao previously approved these changes Apr 9, 2021
@keqiaozhang

Copy link
Copy Markdown

Found a new issue after applying this PR. Please refer to:#2821 (comment)

Comment thread sound/soc/sof/topology.c Outdated
dai->cpu_dai_name = link->cpus->dai_name;
if (j >= link->num_cpus) {
dev_err(sdev->dev,
"error: DAI widget count exceeds link cpus count\n");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we capitalise "CPUs" too, in fact wouldn't "link CPU count" (without the "s") be more correct - like in the first part "DAI widget count" - not "DAI widgets count?"

Comment thread sound/soc/sof/topology.c Outdated
if (link->num_cpus == 1)
dai->cpu_dai_name = link->cpus->dai_name;
else
dai->cpu_dai_name = link->cpus[j++].dai_name;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so does this mean that if .num_cpus > 1 then the number of DAI widgets must not exceed it, but if .num_cpus == 1 then we can have an arbitrary number of DAI widgets?

@lyakh lyakh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some optional comments

Comment thread sound/soc/sof/intel/hda-dai.c Resolved
Comment thread sound/soc/sof/intel/hda-dai.c Resolved
Comment thread sound/soc/sof/intel/hda-dai.c Resolved
Comment thread sound/soc/sof/intel/hda.c
if (ret < 0) {
dev_err(sdev->dev, "error: setting up DAI widget %s\n", w->name);
return ret;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the return value was ignored before this patch? So, it's a separate fix?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a fixup to the patch that added the function so I'd say ok to bake into this one.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it willbe squashed anyway.

Comment thread sound/soc/sof/intel/hda.c Resolved
kv2019i
kv2019i previously approved these changes Apr 12, 2021

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me and easier to follow. These big fixups will be challenging to be send, but in this case should be ok as Ranjani you can do the cleanup (if needed) to the "fixed-up" commit messages. In general, might be a good practise to have an updated commit message to be part of the fixup commit (or a comment stating that no change is needed).

I did thumb-up one Guennadi's comment, but as that's minor enough, I'll go ahead and approve.

Comment thread sound/soc/sof/intel/hda-dai.c Resolved
Comment thread sound/soc/sof/intel/hda.c
if (ret < 0) {
dev_err(sdev->dev, "error: setting up DAI widget %s\n", w->name);
return ret;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a fixup to the patch that added the function so I'd say ok to bake into this one.

Comment thread sound/soc/sof/sof-audio.c
struct sof_ipc_dai_config *config = dai->dai_config;
int ret;

config = &dai->dai_config[dai->current_config];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, good catch. FYI @juimonen

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a formal Fixes: at this point, the original commit was merged by Mark Brown if I am mistaken?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm thats right. I'll leave this one here and submit a separate PR to fix the upstream code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not following @ranj063. The fixup! mechanism is only useful if the base commit is still in topic/sof-dev-rebase. we will squash the result before sending upstream
If the ship has sailed and the base commit to be fixed is already in Mark's tree, then we can't use fixup! but only a bona fide patch with a Fixes tag.

Comment thread sound/soc/sof/intel/hda.c Resolved
Comment thread sound/soc/sof/intel/hda-dai.c Resolved

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits on 'Fix' and fixup!

Comment thread sound/soc/sof/sof-audio.c
struct sof_ipc_dai_config *config = dai->dai_config;
int ret;

config = &dai->dai_config[dai->current_config];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a formal Fixes: at this point, the original commit was merged by Mark Brown if I am mistaken?

Comment thread sound/soc/sof/topology.c Outdated
*/
if (!cpu_dai->playback_widget) {
cpu_dai->playback_widget = w;
dai->cpu_dai_name = cpu_dai->name;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need a Fixes tag as well here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart I want to squash the first 2 commits and remove cpu_dai_name from struct snd_sof_dai altogether. With the new logic to use the playback/capture_widget assocuated with the CPU DAI, we dont really need this at all. What do you think? But then its not really a fx anymore but rather a change in logic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me to remove something we don't need :-)

ranj063 added 2 commits April 12, 2021 09:58
Simplify the widget lookup logic by simply using the
playback/capture widget associated with the CPU DAI. With
this change in logic the cpu_dai_name field in struct snd_sof_dai
is no longer needed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
…ai config set up

Use the current config instead of the first config.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063
ranj063 force-pushed the fix/multi-cpu-dai branch from 26b9e62 to 2f1fbf7 Compare April 12, 2021 17:03
Comment thread sound/soc/sof/intel/hda-dai.c Resolved
@lyakh

lyakh commented Apr 13, 2021

Copy link
Copy Markdown
Collaborator

approval is subject to clarifying where and how the second patch should go, presumably it will be dropped from this PR.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, with the only open the point made by Rander

@RanderWang RanderWang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@plbossart
plbossart merged commit f8e3b2b into thesofproject:topic/sof-dev Apr 14, 2021
@ranj063
ranj063 deleted the fix/multi-cpu-dai branch May 12, 2021 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][TGL][SDW] playback failed on speaker: failed to find SOF DAI for: SDW2 Pin2

7 participants