ASoC: intel: sof_sdw: Move sdw_pin_index into private struct
Whilst it should not cause any issues as only a single instance of the machine will be instantiated, it is still slightly better practice to keep working data in the private data structure, rather than a global variable. Move sdw_pin_index into the mc_private structure. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230915075611.1619548-2-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
642d1de63c
commit
fc46ecf347
@@ -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))
|
||||
@@ -1331,6 +1326,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;
|
||||
@@ -1452,7 +1448,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;
|
||||
|
||||
@@ -1600,7 +1596,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++) {
|
||||
/*
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#define SDW_MAX_CPU_DAIS 16
|
||||
#define SDW_INTEL_BIDIR_PDI_BASE 2
|
||||
|
||||
#define SDW_MAX_LINKS 4
|
||||
|
||||
/* 8 combinations with 4 links + unused group 0 */
|
||||
#define SDW_MAX_GROUPS 9
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user