aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-mcbsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/omap-mcbsp.c')
-rw-r--r--sound/soc/omap/omap-mcbsp.c52
1 files changed, 17 insertions, 35 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 86f213905e2c..f50a5abb470f 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -661,48 +661,23 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
661 return 0; 661 return 0;
662} 662}
663 663
664static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data *mcbsp_data,
665 int clk_id)
666{
667 int sel_bit, set = 0;
668 u16 reg = OMAP2_CONTROL_DEVCONF0;
669
670 if (cpu_class_is_omap1())
671 return -EINVAL; /* TODO: Can this be implemented for OMAP1? */
672 if (mcbsp_data->bus_id != 0)
673 return -EINVAL;
674
675 switch (clk_id) {
676 case OMAP_MCBSP_CLKR_SRC_CLKX:
677 set = 1;
678 case OMAP_MCBSP_CLKR_SRC_CLKR:
679 sel_bit = 3;
680 break;
681 case OMAP_MCBSP_FSR_SRC_FSX:
682 set = 1;
683 case OMAP_MCBSP_FSR_SRC_FSR:
684 sel_bit = 4;
685 break;
686 default:
687 return -EINVAL;
688 }
689
690 if (set)
691 omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
692 else
693 omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
694
695 return 0;
696}
697
698static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, 664static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
699 int clk_id, unsigned int freq, 665 int clk_id, unsigned int freq,
700 int dir) 666 int dir)
701{ 667{
702 struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); 668 struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
703 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 669 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
670 struct omap_mcbsp_platform_data *pdata = cpu_dai->dev->platform_data;
704 int err = 0; 671 int err = 0;
705 672
673 /* The McBSP signal muxing functions are only available on McBSP1 */
674 if (clk_id == OMAP_MCBSP_CLKR_SRC_CLKR ||
675 clk_id == OMAP_MCBSP_CLKR_SRC_CLKX ||
676 clk_id == OMAP_MCBSP_FSR_SRC_FSR ||
677 clk_id == OMAP_MCBSP_FSR_SRC_FSX)
678 if (cpu_class_is_omap1() || mcbsp_data->bus_id != 0)
679 return -EINVAL;
680
706 mcbsp_data->in_freq = freq; 681 mcbsp_data->in_freq = freq;
707 682
708 switch (clk_id) { 683 switch (clk_id) {
@@ -720,11 +695,18 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
720 regs->pcr0 |= SCLKME; 695 regs->pcr0 |= SCLKME;
721 break; 696 break;
722 697
698
723 case OMAP_MCBSP_CLKR_SRC_CLKR: 699 case OMAP_MCBSP_CLKR_SRC_CLKR:
700 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR);
701 break;
724 case OMAP_MCBSP_CLKR_SRC_CLKX: 702 case OMAP_MCBSP_CLKR_SRC_CLKX:
703 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX);
704 break;
725 case OMAP_MCBSP_FSR_SRC_FSR: 705 case OMAP_MCBSP_FSR_SRC_FSR:
706 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR);
707 break;
726 case OMAP_MCBSP_FSR_SRC_FSX: 708 case OMAP_MCBSP_FSR_SRC_FSX:
727 err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id); 709 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX);
728 break; 710 break;
729 default: 711 default:
730 err = -ENODEV; 712 err = -ENODEV;