aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
commit7b6181e06841f5ad15c4ff708b967b4db65a64de (patch)
treebdfcf5b74b692f76581156e452d268b64c795200 /sound
parent72e58063d63c5f0a7bf65312f1e3a5ed9bb5c2ff (diff)
parentbc487fb341af05120bccb9f59ce76302391dcc77 (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (163 commits) omap: complete removal of machine_desc.io_pg_offst and .phys_io omap: UART: fix wakeup registers for OMAP24xx UART2 omap: Fix spotty MMC voltages ASoC: OMAP4: MCPDM: Remove unnecessary include of plat/control.h serial: omap-serial: fix signess error OMAP3: DMA: Errata i541: sDMA FIFO draining does not finish omap: dma: Fix buffering disable bit setting for omap24xx omap: serial: Fix the boot-up crash/reboot without CONFIG_PM OMAP3: PM: fix scratchpad memory accesses for off-mode omap4: pandaboard: enable the ehci port on pandaboard omap4: pandaboard: Fix the init if CONFIG_MMC_OMAP_HS is not set omap4: pandaboard: remove unused hsmmc definition OMAP: McBSP: Remove null omap44xx ops comment OMAP: McBSP: Swap CLKS source definition OMAP: McBSP: Fix CLKR and FSR signal muxing OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks OMAP: control: move plat-omap/control.h to mach-omap2/control.h OMAP: split plat-omap/common.c OMAP: McBSP: implement functional clock switching via clock framework OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c ... Fixed up trivial conflicts in arch/arm/mach-omap2/ {board-zoom-peripherals.c,devices.c} as per Tony
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/omap-mcbsp.c119
-rw-r--r--sound/soc/omap/omap-mcpdm.c1
2 files changed, 29 insertions, 91 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 99696187b55a..d211c9fa5a91 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"
@@ -598,93 +597,6 @@ static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai,
598 return 0; 597 return 0;
599} 598}
600 599
601static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
602 int clk_id)
603{
604 int sel_bit;
605 u16 reg, reg_devconf1 = OMAP243X_CONTROL_DEVCONF1;
606
607 if (cpu_class_is_omap1()) {
608 /* OMAP1's can use only external source clock */
609 if (unlikely(clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK))
610 return -EINVAL;
611 else
612 return 0;
613 }
614
615 if (cpu_is_omap2420() && mcbsp_data->bus_id > 1)
616 return -EINVAL;
617
618 if (cpu_is_omap343x())
619 reg_devconf1 = OMAP343X_CONTROL_DEVCONF1;
620
621 switch (mcbsp_data->bus_id) {
622 case 0:
623 reg = OMAP2_CONTROL_DEVCONF0;
624 sel_bit = 2;
625 break;
626 case 1:
627 reg = OMAP2_CONTROL_DEVCONF0;
628 sel_bit = 6;
629 break;
630 case 2:
631 reg = reg_devconf1;
632 sel_bit = 0;
633 break;
634 case 3:
635 reg = reg_devconf1;
636 sel_bit = 2;
637 break;
638 case 4:
639 reg = reg_devconf1;
640 sel_bit = 4;
641 break;
642 default:
643 return -EINVAL;
644 }
645
646 if (clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK)
647 omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
648 else
649 omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
650
651 return 0;
652}
653
654static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data *mcbsp_data,
655 int clk_id)
656{
657 int sel_bit, set = 0;
658 u16 reg = OMAP2_CONTROL_DEVCONF0;
659
660 if (cpu_class_is_omap1())
661 return -EINVAL; /* TODO: Can this be implemented for OMAP1? */
662 if (mcbsp_data->bus_id != 0)
663 return -EINVAL;
664
665 switch (clk_id) {
666 case OMAP_MCBSP_CLKR_SRC_CLKX:
667 set = 1;
668 case OMAP_MCBSP_CLKR_SRC_CLKR:
669 sel_bit = 3;
670 break;
671 case OMAP_MCBSP_FSR_SRC_FSX:
672 set = 1;
673 case OMAP_MCBSP_FSR_SRC_FSR:
674 sel_bit = 4;
675 break;
676 default:
677 return -EINVAL;
678 }
679
680 if (set)
681 omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
682 else
683 omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
684
685 return 0;
686}
687
688static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, 600static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
689 int clk_id, unsigned int freq, 601 int clk_id, unsigned int freq,
690 int dir) 602 int dir)
@@ -693,6 +605,14 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
693 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 605 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
694 int err = 0; 606 int err = 0;
695 607
608 /* The McBSP signal muxing functions are only available on McBSP1 */
609 if (clk_id == OMAP_MCBSP_CLKR_SRC_CLKR ||
610 clk_id == OMAP_MCBSP_CLKR_SRC_CLKX ||
611 clk_id == OMAP_MCBSP_FSR_SRC_FSR ||
612 clk_id == OMAP_MCBSP_FSR_SRC_FSX)
613 if (cpu_class_is_omap1() || mcbsp_data->bus_id != 0)
614 return -EINVAL;
615
696 mcbsp_data->in_freq = freq; 616 mcbsp_data->in_freq = freq;
697 617
698 switch (clk_id) { 618 switch (clk_id) {
@@ -700,8 +620,20 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
700 regs->srgr2 |= CLKSM; 620 regs->srgr2 |= CLKSM;
701 break; 621 break;
702 case OMAP_MCBSP_SYSCLK_CLKS_FCLK: 622 case OMAP_MCBSP_SYSCLK_CLKS_FCLK:
623 if (cpu_class_is_omap1()) {
624 err = -EINVAL;
625 break;
626 }
627 err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
628 MCBSP_CLKS_PRCM_SRC);
629 break;
703 case OMAP_MCBSP_SYSCLK_CLKS_EXT: 630 case OMAP_MCBSP_SYSCLK_CLKS_EXT:
704 err = omap_mcbsp_dai_set_clks_src(mcbsp_data, clk_id); 631 if (cpu_class_is_omap1()) {
632 err = 0;
633 break;
634 }
635 err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
636 MCBSP_CLKS_PAD_SRC);
705 break; 637 break;
706 638
707 case OMAP_MCBSP_SYSCLK_CLKX_EXT: 639 case OMAP_MCBSP_SYSCLK_CLKX_EXT:
@@ -710,11 +642,18 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
710 regs->pcr0 |= SCLKME; 642 regs->pcr0 |= SCLKME;
711 break; 643 break;
712 644
645
713 case OMAP_MCBSP_CLKR_SRC_CLKR: 646 case OMAP_MCBSP_CLKR_SRC_CLKR:
647 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR);
648 break;
714 case OMAP_MCBSP_CLKR_SRC_CLKX: 649 case OMAP_MCBSP_CLKR_SRC_CLKX:
650 omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX);
651 break;
715 case OMAP_MCBSP_FSR_SRC_FSR: 652 case OMAP_MCBSP_FSR_SRC_FSR:
653 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR);
654 break;
716 case OMAP_MCBSP_FSR_SRC_FSX: 655 case OMAP_MCBSP_FSR_SRC_FSX:
717 err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id); 656 omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX);
718 break; 657 break;
719 default: 658 default:
720 err = -ENODEV; 659 err = -ENODEV;
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index f161c2f5ed36..bed09c27e44c 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -32,7 +32,6 @@
32#include <sound/initval.h> 32#include <sound/initval.h>
33#include <sound/soc.h> 33#include <sound/soc.h>
34 34
35#include <plat/control.h>
36#include <plat/dma.h> 35#include <plat/dma.h>
37#include <plat/mcbsp.h> 36#include <plat/mcbsp.h>
38#include "mcpdm.h" 37#include "mcpdm.h"