コード例 #1
0
static int ak4671_probe(struct platform_device *pdev)
{
	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
	struct snd_soc_codec *codec;
	int ret = 0;

	if (ak4671_codec == NULL) {
		dev_err(&pdev->dev, "Codec device not registered\n");
		return -ENODEV;
	}

	socdev->card->codec = ak4671_codec;
	codec = ak4671_codec;

	/* register pcms */
	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
	if (ret < 0) {
		dev_err(codec->dev, "failed to create pcms: %d\n", ret);
		goto pcm_err;
	}

	snd_soc_add_controls(codec, ak4671_snd_controls,
			     ARRAY_SIZE(ak4671_snd_controls));
	ak4671_add_widgets(codec);

	ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	return ret;

pcm_err:
	return ret;
}
コード例 #2
0
ファイル: ak4671.c プロジェクト: Adjustxx/Savaged-Zen
static int ak4671_probe(struct snd_soc_codec *codec)
{
	struct ak4671_priv *ak4671 = snd_soc_codec_get_drvdata(codec);
	int ret;

	codec->hw_write = (hw_write_t)i2c_master_send;

	ret = snd_soc_codec_set_cache_io(codec, 8, 8, ak4671->control_type);
	if (ret < 0) {
		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
		return ret;
	}

	snd_soc_add_controls(codec, ak4671_snd_controls,
			     ARRAY_SIZE(ak4671_snd_controls));
	ak4671_add_widgets(codec);

	ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	return ret;
}