• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snd_soc_jack_add_pins函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中snd_soc_jack_add_pins函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_soc_jack_add_pins函数的具体用法?C++ snd_soc_jack_add_pins怎么用?C++ snd_soc_jack_add_pins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了snd_soc_jack_add_pins函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: broadwell_rt286_codec_init

static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	int ret = 0;

	ret = snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
				&broadwell_hp);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&broadwell_hp, 1, broadwell_hp_pins);
	if (ret)
		return ret;

	ret = snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE,
				&broadwell_mic);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&broadwell_mic, 1, broadwell_mic_pins);
	if (ret)
		return ret;

	rt286_mic_detect(codec, &broadwell_hp, &broadwell_mic);
	return 0;
}
开发者ID:byxorna,项目名称:linux-samus,代码行数:26,代码来源:broadwell.c


示例2: bdw_rt5677_init

static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd)
{
	struct bdw_rt5677_priv *bdw_rt5677 =
			snd_soc_card_get_drvdata(rtd->card);
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;

	/* Enable codec ASRC function for Stereo DAC/Stereo1 ADC/DMIC/I2S1.
	 * The ASRC clock source is clk_i2s1_asrc.
	 */
	rt5677_sel_asrc_clk_src(codec, RT5677_DA_STEREO_FILTER |
			RT5677_AD_STEREO1_FILTER | RT5677_I2S1_SOURCE,
			RT5677_CLK_SEL_I2S1_ASRC);

	/* Request rt5677 GPIO for headphone amp control */
	bdw_rt5677->gpio_hp_en = devm_gpiod_get_index(codec->dev,
		"RT5677_GPIO_HP_AMP_SHDN_L", RT5677_GPIO_HP_AMP_SHDN_L, GPIOD_ASIS);
	if (IS_ERR(bdw_rt5677->gpio_hp_en)) {
		dev_err(codec->dev, "Can't find HP_AMP_SHDN_L gpio\n");
		return PTR_ERR(bdw_rt5677->gpio_hp_en);
	}
	gpiod_direction_output(bdw_rt5677->gpio_hp_en, 0);

	/* Create and initialize headphone jack */
	if (!snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
			&headphone_jack)) {
		if (snd_soc_jack_add_pins(&headphone_jack, 1,
				&headphone_jack_pin))
			dev_err(codec->dev, "Can't add headphone jack pin\n");

		headphone_jack_gpio.gpiod_dev = codec->dev;
		if (snd_soc_jack_add_gpios(&headphone_jack, 1,
				&headphone_jack_gpio))
			dev_err(codec->dev, "Can't add headphone jack gpio\n");
	} else {
		dev_err(codec->dev, "Can't create headphone jack\n");
	}

	/* Create and initialize mic jack */
	if (!snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE,
			&mic_jack)) {
		if (snd_soc_jack_add_pins(&mic_jack, 1, &mic_jack_pin))
			dev_err(codec->dev, "Can't add mic jack pin\n");

		mic_jack_gpio.gpiod_dev = codec->dev;
		if (snd_soc_jack_add_gpios(&mic_jack, 1, &mic_jack_gpio))
			dev_err(codec->dev, "Can't add mic jack gpio\n");
	} else {
		dev_err(codec->dev, "Can't create mic jack\n");
	}
	bdw_rt5677->codec = codec;

	snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
	return 0;
}
开发者ID:byxorna,项目名称:linux-samus,代码行数:55,代码来源:bdw-rt5677.c


示例3: tegra_wm8903_init

static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_dai *codec_dai = rtd->codec_dai;
	struct snd_soc_codec *codec = codec_dai->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	struct snd_soc_card *card = codec->card;
	struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
	struct tegra_asoc_platform_data *pdata = machine->pdata;

	machine->bias_level = SND_SOC_BIAS_STANDBY;

	if (gpio_is_valid(pdata->gpio_hp_det)) {
		tegra_wm8903_hp_jack_gpio.gpio = pdata->gpio_hp_det;
		snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE,
				&tegra_wm8903_hp_jack);
#ifndef CONFIG_SWITCH
		snd_soc_jack_add_pins(&tegra_wm8903_hp_jack,
					ARRAY_SIZE(tegra_wm8903_hp_jack_pins),
					tegra_wm8903_hp_jack_pins);
