Skip to content

Add SDCA widgets, routes and controls#5358

Closed
charleskeepax wants to merge 9 commits intothesofproject:topic/sof-devfrom
charleskeepax:sof/sdca
Closed

Add SDCA widgets, routes and controls#5358
charleskeepax wants to merge 9 commits intothesofproject:topic/sof-devfrom
charleskeepax:sof/sdca

Conversation

@charleskeepax
Copy link
Copy Markdown

Still a bit of a work in progress but pushing as running a bit late and want you guys to see where we are at with things. This adds support with a few rough edges for automatically generating all the DAPM routes, DAIs, widgets and ALSA controls based on the SDCA DisCo information.

Slightly neaten up the initilization write code to overlay a struct
rather than shifting the pointer along manually. This also removes the
Sparse warning:

sound/soc/sdca/sdca_functions.c:233:36: warning: cast to restricted __le32

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Implementation defined controls will not be present in the large list of
know controls for SDCA. The driver should not return an error for these,
because it is perfectly legal to have implementation defined controls.
Update the handling to instead generate a generic name.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
SDCA Controls come in a variety of data formats, to simplify later
parsing work out this data type as the control is parsed and stash it
for later use.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
SDCA Ranges are two dimensional arrays of data associated with controls,
add a helper to provide an x,y access mechanism to the data and a helper
to locate a specific value inside a range.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Add support for parsing the Group Entity properties from DisCo/ACPI.
Group Entities allow controls of several other Entities, typically
Selector Units, from a single control.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Use the previously parsed DisCo information from ACPI to create DAPM
widgets and routes representing a SDCA Function.

A top level helper sdca_asoc_populate_component() is exported that
counts and allocates everything, however, the intermediate counting and
population functions are also exported should end drivers require some
custom handling that isn't provided by the top level helper.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Use the previously parsed DisCo information from ACPI to create the
ALSA controls required by an SDCA Function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Use the previously parsed DisCo information from ACPI to create the DAI
drivers required to connect an SDCA Function into an ASoC soundcard.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Add helper function to extract the hardware port number from the
DataPort Selector Controls.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>

group->modes = devm_kcalloc(dev, group->num_modes, sizeof(*group->modes),
GFP_KERNEL);
if (!group->modes)
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.

do we need to free affected_list here?

mode->controls = devm_kcalloc(dev, mode->num_controls,
sizeof(*mode->controls), GFP_KERNEL);
if (!mode->controls)
return -ENOMEM;
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.

same here

return 0;

bad_list:
dev_err(dev, "%s: malformed affected controls list\n", entity->label);
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.

probably here as well

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ah yes good spots thank you I will get those fixed up.

"mipi-sdca-ge-selectedmode-controls-affected",
affected_list, num_affected);

group->num_modes = *affected_list;
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 it be group->num_modes = num_affected;?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No that is correct as is, although perhaps slightly confusing, num_affected contains the number of values in affected_list, but the number of modes is the first value in that list.

@charleskeepax
Copy link
Copy Markdown
Author

Mostly the review has moved to upstream now.

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.

3 participants