本文整理汇总了C++中snd_soc_register_component函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_soc_register_component函数的具体用法?C++ snd_soc_register_component怎么用?C++ snd_soc_register_component使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_soc_register_component函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msm_dai_stub_dev_probe
static int msm_dai_stub_dev_probe(struct platform_device *pdev)
{
int rc, id = -1;
const char *stub_dev_id = "qcom,msm-dai-stub-dev-id";
rc = of_property_read_u32(pdev->dev.of_node, stub_dev_id, &id);
if (rc) {
dev_err(&pdev->dev,
"%s: missing %s in dt node\n", __func__, stub_dev_id);
return rc;
}
pdev->id = id;
dev_set_name(&pdev->dev, "%s.%d", "msm-dai-stub-dev", id);
pr_debug("%s: dev name %s, id:%d\n", __func__,
dev_name(&pdev->dev), pdev->id);
switch (id) {
case STUB_RX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_stub_dai_rx, 1);
break;
case STUB_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_stub_dai_tx[0], 1);
break;
case STUB_1_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_stub_dai_tx[1], 1);
break;
case STUB_DTMF_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component,
&msm_dai_stub_dtmf_tx_dai, 1);
break;
case STUB_HOST_RX_CAPTURE_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component,
&msm_dai_stub_host_capture_tx_dai[0], 1);
break;
case STUB_HOST_TX_CAPTURE_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component,
&msm_dai_stub_host_capture_tx_dai[1], 1);
break;
case STUB_HOST_RX_PLAYBACK_RX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component,
&msm_dai_stub_host_playback_rx_dai[0], 1);
break;
case STUB_HOST_TX_PLAYBACK_RX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component,
&msm_dai_stub_host_playback_rx_dai[1], 1);
break;
}
return rc;
}
示例2: sst_byt_pcm_dev_probe
static int sst_byt_pcm_dev_probe(struct platform_device *pdev)
{
struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev);
int ret;
ret = sst_byt_dsp_init(&pdev->dev, sst_pdata);
if (ret < 0)
return -ENODEV;
ret = snd_soc_register_platform(&pdev->dev, &byt_soc_platform);
if (ret < 0)
goto err_plat;
ret = snd_soc_register_component(&pdev->dev, &byt_dai_component,
byt_dais, ARRAY_SIZE(byt_dais));
if (ret < 0)
goto err_comp;
return 0;
err_comp:
snd_soc_unregister_platform(&pdev->dev);
err_plat:
sst_byt_dsp_free(&pdev->dev, sst_pdata);
return ret;
}
示例3: pxa2xx_ac97_dev_probe
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
{
int ret;
if (pdev->id != -1) {
dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
return -ENXIO;
}
ret = pxa2xx_ac97_hw_probe(pdev);
if (ret) {
dev_err(&pdev->dev, "PXA2xx AC97 hw probe error (%d)\n", ret);
return ret;
}
ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops);
if (ret != 0)
return ret;
/* Punt most of the init to the SoC probe; we may need the machine
* driver to do interesting things with the clocking to get us up
* and running.
*/
return snd_soc_register_component(&pdev->dev, &pxa_ac97_component,
pxa_ac97_dai_driver, ARRAY_SIZE(pxa_ac97_dai_driver));
}
示例4: sst_platform_probe
static int sst_platform_probe(struct platform_device *pdev)
{
struct sst_data *sst;
int ret;
struct sst_platform_data *pdata = pdev->dev.platform_data;
pr_debug("sst_platform_probe called\n");
sst = devm_kzalloc(&pdev->dev, sizeof(*sst), GFP_KERNEL);
if (sst == NULL) {
pr_err("kzalloc failed\n");
return -ENOMEM;
}
sst_pdev = &pdev->dev;
sst->pdata = pdata;
mutex_init(&sst->lock);
dev_set_drvdata(&pdev->dev, sst);
ret = snd_soc_register_platform(&pdev->dev,
&sst_soc_platform_drv);
if (ret) {
pr_err("registering soc platform failed\n");
return ret;
}
ret = snd_soc_register_component(&pdev->dev, &pcm_component,
sst_platform_dai, ARRAY_SIZE(sst_platform_dai));
if (ret) {
pr_err("registering cpu dais failed\n");
snd_soc_unregister_platform(&pdev->dev);
}
return ret;
}
示例5: asoc_ssc_init
static int asoc_ssc_init(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct ssc_device *ssc = platform_get_drvdata(pdev);
int ret;
ret = snd_soc_register_component(dev, &atmel_ssc_component,
&atmel_ssc_dai, 1);
if (ret) {
dev_err(dev, "Could not register DAI: %d\n", ret);
goto err;
}
if (ssc->pdata->use_dma)
ret = atmel_pcm_dma_platform_register(dev);
else
ret = atmel_pcm_pdc_platform_register(dev);
if (ret) {
dev_err(dev, "Could not register PCM: %d\n", ret);
goto err_unregister_dai;
}
return 0;
err_unregister_dai:
snd_soc_unregister_component(dev);
err:
return ret;
}
示例6: msm_dai_q6_hdmi_dev_probe
/* To do: change to register DAIs as batch */
static int msm_dai_q6_hdmi_dev_probe(struct platform_device *pdev)
{
int rc, id;
const char *q6_dev_id = "qcom,msm-dai-q6-dev-id";
rc = of_property_read_u32(pdev->dev.of_node, q6_dev_id, &id);
if (rc) {
dev_err(&pdev->dev,
"%s: missing %s in dt node\n", __func__, q6_dev_id);
return rc;
}
pdev->id = id;
dev_set_name(&pdev->dev, "%s.%d", "msm-dai-q6-hdmi", id);
pr_debug("%s: dev name %s, id:%d\n", __func__,
dev_name(&pdev->dev), pdev->id);
switch (pdev->id) {
case HDMI_RX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_hdmi_q6_component,
&msm_dai_q6_hdmi_hdmi_rx_dai, 1);
break;
default:
dev_err(&pdev->dev, "invalid device ID %d\n", pdev->id);
rc = -ENODEV;
break;
}
return rc;
}
示例7: ath79_i2s_drv_probe
static int ath79_i2s_drv_probe(struct platform_device *pdev)
{
printk("%s\n", __FUNCTION__);
spin_lock_init(&ath79_stereo_lock);
ath79_stereo_reset();
return snd_soc_register_component(&pdev->dev, &ath79_i2s_component, &ath79_i2s_dai, 1);
}
示例8: msm_fe_dai_dev_probe
static int msm_fe_dai_dev_probe(struct platform_device *pdev)
{
dev_dbg(&pdev->dev, "%s: dev name %s\n", __func__,
dev_name(&pdev->dev));
return snd_soc_register_component(&pdev->dev, &msm_fe_dai_component,
msm_fe_dais, ARRAY_SIZE(msm_fe_dais));
}
示例9: au1xac97c_drvprobe
static int au1xac97c_drvprobe(struct platform_device *pdev)
{
int ret;
struct resource *iores, *dmares;
struct au1xpsc_audio_data *ctx;
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
mutex_init(&ctx->lock);
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iores)
return -ENODEV;
if (!devm_request_mem_region(&pdev->dev, iores->start,
resource_size(iores),
pdev->name))
return -EBUSY;
ctx->mmio = devm_ioremap_nocache(&pdev->dev, iores->start,
resource_size(iores));
if (!ctx->mmio)
return -EBUSY;
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmares)
return -EBUSY;
ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!dmares)
return -EBUSY;
ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
/* switch it on */
WR(ctx, AC97_ENABLE, EN_D | EN_CE);
WR(ctx, AC97_ENABLE, EN_CE);
ctx->cfg = CFG_RC(3) | CFG_XS(3);
WR(ctx, AC97_CONFIG, ctx->cfg);
platform_set_drvdata(pdev, ctx);
ret = snd_soc_set_ac97_ops(&ac97c_bus_ops);
if (ret)
return ret;
ret = snd_soc_register_component(&pdev->dev, &au1xac97c_component,
&au1xac97c_dai_driver, 1);
if (ret)
return ret;
ac97c_workdata = ctx;
return 0;
}
示例10: msm_dai_stub_dev_probe
static int msm_dai_stub_dev_probe(struct platform_device *pdev)
{
int rc, id = -1;
const char *stub_dev_id = "qcom,msm-dai-stub-dev-id";
rc = of_property_read_u32(pdev->dev.of_node, stub_dev_id, &id);
if (rc) {
dev_err(&pdev->dev,
"%s: missing %s in dt node\n", __func__, stub_dev_id);
return rc;
}
pdev->id = id;
dev_set_name(&pdev->dev, "%s.%d", "msm-dai-stub-dev", id);
pr_debug("%s: dev name %s, id:%d\n", __func__,
dev_name(&pdev->dev), pdev->id);
switch (id) {
case STUB_RX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_stub_dai_rx, 1);
break;
case STUB_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_stub_dai_tx[0], 1);
break;
case STUB_1_TX:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_stub_dai_tx[1], 1);
case TFA9890_LEFT_STUB:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_tfa9890_stub_dai_rx[0], 1);
break;
case TFA9890_RIGHT_STUB:
rc = snd_soc_register_component(&pdev->dev,
&msm_dai_stub_component, &msm_dai_tfa9890_stub_dai_rx[1], 1);
break;
}
return rc;
}
示例11: msm_dai_q6_hdmi_dev_probe
/* To do: change to register DAIs as batch */
static int msm_dai_q6_hdmi_dev_probe(struct platform_device *pdev)
{
int rc = 0;
dev_info(&pdev->dev, "dev name %s dev-id %d\n",
dev_name(&pdev->dev), pdev->id);
rc = snd_soc_register_component(&pdev->dev, &msm_hdmi_q6_component,
&msm_dai_q6_hdmi_hdmi_rx_dai, 1);
return rc;
}
示例12: au1xpsc_i2s_drvprobe
static int au1xpsc_i2s_drvprobe(struct platform_device *pdev)
{
struct resource *iores, *dmares;
unsigned long sel;
struct au1xpsc_audio_data *wd;
wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data),
GFP_KERNEL);
if (!wd)
return -ENOMEM;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
wd->mmio = devm_ioremap_resource(&pdev->dev, iores);
if (IS_ERR(wd->mmio))
return PTR_ERR(wd->mmio);
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmares)
return -EBUSY;
wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!dmares)
return -EBUSY;
wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
/* preserve PSC clock source set up by platform (dev.platform_data
* is already occupied by soc layer)
*/
sel = __raw_readl(PSC_SEL(wd)) & PSC_SEL_CLK_MASK;
__raw_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
wmb(); /* drain writebuffer */
__raw_writel(PSC_SEL_PS_I2SMODE | sel, PSC_SEL(wd));
__raw_writel(0, I2S_CFG(wd));
wmb(); /* drain writebuffer */
/* preconfigure: set max rx/tx fifo depths */
wd->cfg |= PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8;
/* don't wait for I2S core to become ready now; clocks may not
* be running yet; depending on clock input for PSC a wait might
* time out.
*/
/* name the DAI like this device instance ("au1xpsc-i2s.PSCINDEX") */
memcpy(&wd->dai_drv, &au1xpsc_i2s_dai_template,
sizeof(struct snd_soc_dai_driver));
wd->dai_drv.name = dev_name(&pdev->dev);
platform_set_drvdata(pdev, wd);
return snd_soc_register_component(&pdev->dev, &au1xpsc_i2s_component,
&wd->dai_drv, 1);
}
示例13: spdif_out_probe
static int spdif_out_probe(struct platform_device *pdev)
{
struct spdif_out_dev *host;
struct spear_spdif_platform_data *pdata;
struct resource *res;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -EINVAL;
if (!devm_request_mem_region(&pdev->dev, res->start,
resource_size(res), pdev->name)) {
dev_warn(&pdev->dev, "Failed to get memory resourse\n");
return -ENOENT;
}
host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
if (!host) {
dev_warn(&pdev->dev, "kzalloc fail\n");
return -ENOMEM;
}
host->io_base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!host->io_base) {
dev_warn(&pdev->dev, "ioremap failed\n");
return -ENOMEM;
}
host->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk))
return PTR_ERR(host->clk);
pdata = dev_get_platdata(&pdev->dev);
host->dma_params.data = pdata->dma_params;
host->dma_params.addr = res->start + SPDIF_OUT_FIFO_DATA;
host->dma_params.max_burst = 16;
host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
host->dma_params.filter = pdata->filter;
dev_set_drvdata(&pdev->dev, host);
ret = snd_soc_register_component(&pdev->dev, &spdif_out_component,
&spdif_out_dai, 1);
if (ret != 0) {
clk_put(host->clk);
return ret;
}
return 0;
}
示例14: rt5350_pcm_dev_probe
static int rt5350_pcm_dev_probe(struct platform_device *pdev)
{
struct rt5350_pcm *pcm;
int ret;
snd_dmaengine_pcm_register(&pdev->dev,
&rt5350_dmaengine_pcm_config,
SND_DMAENGINE_PCM_FLAG_COMPAT);
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
pcm->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!pcm->mem) {
ret = -ENOENT;
goto err_free;
}
pcm->mem = request_mem_region(pcm->mem->start, resource_size(pcm->mem),
pdev->name);
if (!pcm->mem) {
ret = -EBUSY;
goto err_free;
}
pcm->base = ioremap_nocache(pcm->mem->start, resource_size(pcm->mem));
if (!pcm->base) {
ret = -EBUSY;
goto err_release_mem_region;
}
pcm->phys_base = pcm->mem->start;
platform_set_drvdata(pdev, pcm);
ret = snd_soc_register_component(&pdev->dev, &rt5350_pcm_component,
&rt5350_pcm_dai, 1);
if (!ret) {
dev_err(&pdev->dev, "loaded\n");
return ret;
}
dev_err(&pdev->dev, "Failed to register DAI\n");
iounmap(pcm->base);
err_release_mem_region:
release_mem_region(pcm->mem->start, resource_size(pcm->mem));
err_free:
kfree(pcm);
return ret;
}
示例15: psc_i2s_of_probe
/* ---------------------------------------------------------------------
* OF platform bus binding code:
* - Probe/remove operations
* - OF device match table
*/
static int psc_i2s_of_probe(struct platform_device *op)
{
int rc;
struct psc_dma *psc_dma;
struct mpc52xx_psc __iomem *regs;
rc = mpc5200_audio_dma_create(op);
if (rc != 0)
return rc;
rc = snd_soc_register_component(&op->dev, &psc_i2s_component,
psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai));
if (rc != 0) {
pr_err("Failed to register DAI\n");
return rc;
}
psc_dma = dev_get_drvdata(&op->dev);
regs = psc_dma->psc_regs;
/* Configure the serial interface mode; defaulting to CODEC8 mode */
psc_dma->sicr = MPC52xx_PSC_SICR_DTS1 | MPC52xx_PSC_SICR_I2S |
MPC52xx_PSC_SICR_CLKPOL;
out_be32(&psc_dma->psc_regs->sicr,
psc_dma->sicr | MPC52xx_PSC_SICR_SIM_CODEC_8);
/* Check for the codec handle. If it is not present then we
* are done */
if (!of_get_property(op->dev.of_node, "codec-handle", NULL))
return 0;
/* Due to errata in the dma mode; need to line up enabling
* the transmitter with a transition on the frame sync
* line */
/* first make sure it is low */
while ((in_8(®s->ipcr_acr.ipcr) & 0x80) != 0)
;
/* then wait for the transition to high */
while ((in_8(®s->ipcr_acr.ipcr) & 0x80) == 0)
;
/* Finally, enable the PSC.
* Receiver must always be enabled; even when we only want
* transmit. (see 15.3.2.3 of MPC5200B User's Guide) */
/* Go */
out_8(&psc_dma->psc_regs->command,
MPC52xx_PSC_TX_ENABLE | MPC52xx_PSC_RX_ENABLE);
return 0;
}