#else
		snd_soc_jack_notifier_register(&tegra_wm8903_hp_jack,
					&tegra_wm8903_jack_detect_nb);
#endif
		snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack,
					1,
					&tegra_wm8903_hp_jack_gpio);
	}

	snd_soc_jack_new(codec, "Mic Jack", SND_JACK_MICROPHONE,
			 &tegra_wm8903_mic_jack);
#ifndef CONFIG_SWITCH
	snd_soc_jack_add_pins(&tegra_wm8903_mic_jack,
			      ARRAY_SIZE(tegra_wm8903_mic_jack_pins),
			      tegra_wm8903_mic_jack_pins);
#else
	snd_soc_jack_notifier_register(&tegra_wm8903_mic_jack,
				&tegra_wm8903_jack_detect_nb);
#endif
	wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE,
			  machine_is_cardhu() ? SND_JACK_MICROPHONE : 0);

	ret = tegra_asoc_utils_register_ctls(&machine->util_data);
	if (ret < 0)
		return ret;

	snd_soc_dapm_force_enable_pin(dapm, "MICBIAS");

	return 0;
}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:49,代码来源:tegra_wm8903.c


示例4: hx4700_ak4641_init

static int hx4700_ak4641_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int err;

	
	
	snd_soc_dapm_nc_pin(dapm, "MOUT1");
	snd_soc_dapm_nc_pin(dapm, "MICEXT");
	snd_soc_dapm_nc_pin(dapm, "AUX");

	
	err = snd_soc_jack_new(codec, "Headphone Jack",
				SND_JACK_HEADPHONE, &hs_jack);
	if (err)
		return err;

	err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pin),
					hs_jack_pin);
	if (err)
		return err;

	err = snd_soc_jack_add_gpios(&hs_jack, 1, &hs_jack_gpio);

	return err;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:27,代码来源:hx4700.c


示例5: acclaim_aic3100_init

/*
 * Initialization routine.
 */
static int acclaim_aic3100_init (struct snd_soc_pcm_runtime *pcm)
{
	struct snd_soc_codec *codec = pcm->codec;
	int gpiostatus;

        DBG(KERN_INFO  "acclaim_aic3100_init..\n");

	gpiostatus = snd_soc_jack_new(codec, "Headset Jack",
				      SND_JACK_HEADSET, &hs_jack);
	if (gpiostatus != 0) {
		printk (KERN_ERR "snd_soc_jack_new failed(%d)\n", gpiostatus);
        }

	gpiostatus = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
					   hs_jack_pins);
	if (gpiostatus != 0) {
		printk (KERN_ERR"snd_soc_jack_add_pins failed(%d)\n",
			gpiostatus);
        }

	gpiostatus = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
					    hs_jack_gpios);

        if (gpiostatus != 0)
		printk (KERN_ERR "snd_soc_jack_add_gpios failed..%d\n",
			gpiostatus);

	/* For our Driver, the Codec Driver itself manages the POP
	*  polling and hence
	* we will reset the ALSA pmdown_time to zero.
	*/
	pcm->pmdown_time = 0;
	return 0;
}
开发者ID:LeaderRider,项目名称:kernel3NookTablet,代码行数:37,代码来源:omap4_aic3100.c


示例6: tegra_alc5632_asoc_init

static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	struct device_node *np = codec->card->dev->of_node;
	struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(codec->card);

	snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
			 &tegra_alc5632_hs_jack);
	snd_soc_jack_add_pins(&tegra_alc5632_hs_jack,
			ARRAY_SIZE(tegra_alc5632_hs_jack_pins),
			tegra_alc5632_hs_jack_pins);

	machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0);

	if (gpio_is_valid(machine->gpio_hp_det)) {
		tegra_alc5632_hp_jack_gpio.gpio = machine->gpio_hp_det;
		snd_soc_jack_add_gpios(&tegra_alc5632_hs_jack,
						1,
						&tegra_alc5632_hp_jack_gpio);
		machine->gpio_requested |= GPIO_HP_DET;
	}

	snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");

	return 0;
}
开发者ID:AllenWeb,项目名称:linux,代码行数:27,代码来源:tegra_alc5632.c


