kirkwood-i2s.c (cf40a76e7d5874bb25f4404eecc58a2e033af885) | kirkwood-i2s.c (f98fc0f8154ed17a00a588f1a95f02cb3e33b0d0) |
---|---|
1/* 2 * kirkwood-i2s.c 3 * 4 * (c) 2010 Arnaud Patard <apatard@mandriva.com> 5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the --- 12 unchanged lines hidden (view full) --- 21#include <sound/pcm.h> 22#include <sound/pcm_params.h> 23#include <sound/soc.h> 24#include <linux/platform_data/asoc-kirkwood.h> 25#include <linux/of.h> 26 27#include "kirkwood.h" 28 | 1/* 2 * kirkwood-i2s.c 3 * 4 * (c) 2010 Arnaud Patard <apatard@mandriva.com> 5 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the --- 12 unchanged lines hidden (view full) --- 21#include <sound/pcm.h> 22#include <sound/pcm_params.h> 23#include <sound/soc.h> 24#include <linux/platform_data/asoc-kirkwood.h> 25#include <linux/of.h> 26 27#include "kirkwood.h" 28 |
29#define DRV_NAME "mvebu-audio" 30 | |
31#define KIRKWOOD_I2S_FORMATS \ 32 (SNDRV_PCM_FMTBIT_S16_LE | \ 33 SNDRV_PCM_FMTBIT_S24_LE | \ 34 SNDRV_PCM_FMTBIT_S32_LE) 35 36#define KIRKWOOD_SPDIF_FORMATS \ 37 (SNDRV_PCM_FMTBIT_S16_LE | \ 38 SNDRV_PCM_FMTBIT_S24_LE) --- 480 unchanged lines hidden (view full) --- 519 .rate_min = 5512, 520 .rate_max = 192000, 521 .formats = KIRKWOOD_SPDIF_FORMATS, 522 }, 523 .ops = &kirkwood_i2s_dai_ops, 524 }, 525}; 526 | 29#define KIRKWOOD_I2S_FORMATS \ 30 (SNDRV_PCM_FMTBIT_S16_LE | \ 31 SNDRV_PCM_FMTBIT_S24_LE | \ 32 SNDRV_PCM_FMTBIT_S32_LE) 33 34#define KIRKWOOD_SPDIF_FORMATS \ 35 (SNDRV_PCM_FMTBIT_S16_LE | \ 36 SNDRV_PCM_FMTBIT_S24_LE) --- 480 unchanged lines hidden (view full) --- 517 .rate_min = 5512, 518 .rate_max = 192000, 519 .formats = KIRKWOOD_SPDIF_FORMATS, 520 }, 521 .ops = &kirkwood_i2s_dai_ops, 522 }, 523}; 524 |
527static const struct snd_soc_component_driver kirkwood_i2s_component = { 528 .name = DRV_NAME, 529}; 530 | |
531static int kirkwood_i2s_dev_probe(struct platform_device *pdev) 532{ 533 struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data; 534 struct snd_soc_dai_driver *soc_dai = kirkwood_i2s_dai; 535 struct kirkwood_dma_data *priv; 536 struct resource *mem; 537 struct device_node *np = pdev->dev.of_node; 538 int err; --- 57 unchanged lines hidden (view full) --- 596 if (priv->burst == 32) { 597 priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_32; 598 priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_32; 599 } else { 600 priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_128; 601 priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128; 602 } 603 | 525static int kirkwood_i2s_dev_probe(struct platform_device *pdev) 526{ 527 struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data; 528 struct snd_soc_dai_driver *soc_dai = kirkwood_i2s_dai; 529 struct kirkwood_dma_data *priv; 530 struct resource *mem; 531 struct device_node *np = pdev->dev.of_node; 532 int err; --- 57 unchanged lines hidden (view full) --- 590 if (priv->burst == 32) { 591 priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_32; 592 priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_32; 593 } else { 594 priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_128; 595 priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128; 596 } 597 |
604 err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component, | 598 err = devm_snd_soc_register_component(&pdev->dev, &kirkwood_soc_component, |
605 soc_dai, 2); 606 if (err) { 607 dev_err(&pdev->dev, "snd_soc_register_component failed\n"); 608 goto err_component; 609 } 610 | 599 soc_dai, 2); 600 if (err) { 601 dev_err(&pdev->dev, "snd_soc_register_component failed\n"); 602 goto err_component; 603 } 604 |
611 err = snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform); 612 if (err) { 613 dev_err(&pdev->dev, "snd_soc_register_platform failed\n"); 614 goto err_platform; 615 } 616 | |
617 kirkwood_i2s_init(priv); 618 619 return 0; | 605 kirkwood_i2s_init(priv); 606 607 return 0; |
620 err_platform: 621 snd_soc_unregister_component(&pdev->dev); | 608 |
622 err_component: 623 if (!IS_ERR(priv->extclk)) 624 clk_disable_unprepare(priv->extclk); 625 clk_disable_unprepare(priv->clk); 626 627 return err; 628} 629 630static int kirkwood_i2s_dev_remove(struct platform_device *pdev) 631{ 632 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); 633 | 609 err_component: 610 if (!IS_ERR(priv->extclk)) 611 clk_disable_unprepare(priv->extclk); 612 clk_disable_unprepare(priv->clk); 613 614 return err; 615} 616 617static int kirkwood_i2s_dev_remove(struct platform_device *pdev) 618{ 619 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); 620 |
634 snd_soc_unregister_platform(&pdev->dev); 635 snd_soc_unregister_component(&pdev->dev); 636 | |
637 if (!IS_ERR(priv->extclk)) 638 clk_disable_unprepare(priv->extclk); 639 clk_disable_unprepare(priv->clk); 640 641 return 0; 642} 643 644#ifdef CONFIG_OF --- 25 unchanged lines hidden --- | 621 if (!IS_ERR(priv->extclk)) 622 clk_disable_unprepare(priv->extclk); 623 clk_disable_unprepare(priv->clk); 624 625 return 0; 626} 627 628#ifdef CONFIG_OF --- 25 unchanged lines hidden --- |