aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 16:00:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 16:00:13 -0400
commitb2094ef840697bc8ca5d17a83b7e30fad5f1e9fa (patch)
tree64e5f7253b6a85b6d5d36f95c0d3c67c1798918d /sound/soc/codecs/twl4030.c
parent424a6f6ef990b7e9f56f6627bfc6c46b493faeb4 (diff)
parent6681bc0deba495fad0d6fb349e40524abd1b1732 (diff)
Merge tag 'sound-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull updates of sound stuff from Takashi Iwai: "Here is the first big update chunk of sound stuff for 3.4-rc1. In the common sound infrastructure, there are a few changes for dynamic PCM support (used in ASoC) and a few clean-ups. Majority of changes are found, as usual, in HD-audio and ASoC. Some highlights of HD-audio changes: - All the long-standing static quirk codes for Realtek codec were finally removed by fixing and extending the Realtek auto-parser. - The mute-LED control is standardized over all HD-audio codec drivers using the extended vmaster hook. - The vmaster slave mixer elements are initialized to 0dB as default so that the user won't be annoyed by the silent output after updates, e.g. due to the additions of new elements. - Other many fix-ups for the misc HD-audio devices. In the ASoC side, this is a very active release, including a quite a few framework enhancements. Some highlights: - Support for widgets not associated with a CODEC, an important part of the dynamic PCM framework. - A library factoring out the common code shared by dmaengine based DMA drivers contributed by Lars-Peter Clausen. This will save a lot of code and make it much easier to deploy enhancements to dmaengine. - Support for binary controls, used for providing runtime configuration of algorithm coefficients. - A new DAPM widget type for regulator supplies allowing drivers for devices that can power down unused supplies while active to do without any per-driver code. - DAPM widgets for DAIs, initially giving a speed boost for playback startup and shutdown and also the basis for CODEC<->CODEC DAI link support. - Support for specifying the number of significant bits on audio interfaces, useful for allowing applications to know how much effort to put into generating data for a larger sample format. - Conversion of the FSI driver used on some SH processors to DMAEngine. - Conversion of EP93xx drivers to DMAEngine. - New CODEC drivers for Maxim MAX9768 and Wolfson Microelectronics WM2200. - Move audmux driver from arc/arm to sound/soc - McBSP move from arch/ to sound/ and updates Also, a few small updates and fixes for other drivers like au88x0, ymfpci, USB 6fire, USB usx2yaudio are included." * tag 'sound-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (446 commits) ASoC: wm8994: Provide VMID mode control and fix default sequence ASoC: wm8994: Add missing break in resume ASoC: wm_hubs: Don't actively manage LINEOUT_VMID_BUF ASoC: pxa-ssp: atomically set stream active masks ASoC: fsl: p1022ds: tell the WM8776 codec driver that it's the master ASoC: Samsung: Added to support mono recording ALSA: hda - Fix build with CONFIG_PM=n ALSA: au88x0 - Avoid possible Oops at unbinding ALSA: usb-audio - Fix build error by consitification of rate list ASoC: core: Fix obscure leak of runtime array ALSA: pcm - Avoid GFP_ATOMIC in snd_pcm_link() ALSA: pcm: Constify the list in snd_pcm_hw_constraint_list ASoC: wm8996: Add 44.1kHz support ALSA: hda - Fix build of patch_sigmatel.c without CONFIG_SND_HDA_POWER_SAVE ASoC: mx27vis-aic32x4: Convert it to platform driver ALSA: hda - fix printing of high HDMI sample rates ALSA: ymfpci - Fix legacy registers on S3/S4 resume ALSA: control - Fixe a trailing white space error ALSA: hda - Add expose_enum_ctl flag to snd_hda_add_vmaster_hook() ALSA: hda - Add "Mute-LED Mode" enum control ...
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r--sound/soc/codecs/twl4030.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 18e71014cc2e..170cf9a8fc79 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1002,8 +1002,8 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
1002 unsigned short mask, bitmask; 1002 unsigned short mask, bitmask;
1003 1003
1004 if (twl4030->configured) { 1004 if (twl4030->configured) {
1005 printk(KERN_ERR "twl4030 operation mode cannot be " 1005 dev_err(codec->dev,
1006 "changed on-the-fly\n"); 1006 "operation mode cannot be changed on-the-fly\n");
1007 return -EBUSY; 1007 return -EBUSY;
1008 } 1008 }
1009 1009
@@ -1689,7 +1689,6 @@ static int twl4030_startup(struct snd_pcm_substream *substream,
1689 struct snd_soc_codec *codec = rtd->codec; 1689 struct snd_soc_codec *codec = rtd->codec;
1690 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); 1690 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
1691 1691
1692 snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24);
1693 if (twl4030->master_substream) { 1692 if (twl4030->master_substream) {
1694 twl4030->slave_substream = substream; 1693 twl4030->slave_substream = substream;
1695 /* The DAI has one configuration for playback and capture, so 1694 /* The DAI has one configuration for playback and capture, so
@@ -1801,7 +1800,7 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
1801 mode |= TWL4030_APLL_RATE_96000; 1800 mode |= TWL4030_APLL_RATE_96000;
1802 break; 1801 break;
1803 default: 1802 default:
1804 printk(KERN_ERR "TWL4030 hw params: unknown rate %d\n", 1803 dev_err(codec->dev, "%s: unknown rate %d\n", __func__,
1805 params_rate(params)); 1804 params_rate(params));
1806 return -EINVAL; 1805 return -EINVAL;
1807 } 1806 }
@@ -1818,7 +1817,7 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
1818 format |= TWL4030_DATA_WIDTH_32S_24W; 1817 format |= TWL4030_DATA_WIDTH_32S_24W;
1819 break; 1818 break;
1820 default: 1819 default:
1821 printk(KERN_ERR "TWL4030 hw params: unknown format %d\n", 1820 dev_err(codec->dev, "%s: unknown format %d\n", __func__,
1822 params_format(params)); 1821 params_format(params));
1823 return -EINVAL; 1822 return -EINVAL;
1824 } 1823 }
@@ -1868,13 +1867,13 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1868 case 38400000: 1867 case 38400000:
1869 break; 1868 break;
1870 default: 1869 default:
1871 dev_err(codec->dev, "Unsupported APLL mclk: %u\n", freq); 1870 dev_err(codec->dev, "Unsupported HFCLKIN: %u\n", freq);
1872 return -EINVAL; 1871 return -EINVAL;
1873 } 1872 }
1874 1873
1875 if ((freq / 1000) != twl4030->sysclk) { 1874 if ((freq / 1000) != twl4030->sysclk) {
1876 dev_err(codec->dev, 1875 dev_err(codec->dev,
1877 "Mismatch in APLL mclk: %u (configured: %u)\n", 1876 "Mismatch in HFCLKIN: %u (configured: %u)\n",
1878 freq, twl4030->sysclk * 1000); 1877 freq, twl4030->sysclk * 1000);
1879 return -EINVAL; 1878 return -EINVAL;
1880 } 1879 }
@@ -1984,9 +1983,9 @@ static int twl4030_voice_startup(struct snd_pcm_substream *substream,
1984 * not available. 1983 * not available.
1985 */ 1984 */
1986 if (twl4030->sysclk != 26000) { 1985 if (twl4030->sysclk != 26000) {
1987 dev_err(codec->dev, "The board is configured for %u Hz, while" 1986 dev_err(codec->dev,
1988 "the Voice interface needs 26MHz APLL mclk\n", 1987 "%s: HFCLKIN is %u KHz, voice interface needs 26MHz\n",
1989 twl4030->sysclk * 1000); 1988 __func__, twl4030->sysclk);
1990 return -EINVAL; 1989 return -EINVAL;
1991 } 1990 }
1992 1991
@@ -1997,8 +1996,8 @@ static int twl4030_voice_startup(struct snd_pcm_substream *substream,
1997 & TWL4030_OPT_MODE; 1996 & TWL4030_OPT_MODE;
1998 1997
1999 if (mode != TWL4030_OPTION_2) { 1998 if (mode != TWL4030_OPTION_2) {
2000 printk(KERN_ERR "TWL4030 voice startup: " 1999 dev_err(codec->dev, "%s: the codec mode is not option2\n",
2001 "the codec mode is not option2\n"); 2000 __func__);
2002 return -EINVAL; 2001 return -EINVAL;
2003 } 2002 }
2004 2003
@@ -2039,7 +2038,7 @@ static int twl4030_voice_hw_params(struct snd_pcm_substream *substream,
2039 mode |= TWL4030_SEL_16K; 2038 mode |= TWL4030_SEL_16K;
2040 break; 2039 break;
2041 default: 2040 default:
2042 printk(KERN_ERR "TWL4030 voice hw params: unknown rate %d\n", 2041 dev_err(codec->dev, "%s: unknown rate %d\n", __func__,
2043 params_rate(params)); 2042 params_rate(params));
2044 return -EINVAL; 2043 return -EINVAL;
2045 } 2044 }
@@ -2068,13 +2067,14 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai,
2068 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); 2067 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
2069 2068
2070 if (freq != 26000000) { 2069 if (freq != 26000000) {
2071 dev_err(codec->dev, "Unsupported APLL mclk: %u, the Voice" 2070 dev_err(codec->dev,
2072 "interface needs 26MHz APLL mclk\n", freq); 2071 "%s: HFCLKIN is %u KHz, voice interface needs 26MHz\n",
2072 __func__, freq / 1000);
2073 return -EINVAL; 2073 return -EINVAL;
2074 } 2074 }
2075 if ((freq / 1000) != twl4030->sysclk) { 2075 if ((freq / 1000) != twl4030->sysclk) {
2076 dev_err(codec->dev, 2076 dev_err(codec->dev,
2077 "Mismatch in APLL mclk: %u (configured: %u)\n", 2077 "Mismatch in HFCLKIN: %u (configured: %u)\n",
2078 freq, twl4030->sysclk * 1000); 2078 freq, twl4030->sysclk * 1000);
2079 return -EINVAL; 2079 return -EINVAL;
2080 } 2080 }
@@ -2175,13 +2175,15 @@ static struct snd_soc_dai_driver twl4030_dai[] = {
2175 .channels_min = 2, 2175 .channels_min = 2,
2176 .channels_max = 4, 2176 .channels_max = 4,
2177 .rates = TWL4030_RATES | SNDRV_PCM_RATE_96000, 2177 .rates = TWL4030_RATES | SNDRV_PCM_RATE_96000,
2178 .formats = TWL4030_FORMATS,}, 2178 .formats = TWL4030_FORMATS,
2179 .sig_bits = 24,},
2179 .capture = { 2180 .capture = {
2180 .stream_name = "Capture", 2181 .stream_name = "Capture",
2181 .channels_min = 2, 2182 .channels_min = 2,
2182 .channels_max = 4, 2183 .channels_max = 4,
2183 .rates = TWL4030_RATES, 2184 .rates = TWL4030_RATES,
2184 .formats = TWL4030_FORMATS,}, 2185 .formats = TWL4030_FORMATS,
2186 .sig_bits = 24,},
2185 .ops = &twl4030_dai_hifi_ops, 2187 .ops = &twl4030_dai_hifi_ops,
2186}, 2188},
2187{ 2189{
@@ -2220,13 +2222,12 @@ static int twl4030_soc_probe(struct snd_soc_codec *codec)
2220 2222
2221 twl4030 = kzalloc(sizeof(struct twl4030_priv), GFP_KERNEL); 2223 twl4030 = kzalloc(sizeof(struct twl4030_priv), GFP_KERNEL);
2222 if (twl4030 == NULL) { 2224 if (twl4030 == NULL) {
2223 printk("Can not allocate memroy\n"); 2225 dev_err(codec->dev, "Can not allocate memory\n");
2224 return -ENOMEM; 2226 return -ENOMEM;
2225 } 2227 }
2226 snd_soc_codec_set_drvdata(codec, twl4030); 2228 snd_soc_codec_set_drvdata(codec, twl4030);
2227 /* Set the defaults, and power up the codec */ 2229 /* Set the defaults, and power up the codec */
2228 twl4030->sysclk = twl4030_audio_get_mclk() / 1000; 2230 twl4030->sysclk = twl4030_audio_get_mclk() / 1000;
2229 codec->dapm.idle_bias_off = 1;
2230 2231
2231 twl4030_init_chip(codec); 2232 twl4030_init_chip(codec);
2232 2233
@@ -2252,6 +2253,7 @@ static struct snd_soc_codec_driver soc_codec_dev_twl4030 = {
2252 .read = twl4030_read_reg_cache, 2253 .read = twl4030_read_reg_cache,
2253 .write = twl4030_write, 2254 .write = twl4030_write,
2254 .set_bias_level = twl4030_set_bias_level, 2255 .set_bias_level = twl4030_set_bias_level,
2256 .idle_bias_off = true,
2255 .reg_cache_size = sizeof(twl4030_reg), 2257 .reg_cache_size = sizeof(twl4030_reg),
2256 .reg_word_size = sizeof(u8), 2258 .reg_word_size = sizeof(u8),
2257 .reg_cache_default = twl4030_reg, 2259 .reg_cache_default = twl4030_reg,