示例7: tobermory_late_probe

static int tobermory_late_probe(struct snd_soc_card *card)
{
	struct snd_soc_codec *codec = card->rtd[0].codec;
	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
	int ret;

	ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,
				     32768, SND_SOC_CLOCK_IN);
	if (ret < 0)
		return ret;

	ret = snd_soc_jack_new(codec, "Headset",
			       SND_JACK_HEADSET | SND_JACK_BTN_0,
			       &tobermory_headset);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&tobermory_headset,
				    ARRAY_SIZE(tobermory_headset_pins),
				    tobermory_headset_pins);
	if (ret)
		return ret;

	wm8962_mic_detect(codec, &tobermory_headset);

	return 0;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:27,代码来源:tobermory.c


示例8: speyside_wm8996_init

static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_dai *dai = rtd->codec_dai;
	struct snd_soc_codec *codec = rtd->codec;
	int ret;

	ret = snd_soc_dai_set_sysclk(dai, WM8996_SYSCLK_MCLK2, 32768, 0);
	if (ret < 0)
		return ret;

	ret = gpio_request(WM8996_HPSEL_GPIO, "HP_SEL");
	if (ret != 0)
		pr_err("Failed to request HP_SEL GPIO: %d\n", ret);
	gpio_direction_output(WM8996_HPSEL_GPIO, speyside_jack_polarity);

	ret = snd_soc_jack_new(codec, "Headset",
			       SND_JACK_HEADSET | SND_JACK_BTN_0,
			       &speyside_headset);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&speyside_headset,
				    ARRAY_SIZE(speyside_headset_pins),
				    speyside_headset_pins);
	if (ret)
		return ret;

	wm8996_detect(codec, &speyside_headset, speyside_set_polarity);

	return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:31,代码来源:speyside.c


示例9: rt5631_codec_init

static int rt5631_codec_init(struct snd_soc_pcm_runtime *rtd)
{
    struct snd_soc_codec *codec = rtd->codec;
    //struct snd_soc_dai *codec_dai = rtd->codec_dai;
    struct snd_soc_dapm_context *dapm = &codec->dapm;
    int ret = 0;

    printk(KERN_DEBUG "enter %s rt5631_snd_pdata: %p\n", __func__, rt5631_snd_pdata);

    /* Add specific widgets */
    snd_soc_dapm_new_controls(dapm, rt5631_dapm_widgets,
                  ARRAY_SIZE(rt5631_dapm_widgets));
    /* Set up specific audio path interconnects */
    snd_soc_dapm_add_routes(dapm, rt5631_dapm_intercon, ARRAY_SIZE(rt5631_dapm_intercon));

    /* Setup spk/hp/mono output */
  //  rt5631_set_output(codec);

    /* Setuo mic input */
  //  rt5631_set_input(codec);

    /* not connected */
    snd_soc_dapm_nc_pin(dapm, "MONO");
    snd_soc_dapm_nc_pin(dapm, "AUXO2");

    snd_soc_dapm_nc_pin(dapm, "DMIC");
    snd_soc_dapm_nc_pin(dapm, "AXIL");
    snd_soc_dapm_nc_pin(dapm, "AXIR");

    /* always connected */
    snd_soc_dapm_enable_pin(dapm, "Ext Spk");
	snd_soc_dapm_enable_pin(dapm, "MAIN MIC");

    /* disable connected */
    snd_soc_dapm_disable_pin(dapm, "HP");

    snd_soc_dapm_sync(dapm);

#if HP_DET
    ret = snd_soc_jack_new(codec, "hp switch", SND_JACK_HEADPHONE, &rt5631_snd_priv->jack);
    if (ret) {
        printk(KERN_WARNING "Failed to alloc resource for hp switch\n");
    } else {
        ret = snd_soc_jack_add_pins(&rt5631_snd_priv->jack, ARRAY_SIZE(jack_pins), jack_pins);
        if (ret) {
            printk(KERN_WARNING "Failed to setup hp pins\n");
        }
    }
    rt5631_snd_priv->data= (void*)codec;

    init_timer(&rt5631_snd_priv->timer);
    rt5631_snd_priv->timer.function = rt5631_timer_func;
    rt5631_snd_priv->timer.data = (unsigned long)rt5631_snd_priv;

    INIT_WORK(&rt5631_snd_priv->work, rt5631_work_func);
    mutex_init(&rt5631_snd_priv->lock);
#endif

    return 0;
}
开发者ID:nspierbundel,项目名称:amlogic-common-3.0.8,代码行数:60,代码来源:aml_m6_rt5631.c


