本文整理汇总了C++中snd_ctl_add函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_ctl_add函数的具体用法?C++ snd_ctl_add怎么用?C++ snd_ctl_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_ctl_add函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: msm_dai_q6_hdmi_dai_probe
static int msm_dai_q6_hdmi_dai_probe(struct snd_soc_dai *dai)
{
struct msm_dai_q6_hdmi_dai_data *dai_data;
const struct snd_kcontrol_new *kcontrol;
int rc = 0;
struct snd_soc_dapm_route intercon;
if (!dai) {
pr_err("%s: dai not found\n", __func__);
return -EINVAL;
}
dai_data = kzalloc(sizeof(struct msm_dai_q6_hdmi_dai_data),
GFP_KERNEL);
if (!dai_data) {
dev_err(dai->dev, "DAI-%d: fail to allocate dai data\n",
dai->id);
rc = -ENOMEM;
} else
dev_set_drvdata(dai->dev, dai_data);
kcontrol = &hdmi_config_controls[0];
rc = snd_ctl_add(dai->card->snd_card,
snd_ctl_new1(kcontrol, dai_data));
kcontrol = &hdmi_config_controls[1];
rc = snd_ctl_add(dai->card->snd_card,
snd_ctl_new1(kcontrol, dai_data));
memset(&intercon, 0 , sizeof(intercon));
if (!rc && dai && dai->driver) {
if (dai->driver->playback.stream_name &&
dai->driver->playback.aif_name) {
dev_dbg(dai->dev, "%s add route for widget %s",
__func__, dai->driver->playback.stream_name);
intercon.source = dai->driver->playback.aif_name;
intercon.sink = dai->driver->playback.stream_name;
dev_dbg(dai->dev, "%s src %s sink %s\n",
__func__, intercon.source, intercon.sink);
snd_soc_dapm_add_routes(&dai->dapm, &intercon, 1);
}
if (dai->driver->capture.stream_name &&
dai->driver->capture.aif_name) {
dev_dbg(dai->dev, "%s add route for widget %s",
__func__, dai->driver->capture.stream_name);
intercon.sink = dai->driver->capture.aif_name;
intercon.source = dai->driver->capture.stream_name;
dev_dbg(dai->dev, "%s src %s sink %s\n",
__func__, intercon.source, intercon.sink);
snd_soc_dapm_add_routes(&dai->dapm, &intercon, 1);
}
}
return rc;
}
开发者ID:Nothing-Dev,项目名称:android_kernel_huawei_hwY635,代码行数:56,代码来源:msm-dai-q6-hdmi-v2.c
示例2: snd_cs4236_mixer
int snd_cs4236_mixer(struct snd_wss *chip)
{
struct snd_card *card;
unsigned int idx, count;
int err;
struct snd_kcontrol_new *kcontrol;
if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card;
strcpy(card->mixername, snd_wss_chip_id(chip));
if (chip->hardware == WSS_HW_CS4235 ||
chip->hardware == WSS_HW_CS4239) {
for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0)
return err;
}
} else {
for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_controls); idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_controls[idx], chip))) < 0)
return err;
}
}
switch (chip->hardware) {
case WSS_HW_CS4235:
case WSS_HW_CS4239:
count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235);
kcontrol = snd_cs4236_3d_controls_cs4235;
break;
case WSS_HW_CS4237B:
count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237);
kcontrol = snd_cs4236_3d_controls_cs4237;
break;
case WSS_HW_CS4238B:
count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238);
kcontrol = snd_cs4236_3d_controls_cs4238;
break;
default:
count = 0;
kcontrol = NULL;
}
for (idx = 0; idx < count; idx++, kcontrol++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0)
return err;
}
if (chip->hardware == WSS_HW_CS4237B ||
chip->hardware == WSS_HW_CS4238B) {
for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0)
return err;
}
}
return 0;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:55,代码来源:cs4236_lib.c
示例3: snd_ak4641_add_mixer_controls
int snd_ak4641_add_mixer_controls(struct snd_ak4641 *ak, struct snd_card *card)
{
snd_ak4641_lock(ak);
snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_playback_volume, ak));
snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_playback_switch, ak));
snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_mic_gain, ak));
snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_mic_boost, ak));
snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_mono_out, ak));
snd_ak4641_unlock(ak);
return 0;
}
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:11,代码来源:htcuniversal_ak4641.c
示例4: xonar_d1_mixer_init
static int xonar_d1_mixer_init(struct oxygen *chip)
{
int err;
err = snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip));
if (err < 0)
return err;
err = snd_ctl_add(chip->card, snd_ctl_new1(&rolloff_control, chip));
if (err < 0)
return err;
return 0;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:12,代码来源:xonar_cs43xx.c
示例5: codec_soc_probe
static int codec_soc_probe(struct platform_device *pdev)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
struct snd_soc_codec *codec;
int ret = 0;
socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
if (!socdev->card->codec)
return -ENOMEM;
codec = socdev->card->codec;
mutex_init(&codec->mutex);
codec->name = "tegra-generic-codec";
codec->owner = THIS_MODULE;
codec->dai = &tegra_generic_codec_dai;
codec->num_dai = 1;
codec->write = NULL;
codec->read = NULL;
INIT_LIST_HEAD(&codec->dapm_widgets);
INIT_LIST_HEAD(&codec->dapm_paths);
/* Register PCMs. */
ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
if (ret < 0) {
printk(KERN_ERR "codec: failed to create pcms\n");
goto pcm_err;
}
/* Register Card. */
ret = snd_soc_init_card(socdev);
if (ret < 0) {
printk(KERN_ERR "codec: failed to register card\n");
goto card_err;
}
/* Add volume control */
ret = snd_ctl_add(codec->card,
snd_ctl_new1(&tegra_codec_ctrl_volume, codec));
if (ret < 0) {
printk(KERN_ERR "codec: failed to add control\n");
goto card_err;
}
/* Add route control */
return snd_ctl_add(codec->card,
snd_ctl_new1(&tegra_codec_ctrl_route, codec));
card_err:
snd_soc_free_pcms(socdev);
pcm_err:
kfree(socdev->card->codec);
return ret;
}
开发者ID:Atrix-Dev-Team,项目名称:kernel-MB860,代码行数:51,代码来源:tegra_codec_rpc.c
示例6: add_aicamixer_controls
static int add_aicamixer_controls(struct snd_card_aica *dreamcastcard)
{
int err;
err = snd_ctl_add
(dreamcastcard->card,
snd_ctl_new1(&snd_aica_pcmvolume_control, dreamcastcard));
if (unlikely(err < 0))
return err;
err = snd_ctl_add
(dreamcastcard->card,
snd_ctl_new1(&snd_aica_pcmswitch_control, dreamcastcard));
if (unlikely(err < 0))
return err;
return 0;
}
开发者ID:AK101111,项目名称:linux,代码行数:15,代码来源:aica.c
示例7: pavo_jzcodec_init
/*
* Pavo for a jzcodec as connected on jz4740 Device
*/
static int pavo_jzcodec_init(struct snd_soc_codec *codec)
{
int i, err;
snd_soc_dapm_set_endpoint(codec, "LLINEIN", 0);
snd_soc_dapm_set_endpoint(codec, "RLINEIN", 0);
/* Add pavo specific controls */
for (i = 0; i < ARRAY_SIZE(jzcodec_pavo_controls); i++) {
err = snd_ctl_add(codec->card,
snd_soc_cnew(&jzcodec_pavo_controls[i],codec, NULL));
if (err < 0)
return err;
}
/* Add pavo specific widgets */
for(i = 0; i < ARRAY_SIZE(jzcodec_dapm_widgets); i++) {
snd_soc_dapm_new_control(codec, &jzcodec_dapm_widgets[i]);
}
/* Set up pavo specific audio path audio_map */
for(i = 0; audio_map[i][0] != NULL; i++) {
snd_soc_dapm_connect_input(codec, audio_map[i][0],
audio_map[i][1], audio_map[i][2]);
}
snd_soc_dapm_sync_endpoints(codec);
return 0;
}
开发者ID:heroistired,项目名称:jzcode-x11,代码行数:32,代码来源:pavo.c
示例8: snd_ak4114_build
int snd_ak4114_build(ak4114_t *ak4114,
snd_pcm_substream_t *ply_substream,
snd_pcm_substream_t *cap_substream)
{
snd_kcontrol_t *kctl;
unsigned int idx;
int err;
snd_assert(cap_substream, return -EINVAL);
ak4114->playback_substream = ply_substream;
ak4114->capture_substream = cap_substream;
for (idx = 0; idx < AK4114_CONTROLS; idx++) {
kctl = snd_ctl_new1(&snd_ak4114_iec958_controls[idx], ak4114);
if (kctl == NULL)
return -ENOMEM;
if (!strstr(kctl->id.name, "Playback")) {
if (ply_substream == NULL) {
snd_ctl_free_one(kctl);
ak4114->kctls[idx] = NULL;
continue;
}
kctl->id.device = ply_substream->pcm->device;
kctl->id.subdevice = ply_substream->number;
} else {
kctl->id.device = cap_substream->pcm->device;
kctl->id.subdevice = cap_substream->number;
}
err = snd_ctl_add(ak4114->card, kctl);
if (err < 0)
return err;
ak4114->kctls[idx] = kctl;
}
return 0;
}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:34,代码来源:ak4114.c
示例9: s6105_aic3x_init
/* Logic for a aic3x as connected on the s6105 ip camera ref design */
static int s6105_aic3x_init(struct snd_soc_codec *codec)
{
/* Add s6105 specific widgets */
snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets,
ARRAY_SIZE(aic3x_dapm_widgets));
/* Set up s6105 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
/* not present */
snd_soc_dapm_nc_pin(codec, "MONO_LOUT");
snd_soc_dapm_nc_pin(codec, "LINE2L");
snd_soc_dapm_nc_pin(codec, "LINE2R");
/* not connected */
snd_soc_dapm_nc_pin(codec, "MIC3L"); /* LINE2L on this chip */
snd_soc_dapm_nc_pin(codec, "MIC3R"); /* LINE2R on this chip */
snd_soc_dapm_nc_pin(codec, "LLOUT");
snd_soc_dapm_nc_pin(codec, "RLOUT");
snd_soc_dapm_nc_pin(codec, "HPRCOM");
/* always connected */
snd_soc_dapm_enable_pin(codec, "Audio In");
/* must correspond to audio_out_mux.private_value initializer */
snd_soc_dapm_disable_pin(codec, "Audio Out Differential");
snd_soc_dapm_sync(codec);
snd_soc_dapm_enable_pin(codec, "Audio Out Stereo");
snd_soc_dapm_sync(codec);
snd_ctl_add(codec->card, snd_ctl_new1(&audio_out_mux, codec));
return 0;
}
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:36,代码来源:s6105-ipcam.c
示例10: snd_intelmad_mixer
/**
* snd_intelmad_mixer- to setup mixer settings of the card
*
* @intelmaddata: pointer to internal context
*
* This function is called from probe function to set up mixer controls
*/
static int __devinit snd_intelmad_mixer(struct snd_intelmad *intelmaddata)
{
struct snd_card *card;
unsigned int idx;
int ret_val = 0, max_controls = 0;
char *mixername = "IntelMAD Controls";
struct snd_kcontrol_new *controls;
WARN_ON(!intelmaddata);
card = intelmaddata->card;
strncpy(card->mixername, mixername, sizeof(card->mixername)-1);
/* add all widget controls and expose the same */
if (intelmaddata->cpu_id == CPU_CHIP_PENWELL) {
max_controls = MAX_CTRL_MFLD;
controls = snd_intelmad_controls_mfld;
} else {
max_controls = MAX_CTRL_MRST;
controls = snd_intelmad_controls_mrst;
}
for (idx = 0; idx < max_controls; idx++) {
ret_val = snd_ctl_add(card,
snd_ctl_new1(&controls[idx],
intelmaddata));
pr_debug("mixer[idx]=%d added\n", idx);
if (ret_val) {
pr_err("in adding of control index = %d\n", idx);
break;
}
}
return ret_val;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:39,代码来源:intelmid.c
示例11: n810_aic33_init
static int n810_aic33_init(struct snd_soc_codec *codec)
{
int i, err;
/* Not connected */
snd_soc_dapm_disable_pin(codec, "MONO_LOUT");
snd_soc_dapm_disable_pin(codec, "HPLCOM");
snd_soc_dapm_disable_pin(codec, "HPRCOM");
/* Add N810 specific controls */
for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) {
err = snd_ctl_add(codec->card,
snd_soc_cnew(&aic33_n810_controls[i], codec, NULL));
if (err < 0)
return err;
}
/* Add N810 specific widgets */
snd_soc_dapm_new_controls(codec, aic33_dapm_widgets,
ARRAY_SIZE(aic33_dapm_widgets));
/* Set up N810 specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec);
return 0;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:28,代码来源:n810.c
示例12: snd_ak4113_build
int snd_ak4113_build(struct ak4113 *ak4113,
struct snd_pcm_substream *cap_substream)
{
struct snd_kcontrol *kctl;
unsigned int idx;
int err;
if (snd_BUG_ON(!cap_substream))
return -EINVAL;
ak4113->substream = cap_substream;
for (idx = 0; idx < AK4113_CONTROLS; idx++) {
kctl = snd_ctl_new1(&snd_ak4113_iec958_controls[idx], ak4113);
if (kctl == NULL)
return -ENOMEM;
kctl->id.device = cap_substream->pcm->device;
kctl->id.subdevice = cap_substream->number;
err = snd_ctl_add(ak4113->card, kctl);
if (err < 0)
return err;
ak4113->kctls[idx] = kctl;
}
snd_ak4113_proc_init(ak4113);
/* trigger workq */
schedule_delayed_work(&ak4113->work, HZ / 10);
return 0;
}
开发者ID:jerem,项目名称:hi35xx-buildroot,代码行数:26,代码来源:ak4113.c
示例13: spitz_wm8750_init
/*
* Logic for a wm8750 as connected on a Sharp SL-Cxx00 Device
*/
static int spitz_wm8750_init(struct snd_soc_codec *codec)
{
int i, err;
/* NC codec pins */
snd_soc_dapm_set_endpoint(codec, "RINPUT1", 0);
snd_soc_dapm_set_endpoint(codec, "LINPUT2", 0);
snd_soc_dapm_set_endpoint(codec, "RINPUT2", 0);
snd_soc_dapm_set_endpoint(codec, "LINPUT3", 0);
snd_soc_dapm_set_endpoint(codec, "RINPUT3", 0);
snd_soc_dapm_set_endpoint(codec, "OUT3", 0);
snd_soc_dapm_set_endpoint(codec, "MONO", 0);
/* Add spitz specific controls */
for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) {
err = snd_ctl_add(codec->card,
snd_soc_cnew(&wm8750_spitz_controls[i], codec, NULL));
if (err < 0)
return err;
}
/* Add spitz specific widgets */
for (i = 0; i < ARRAY_SIZE(wm8750_dapm_widgets); i++)
snd_soc_dapm_new_control(codec, &wm8750_dapm_widgets[i]);
/* Set up spitz specific audio path audio_map */
for (i = 0; audio_map[i][0] != NULL; i++)
snd_soc_dapm_connect_input(codec, audio_map[i][0],
audio_map[i][1], audio_map[i][2]);
snd_soc_dapm_sync_endpoints(codec);
return 0;
}
开发者ID:274914765,项目名称:C,代码行数:36,代码来源:spitz.c
示例14: smdk_wm8580_init
/*
* This is an example machine initialisation for a wm8580 connected to a
* smdk2450. It is missing logic to detect hp/mic insertions and logic
* to re-route the audio in such an event.
*/
static int smdk_wm8580_init(struct snd_soc_codec *codec)
{
int i, err;
/* set endpoints to default mode */
set_scenario_endpoints(codec, SMDK_AUDIO_OFF);
/* Add smdk2450 specific widgets */
for (i = 0; i < ARRAY_SIZE(wm8580_dapm_widgets); i++)
snd_soc_dapm_new_control(codec, &wm8580_dapm_widgets[i]);
/* add smdk2450 specific controls */
for (i = 0; i < ARRAY_SIZE(wm8580_smdk_controls); i++) {
err = snd_ctl_add(codec->card,
snd_soc_cnew(&wm8580_smdk_controls[i],
codec, NULL));
if (err < 0)
return err;
}
/* set up smdk2450 specific audio path audio_mapnects */
for (i = 0; audio_map[i][0] != NULL; i++) {
snd_soc_dapm_connect_input(codec, audio_map[i][0],
audio_map[i][1], audio_map[i][2]);
}
/* always connected */
snd_soc_dapm_set_endpoint(codec, "Mic1 Jack", 1);
snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1);
snd_soc_dapm_set_endpoint(codec, "Line In Jack", 1);
snd_soc_dapm_sync_endpoints(codec);
return 0;
}
开发者ID:maliyu,项目名称:SOM2416,代码行数:39,代码来源:smdk2450_wm8580.c
示例15: snd_cs8427_iec958_build
int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
struct snd_pcm_substream *play_substream,
struct snd_pcm_substream *cap_substream)
{
struct cs8427 *chip = cs8427->private_data;
struct snd_kcontrol *kctl;
unsigned int idx;
int err;
if (snd_BUG_ON(!play_substream || !cap_substream))
return -EINVAL;
for (idx = 0; idx < ARRAY_SIZE(snd_cs8427_iec958_controls); idx++) {
kctl = snd_ctl_new1(&snd_cs8427_iec958_controls[idx], cs8427);
if (kctl == NULL)
return -ENOMEM;
kctl->id.device = play_substream->pcm->device;
kctl->id.subdevice = play_substream->number;
err = snd_ctl_add(cs8427->bus->card, kctl);
if (err < 0)
return err;
if (! strcmp(kctl->id.name,
SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM)))
chip->playback.pcm_ctl = kctl;
}
chip->playback.substream = play_substream;
chip->capture.substream = cap_substream;
if (snd_BUG_ON(!chip->playback.pcm_ctl))
return -EIO;
return 0;
}
开发者ID:nos1609,项目名称:Chrono_Kernel-1,代码行数:31,代码来源:cs8427.c
示例16: imx_3stack_wm8350_init
static int imx_3stack_wm8350_init(struct snd_soc_codec *codec)
{
struct imx_3stack_priv *priv = &machine_priv;
struct wm8350 *wm8350 = priv->wm8350;
int i, ret;
codec->control_data = wm8350;
/* Add imx_3stack specific controls */
for (i = 0; i < ARRAY_SIZE(wm8350_machine_controls); i++) {
ret = snd_ctl_add(codec->card,
snd_soc_cnew(&wm8350_machine_controls[i],
codec, NULL));
if (ret < 0)
return ret;
}
/* Add imx_3stack specific widgets */
snd_soc_dapm_new_controls(codec, imx_3stack_dapm_widgets,
ARRAY_SIZE(imx_3stack_dapm_widgets));
/* Set up imx_3stack specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec);
return 0;
}
开发者ID:YCsuperlife,项目名称:imx53_kernel,代码行数:29,代码来源:imx-3stack-wm8350.c
示例17: spitz_wm8750_init
/*
* Logic for a wm8750 as connected on a Sharp SL-Cxx00 Device
*/
static int spitz_wm8750_init(struct snd_soc_codec *codec)
{
int i, err;
/* NC codec pins */
snd_soc_dapm_disable_pin(codec, "RINPUT1");
snd_soc_dapm_disable_pin(codec, "LINPUT2");
snd_soc_dapm_disable_pin(codec, "RINPUT2");
snd_soc_dapm_disable_pin(codec, "LINPUT3");
snd_soc_dapm_disable_pin(codec, "RINPUT3");
snd_soc_dapm_disable_pin(codec, "OUT3");
snd_soc_dapm_disable_pin(codec, "MONO");
/* Add spitz specific controls */
for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) {
err = snd_ctl_add(codec->card,
snd_soc_cnew(&wm8750_spitz_controls[i], codec, NULL));
if (err < 0)
return err;
}
/* Add spitz specific widgets */
snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets,
ARRAY_SIZE(wm8750_dapm_widgets));
/* Set up spitz specific audio paths */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec);
return 0;
}
开发者ID:maraz,项目名称:linux-2.6,代码行数:34,代码来源:spitz.c
示例18: tosa_ac97_init
static int tosa_ac97_init(struct snd_soc_codec *codec)
{
int i, err;
snd_soc_dapm_disable_pin(codec, "OUT3");
snd_soc_dapm_disable_pin(codec, "MONOOUT");
/* add tosa specific controls */
for (i = 0; i < ARRAY_SIZE(tosa_controls); i++) {
err = snd_ctl_add(codec->card,
snd_soc_cnew(&tosa_controls[i],codec, NULL));
if (err < 0)
return err;
}
/* add tosa specific widgets */
snd_soc_dapm_new_controls(codec, tosa_dapm_widgets,
ARRAY_SIZE(tosa_dapm_widgets));
/* set up tosa specific audio path audio_map */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec);
return 0;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:25,代码来源:tosa.c
示例19: usb6fire_control_init
int __devinit usb6fire_control_init(struct sfire_chip *chip)
{
int i;
int ret;
struct control_runtime *rt = kzalloc(sizeof(struct control_runtime),
GFP_KERNEL);
struct comm_runtime *comm_rt = chip->comm;
if (!rt)
return -ENOMEM;
rt->chip = chip;
rt->update_streaming = usb6fire_control_streaming_update;
rt->set_rate = usb6fire_control_set_rate;
rt->set_channels = usb6fire_control_set_channels;
i = 0;
while (init_data[i].type) {
comm_rt->write8(comm_rt, init_data[i].type, init_data[i].reg,
init_data[i].value);
i++;
}
usb6fire_control_opt_coax_update(rt);
usb6fire_control_line_phono_update(rt);
usb6fire_control_output_vol_update(rt);
usb6fire_control_output_mute_update(rt);
usb6fire_control_input_vol_update(rt);
usb6fire_control_streaming_update(rt);
ret = usb6fire_control_add_virtual(rt, chip->card,
"Master Playback Volume", vol_elements);
if (ret) {
snd_printk(KERN_ERR PREFIX "cannot add control.\n");
kfree(rt);
return ret;
}
ret = usb6fire_control_add_virtual(rt, chip->card,
"Master Playback Switch", mute_elements);
if (ret) {
snd_printk(KERN_ERR PREFIX "cannot add control.\n");
kfree(rt);
return ret;
}
i = 0;
while (elements[i].name) {
ret = snd_ctl_add(chip->card, snd_ctl_new1(&elements[i], rt));
if (ret < 0) {
kfree(rt);
snd_printk(KERN_ERR PREFIX "cannot add control.\n");
return ret;
}
i++;
}
chip->control = rt;
return 0;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:59,代码来源:control.c
示例20: create_src_gain_mixer
static int create_src_gain_mixer(struct lola *chip,
int num, int ofs, char *name)
{
lola_src_gain_mixer.name = name;
lola_src_gain_mixer.private_value = ofs + (num << 8);
return snd_ctl_add(chip->card,
snd_ctl_new1(&lola_src_gain_mixer, chip));
}
开发者ID:3null,项目名称:linux,代码行数:8,代码来源:lola_mixer.c
注:本文中的snd_ctl_add函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论