本文整理汇总了C++中snd_soc_card_set_drvdata函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_soc_card_set_drvdata函数的具体用法?C++ snd_soc_card_set_drvdata怎么用?C++ snd_soc_card_set_drvdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_soc_card_set_drvdata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snd_adonisuniv_probe
static int __devinit snd_adonisuniv_probe(struct platform_device *pdev)
{
int ret;
struct wm5102_machine_priv *wm5102;
wm5102 = kzalloc(sizeof *wm5102, GFP_KERNEL);
if (!wm5102) {
pr_err("Failed to allocate memory\n");
return -ENOMEM;
}
exynos5_audio_set_mclk(1, 0);
ret = snd_soc_register_dais(&pdev->dev, adonisuniv_ext_dai,
ARRAY_SIZE(adonisuniv_ext_dai));
if (ret != 0)
pr_err("Failed to register external DAIs: %d\n", ret);
snd_soc_card_set_drvdata(&adonisuniv, wm5102);
adonisuniv.dev = &pdev->dev;
ret = snd_soc_register_card(&adonisuniv);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret);
kfree(wm5102);
}
adonisuniv_gpio_init();
return ret;
}
示例2: snd_cht_mc_probe
static int snd_cht_mc_probe(struct platform_device *pdev)
{
int ret_val = 0;
bool found = false;
struct cht_mc_private *drv;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
if (!drv)
return -ENOMEM;
if (ACPI_SUCCESS(acpi_get_devices(
"104C227E",
snd_acpi_codec_match,
&found, NULL)) && found) {
drv->ts3a227e_present = true;
} else {
/* no need probe TI jack detection chip */
snd_soc_card_cht.aux_dev = NULL;
snd_soc_card_cht.num_aux_devs = 0;
drv->ts3a227e_present = false;
}
/* register the soc card */
snd_soc_card_cht.dev = &pdev->dev;
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
if (ret_val) {
dev_err(&pdev->dev,
"snd_soc_register_card failed %d\n", ret_val);
return ret_val;
}
platform_set_drvdata(pdev, &snd_soc_card_cht);
return ret_val;
}
示例3: aml_m8_audio_probe
static int aml_m8_audio_probe(struct platform_device *pdev)
{
//struct device_node *np = pdev->dev.of_node;
struct snd_soc_card *card = &aml_snd_soc_card;
struct aml_audio_private_data *p_aml_audio;
int ret = 0;
printk(KERN_DEBUG "enter %s\n", __func__);
#ifdef CONFIG_USE_OF
p_aml_audio = devm_kzalloc(&pdev->dev,
sizeof(struct aml_audio_private_data), GFP_KERNEL);
if (!p_aml_audio) {
dev_err(&pdev->dev, "Can't allocate aml_audio_private_data\n");
ret = -ENOMEM;
goto err;
}
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, p_aml_audio);
if (!(pdev->dev.of_node)) {
dev_err(&pdev->dev, "Must be instantiated using device tree\n");
ret = -EINVAL;
goto err;
}
ret = snd_soc_of_parse_card_name(card, "aml,sound_card");
if (ret)
goto err;
ret = of_property_read_string_index(pdev->dev.of_node, "aml,codec_dai",
0, &aml_codec_dai_link[0].codec_dai_name);
if (ret)
goto err;
ret = snd_soc_of_parse_audio_routing(card, "aml,audio-routing");
if (ret)
goto err;
// aml_codec_dai_link[0].codec_of_node = of_parse_phandle(
// pdev->dev.of_node, "aml,audio-codec", 0);
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
goto err;
}
aml_m8_pinmux_init(card);
return 0;
#endif
err:
kfree(p_aml_audio);
return ret;
}
示例4: omap_abe_probe
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;
struct omap_abe_data *card_data;
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_abe) {
if (pdata->has_dmic) {
card->dai_link = omap_abe_dai_link;
card->num_links = ARRAY_SIZE(omap_abe_dai_link);
} else {
card->dai_link = omap_abe_no_dmic_dai;
card->num_links = ARRAY_SIZE(omap_abe_no_dmic_dai);
}
} else 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);
}
card_data = devm_kzalloc(&pdev->dev, sizeof(*card_data), GFP_KERNEL);
if (card_data == NULL)
return -ENOMEM;
snd_soc_card_set_drvdata(card, card_data);
ret = snd_soc_register_card(card);
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
card_data->av_switch_reg = regulator_get(&pdev->dev, "av-switch");
if (IS_ERR(card_data->av_switch_reg)) {
dev_warn(&pdev->dev, "couldn't get AV Switch regulator\n");
card_data->av_switch_reg = NULL;
}
return ret;
}
示例5: tegra_wm8903_driver_probe
static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_tegra_wm8903;
struct tegra_wm8903 *machine;
struct tegra_wm8903_platform_data *pdata;
int ret;
pdata = pdev->dev.platform_data;
if (!pdata) {
dev_err(&pdev->dev, "No platform data supplied\n");
return -EINVAL;
}
machine = kzalloc(sizeof(struct tegra_wm8903), GFP_KERNEL);
if (!machine) {
dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n");
return -ENOMEM;
}
machine->pdata = pdata;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret)
goto err_free_machine;
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine);
if (machine_is_harmony() || machine_is_ventana()) {
card->dapm_routes = harmony_audio_map;
card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map);
} else if (machine_is_seaboard()) {
card->dapm_routes = seaboard_audio_map;
card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map);
} else if (machine_is_kaen()) {
card->dapm_routes = kaen_audio_map;
card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map);
} else {
card->dapm_routes = aebl_audio_map;
card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map);
}
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_free_machine:
kfree(machine);
return ret;
}
示例6: tegra_max98095_driver_probe
static __devinit int tegra_max98095_driver_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_tegra_max98095;
struct tegra_max98095 *machine;
struct tegra_asoc_platform_data *pdata;
int ret;
pdata = pdev->dev.platform_data;
if (!pdata) {
dev_err(&pdev->dev, "No platform data supplied\n");
return -EINVAL;
}
machine = kzalloc(sizeof(struct tegra_max98095), GFP_KERNEL);
if (!machine) {
dev_err(&pdev->dev, "Can't allocate tegra_max98095 struct\n");
return -ENOMEM;
}
machine->pdata = pdata;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret)
goto err_free_machine;
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine);
#ifdef CONFIG_SWITCH
/* Add h2w switch class support */
ret = switch_dev_register(&wired_switch_dev);
if (ret < 0) {
dev_err(&pdev->dev, "not able to register switch device\n");
goto err_fini_utils;
}
#endif
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
goto err_switch_unregister;
}
return 0;
err_switch_unregister:
#ifdef CONFIG_SWITCH
switch_dev_unregister(&wired_switch_dev);
#endif
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err_free_machine:
kfree(machine);
return ret;
}
示例7: tegra_snd_trimslice_probe
static int tegra_snd_trimslice_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
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");
return -ENOMEM;
}
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, trimslice);
trimslice_tlv320aic23_dai.codec_of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0);
if (!trimslice_tlv320aic23_dai.codec_of_node) {
dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL;
goto err;
}
trimslice_tlv320aic23_dai.cpu_of_node = of_parse_phandle(np,
"nvidia,i2s-controller", 0);
if (!trimslice_tlv320aic23_dai.cpu_of_node) {
dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL;
goto err;
}
trimslice_tlv320aic23_dai.platform_of_node =
trimslice_tlv320aic23_dai.cpu_of_node;
ret = tegra_asoc_utils_init(&trimslice->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(&trimslice->util_data);
err:
return ret;
}
示例8: snd_cht_mc_probe
static int snd_cht_mc_probe(struct platform_device *pdev)
{
const struct dmi_system_id *dmi_id;
struct device *dev = &pdev->dev;
int ret_val = 0;
struct cht_mc_private *drv;
const char *mclk_name;
int quirks = 0;
dmi_id = dmi_first_match(cht_max98090_quirk_table);
if (dmi_id)
quirks = (unsigned long)dmi_id->driver_data;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
if (!drv)
return -ENOMEM;
drv->ts3a227e_present = acpi_dev_found("104C227E");
if (!drv->ts3a227e_present) {
/* no need probe TI jack detection chip */
snd_soc_card_cht.aux_dev = NULL;
snd_soc_card_cht.num_aux_devs = 0;
ret_val = devm_acpi_dev_add_driver_gpios(dev->parent,
acpi_max98090_gpios);
if (ret_val)
dev_dbg(dev, "Unable to add GPIO mapping table\n");
}
/* register the soc card */
snd_soc_card_cht.dev = &pdev->dev;
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
if (quirks & QUIRK_PMC_PLT_CLK_0)
mclk_name = "pmc_plt_clk_0";
else
mclk_name = "pmc_plt_clk_3";
drv->mclk = devm_clk_get(&pdev->dev, mclk_name);
if (IS_ERR(drv->mclk)) {
dev_err(&pdev->dev,
"Failed to get MCLK from %s: %ld\n",
mclk_name, PTR_ERR(drv->mclk));
return PTR_ERR(drv->mclk);
}
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
if (ret_val) {
dev_err(&pdev->dev,
"snd_soc_register_card failed %d\n", ret_val);
return ret_val;
}
platform_set_drvdata(pdev, &snd_soc_card_cht);
return ret_val;
}
示例9: snd_ctp_mc_probe
/* SoC card */
static int snd_ctp_mc_probe(struct platform_device *pdev)
{
int ret_val = 0;
struct ctp_mc_private *ctx;
struct ctp_audio_platform_data *pdata = pdev->dev.platform_data;
pr_debug("In %s\n", __func__);
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
if (!ctx) {
pr_err("allocation failed\n");
return -ENOMEM;
}
/* register the soc card */
snd_soc_card_ctp.dev = &pdev->dev;
ctx->ops = (struct snd_soc_machine_ops *)platform_get_device_id(pdev)->driver_data;
if (ctx->ops == NULL)
return -EINVAL;
ctx->ops->card_name(&snd_soc_card_ctp);
ctx->ops->dai_link(&snd_soc_card_ctp);
if (ctx->ops->dmic3_support) {
ret_val = gpio_request(pdata->codec_gpio_dmic, "dmic_switch_gpio");
if (!ret_val) {
ctx->dmic_gpio = pdata->codec_gpio_dmic;
} else {
pr_err("req dmic_switch_gpio failed:%d\n", ret_val);
return ret_val;
}
}
ret_val = snd_ctp_register_jack_data(pdev, ctx);
if (ret_val)
goto free_jack;
snd_soc_card_set_drvdata(&snd_soc_card_ctp, ctx);
ret_val = snd_soc_register_card(&snd_soc_card_ctp);
if (ret_val) {
pr_err("snd_soc_register_card failed %d\n", ret_val);
goto free_jack;
}
if (!snd_soc_card_ctp.instantiated) {
pr_err("snd_soc_card_ctp is not instantiated.\n");
ret_val = -ENODEV;
goto free_jack;
}
platform_set_drvdata(pdev, &snd_soc_card_ctp);
pr_debug("successfully exited probe\n");
return ret_val;
free_jack:
snd_ctp_unregister_jack(ctx, pdev);
return ret_val;
}
示例10: snd_ctp_mc_remove
static int snd_ctp_mc_remove(struct platform_device *pdev)
{
struct snd_soc_card *soc_card = platform_get_drvdata(pdev);
struct ctp_mc_private *ctx = snd_soc_card_get_drvdata(soc_card);
pr_debug("In %s\n", __func__);
snd_ctp_unregister_jack(ctx, pdev);
snd_soc_card_set_drvdata(soc_card, NULL);
snd_soc_unregister_card(soc_card);
platform_set_drvdata(pdev, NULL);
return 0;
}
示例11: sirf_audio_probe
static int sirf_audio_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_sirf_audio_card;
struct sirf_audio_card *sirf_audio_card;
int ret;
sirf_audio_card = devm_kzalloc(&pdev->dev, sizeof(struct sirf_audio_card),
GFP_KERNEL);
if (sirf_audio_card == NULL)
return -ENOMEM;
sirf_audio_dai_link[0].cpu_of_node =
of_parse_phandle(pdev->dev.of_node, "sirf,audio-platform", 0);
sirf_audio_dai_link[0].platform_of_node =
of_parse_phandle(pdev->dev.of_node, "sirf,audio-platform", 0);
sirf_audio_dai_link[0].codec_of_node =
of_parse_phandle(pdev->dev.of_node, "sirf,audio-codec", 0);
sirf_audio_card->gpio_spk_pa = of_get_named_gpio(pdev->dev.of_node,
"spk-pa-gpios", 0);
sirf_audio_card->gpio_hp_pa = of_get_named_gpio(pdev->dev.of_node,
"hp-pa-gpios", 0);
if (gpio_is_valid(sirf_audio_card->gpio_spk_pa)) {
ret = devm_gpio_request_one(&pdev->dev,
sirf_audio_card->gpio_spk_pa,
GPIOF_OUT_INIT_LOW, "SPA_PA_SD");
if (ret) {
dev_err(&pdev->dev,
"Failed to request GPIO_%d for reset: %d\n",
sirf_audio_card->gpio_spk_pa, ret);
return ret;
}
}
if (gpio_is_valid(sirf_audio_card->gpio_hp_pa)) {
ret = devm_gpio_request_one(&pdev->dev,
sirf_audio_card->gpio_hp_pa,
GPIOF_OUT_INIT_LOW, "HP_PA_SD");
if (ret) {
dev_err(&pdev->dev,
"Failed to request GPIO_%d for reset: %d\n",
sirf_audio_card->gpio_hp_pa, ret);
return ret;
}
}
card->dev = &pdev->dev;
snd_soc_card_set_drvdata(card, sirf_audio_card);
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret);
return ret;
}
示例12: omap_abe_probe
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;
struct abe_twl6040 *priv;
int num_links = 0;
int ret;
card->dev = &pdev->dev;
if (!pdata) {
dev_err(&pdev->dev, "Missing pdata\n");
return -ENODEV;
}
priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;
if (pdata->card_name) {
card->name = pdata->card_name;
} else {
dev_err(&pdev->dev, "Card name is not provided\n");
return -ENODEV;
}
priv->jack_detection = pdata->jack_detection;
priv->mclk_freq = pdata->mclk_freq;
if (!priv->mclk_freq) {
dev_err(&pdev->dev, "MCLK frequency missing\n");
return -ENODEV;
}
if (pdata->has_dmic)
num_links = 2;
else
num_links = 1;
card->dai_link = abe_twl6040_dai_links;
card->num_links = num_links;
snd_soc_card_set_drvdata(card, priv);
ret = snd_soc_register_card(card);
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
return ret;
}
示例13: mop500_ab8500_remove
void mop500_ab8500_remove(struct snd_soc_card *card)
{
struct mop500_ab8500_drvdata *drvdata = snd_soc_card_get_drvdata(card);
if (drvdata->clk_ptr_sysclk != NULL)
clk_put(drvdata->clk_ptr_sysclk);
if (drvdata->clk_ptr_ulpclk != NULL)
clk_put(drvdata->clk_ptr_ulpclk);
if (drvdata->clk_ptr_intclk != NULL)
clk_put(drvdata->clk_ptr_intclk);
snd_soc_card_set_drvdata(card, drvdata);
}
示例14: tegra_aic3008_driver_probe
static __devinit int tegra_aic3008_driver_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_tegra_aic3008;
struct tegra_aic3008 *machine;
struct htc_asoc_platform_data *pdata;
int ret;
AUD_INFO("starting tegra_aic3008_driver_probe...\n");
pdata = pdev->dev.platform_data;
if (!pdata) {
dev_err(&pdev->dev, "No platform data supplied\n");
return -EINVAL;
}
AUD_INFO("starting tegra_aic3008_driver_probe...%p %p\n", &pdata->aic3008_power, &aic3008_power_ctl);
aic3008_power_ctl = &pdata->aic3008_power;
machine = kzalloc(sizeof(struct tegra_aic3008), GFP_KERNEL);
if (!machine) {
AUD_ERR("Can't allocate tegra_aic3008 struct\n");
return -ENOMEM;
}
machine->pdata = pdata;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev, card);
util_data = &machine->util_data;
if (ret)
goto err_free_machine;
AUD_DBG("DONE tegra_asoc_utils_init()\n");
card->dev = &pdev->dev;
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine);
ret = snd_soc_register_card(card);
if (ret) {
AUD_ERR("snd_soc_register_card failed %d\n",ret);
goto err_unregister_switch;
}
AUD_DBG("DONE snd_soc_register_card()\n");
return 0;
err_unregister_switch:
tegra_asoc_utils_fini(&machine->util_data);
err_free_machine:
kfree(machine);
return ret;
}
示例15: sdm845_snd_platform_probe
static int sdm845_snd_platform_probe(struct platform_device *pdev)
{
struct snd_soc_card *card;
struct sdm845_snd_data *data;
struct device *dev = &pdev->dev;
int ret;
card = kzalloc(sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;
/* Allocate the private data */
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto data_alloc_fail;
}
card->dapm_widgets = sdm845_snd_widgets;
card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets);
card->dev = dev;
dev_set_drvdata(dev, card);
ret = qcom_snd_parse_of(card);
if (ret) {
dev_err(dev, "Error parsing OF data\n");
goto parse_dt_fail;
}
data->card = card;
snd_soc_card_set_drvdata(card, data);
sdm845_add_ops(card);
ret = snd_soc_register_card(card);
if (ret) {
dev_err(dev, "Sound card registration failed\n");
goto register_card_fail;
}
return ret;
register_card_fail:
kfree(card->dai_link);
parse_dt_fail:
kfree(data);
data_alloc_fail:
kfree(card);
return ret;
}