示例10: hx4700_ak4641_init

/*
 * Logic for a ak4641 as connected on a HP iPAQ hx4700
 */
static int hx4700_ak4641_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int err;

	/* NC codec pins */
	/* FIXME: is anything connected here? */
	snd_soc_dapm_nc_pin(dapm, "MOUT1");
	snd_soc_dapm_nc_pin(dapm, "MICEXT");
	snd_soc_dapm_nc_pin(dapm, "AUX");

	/* Jack detection API stuff */
	err = snd_soc_jack_new(codec, "Headphone Jack",
				SND_JACK_HEADPHONE, &hs_jack);
	if (err)
		return err;

	err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pin),
					hs_jack_pin);
	if (err)
		return err;

	err = snd_soc_jack_add_gpios(&hs_jack, 1, &hs_jack_gpio);

	return err;
}
开发者ID:3null,项目名称:linux,代码行数:30,代码来源:hx4700.c


示例11: palm27x_ac97_init

static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int err;

	/* not connected pins */
	snd_soc_dapm_nc_pin(dapm, "OUT3");
	snd_soc_dapm_nc_pin(dapm, "MONOOUT");
	snd_soc_dapm_nc_pin(dapm, "LINEINL");
	snd_soc_dapm_nc_pin(dapm, "LINEINR");
	snd_soc_dapm_nc_pin(dapm, "PCBEEP");
	snd_soc_dapm_nc_pin(dapm, "PHONE");
	snd_soc_dapm_nc_pin(dapm, "MIC2");

	/* Jack detection API stuff */
	err = snd_soc_jack_new(codec, "Headphone Jack",
				SND_JACK_HEADPHONE, &hs_jack);
	if (err)
		return err;

	err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
				hs_jack_pins);
	if (err)
		return err;

	err = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
				hs_jack_gpios);

	return err;
}
开发者ID:3null,项目名称:linux,代码行数:31,代码来源:palm27x.c


示例12: sdp4430_twl6040_init

static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	int ret;

	/* Add SDP4430 specific controls */
	ret = snd_soc_add_controls(codec, sdp4430_controls,
				ARRAY_SIZE(sdp4430_controls));
	if (ret)
		return ret;

	/* Add SDP4430 specific widgets */
	ret = snd_soc_dapm_new_controls(codec->dapm, sdp4430_twl6040_dapm_widgets,
				ARRAY_SIZE(sdp4430_twl6040_dapm_widgets));
	if (ret)
		return ret;

	/* Set up SDP4430 specific audio path audio_map */
	snd_soc_dapm_add_routes(codec->dapm, audio_map, ARRAY_SIZE(audio_map));

	/* SDP4430 connected pins */
	snd_soc_dapm_enable_pin(codec->dapm, "Ext Mic");
	snd_soc_dapm_enable_pin(codec->dapm, "Ext Spk");
	snd_soc_dapm_enable_pin(codec->dapm, "AFML");
	snd_soc_dapm_enable_pin(codec->dapm, "AFMR");
	snd_soc_dapm_disable_pin(codec->dapm, "Headset Mic");
	snd_soc_dapm_disable_pin(codec->dapm, "Headset Stereophone");

	/* allow audio paths from the audio modem to run during suspend */
	snd_soc_dapm_ignore_suspend(codec, "Ext Mic");
	snd_soc_dapm_ignore_suspend(codec, "Ext Spk");
	snd_soc_dapm_ignore_suspend(codec, "AFML");
	snd_soc_dapm_ignore_suspend(codec, "AFMR");
	snd_soc_dapm_ignore_suspend(codec, "Headset Mic");
	snd_soc_dapm_ignore_suspend(codec, "Headset Stereophone");

	ret = snd_soc_dapm_sync(codec->dapm);
	if (ret)
		return ret;

	/*Headset jack detection */
	ret = snd_soc_jack_new(codec, "Headset Jack",
				SND_JACK_HEADSET, &hs_jack);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
				hs_jack_pins);

	if (machine_is_omap_4430sdp())
		twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET);
	else
		snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET);

	/* wait 500 ms before switching of HS power */
	rtd->pmdown_time = 500;

	return ret;
}
开发者ID:mephistophilis,项目名称:samsung_nowplus_kernel,代码行数:59,代码来源:sdp4430.c


