aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/omap-mcbsp.c69
1 files changed, 13 insertions, 56 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index f50a5abb470f..b59ad11466a9 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -31,7 +31,6 @@
31#include <sound/initval.h> 31#include <sound/initval.h>
32#include <sound/soc.h> 32#include <sound/soc.h>
33 33
34#include <plat/control.h>
35#include <plat/dma.h> 34#include <plat/dma.h>
36#include <plat/mcbsp.h> 35#include <plat/mcbsp.h>
37#include "omap-mcbsp.h" 36#include "omap-mcbsp.h"
@@ -608,66 +607,12 @@ static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai,
608 return 0; 607 return 0;
609} 608}
610 609
611static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
612 int clk_id)
613{
614 int sel_bit;
615 u16 reg, reg_devconf1 = OMAP243X_CONTROL_DEVCONF1;
616
617 if (cpu_class_is_omap1()) {
618 /* OMAP1's can use only external source clock */
619 if (unlikely(clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK))
620 return -EINVAL;
621 else
622 return 0;
623 }
624
625 if (cpu_is_omap2420() && mcbsp_data->bus_id > 1)
626 return -EINVAL;
627
628 if (cpu_is_omap343x())
629 reg_devconf1 = OMAP343X_CONTROL_DEVCONF1;
630
631 switch (mcbsp_data->bus_id) {
632 case 0:
633 reg = OMAP2_CONTROL_DEVCONF0;
634 sel_bit = 2;
635 break;
636 case 1:
637 reg = OMAP2_CONTROL_DEVCONF0;
638 sel_bit = 6;
639 break;
640 case 2:
641 reg = reg_devconf1;
642 sel_bit = 0;
643 break;
644 case 3:
645 reg = reg_devconf1;
646 sel_bit = 2;
647 break;
648 case 4:
649 reg = reg_devconf1;
650 sel_bit = 4;
651 break;
652 default:
653 return -EINVAL;
654 }
655
656 if (clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK)
657 omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
658 else
659 omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
660
661 return 0;
662}
663
664static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, 610static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
665 int clk_id, unsigned int freq, 611 int clk_id, unsigned int freq,
666 int dir) 612 int dir)
667{ 613{
668 struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); 614 struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
669 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 615 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
670 struct omap_mcbsp_platform_data *pdata = cpu_dai->dev->platform_data;
671 int err = 0; 616 int err = 0;
672 617
673 /* The McBSP signal muxing functions are only available on McBSP1 */ 618 /* The McBSP signal muxing functions are only available on McBSP1 */
@@ -685,8 +630,20 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
685 regs->srgr2 |= CLKSM; 630 regs->srgr2 |= CLKSM;
686 break; 631 break;
687 case OMAP_MCBSP_SYSCLK_CLKS_FCLK: 632 case OMAP_MCBSP_SYSCLK_CLKS_FCLK:
633 if (cpu_class_is_omap1()) {
634 err = -EINVAL;
635 break;
636 }
637 err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
638 MCBSP_CLKS_PRCM_SRC);
639 break;
688 case OMAP_MCBSP_SYSCLK_CLKS_EXT: 640 case OMAP_MCBSP_SYSCLK_CLKS_EXT:
689 err = omap_mcbsp_dai_set_clks_src(mcbsp_data, clk_id); 641 if (cpu_class_is_omap1()) {
642 err = 0;
643 break;
644 }
645 err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
646 MCBSP_CLKS_PAD_SRC);
690 break; 647 break;
691 648
692 case OMAP_MCBSP_SYSCLK_CLKX_EXT: 649 case OMAP_MCBSP_SYSCLK_CLKX_EXT: