static int rockchip_wm8900_audio_probe(struct platform_device *pdev) { int ret; struct snd_soc_card *card = &rockchip_wm8900_snd_card; card->dev = &pdev->dev; ret = rockchip_of_get_sound_card_info(card); if (ret) { printk("%s() get sound card info failed:%d\n", __FUNCTION__, ret); return ret; } ret = snd_soc_register_card(card); if (ret) printk("%s() register card failed:%d\n", __FUNCTION__, ret); return ret; }
/* * After SMDKC110 Base Board's Rev is '0.1', 12MHz External OSC(X1) * is absent (or not connected), so we connect EXT_VOICE_CLK(OSC4), * 2.0484Mhz, directly with MCLK both Codec and SoC. */ static int __devinit snd_smdk_probe(struct platform_device *pdev) { int ret = 0; xtal_freq = SMDK_WM8580_EXT_OSC; mclk_freq = SMDK_WM8580_EXT_MCLK; if (machine_is_smdkc110() || machine_is_smdkv210()) xtal_freq = mclk_freq = SMDK_WM8580_EXT_VOICE; smdk_pcm.dev = &pdev->dev; ret = snd_soc_register_card(&smdk_pcm); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret); return ret; } return 0; }
static int asoc_simple_card_probe(struct platform_device *pdev) { struct asoc_simple_card_info *cinfo = pdev->dev.platform_data; struct device *dev = &pdev->dev; if (!cinfo) { dev_err(dev, "no info for asoc-simple-card\n"); return -EINVAL; } if (!cinfo->name || !cinfo->card || !cinfo->codec || !cinfo->platform || !cinfo->cpu_dai.name || !cinfo->codec_dai.name) { dev_err(dev, "insufficient asoc_simple_card_info settings\n"); return -EINVAL; } /* * init snd_soc_dai_link */ cinfo->snd_link.name = cinfo->name; cinfo->snd_link.stream_name = cinfo->name; cinfo->snd_link.cpu_dai_name = cinfo->cpu_dai.name; cinfo->snd_link.platform_name = cinfo->platform; cinfo->snd_link.codec_name = cinfo->codec; cinfo->snd_link.codec_dai_name = cinfo->codec_dai.name; cinfo->snd_link.init = asoc_simple_card_dai_init; /* * init snd_soc_card */ cinfo->snd_card.name = cinfo->card; cinfo->snd_card.owner = THIS_MODULE; cinfo->snd_card.dai_link = &cinfo->snd_link; cinfo->snd_card.num_links = 1; cinfo->snd_card.dev = &pdev->dev; return snd_soc_register_card(&cinfo->snd_card); }
static int __devinit snappercl15_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_snappercl15; int ret; ret = ep93xx_i2s_acquire(); if (ret) return ret; card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ep93xx_i2s_release(); } return ret; }
static int e750_probe(struct platform_device *pdev) { struct snd_soc_card *card = &e750; int ret; ret = gpio_request_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); if (ret) return ret; card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); } return ret; }
static int hx4700_audio_probe(struct platform_device *pdev) { int ret; if (!machine_is_h4700()) return -ENODEV; ret = gpio_request_array(hx4700_audio_gpios, ARRAY_SIZE(hx4700_audio_gpios)); if (ret) return ret; snd_soc_card_hx4700.dev = &pdev->dev; ret = snd_soc_register_card(&snd_soc_card_hx4700); if (ret) gpio_free_array(hx4700_audio_gpios, ARRAY_SIZE(hx4700_audio_gpios)); return ret; }
static int __devinit emei_dkb_probe(struct platform_device *pdev) { struct snd_soc_card *card = &emei_dkb_card; int ret; card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); return ret; } #ifdef CONFIG_PROC_FS create_ssp_master_proc_file(); create_gssp_master_proc_file(); #endif return ret; }
static int __devinit zed_adau1761_probe(struct platform_device *pdev) { struct snd_soc_card *card = &zed_adau1761_card; struct device_node *of_node = pdev->dev.of_node; if (!of_node) return -ENXIO; card->dev = &pdev->dev; zed_adau1761_dai_link.codec_of_node = of_parse_phandle(of_node, "audio-codec", 0); zed_adau1761_dai_link.cpu_dai_of_node = of_parse_phandle(of_node, "cpu-dai", 0); zed_adau1761_dai_link.platform_of_node = of_parse_phandle(of_node, "pcm", 0); if (!zed_adau1761_dai_link.codec_of_node || !zed_adau1761_dai_link.cpu_dai_of_node || !zed_adau1761_dai_link.platform_of_node) return -ENXIO; return snd_soc_register_card(card); }
static __devinit int dfl61wl1273_probe(struct platform_device *pdev) { int err; struct snd_soc_card *card = &dfl61wl1273_sound_card; if (!machine_is_nokia_rm680() && !machine_is_nokia_rm696()) return -ENODEV; printk(KERN_INFO "ALSA for WL1273 on Nokia DFL61 init\n"); card->dev = &pdev->dev; err = snd_soc_register_card(card); if (err) { printk(KERN_ERR "Error: %d\n", err); return err; } printk(KERN_INFO "DFL61 WL1273 init done\n"); return 0; }
static int __devinit simone_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_simone; int ret; simone_snd_ac97_device = platform_device_register_simple("ac97-codec", -1, NULL, 0); if (IS_ERR(simone_snd_ac97_device)) return PTR_ERR(simone_snd_ac97_device); card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); platform_device_unregister(simone_snd_ac97_device); } return ret; }
static int __devinit poodle_probe(struct platform_device *pdev) { struct snd_soc_card *card = &poodle; int ret; locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_AMP_ON, 0); /* */ locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_MUTE_L, 0); locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_MUTE_R, 0); card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); return ret; }
static int __devinit sunxi_snddaudio0_dev_probe(struct platform_device *pdev) { int ret = 0; script_item_u val; script_item_value_type_e type; struct snd_soc_card *card = &snd_soc_sunxi_snddaudio; type = script_get_item(TDM_NAME, "daudio_select", &val); if (SCIRPT_ITEM_VALUE_TYPE_INT != type) { pr_err("[I2S0] daudio_select type err!\n"); } daudio_pcm_select = val.val; type = script_get_item(TDM_NAME, "daudio_master", &val); if (SCIRPT_ITEM_VALUE_TYPE_INT != type) { pr_err("[I2S0] daudio_master type err!\n"); } daudio_master = val.val; type = script_get_item(TDM_NAME, "audio_format", &val); if (SCIRPT_ITEM_VALUE_TYPE_INT != type) { pr_err("[I2S0] audio_format type err!\n"); } audio_format = val.val; type = script_get_item(TDM_NAME, "signal_inversion", &val); if (SCIRPT_ITEM_VALUE_TYPE_INT != type) { pr_err("[I2S0] signal_inversion type err!\n"); } signal_inversion = val.val; #ifdef CONFIG_HAS_EARLYSUSPEND register_early_suspend(&rt3261_early_suspend_handler); #endif card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); } return ret; }
static __devinit int omap_abe_probe(struct platform_device *pdev) { struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev); struct snd_soc_card *card = &omap_abe_card; int ret; card->dev = &pdev->dev; if (!pdata) { dev_err(&pdev->dev, "Missing pdata\n"); return -ENODEV; } if (pdata->card_name) { card->name = pdata->card_name; } else { dev_err(&pdev->dev, "Card name is not provided\n"); return -ENODEV; } if (!pdata->mclk_freq) { dev_err(&pdev->dev, "MCLK frequency missing\n"); return -ENODEV; } if (pdata->has_dmic) { card->dai_link = twl6040_dmic_dai; card->num_links = ARRAY_SIZE(twl6040_dmic_dai); } else { card->dai_link = twl6040_only_dai; card->num_links = ARRAY_SIZE(twl6040_only_dai); } ret = snd_soc_register_card(card); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); return ret; }
/* * initialise the TLV320 driver * register the mixer and dsp interfaces with the kernel */ static int tlv320_init(struct snd_soc_device *socdev) { struct snd_soc_codec *codec = socdev->codec; int ret = 0; codec->name = "TLV320"; codec->owner = THIS_MODULE; codec->read = tlv320_read_reg_cache; codec->write = tlv320_write; codec->dai = tlv320_dai; codec->num_dai = ARRAY_SIZE(tlv320_dai); codec->reg_cache_size = ARRAY_SIZE(tlv320_reg_addr); codec->reg_cache = kzalloc(sizeof(u8) * ARRAY_SIZE(tlv320_reg_addr), GFP_KERNEL); if (codec->reg_cache == NULL) return -ENOMEM; memcpy(codec->reg_cache, tlv320_reg_addr, sizeof(u8) * ARRAY_SIZE(tlv320_reg_addr)); codec->reg_cache_size = sizeof(u8) * ARRAY_SIZE(tlv320_reg_addr); /* register pcms */ ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); if (ret < 0) { kfree(codec->reg_cache); return ret; } queue_delayed_work(tlv320_workq, &codec->delayed_work, msecs_to_jiffies(caps_charge)); ret = snd_soc_register_card(socdev); if (ret < 0) { snd_soc_free_pcms(socdev); snd_soc_dapm_free(socdev); } return ret; }
static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev) { int ret; struct snd_soc_card *card = &rockchip_hdmi_spdif_snd_card; card->dev = &pdev->dev; ret = rockchip_of_get_sound_card_info_(card, false); if (ret) { pr_err("%s() get sound card info failed:%d\n", __func__, ret); return ret; } ret = snd_soc_register_card(card); if (ret) pr_err("%s() register card failed:%d\n", __func__, ret); return ret; }
static int bfin_eval_adav80x_probe(struct platform_device *pdev) { struct snd_soc_card *card = &bfin_eval_adav80x; const char *codec_name; switch (platform_get_device_id(pdev)->driver_data) { case BFIN_EVAL_ADAV801: codec_name = "spi0.1"; break; case BFIN_EVAL_ADAV803: codec_name = "adav803.0-0034"; break; default: return -EINVAL; } bfin_eval_adav80x_dais[0].codec_name = codec_name; card->dev = &pdev->dev; return snd_soc_register_card(&bfin_eval_adav80x); }
static int bf5xx_ad1836_driver_probe(struct platform_device *pdev) { struct snd_soc_card *card = &bf5xx_ad1836; const char **link_name; int ret; link_name = pdev->dev.platform_data; if (!link_name) { dev_err(&pdev->dev, "No platform data supplied\n"); return -EINVAL; } bf5xx_ad1836_dai.cpu_dai_name = link_name[0]; bf5xx_ad1836_dai.codec_name = link_name[1]; card->dev = &pdev->dev; platform_set_drvdata(pdev, card); ret = snd_soc_register_card(card); if (ret) dev_err(&pdev->dev, "Failed to register card\n"); return ret; }
static int __devinit d2plug_card_probe(struct platform_device *pdev) { struct snd_soc_card *card; int ret; dev_dbg(&pdev->dev, "pdev->id = %d\n", pdev->id); if (pdev->id) card = &d2plug_audio_card; else card = &d2plug_hdmi_card; card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); } return ret; }
static int __devinit edb93xx_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_edb93xx; int ret; ret = ep93xx_i2s_acquire(EP93XX_SYSCON_DEVCFG_I2SONAC97, EP93XX_SYSCON_I2SCLKDIV_ORIDE | EP93XX_SYSCON_I2SCLKDIV_SPOL); if (ret) return ret; card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); ep93xx_i2s_release(); } return ret; }
static int dbmd2_snd_probe(struct platform_device *pdev) { int ret = 0; struct snd_soc_card *card = &dspg_dbmd2_card; // struct device_node *np = pdev->dev.of_node; /* note: platform_set_drvdata() here saves pointer to the card's data * on the device's 'struct device_private *p'->driver_data */ #if defined(CONFIG_ARCH_MSM8916) if(!is_codec_probe_done()){ dev_err(&pdev->dev, "%s - defer as codec_probe_done is false\n", __func__); return -EPROBE_DEFER; } #endif card->dev = &pdev->dev; if (dbmd2_init_dai_link(card) < 0) { dev_err(&pdev->dev, "initialization of DAI links failed\n"); ret = -1; goto ERR_CLEAR; } /* Register ASoC sound Card */ ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "registering of sound card failed\n"); goto ERR_CLEAR; } dev_info(&pdev->dev, "DBMD2 ASoC card registered\n"); return 0; ERR_CLEAR: return ret; }
static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev) { struct snd_mx27vis_platform_data *pdata = pdev->dev.platform_data; int ret; if (!pdata) { dev_err(&pdev->dev, "No platform data supplied\n"); return -EINVAL; } mx27vis_amp_gain0_gpio = pdata->amp_gain0_gpio; mx27vis_amp_gain1_gpio = pdata->amp_gain1_gpio; mx27vis_amp_mutel_gpio = pdata->amp_mutel_gpio; mx27vis_amp_muter_gpio = pdata->amp_muter_gpio; mx27vis_aic32x4.dev = &pdev->dev; ret = snd_soc_register_card(&mx27vis_aic32x4); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); return ret; } /* Connect SSI0 as clock slave to SSI1 external pins */ imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR | IMX_AUDMUX_V1_PCR_TCLKDIR | IMX_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_PPCR1_SSI_PINS_1) | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_PPCR1_SSI_PINS_1) ); imx_audmux_v1_configure_port(MX27_AUDMUX_PPCR1_SSI_PINS_1, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) ); return ret; }
static int mt8173_max98090_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card = &mt8173_max98090_card; struct device_node *codec_node, *platform_node; int ret, i; platform_node = of_parse_phandle(pdev->dev.of_node, "mediatek,platform", 0); if (!platform_node) { dev_err(&pdev->dev, "Property 'platform' missing or invalid\n"); return -EINVAL; } for (i = 0; i < card->num_links; i++) { if (mt8173_max98090_dais[i].platform_name) continue; mt8173_max98090_dais[i].platform_of_node = platform_node; } codec_node = of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0); if (!codec_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); return -EINVAL; } for (i = 0; i < card->num_links; i++) { if (mt8173_max98090_dais[i].codec_name) continue; mt8173_max98090_dais[i].codec_of_node = codec_node; } card->dev = &pdev->dev; ret = snd_soc_register_card(card); if (ret) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); return ret; }
static __devinit int tegra_rt5631_driver_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_tegra_rt5631; struct tegra_rt5631 *machine; int ret; printk("%s+\n", __func__); machine = kzalloc(sizeof(struct tegra_rt5631), GFP_KERNEL); if (!machine) { dev_err(&pdev->dev, "Can't allocate tegra_rt5631 struct\n"); return -ENOMEM; } ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev, card); if (ret) goto err_free_machine; card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); goto err_fini_utils; } printk("%s-\n", __func__); return 0; err_fini_utils: tegra_asoc_utils_fini(&machine->util_data); err_free_machine: kfree(machine); return ret; }
static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_trimslice; struct tegra_trimslice *trimslice; int ret; trimslice = devm_kzalloc(&pdev->dev, sizeof(struct tegra_trimslice), GFP_KERNEL); if (!trimslice) { dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n"); ret = -ENOMEM; goto err; } ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); if (ret) goto err; card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, trimslice); ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); goto err_fini_utils; } return 0; err_fini_utils: tegra_asoc_utils_fini(&trimslice->util_data); err: return ret; }
static int mop500_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; int ret; dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); mop500_card.dev = &pdev->dev; if (np) { ret = mop500_of_probe(pdev, np); if (ret) return ret; } dev_dbg(&pdev->dev, "%s: Card %s: Set platform drvdata.\n", __func__, mop500_card.name); platform_set_drvdata(pdev, &mop500_card); snd_soc_card_set_drvdata(&mop500_card, NULL); dev_dbg(&pdev->dev, "%s: Card %s: num_links = %d\n", __func__, mop500_card.name, mop500_card.num_links); dev_dbg(&pdev->dev, "%s: Card %s: DAI-link 0: name = %s\n", __func__, mop500_card.name, mop500_card.dai_link[0].name); dev_dbg(&pdev->dev, "%s: Card %s: DAI-link 0: stream_name = %s\n", __func__, mop500_card.name, mop500_card.dai_link[0].stream_name); ret = snd_soc_register_card(&mop500_card); if (ret) dev_err(&pdev->dev, "Error: snd_soc_register_card failed (%d)!\n", ret); return ret; }
static int palm27x_asoc_probe(struct platform_device *pdev) { int ret; if (!(machine_is_palmtx() || machine_is_palmt5() || machine_is_palmld() || machine_is_palmte2())) return -ENODEV; if (!pdev->dev.platform_data) { dev_err(&pdev->dev, "please supply platform_data\n"); return -ENODEV; } hs_jack_gpios[0].gpio = ((struct palm27x_asoc_info *) (pdev->dev.platform_data))->jack_gpio; palm27x_asoc.dev = &pdev->dev; ret = snd_soc_register_card(&palm27x_asoc); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); return ret; }
static int __devinit snd_adonisuniv_probe(struct platform_device *pdev) { int ret; struct ymu831_machine_priv *ymu831; ymu831 = kzalloc(sizeof(struct ymu831_machine_priv), GFP_KERNEL); if (!ymu831) { pr_err("Failed to allocate memory\n"); return -ENOMEM; } exynos5_audio_set_mclk(1, 0); snd_soc_card_set_drvdata(&ymu831_snd_card, ymu831); ymu831_snd_card.dev = &pdev->dev; ret = snd_soc_register_card(&ymu831_snd_card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret); kfree(ymu831); } return ret; }
static int tegra_wm8903_driver_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct snd_soc_card *card = &snd_soc_tegra_wm8903; struct tegra_wm8903 *machine; int ret; machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm8903), GFP_KERNEL); if (!machine) { dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n"); return -ENOMEM; } card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); machine->gpio_spkr_en = of_get_named_gpio(np, "nvidia,spkr-en-gpios", 0); if (machine->gpio_spkr_en == -EPROBE_DEFER) return -EPROBE_DEFER; if (gpio_is_valid(machine->gpio_spkr_en)) { ret = devm_gpio_request_one(&pdev->dev, machine->gpio_spkr_en, GPIOF_OUT_INIT_LOW, "spkr_en"); if (ret) { dev_err(card->dev, "cannot get spkr_en gpio\n"); return ret; } } machine->gpio_hp_mute = of_get_named_gpio(np, "nvidia,hp-mute-gpios", 0); if (machine->gpio_hp_mute == -EPROBE_DEFER) return -EPROBE_DEFER; if (gpio_is_valid(machine->gpio_hp_mute)) { ret = devm_gpio_request_one(&pdev->dev, machine->gpio_hp_mute, GPIOF_OUT_INIT_HIGH, "hp_mute"); if (ret) { dev_err(card->dev, "cannot get hp_mute gpio\n"); return ret; } } machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); if (machine->gpio_hp_det == -EPROBE_DEFER) return -EPROBE_DEFER; machine->gpio_int_mic_en = of_get_named_gpio(np, "nvidia,int-mic-en-gpios", 0); if (machine->gpio_int_mic_en == -EPROBE_DEFER) return -EPROBE_DEFER; if (gpio_is_valid(machine->gpio_int_mic_en)) { /* Disable int mic; enable signal is active-high */ ret = devm_gpio_request_one(&pdev->dev, machine->gpio_int_mic_en, GPIOF_OUT_INIT_LOW, "int_mic_en"); if (ret) { dev_err(card->dev, "cannot get int_mic_en gpio\n"); return ret; } } machine->gpio_ext_mic_en = of_get_named_gpio(np, "nvidia,ext-mic-en-gpios", 0); if (machine->gpio_ext_mic_en == -EPROBE_DEFER) return -EPROBE_DEFER; if (gpio_is_valid(machine->gpio_ext_mic_en)) { /* Enable ext mic; enable signal is active-low */ ret = devm_gpio_request_one(&pdev->dev, machine->gpio_ext_mic_en, GPIOF_OUT_INIT_LOW, "ext_mic_en"); if (ret) { dev_err(card->dev, "cannot get ext_mic_en gpio\n"); return ret; } } ret = snd_soc_of_parse_card_name(card, "nvidia,model"); if (ret) goto err; ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); if (ret) goto err; tegra_wm8903_dai.codec_of_node = of_parse_phandle(np, "nvidia,audio-codec", 0); if (!tegra_wm8903_dai.codec_of_node) { dev_err(&pdev->dev, "Property 'nvidia,audio-codec' missing or invalid\n"); ret = -EINVAL; goto err; } tegra_wm8903_dai.cpu_of_node = of_parse_phandle(np, "nvidia,i2s-controller", 0); if (!tegra_wm8903_dai.cpu_of_node) { dev_err(&pdev->dev, "Property 'nvidia,i2s-controller' missing or invalid\n"); ret = -EINVAL; goto err; } tegra_wm8903_dai.platform_of_node = tegra_wm8903_dai.cpu_of_node; ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); if (ret) goto err; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); goto err_fini_utils; } return 0; err_fini_utils: tegra_asoc_utils_fini(&machine->util_data); err: return ret; }
static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct snd_soc_card *card = &snd_soc_tegra_sgtl5000; struct tegra_sgtl5000 *machine; int ret; machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_sgtl5000), GFP_KERNEL); if (!machine) return -ENOMEM; card->dev = &pdev->dev; snd_soc_card_set_drvdata(card, machine); ret = snd_soc_of_parse_card_name(card, "nvidia,model"); if (ret) goto err; ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); if (ret) goto err; tegra_sgtl5000_dai.codec_of_node = of_parse_phandle(np, "nvidia,audio-codec", 0); if (!tegra_sgtl5000_dai.codec_of_node) { dev_err(&pdev->dev, "Property 'nvidia,audio-codec' missing or invalid\n"); ret = -EINVAL; goto err; } tegra_sgtl5000_dai.cpu_of_node = of_parse_phandle(np, "nvidia,i2s-controller", 0); if (!tegra_sgtl5000_dai.cpu_of_node) { dev_err(&pdev->dev, "Property 'nvidia,i2s-controller' missing/invalid\n"); ret = -EINVAL; goto err; } tegra_sgtl5000_dai.platform_of_node = tegra_sgtl5000_dai.cpu_of_node; ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); if (ret) goto err; ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); goto err_fini_utils; } return 0; err_fini_utils: tegra_asoc_utils_fini(&machine->util_data); err: return ret; }
static int omap_hdmi_audio_probe(struct platform_device *pdev) { struct omap_hdmi_audio_pdata *ha = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct hdmi_audio_data *ad; struct snd_soc_dai_driver *dai_drv; struct snd_soc_card *card; int ret; if (!ha) { dev_err(dev, "No platform data\n"); return -EINVAL; } ad = devm_kzalloc(dev, sizeof(*ad), GFP_KERNEL); if (!ad) return -ENOMEM; ad->dssdev = ha->dev; ad->ops = ha->ops; ad->dma_data.addr = ha->audio_dma_addr; ad->dma_data.filter_data = "audio_tx"; ad->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; mutex_init(&ad->current_stream_lock); switch (ha->dss_version) { case OMAPDSS_VER_OMAP4430_ES1: case OMAPDSS_VER_OMAP4430_ES2: case OMAPDSS_VER_OMAP4: dai_drv = &omap4_hdmi_dai; break; case OMAPDSS_VER_OMAP5: dai_drv = &omap5_hdmi_dai; break; default: return -EINVAL; } ret = snd_soc_register_component(ad->dssdev, &omap_hdmi_component, dai_drv, 1); if (ret) return ret; ret = omap_pcm_platform_register(ad->dssdev); if (ret) return ret; card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; card->name = devm_kasprintf(dev, GFP_KERNEL, "HDMI %s", dev_name(ad->dssdev)); card->owner = THIS_MODULE; card->dai_link = devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL); card->dai_link->name = card->name; card->dai_link->stream_name = card->name; card->dai_link->cpu_dai_name = dev_name(ad->dssdev); card->dai_link->platform_name = dev_name(ad->dssdev); card->dai_link->codec_name = "snd-soc-dummy"; card->dai_link->codec_dai_name = "snd-soc-dummy-dai"; card->num_links = 1; card->dev = dev; ret = snd_soc_register_card(card); if (ret) { dev_err(dev, "snd_soc_register_card failed (%d)\n", ret); snd_soc_unregister_component(ad->dssdev); return ret; } ad->card = card; snd_soc_card_set_drvdata(card, ad); dev_set_drvdata(dev, ad); return 0; }