示例13: aml_m1_codec_init

static int aml_m1_codec_init(struct snd_soc_codec *codec)
{
    struct snd_soc_card *card = codec->socdev->card;

    int err;
    //Add board specific DAPM widgets and routes
    err = snd_soc_dapm_new_controls(codec, aml_m1_dapm_widgets, ARRAY_SIZE(aml_m1_dapm_widgets));
    if(err){
        dev_warn(card->dev, "Failed to register DAPM widgets\n");
        return 0;
    }

    err = snd_soc_dapm_add_routes(codec, intercon,
        ARRAY_SIZE(intercon));
    if(err){
        dev_warn(card->dev, "Failed to setup dapm widgets routine\n");
        return 0;
    }

#if HP_DET
    if ((soc_cs42l52_dai.ac97_pdata) && ((struct cs42l52_platform_data *) (soc_cs42l52_dai.ac97_pdata))->is_hp_pluged)
        hp_detect_flag = ((struct cs42l52_platform_data *) (soc_cs42l52_dai.ac97_pdata))->is_hp_pluged() ? (0) : (1);
    else
        hp_detect_flag = 1; // If is_hp_pluged function is not registered in bsp, set speaker as default.

    err = snd_soc_jack_new(card, "hp_switch",
        SND_JACK_HEADSET, &hp_jack);
    if(err){
        dev_warn(card->dev, "Failed to alloc resource for hook switch\n");
    }else{
        err = snd_soc_jack_add_pins(&hp_jack, ARRAY_SIZE(hp_jack_pins), hp_jack_pins);
        if(err){
            dev_warn(card->dev, "Failed to setup hook hp jack pin\n");
        }
    }

    // create a timer to poll the HP IN status
    spin_lock_init(&lock);
    timer.function = &cs42l52_hp_detect_timer;
    timer.data = (unsigned long)codec;
    timer.expires = jiffies + HZ*10;
    init_timer(&timer);
    INIT_WORK(&cs42l52_work.cs42l52_workqueue, cs42l52_hp_detect_queue);
#endif

    snd_soc_dapm_nc_pin(codec,"LINPUT1");
    snd_soc_dapm_nc_pin(codec,"RINPUT1");

    snd_soc_dapm_enable_pin(codec, "Ext Spk");
    snd_soc_dapm_disable_pin(codec, "HP");
    snd_soc_dapm_enable_pin(codec, "MIC IN");
    snd_soc_dapm_disable_pin(codec, "HP MIC");
    snd_soc_dapm_disable_pin(codec, "FM IN");

    snd_soc_dapm_sync(codec);

    return 0;
}
开发者ID:KaZoom,项目名称:buildroot-linux-kernel-m3,代码行数:58,代码来源:aml_m1_mid_cs42l52.c


示例14: sdp3430_twl4030_init

static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret;

	/* Add SDP3430 specific widgets */
	ret = snd_soc_dapm_new_controls(dapm, sdp3430_twl4030_dapm_widgets,
				ARRAY_SIZE(sdp3430_twl4030_dapm_widgets));
	if (ret)
		return ret;

	/* Set up SDP3430 specific audio path audio_map */
	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));

	/* SDP3430 connected pins */
	snd_soc_dapm_enable_pin(dapm, "Ext Mic");
	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
	snd_soc_dapm_disable_pin(dapm, "Headset Mic");
	snd_soc_dapm_disable_pin(dapm, "Headset Stereophone");

	/* TWL4030 not connected pins */
	snd_soc_dapm_nc_pin(dapm, "AUXL");
	snd_soc_dapm_nc_pin(dapm, "AUXR");
	snd_soc_dapm_nc_pin(dapm, "CARKITMIC");
	snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
	snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");

	snd_soc_dapm_nc_pin(dapm, "OUTL");
	snd_soc_dapm_nc_pin(dapm, "OUTR");
	snd_soc_dapm_nc_pin(dapm, "EARPIECE");
	snd_soc_dapm_nc_pin(dapm, "PREDRIVEL");
	snd_soc_dapm_nc_pin(dapm, "PREDRIVER");
	snd_soc_dapm_nc_pin(dapm, "CARKITL");
	snd_soc_dapm_nc_pin(dapm, "CARKITR");

	ret = snd_soc_dapm_sync(dapm);
	if (ret)
		return ret;

	/* Headset jack detection */
	ret = snd_soc_jack_new(codec, "Headset Jack",
				SND_JACK_HEADSET, &hs_jack);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
				hs_jack_pins);
	if (ret)
		return ret;

	ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
				hs_jack_gpios);

	return ret;
}
开发者ID:nos1609,项目名称:Chrono_Kernel-1,代码行数:56,代码来源:sdp3430.c


