/* This function is called when ASoC has all the pieces it needs to instantiate a sound driver.  */
static int cs4270_probe(struct platform_device *pdev)
/* This function is called when ASoC has all the pieces it needs to instantiate a sound driver.  */
static int cs4270_probe(struct platform_device *pdev)
{
	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
	struct snd_soc_codec *codec = cs4270_codec;
	int ret;
	socdev->card->codec = codec;
	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
	if (ret < 0) {
		dev_err(codec->dev, "failed to create pcms\n");
		return ret;
	}
	ret = snd_soc_add_controls(codec, cs4270_snd_controls,
				ARRAY_SIZE(cs4270_snd_controls));
	if (ret < 0) {
		dev_err(codec->dev, "failed to add controls\n");
		goto error_free_pcms;
	}
	return 0;
error_free_pcms:
	snd_soc_free_pcms(socdev);
	return ret;
}