当前位置: 首页>>代码示例>>C++>>正文


C++ snd_soc_jack_add_gpios函数代码示例

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


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

示例1: tegra_max98090_asoc_init

static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)
{
	struct tegra_max98090 *machine = snd_soc_card_get_drvdata(rtd->card);

	if (gpio_is_valid(machine->gpio_hp_det)) {
		snd_soc_card_jack_new(rtd->card, "Headphones",
				      SND_JACK_HEADPHONE,
				      &tegra_max98090_hp_jack,
				      tegra_max98090_hp_jack_pins,
				      ARRAY_SIZE(tegra_max98090_hp_jack_pins));

		tegra_max98090_hp_jack_gpio.gpio = machine->gpio_hp_det;
		snd_soc_jack_add_gpios(&tegra_max98090_hp_jack,
					1,
					&tegra_max98090_hp_jack_gpio);
	}

	if (gpio_is_valid(machine->gpio_mic_det)) {
		snd_soc_card_jack_new(rtd->card, "Mic Jack",
				      SND_JACK_MICROPHONE,
				      &tegra_max98090_mic_jack,
				      tegra_max98090_mic_jack_pins,
				      ARRAY_SIZE(tegra_max98090_mic_jack_pins));

		tegra_max98090_mic_jack_gpio.gpio = machine->gpio_mic_det;
		snd_soc_jack_add_gpios(&tegra_max98090_mic_jack,
				       1,
				       &tegra_max98090_mic_jack_gpio);
	}

	return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:32,代码来源:tegra_max98090.c

示例2: tegra_rt5677_asoc_init

static int tegra_rt5677_asoc_init(struct snd_soc_pcm_runtime *rtd)
{
	struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(rtd->card);

	snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
			      &tegra_rt5677_hp_jack,
			      &tegra_rt5677_hp_jack_pins, 1);

	if (gpio_is_valid(machine->gpio_hp_det)) {
		tegra_rt5677_hp_jack_gpio.gpio = machine->gpio_hp_det;
		snd_soc_jack_add_gpios(&tegra_rt5677_hp_jack, 1,
				&tegra_rt5677_hp_jack_gpio);
	}


	snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE,
			      &tegra_rt5677_mic_jack,
			      &tegra_rt5677_mic_jack_pins, 1);

	if (gpio_is_valid(machine->gpio_mic_present)) {
		tegra_rt5677_mic_jack_gpio.gpio = machine->gpio_mic_present;
		snd_soc_jack_add_gpios(&tegra_rt5677_mic_jack, 1,
				&tegra_rt5677_mic_jack_gpio);
	}

	snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "MICBIAS1");

	return 0;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:29,代码来源:tegra_rt5677.c

示例3: 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

示例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: alc5623_dai_init

static int alc5623_dai_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_codec *codec = rtd->codec;
	struct snd_soc_jack_gpio *jack = &jack_gpio;
	int ret;

	pr_debug("%s: %s\n", __func__, jack->name);

	alc5623 = codec;

	if (NULL == jack->name)
		return 0;

#if defined(CONFIG_PLAT_S5P4418_NBOX)
	/***************************************/
	// [email protected], 20140609 Testing
	/***************************************/
	ret = switch_dev_register(&switch_nxl_jack_detection);
	if (ret < 0) {
		printk("%s : Failed to register switch device\n", __func__);
	}
	//wake_lock_init(&detect_jack_wake_lock, WAKE_LOCK_SUSPEND, "nxl_jack_detect");
#endif

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

	ret = snd_soc_jack_add_gpios(&hp_jack, 1, jack);
	printk("%s: %s register audio jack detect, %d\n", ret?"Fail":"Done", __func__, jack->gpio);

	return 0;
}
开发者ID:iTOP4418,项目名称:kernel-3.4.39,代码行数:33,代码来源:nxp-rt5623.c

示例7: smartq_wm8987_init