示例15: omap_twl4030_init

static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_card *card = codec->card;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	struct omap_tw4030_pdata *pdata = dev_get_platdata(card->dev);
	struct omap_twl4030 *priv = snd_soc_card_get_drvdata(card);
	int ret = 0;

	/* Headset jack detection only if it is supported */
	if (priv->jack_detect > 0) {
		hs_jack_gpios[0].gpio = priv->jack_detect;

		ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
				       &priv->hs_jack);
		if (ret)
			return ret;

		ret = snd_soc_jack_add_pins(&priv->hs_jack,
					    ARRAY_SIZE(hs_jack_pins),
					    hs_jack_pins);
		if (ret)
			return ret;

		ret = snd_soc_jack_add_gpios(&priv->hs_jack,
					     ARRAY_SIZE(hs_jack_gpios),
					     hs_jack_gpios);
		if (ret)
			return ret;
	}

	/*
	 * NULL pdata means we booted with DT. In this case the routing is
	 * provided and the card is fully routed, no need to mark pins.
	 */
	if (!pdata || !pdata->custom_routing)
		return ret;

	/* Disable not connected paths if not used */
	twl4030_disconnect_pin(dapm, pdata->has_ear, "Earpiece Spk");
	twl4030_disconnect_pin(dapm, pdata->has_hf, "Handsfree Spk");
	twl4030_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone");
	twl4030_disconnect_pin(dapm, pdata->has_predriv, "Ext Spk");
	twl4030_disconnect_pin(dapm, pdata->has_carkit, "Carkit Spk");

	twl4030_disconnect_pin(dapm, pdata->has_mainmic, "Main Mic");
	twl4030_disconnect_pin(dapm, pdata->has_submic, "Sub Mic");
	twl4030_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic");
	twl4030_disconnect_pin(dapm, pdata->has_carkitmic, "Carkit Mic");
	twl4030_disconnect_pin(dapm, pdata->has_digimic0, "Digital0 Mic");
	twl4030_disconnect_pin(dapm, pdata->has_digimic1, "Digital1 Mic");
	twl4030_disconnect_pin(dapm, pdata->has_linein, "Line In");

	return ret;
}
开发者ID:AiWinters,项目名称:linux,代码行数:55,代码来源:omap-twl4030.c


示例16: asoc_simple_card_dai_init

static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
{
    struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
    struct snd_soc_dai *codec = rtd->codec_dai;
    struct snd_soc_dai *cpu = rtd->cpu_dai;
    struct simple_dai_props *dai_props;
    int num, ret;

    num = rtd - rtd->card->rtd;
    dai_props = &priv->dai_props[num];
    ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai);
    if (ret < 0)
        return ret;

    ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai);
    if (ret < 0)
        return ret;

    if (gpio_is_valid(priv->gpio_hp_det)) {
        snd_soc_jack_new(codec->codec, "Headphones", SND_JACK_HEADPHONE,
                         &simple_card_hp_jack);
        snd_soc_jack_add_pins(&simple_card_hp_jack,
                              ARRAY_SIZE(simple_card_hp_jack_pins),
                              simple_card_hp_jack_pins);

        simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
        snd_soc_jack_add_gpios(&simple_card_hp_jack, 1,
                               &simple_card_hp_jack_gpio);
    }

    if (gpio_is_valid(priv->gpio_mic_det)) {
        snd_soc_jack_new(codec->codec, "Mic Jack", SND_JACK_MICROPHONE,
                         &simple_card_mic_jack);
        snd_soc_jack_add_pins(&simple_card_mic_jack,
                              ARRAY_SIZE(simple_card_mic_jack_pins),
                              simple_card_mic_jack_pins);
        simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
        snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
                               &simple_card_mic_jack_gpio);
    }
    return 0;
}
开发者ID:mikemvk,项目名称:linux-at91,代码行数:42,代码来源:simple-card.c


