ASoC: Intel: sof_sdw: pass card information to init/exit functions
If we want to handle a context in init/exit function, we have to pass the card information. This will be necessary to better deal with device properties in the follow-up commits. No functional change other than prototype update. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210813151116.23931-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d3409eb20d
commit
cdf99c9ab7
|
@ -352,7 +352,8 @@ static const struct snd_soc_ops sdw_ops = {
|
|||
.shutdown = sdw_shutdown,
|
||||
};
|
||||
|
||||
static int sof_sdw_mic_codec_mockup_init(const struct snd_soc_acpi_link_adr *link,
|
||||
static int sof_sdw_mic_codec_mockup_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
@ -697,7 +698,8 @@ static int create_codec_dai_name(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int set_codec_init_func(const struct snd_soc_acpi_link_adr *link,
|
||||
static int set_codec_init_func(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
bool playback, int group_id)
|
||||
{
|
||||
|
@ -720,7 +722,8 @@ static int set_codec_init_func(const struct snd_soc_acpi_link_adr *link,
|
|||
if (link->adr_d[i].endpoints->group_id != group_id)
|
||||
continue;
|
||||
if (codec_info_list[codec_index].init)
|
||||
codec_info_list[codec_index].init(link,
|
||||
codec_info_list[codec_index].init(card,
|
||||
link,
|
||||
dai_links,
|
||||
&codec_info_list[codec_index],
|
||||
playback);
|
||||
|
@ -805,7 +808,8 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int create_sdw_dailink(struct device *dev, int *be_index,
|
||||
static int create_sdw_dailink(struct snd_soc_card *card,
|
||||
struct device *dev, int *be_index,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
int sdw_be_num, int sdw_cpu_dai_num,
|
||||
struct snd_soc_dai_link_component *cpus,
|
||||
|
@ -926,7 +930,7 @@ static int create_sdw_dailink(struct device *dev, int *be_index,
|
|||
codecs, codec_num,
|
||||
NULL, &sdw_ops);
|
||||
|
||||
ret = set_codec_init_func(link, dai_links + (*be_index)++,
|
||||
ret = set_codec_init_func(card, link, dai_links + (*be_index)++,
|
||||
playback, group_id);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to init codec %d", codec_index);
|
||||
|
@ -1107,7 +1111,7 @@ static int sof_card_dai_links_create(struct device *dev,
|
|||
group_generated[endpoint->group_id])
|
||||
continue;
|
||||
|
||||
ret = create_sdw_dailink(dev, &be_id, links, sdw_be_num,
|
||||
ret = create_sdw_dailink(card, dev, &be_id, links, sdw_be_num,
|
||||
sdw_cpu_dai_num, cpus, adr_link,
|
||||
&cpu_id, group_generated,
|
||||
codec_conf, codec_conf_count,
|
||||
|
@ -1170,7 +1174,7 @@ SSP:
|
|||
ssp_components, 1,
|
||||
NULL, info->ops);
|
||||
|
||||
ret = info->init(NULL, links + link_id, info, 0);
|
||||
ret = info->init(card, NULL, links + link_id, info, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -1393,7 +1397,7 @@ static int mc_remove(struct platform_device *pdev)
|
|||
for_each_card_prelinks(card, j, link) {
|
||||
if (!strcmp(link->codecs[0].dai_name,
|
||||
codec_info_list[i].dai_name)) {
|
||||
ret = codec_info_list[i].exit(&pdev->dev, link);
|
||||
ret = codec_info_list[i].exit(card, link);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev,
|
||||
"codec exit failed %d\n",
|
||||
|
|
|
@ -62,12 +62,13 @@ struct sof_sdw_codec_info {
|
|||
const char *dai_name;
|
||||
const struct snd_soc_ops *ops;
|
||||
|
||||
int (*init)(const struct snd_soc_acpi_link_adr *link,
|
||||
int (*init)(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
||||
int (*exit)(struct device *dev, struct snd_soc_dai_link *dai_link);
|
||||
int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
|
||||
bool late_probe;
|
||||
int (*codec_card_late_probe)(struct snd_soc_card *card);
|
||||
};
|
||||
|
@ -76,6 +77,7 @@ struct mc_private {
|
|||
struct list_head hdmi_pcm_list;
|
||||
bool idisp_codec;
|
||||
struct snd_soc_jack sdw_headset;
|
||||
struct device *headset_codec_dev; /* only one headset per card */
|
||||
};
|
||||
|
||||
extern unsigned long sof_sdw_quirk;
|
||||
|
@ -95,21 +97,24 @@ int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card);
|
|||
int sof_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd);
|
||||
|
||||
/* RT711 support */
|
||||
int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt711_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link);
|
||||
int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
|
||||
|
||||
/* RT711-SDCA support */
|
||||
int sof_sdw_rt711_sdca_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt711_sdca_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
int sof_sdw_rt711_sdca_exit(struct device *dev, struct snd_soc_dai_link *dai_link);
|
||||
int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
|
||||
|
||||
/* RT700 support */
|
||||
int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt700_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
@ -117,31 +122,36 @@ int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
|
|||
/* RT1308 support */
|
||||
extern struct snd_soc_ops sof_sdw_rt1308_i2s_ops;
|
||||
|
||||
int sof_sdw_rt1308_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt1308_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
||||
/* RT1316 support */
|
||||
int sof_sdw_rt1316_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt1316_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
||||
/* RT715 support */
|
||||
int sof_sdw_rt715_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt715_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
||||
/* RT715-SDCA support */
|
||||
int sof_sdw_rt715_sdca_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt715_sdca_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
||||
/* MAX98373 support */
|
||||
int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_mx8373_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
@ -149,7 +159,8 @@ int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
|
|||
int sof_sdw_mx8373_late_probe(struct snd_soc_card *card);
|
||||
|
||||
/* RT5682 support */
|
||||
int sof_sdw_rt5682_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt5682_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback);
|
||||
|
|
|
@ -120,7 +120,8 @@ static const struct snd_soc_ops max_98373_sdw_ops = {
|
|||
.shutdown = sdw_shutdown,
|
||||
};
|
||||
|
||||
int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_mx8373_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -127,7 +127,8 @@ struct snd_soc_ops sof_sdw_rt1308_i2s_ops = {
|
|||
.hw_params = rt1308_i2s_hw_params,
|
||||
};
|
||||
|
||||
int sof_sdw_rt1308_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt1308_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -89,7 +89,8 @@ static int all_spk_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return second_spk_init(rtd);
|
||||
}
|
||||
|
||||
int sof_sdw_rt1316_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt1316_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -111,7 +111,8 @@ static int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int sof_sdw_rt5682_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt5682_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -110,7 +110,8 @@ static int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt700_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -135,7 +135,7 @@ static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link)
|
||||
int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
|
||||
{
|
||||
struct device *sdw_dev;
|
||||
|
||||
|
@ -150,7 +150,8 @@ int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt711_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -135,7 +135,7 @@ static int rt711_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int sof_sdw_rt711_sdca_exit(struct device *dev, struct snd_soc_dai_link *dai_link)
|
||||
int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
|
||||
{
|
||||
struct device *sdw_dev;
|
||||
|
||||
|
@ -150,7 +150,8 @@ int sof_sdw_rt711_sdca_exit(struct device *dev, struct snd_soc_dai_link *dai_lin
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sof_sdw_rt711_sdca_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt711_sdca_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -24,7 +24,8 @@ static int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sof_sdw_rt715_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt715_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
|
@ -24,7 +24,8 @@ static int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sof_sdw_rt715_sdca_init(const struct snd_soc_acpi_link_adr *link,
|
||||
int sof_sdw_rt715_sdca_init(struct snd_soc_card *card,
|
||||
const struct snd_soc_acpi_link_adr *link,
|
||||
struct snd_soc_dai_link *dai_links,
|
||||
struct sof_sdw_codec_info *info,
|
||||
bool playback)
|
||||
|
|
Loading…
Reference in New Issue