static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd)
{
	struct snd_soc_dapm_context *dapm = &rtd->card->dapm;
	int err = 0;

	/* set endpoints to not connected */
	snd_soc_dapm_nc_pin(dapm, "LINPUT1");
	snd_soc_dapm_nc_pin(dapm, "RINPUT1");
	snd_soc_dapm_nc_pin(dapm, "OUT3");
	snd_soc_dapm_nc_pin(dapm, "ROUT1");

	/* Headphone jack detection */
	err = snd_soc_card_jack_new(rtd->card, "Headphone Jack",
				    SND_JACK_HEADPHONE, &smartq_jack,
				    smartq_jack_pins,
				    ARRAY_SIZE(smartq_jack_pins));
	if (err)
		return err;

	err = snd_soc_jack_add_gpios(&smartq_jack,
				     ARRAY_SIZE(smartq_jack_gpios),
				     smartq_jack_gpios);

	return err;
}
开发者ID:Chong-Li,项目名称:cse522,代码行数:25,代码来源:smartq_wm8987.c

示例8: 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_card *card = rtd->card;
	struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);

	if (gpio_is_valid(machine->gpio_hp_det)) {
		tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det;
		snd_soc_card_jack_new(rtd->card, "Headphone Jack",
				      SND_JACK_HEADPHONE, &tegra_wm8903_hp_jack,
				      tegra_wm8903_hp_jack_pins,
				      ARRAY_SIZE(tegra_wm8903_hp_jack_pins));
		snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack,
					1,
					&tegra_wm8903_hp_jack_gpio);
	}

	snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE,
			      &tegra_wm8903_mic_jack,
			      tegra_wm8903_mic_jack_pins,
			      ARRAY_SIZE(tegra_wm8903_mic_jack_pins));
	wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE,
				0);

	snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS");

	return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:29,代码来源:tegra_wm8903.c

示例9: 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

示例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: 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

示例12: tegra_wired_jack_probe

/* platform driver */
static int tegra_wired_jack_probe(struct platform_device *pdev)
{
	int ret;
	int hp_det_n;
	struct tegra_wired_jack_conf *pdata;

	pdata = (struct tegra_wired_jack_conf *)pdev->dev.platform_data;
	if (!pdata || !pdata->hp_det_n) {
		pr_err("Please set up gpio pins for jack.\n");
		return -EBUSY;
	}

	hp_det_n = pdata->hp_det_n;
	hs_jack_gpios[HEAD_DET_GPIO].gpio = hp_det_n;

	ret = snd_soc_jack_add_gpios(tegra_wired_jack,
				     ARRAY_SIZE(hs_jack_gpios),
				     hs_jack_gpios);
	if (ret) {
		pr_err("Could NOT set up gpio pins for jack.\n");
		snd_soc_jack_free_gpios(tegra_wired_jack,
					ARRAY_SIZE(hs_jack_gpios),
					hs_jack_gpios);
		return ret;
	}

	return 0;
}
开发者ID:ahadjaman,项目名称:lge-kernel-startablet-ICS,代码行数:29,代码来源:tegra_wired_jack.c

示例13: 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_card_jack_new(rtd->card, "Headphones",
				      SND_JACK_HEADPHONE,
				      &simple_card_hp_jack,
				      simple_card_hp_jack_pins,
				      ARRAY_SIZE(simple_card_hp_jack_pins));

		simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
		simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
		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_card_jack_new(rtd->card, "Mic Jack",
				      SND_JACK_MICROPHONE,
				      &simple_card_mic_jack,
				      simple_card_mic_jack_pins,
				      ARRAY_SIZE(simple_card_mic_jack_pins));
		simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
		simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
		snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
				       &simple_card_mic_jack_gpio);
	}
	return 0;
}
开发者ID:robixnai,项目名称:linux,代码行数:44,代码来源:simple-card.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: h1940_uda1380_init

static int h1940_uda1380_init(struct snd_soc_pcm_runtime *rtd)
{
	snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
		&hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins));

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

	return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:10,代码来源:h1940_uda1380.c


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