Re: [PATCH] ASoC: Intel: avs: Add support for RT5663 codec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
> +			       struct snd_soc_dai_link **dai_link)
> +{
> +	struct snd_soc_dai_link_component *platform;
> +	struct snd_soc_dai_link *dl;
> +
> +	dl = devm_kzalloc(dev, sizeof(*dl), GFP_KERNEL);
> +	platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
> +	if (!dl || !platform)
> +		return -ENOMEM;
> +
> +	platform->name = platform_name;
> +
> +	dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port);
> +	dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
> +	dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL);
> +	if (!dl->name || !dl->cpus || !dl->codecs)
> +		return -ENOMEM;
> +
> +	dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port);
> +	dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5663:00");
> +	dl->codecs->dai_name = RT5663_DAI_NAME;
> +	if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name)
> +		return -ENOMEM;
> +
> +	dl->num_cpus = 1;
> +	dl->num_codecs = 1;
> +	dl->platforms = platform;
> +	dl->num_platforms = 1;
> +	dl->id = 0;
> +	dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;

can I ask why it's necessary to hard-code the format, shouldn't this be
specified in the topology?

It's a generic question for AVS machine drivers, the same code is found
in other cases.

> +	dl->init = avs_rt5663_codec_init;
> +	dl->nonatomic = 1;
> +	dl->no_pcm = 1;
> +	dl->dpcm_capture = 1;
> +	dl->dpcm_playback = 1;
> +
> +	*dai_link = dl;
> +
> +	return 0;
> +}



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux