Skip to content
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

Add SDCA widgets, routes and controls #5358

Open
wants to merge 9 commits into
base: topic/sof-dev
Choose a base branch
from

Conversation

charleskeepax
Copy link

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
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
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
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
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
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
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.

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