예제 #1
0
파일: cs42l52.c 프로젝트: MaxChina/linux
static int cs42l52_remove(struct snd_soc_codec *codec)
{
	cs42l52_free_beep(codec);
	cs42l52_set_bias_level(codec, SND_SOC_BIAS_OFF);

	return 0;
}
static int cs42l52_probe(struct snd_soc_codec *codec)
{
	struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
	int ret;

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

	cs42l52_init_beep(codec);

	cs42l52_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	cs42l52->sysclk = CS42L52_DEFAULT_CLK;
	cs42l52->config.format = CS42L52_DEFAULT_FORMAT;

	/* Set Platform MICx CFG */
	snd_soc_update_bits(codec, CS42L52_MICA_CTL,
			    CS42L52_MIC_CTL_TYPE_MASK,
				cs42l52->pdata.mica_cfg <<
				CS42L52_MIC_CTL_TYPE_SHIFT);

	snd_soc_update_bits(codec, CS42L52_MICB_CTL,
			    CS42L52_MIC_CTL_TYPE_MASK,
				cs42l52->pdata.micb_cfg <<
				CS42L52_MIC_CTL_TYPE_SHIFT);

	/* if Single Ended, Get Mic_Select */
	if (cs42l52->pdata.mica_cfg)
		snd_soc_update_bits(codec, CS42L52_MICA_CTL,
				    CS42L52_MIC_CTL_MIC_SEL_MASK,
				cs42l52->pdata.mica_sel <<
				CS42L52_MIC_CTL_MIC_SEL_SHIFT);
	if (cs42l52->pdata.micb_cfg)
		snd_soc_update_bits(codec, CS42L52_MICB_CTL,
				    CS42L52_MIC_CTL_MIC_SEL_MASK,
				cs42l52->pdata.micb_sel <<
				CS42L52_MIC_CTL_MIC_SEL_SHIFT);

	/* Set Platform Charge Pump Freq */
	snd_soc_update_bits(codec, CS42L52_CHARGE_PUMP,
			    CS42L52_CHARGE_PUMP_MASK,
				cs42l52->pdata.chgfreq <<
				CS42L52_CHARGE_PUMP_SHIFT);

	/* Set Platform Bias Level */
	snd_soc_update_bits(codec, CS42L52_IFACE_CTL2,
			    CS42L52_IFACE_CTL2_BIAS_LVL,
				cs42l52->pdata.micbias_lvl);

	return ret;
}
예제 #3
0
파일: cs42l52.c 프로젝트: MaxChina/linux
static int cs42l52_probe(struct snd_soc_codec *codec)
{
	struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);

	regcache_cache_only(cs42l52->regmap, true);

	cs42l52_add_mic_controls(codec);

	cs42l52_init_beep(codec);

	cs42l52_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	cs42l52->sysclk = CS42L52_DEFAULT_CLK;
	cs42l52->config.format = CS42L52_DEFAULT_FORMAT;

	return 0;
}
예제 #4
0
파일: cs42l52.c 프로젝트: MaxChina/linux
static int cs42l52_resume(struct snd_soc_codec *codec)
{
	cs42l52_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

	return 0;
}
예제 #5
0
파일: cs42l52.c 프로젝트: MaxChina/linux
static int cs42l52_suspend(struct snd_soc_codec *codec)
{
	cs42l52_set_bias_level(codec, SND_SOC_BIAS_OFF);

	return 0;
}