aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/mcbsp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-08 18:07:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-08 18:07:14 -0400
commitf5a246eab9a268f51ba8189ea5b098a1bfff200e (patch)
treea6ff7169e0bcaca498d9aec8b0624de1b74eaecb /arch/arm/mach-omap2/mcbsp.c
parentd5bbd43d5f450c3fca058f5b85f3dfb4e8cc88c9 (diff)
parent7ff34ad80b7080fafaac8efa9ef0061708eddd51 (diff)
Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "This contains pretty many small commits covering fairly large range of files in sound/ directory. Partly because of additional API support and partly because of constantly developed ASoC and ARM stuff. Some highlights: - Introduced the helper function and documentation for exposing the channel map via control API, as discussed in Plumbers; most of PCI drivers are covered, will follow more drivers later - Most of drivers have been replaced with the new PM callbacks (if the bus is supported) - HD-audio controller got the support of runtime PM and the support of D3 clock-stop. Also changing the power_save option in sysfs kicks off immediately to enable / disable the power-save mode. - Another significant code change in HD-audio is the rewrite of firmware loading code. Other than that, most of changes in HD-audio are continued cleanups and standardization for the generic auto parser and bug fixes (HBR, device-specific fixups), in addition to the support of channel-map API. - Addition of ASoC bindings for the compressed API, used by the mid-x86 drivers. - Lots of cleanups and API refreshes for ASoC codec drivers and DaVinci. - Conversion of OMAP to dmaengine. - New machine driver for Wolfson Microelectronics Bells. - New CODEC driver for Wolfson Microelectronics WM0010. - Enhancements to the ux500 and wm2000 drivers - A new driver for DA9055 and the support for regulator bypass mode." Fix up various arm soc header file reorg conflicts. * tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (339 commits) ALSA: hda - Add new codec ALC283 ALC290 support ALSA: hda - avoid unneccesary indices on "Headphone Jack" controls ALSA: hda - fix indices on boost volume on Conexant ALSA: aloop - add locking to timer access ALSA: hda - Fix hang caused by race during suspend. sound: Remove unnecessary semicolon ALSA: hda/realtek - Fix detection of ALC271X codec ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310 ALSA: hda - make Realtek/Sigmatel/Conexant use the generic unsol event ALSA: hda - make a generic unsol event handler ASoC: codecs: Add DA9055 codec driver ASoC: eukrea-tlv320: Convert it to platform driver ALSA: ASoC: add DT bindings for CS4271 ASoC: wm_hubs: Ensure volume updates are handled during class W startup ASoC: wm5110: Adding missing volume update bits ASoC: wm5110: Add OUT3R support ASoC: wm5110: Add AEC loopback support ASoC: wm5110: Rename EPOUT to HPOUT3 ASoC: arizona: Add more clock rates ASoC: arizona: Add more DSP options for mixer input muxes ...
Diffstat (limited to 'arch/arm/mach-omap2/mcbsp.c')
-rw-r--r--arch/arm/mach-omap2/mcbsp.c126
1 files changed, 7 insertions, 119 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 7d47407d6d46..37f8f948047b 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -15,6 +15,7 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/of.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/platform_data/asoc-ti-mcbsp.h> 21#include <linux/platform_data/asoc-ti-mcbsp.h>
@@ -23,8 +24,6 @@
23#include <plat/omap_device.h> 24#include <plat/omap_device.h>
24#include <linux/pm_runtime.h> 25#include <linux/pm_runtime.h>
25 26
26#include "control.h"
27
28/* 27/*
29 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. 28 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
30 * Sidetone needs non-gated ICLK and sidetone autoidle is broken. 29 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
@@ -32,112 +31,6 @@
32#include "cm2xxx_3xxx.h" 31#include "cm2xxx_3xxx.h"
33#include "cm-regbits-34xx.h" 32#include "cm-regbits-34xx.h"
34 33
35/* McBSP1 internal signal muxing function for OMAP2/3 */
36static int omap2_mcbsp1_mux_rx_clk(struct device *dev, const char *signal,
37 const char *src)
38{
39 u32 v;
40
41 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
42
43 if (!strcmp(signal, "clkr")) {
44 if (!strcmp(src, "clkr"))
45 v &= ~OMAP2_MCBSP1_CLKR_MASK;
46 else if (!strcmp(src, "clkx"))
47 v |= OMAP2_MCBSP1_CLKR_MASK;
48 else
49 return -EINVAL;
50 } else if (!strcmp(signal, "fsr")) {
51 if (!strcmp(src, "fsr"))
52 v &= ~OMAP2_MCBSP1_FSR_MASK;
53 else if (!strcmp(src, "fsx"))
54 v |= OMAP2_MCBSP1_FSR_MASK;
55 else
56 return -EINVAL;
57 } else {
58 return -EINVAL;
59 }
60
61 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
62
63 return 0;
64}
65
66/* McBSP4 internal signal muxing function for OMAP4 */
67#define OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX (1 << 31)
68#define OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX (1 << 30)
69static int omap4_mcbsp4_mux_rx_clk(struct device *dev, const char *signal,
70 const char *src)
71{
72 u32 v;
73
74 /*
75 * In CONTROL_MCBSPLP register only bit 30 (CLKR mux), and bit 31 (FSR
76 * mux) is used */
77 v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP);
78
79 if (!strcmp(signal, "clkr")) {
80 if (!strcmp(src, "clkr"))
81 v &= ~OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX;
82 else if (!strcmp(src, "clkx"))
83 v |= OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_CLKX;
84 else
85 return -EINVAL;
86 } else if (!strcmp(signal, "fsr")) {
87 if (!strcmp(src, "fsr"))
88 v &= ~OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX;
89 else if (!strcmp(src, "fsx"))
90 v |= OMAP4_CONTROL_MCBSPLP_ALBCTRLRX_FSX;
91 else
92 return -EINVAL;
93 } else {
94 return -EINVAL;
95 }
96
97 omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MCBSPLP);
98
99 return 0;
100}
101
102/* McBSP CLKS source switching function */
103static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
104 const char *src)
105{
106 struct clk *fck_src;
107 char *fck_src_name;
108 int r;
109
110 if (!strcmp(src, "clks_ext"))
111 fck_src_name = "pad_fck";
112 else if (!strcmp(src, "clks_fclk"))
113 fck_src_name = "prcm_fck";
114 else
115 return -EINVAL;
116
117 fck_src = clk_get(dev, fck_src_name);
118 if (IS_ERR_OR_NULL(fck_src)) {
119 pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
120 fck_src_name);
121 return -EINVAL;
122 }
123
124 pm_runtime_put_sync(dev);
125
126 r = clk_set_parent(clk, fck_src);
127 if (IS_ERR_VALUE(r)) {
128 pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
129 "clks", fck_src_name);
130 clk_put(fck_src);
131 return -EINVAL;
132 }
133
134 pm_runtime_get_sync(dev);
135
136 clk_put(fck_src);
137
138 return 0;
139}
140
141static int omap3_enable_st_clock(unsigned int id, bool enable) 34static int omap3_enable_st_clock(unsigned int id, bool enable)
142{ 35{
143 unsigned int w; 36 unsigned int w;
@@ -179,17 +72,11 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
179 pdata->reg_size = 4; 72 pdata->reg_size = 4;
180 pdata->has_ccr = true; 73 pdata->has_ccr = true;
181 } 74 }
182 pdata->set_clk_src = omap2_mcbsp_set_clk_src;
183
184 /* On OMAP2/3 the McBSP1 port has 6 pin configuration */
185 if (id == 1 && oh->class->rev < MCBSP_CONFIG_TYPE4)
186 pdata->mux_signal = omap2_mcbsp1_mux_rx_clk;
187 75
188 /* On OMAP4 the McBSP4 port has 6 pin configuration */ 76 if (oh->class->rev == MCBSP_CONFIG_TYPE2) {
189 if (id == 4 && oh->class->rev == MCBSP_CONFIG_TYPE4) 77 /* The FIFO has 128 locations */
190 pdata->mux_signal = omap4_mcbsp4_mux_rx_clk; 78 pdata->buffer_size = 0x80;
191 79 } else if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
192 if (oh->class->rev == MCBSP_CONFIG_TYPE3) {
193 if (id == 2) 80 if (id == 2)
194 /* The FIFO has 1024 + 256 locations */ 81 /* The FIFO has 1024 + 256 locations */
195 pdata->buffer_size = 0x500; 82 pdata->buffer_size = 0x500;
@@ -225,7 +112,8 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
225 112
226static int __init omap2_mcbsp_init(void) 113static int __init omap2_mcbsp_init(void)
227{ 114{
228 omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL); 115 if (!of_have_populated_dt())
116 omap_hwmod_for_each_by_class("mcbsp", omap_init_mcbsp, NULL);
229 117
230 return 0; 118 return 0;
231} 119}