示例17: palm27x_ac97_init

static int palm27x_ac97_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	int err;

	/* add palm27x specific widgets */
	err = snd_soc_dapm_new_controls(codec, palm27x_dapm_widgets,
				ARRAY_SIZE(palm27x_dapm_widgets));
	if (err)
		return err;

	/* set up palm27x specific audio path audio_map */
	err = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
	if (err)
		return err;

	/* connected pins */
	if (machine_is_palmld())
		snd_soc_dapm_enable_pin(codec, "MIC1");
	snd_soc_dapm_enable_pin(codec, "HPOUTL");
	snd_soc_dapm_enable_pin(codec, "HPOUTR");
	snd_soc_dapm_enable_pin(codec, "LOUT2");
	snd_soc_dapm_enable_pin(codec, "ROUT2");

	/* not connected pins */
	snd_soc_dapm_nc_pin(codec, "OUT3");
	snd_soc_dapm_nc_pin(codec, "MONOOUT");
	snd_soc_dapm_nc_pin(codec, "LINEINL");
	snd_soc_dapm_nc_pin(codec, "LINEINR");
	snd_soc_dapm_nc_pin(codec, "PCBEEP");
	snd_soc_dapm_nc_pin(codec, "PHONE");
	snd_soc_dapm_nc_pin(codec, "MIC2");

	err = snd_soc_dapm_sync(codec);
	if (err)
		return err;

	/* Jack detection API stuff */
	err = snd_soc_jack_new(codec, "Headphone Jack",
				SND_JACK_HEADPHONE, &hs_jack);
	if (err)
		return err;

	err = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
				hs_jack_pins);
	if (err)
		return err;

	err = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
				hs_jack_gpios);

	return err;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:53,代码来源:palm27x.c


示例18: omap4_aic31xx_init

/*
 * omap4_aic31xx_init
 * This function is to initialize the machine Driver.
 */
static int omap4_aic31xx_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int ret = 0;
//	int gpiostatus;

	printk(KERN_INFO "entered the omap4_aic31xx_init function....\n");

	/* Add OMAP4 specific widgets */
	ret = snd_soc_dapm_new_controls(dapm, omap4_aic31xx_dapm_widgets,
					ARRAY_SIZE(omap4_aic31xx_dapm_widgets));
	if (ret) {
		printk(KERN_INFO "snd_soc_dapm_new_controls failed.\n");
		return ret;
	}
	DBG("snd_soc_dapm_new_controls passed..\n");

	/* Set up OMAP4 specific audio path audio_map */
	ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));

	if (ret != 0)
		printk(KERN_INFO "snd_soc_dapm_add_routes failed..%d\n", ret);

	ret = snd_soc_dapm_sync(dapm);
	if (ret != 0) {
		printk(KERN_INFO "snd_soc_dapm_sync failed... %d\n", ret);
		return ret;
	}

	/* Headset jack detection */
	ret = snd_soc_jack_new(codec, "Headset Jack",
			       SND_JACK_HEADSET, &hs_jack);
	if (ret != 0) {
		printk(KERN_INFO "snd_soc_jack_new failed...\n");
		return ret;
	}

	ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins),
				    hs_jack_pins);
	if (ret != 0) {
		printk(KERN_INFO "snd_soc_jack_add_pins failed... %d\n", ret);
		return ret;
	}

	ret = snd_soc_jack_add_gpios(&hs_jack, ARRAY_SIZE(hs_jack_gpios),
				     hs_jack_gpios);


	DBG("%s: Exiting\n", __func__);
	return ret;
}
开发者ID:LeaderRider,项目名称:kernel3NookTablet,代码行数:56,代码来源:omap4_panda_aic31xx.c


示例19: aml_asoc_init

