Пример #1
0
static int msm_soc_dai_init(
	struct snd_soc_pcm_runtime *rtd)
{
	int ret = 0;
        struct snd_soc_codec *codec = rtd->codec;

	mutex_init(&the_locks.lock);
	mutex_init(&the_locks.write_lock);
	mutex_init(&the_locks.read_lock);
	spin_lock_init(&the_locks.read_dsp_lock);
	spin_lock_init(&the_locks.write_dsp_lock);
	spin_lock_init(&the_locks.mixer_lock);
	init_waitqueue_head(&the_locks.eos_wait);
	init_waitqueue_head(&the_locks.write_wait);
	init_waitqueue_head(&the_locks.read_wait);
	msm_vol_ctl.volume = MSM_PLAYBACK_DEFAULT_VOLUME;
	msm_vol_ctl.pan = MSM_PLAYBACK_DEFAULT_PAN;

	ret = msm_new_mixer(codec);
	if (ret < 0) {
		pr_err("msm_soc: ALSA MSM Mixer Fail\n");
	}

	return ret;
}
Пример #2
0
static int msm_soc_dai_init(struct snd_soc_codec *codec)
{

	int ret = 0;
	ret = msm_new_mixer(codec->card);
	if (ret < 0)
		MM_AUD_ERR("msm_soc: ALSA MSM Mixer Fail\n");

	return ret;
}
Пример #3
0
static int msm_soc_dai_init(struct snd_soc_codec *codec)
{

	int ret = 0;
	ret = msm_new_mixer(codec->card);
	if (ret < 0)
		pr_err("%s: ALSA MSM Mixer Fail\n", __func__);

	return ret;
}
Пример #4
0
static int msm_soc_dai_init(
	struct snd_soc_pcm_runtime *rtd)
{

	int ret = 0;
	struct snd_soc_codec *codec = rtd->codec;

	init_waitqueue_head(&the_locks.enable_wait);
	init_waitqueue_head(&the_locks.eos_wait);
	init_waitqueue_head(&the_locks.write_wait);
	init_waitqueue_head(&the_locks.read_wait);
	memset(&session_route, DEVICE_IGNORE, sizeof(struct pcm_session));

	ret = msm_new_mixer(codec);
	if (ret < 0)
		pr_err("%s: ALSA MSM Mixer Fail\n", __func__);

	return ret;
}
Пример #5
0
static int msm_soc_dai_init(
    struct snd_soc_pcm_runtime *rtd)
{
    int ret = 0;
    struct snd_soc_codec *codec = rtd->codec;
    ret = msm_new_mixer(codec);
    if (ret < 0)
        MM_ERR("msm_soc: ALSA MSM Mixer Fail\n");

    mutex_init(&the_locks.lock);
    mutex_init(&the_locks.write_lock);
    mutex_init(&the_locks.read_lock);
    spin_lock_init(&the_locks.read_dsp_lock);
    spin_lock_init(&the_locks.write_dsp_lock);
    spin_lock_init(&the_locks.mixer_lock);
    init_waitqueue_head(&the_locks.enable_wait);
    init_waitqueue_head(&the_locks.eos_wait);
    init_waitqueue_head(&the_locks.write_wait);
    init_waitqueue_head(&the_locks.read_wait);
    src_dev = DEVICE_IGNORE;
    dst_dev = DEVICE_IGNORE;

    return ret;
}
Пример #6
0
static int msm_soc_dai_init(struct snd_soc_codec *codec)
{
	int ret = 0;
	struct snd_soc_card *card = codec->socdev->card;
	struct wm8994_priv *wm8994;

	ret = msm_new_mixer(codec->card);
	if (ret < 0)
		pr_err("%s: ALSA MSM Mixer Fail\n", __func__);

	wm8994_add_controls(codec);
	// permanently disable pin
	snd_soc_dapm_nc_pin(codec, "SPKOUTRN");
	snd_soc_dapm_nc_pin(codec, "SPKOUTRP");
	snd_soc_dapm_nc_pin(codec, "SPKOUTLN");
	snd_soc_dapm_nc_pin(codec, "SPKOUTLP");
	snd_soc_dapm_nc_pin(codec, "HPOUT2P");
	snd_soc_dapm_nc_pin(codec, "HPOUT2N");
	snd_soc_dapm_nc_pin(codec, "IN2RP:VXRP");
	snd_soc_dapm_nc_pin(codec, "IN2RN");
	snd_soc_dapm_nc_pin(codec, "IN2LN");
	snd_soc_dapm_nc_pin(codec, "IN1RN");
	snd_soc_dapm_nc_pin(codec, "IN1RP");
	snd_soc_dapm_nc_pin(codec, "IN1LN");

#if defined(CONFIG_MACH_TENDERLOIN)
	snd_soc_dapm_new_controls(codec, tenderloin_dapm_widgets,
				ARRAY_SIZE(tenderloin_dapm_widgets));

	snd_soc_dapm_add_routes(codec, tenderloin_dapm_routes,
				ARRAY_SIZE(tenderloin_dapm_routes));
#endif

	// Initially clock from MCLK1 - we will switch over to the FLLs
	// once we start playing audio but don't have BCLK yet to boot
	// them.
	ret = snd_soc_dai_set_sysclk(&codec->dai[0], WM8994_SYSCLK_MCLK1,
					WM_FLL, 0);
	if (ret != 0) {
		pr_err("Failed to set DAI sysclk: %d\n", ret);
		return ret;
	}
	ret = snd_soc_dai_set_sysclk(&codec->dai[1], WM8994_SYSCLK_MCLK1,
					WM_FLL, 0);
	if (ret != 0) {
		pr_err("Failed to set DAI sysclk: %d\n", ret);
		return ret;
	}

	/* Headphone jack detection */
	// If we have the HeadSet uart (hs_uart) then we DONT want to detect headphones
	if ( hs_uart == 1 ) {
		snd_soc_jack_new(card, "headset", SND_JACK_MICROPHONE | SND_JACK_BTN_0, &hp_jack);
	} else {
		snd_soc_jack_new(card, "headset", SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | SND_JACK_BTN_0, &hp_jack);
	}
	snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins),hp_jack_pins);
	snd_jack_set_key(hp_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); // mapping button 0 to KEY_PLAYPUASE

	// Register a notifier with snd_soc_jack
	jack_notifier.notifier_call = jack_notifier_event;

	snd_soc_jack_notifier_register(&hp_jack, &jack_notifier);

	ret = snd_soc_jack_add_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), hp_jack_gpios);

	wm8994 = snd_soc_codec_get_drvdata(codec);

	if(wm8994)
		wm8994->soc_jack = &hp_jack;

	// add headphone switch
	headphone_switch = kzalloc(sizeof(struct switch_dev), GFP_KERNEL);
	if (headphone_switch) {
		headphone_switch->name = "h2w";
		headphone_switch->print_name = headphone_switch_print_name;

		ret = switch_dev_register(headphone_switch);
		if (ret < 0) {
			printk(KERN_ERR "Unable to register headphone switch\n");
			kfree(headphone_switch);
			headphone_switch = NULL;
		} else {
			headphone_plugged = hp_jack.status ? 1 : 0;
			printk(KERN_INFO "Headphone switch initialized, plugged=%d\n",
					headphone_plugged);
			switch_set_state(headphone_switch, headphone_plugged);
		}
	} else {
		printk(KERN_ERR "Unable to allocate headphone switch\n");
	}

   return ret;
}