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

Remove large global CPUs array. #4529

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions sound/soc/intel/boards/sof_sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");

#define INC_ID(BE, CPU, LINK) do { (BE)++; (CPU)++; (LINK)++; } while (0)

#define SDW_MAX_LINKS 4

/* To store SDW Pin index for each SoundWire link */
static unsigned int sdw_pin_index[SDW_MAX_LINKS];

static void log_quirks(struct device *dev)
{
if (SOF_JACK_JDSRC(sof_sdw_quirk))
Expand Down Expand Up @@ -1341,6 +1336,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
int adr_index,
int dai_index)
{
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
struct device *dev = card->dev;
const struct snd_soc_acpi_link_adr *adr_link_next;
struct snd_soc_dai_link_component *codecs;
Expand Down Expand Up @@ -1462,7 +1458,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
for (k = 0; k < cpu_dai_num; k++) {
cpu_name = devm_kasprintf(dev, GFP_KERNEL,
"SDW%d Pin%d", cpu_dai_id[k],
sdw_pin_index[cpu_dai_id[k]]++);
ctx->sdw_pin_index[cpu_dai_id[k]]++);
if (!cpu_name)
return -ENOMEM;

Expand Down Expand Up @@ -1610,7 +1606,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
goto SSP;

for (i = 0; i < SDW_MAX_LINKS; i++)
sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;
ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;

for (; adr_link->num_adr; adr_link++) {
/*
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/intel/boards/sof_sdw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define SDW_MAX_CPU_DAIS 16
#define SDW_INTEL_BIDIR_PDI_BASE 2

#define SDW_MAX_LINKS 4
Copy link
Member

Choose a reason for hiding this comment

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

Heads-up that we're going to have to change this to 5 in the coming weeks, and refactor the code to use a single value shared across the tree.


/* 8 combinations with 4 links + unused group 0 */
#define SDW_MAX_GROUPS 9

Expand Down Expand Up @@ -97,6 +99,8 @@ struct mc_private {
struct snd_soc_jack sdw_headset;
struct device *headset_codec_dev; /* only one headset per card */
struct device *amp_dev1, *amp_dev2;
/* To store SDW Pin index for each SoundWire link */
unsigned int sdw_pin_index[SDW_MAX_LINKS];
};

extern unsigned long sof_sdw_quirk;
Expand Down