static int aml_asoc_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_card *card = rtd->card;
    struct snd_soc_codec *codec = rtd->codec;
    //struct snd_soc_dai *codec_dai = rtd->codec_dai;
    struct snd_soc_dapm_context *dapm = &codec->dapm;
	struct aml_audio_private_data * p_aml_audio;
    int ret = 0;
	
    printk(KERN_DEBUG "enter %s \n", __func__);
	p_aml_audio = snd_soc_card_get_drvdata(card);

    /* Add specific widgets */
    snd_soc_dapm_new_controls(dapm, aml_asoc_dapm_widgets,
                  ARRAY_SIZE(aml_asoc_dapm_widgets));
    ret = snd_soc_jack_new(codec, "hp switch", SND_JACK_HEADPHONE, &p_aml_audio->jack);
    if (ret) {
        printk(KERN_WARNING "Failed to alloc resource for hp switch\n");
    } else {
        ret = snd_soc_jack_add_pins(&p_aml_audio->jack, ARRAY_SIZE(jack_pins), jack_pins);
        if (ret) {
            printk(KERN_WARNING "Failed to setup hp pins\n");
        }
    }
#if HP_IRQ	
	p_aml_audio->gpio_hp_det = of_get_named_gpio(card->dev->of_node,"rt5631_gpio",0);

	if (gpio_is_valid(p_aml_audio->gpio_hp_det)) {
		aml_audio_hp_jack_gpio.gpio = p_aml_audio->gpio_hp_det;
		snd_soc_jack_add_gpios(&p_aml_audio->jack,
						1, &aml_audio_hp_jack_gpio);
	}
#endif
#if HP_DET
    init_timer(&p_aml_audio->timer);
    p_aml_audio->timer.function = aml_asoc_timer_func;
    p_aml_audio->timer.data = (unsigned long)p_aml_audio;
    p_aml_audio->data= (void*)card;

    INIT_WORK(&p_aml_audio->work, aml_asoc_work_func);
    mutex_init(&p_aml_audio->lock);

    mutex_lock(&p_aml_audio->lock);
    if (!p_aml_audio->timer_en) {
        aml_audio_start_timer(p_aml_audio, msecs_to_jiffies(100));
    }
    mutex_unlock(&p_aml_audio->lock);

#endif

    return 0;
}
开发者ID:akuster,项目名称:linux-meson,代码行数:52,代码来源:aml_m6_rt5631.c


示例20: cx81801_receive

/* Line discipline .receive_buf() */
static void cx81801_receive(struct tty_struct *tty,
				const unsigned char *cp, char *fp, int count)
{
	struct snd_soc_codec *codec = tty->disc_data;
	const unsigned char *c;
	int apply, ret;

	if (!codec)
		return;

	if (!codec->hw_write) {
		/* First modem response, complete setup procedure */

		/* Initialize timer used for config pulse generation */
		setup_timer(&cx81801_timer, cx81801_timeout, 0);

		v253_ops.receive_buf(tty, cp, fp, count);

		/* Link hook switch to DAPM pins */
		ret = snd_soc_jack_add_pins(&ams_delta_hook_switch,
					ARRAY_SIZE(ams_delta_hook_switch_pins),
					ams_delta_hook_switch_pins);
		if (ret)
			dev_warn(codec->dev,
				"Failed to link hook switch to DAPM pins, "
				"will continue with hook switch unlinked.\n");

		return;
	}

	v253_ops.receive_buf(tty, cp, fp, count);

	for (c = &cp[count - 1]; c >= cp; c--) {
		if (*c != '\r')
			continue;
		/* Complete modem response received, apply config to codec */

		spin_lock_bh(&ams_delta_lock);
		mod_timer(&cx81801_timer, jiffies + msecs_to_jiffies(150));
		apply = !ams_delta_muted && !cx81801_cmd_pending;
		cx81801_cmd_pending = 1;
		spin_unlock_bh(&ams_delta_lock);

		/* Apply config pulse by connecting the codec to the modem
		 * if not already done */
		if (apply)
			ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
						AMS_DELTA_LATCH2_MODEM_CODEC);
		break;
	}
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:52,代码来源:ams-delta.c



注:本文中的snd_soc_jack_add_pins函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snd_soc_jack_new函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_soc_jack_add_gpios函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap