diff options
author | guoyin.chen <guoyin.chen@freescale.com> | 2013-07-15 15:01:21 +0800 |
---|---|---|
committer | guoyin.chen <guoyin.chen@freescale.com> | 2013-07-15 15:01:21 +0800 |
commit | 5793da66dd82a437c23d4a833674c0e09bd1aa07 (patch) | |
tree | 2f34bdc95dedb46d2a91d12837e58b1cf3a3e33f /sound | |
parent | f128c5660150679f00e518da8e3f582e9a2f03a8 (diff) | |
parent | 9e268cc3e4386f1a5a31a62f7207e5a9b8420124 (diff) |
Merge remote-tracking branch 'fsl-linux-sdk/imx_3.0.35_4.1.0' into imx_3.0.35_android
Conflicts:
arch/arm/mach-mx6/Kconfig
arch/arm/mach-mx6/board-mx6q_arm2.c
arch/arm/mach-mx6/board-mx6q_arm2.h
arch/arm/mach-mx6/board-mx6q_hdmidongle.c
arch/arm/mach-mx6/board-mx6q_sabreauto.c
arch/arm/mach-mx6/board-mx6q_sabreauto.h
arch/arm/mach-mx6/board-mx6q_sabrelite.c
arch/arm/mach-mx6/board-mx6q_sabresd.c
arch/arm/mach-mx6/board-mx6q_sabresd.h
arch/arm/mach-mx6/clock.c
arch/arm/mach-mx6/pcie.c
arch/arm/plat-mxc/include/mach/iomux-mx6q.h
arch/arm/plat-mxc/include/mach/pcie.h
drivers/dma/imx-sdma.c
drivers/input/touchscreen/egalax_ts.c
drivers/media/video/mxc/capture/csi_v4l2_capture.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
drivers/mxc/mlb/mxc_mlb150.c
drivers/mxc/thermal/thermal.c
drivers/net/fec.c
drivers/usb/host/ehci-arc.c
drivers/video/mxc/mxc_ipuv3_fb.c
include/linux/fec.h
sound/soc/imx/imx-wm8962.c
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/imx/imx-si4763.c | 4 | ||||
-rw-r--r-- | sound/soc/imx/imx-wm8962.c | 65 |
2 files changed, 63 insertions, 6 deletions
diff --git a/sound/soc/imx/imx-si4763.c b/sound/soc/imx/imx-si4763.c index 1dd50e769235..7b2458edffa8 100644 --- a/sound/soc/imx/imx-si4763.c +++ b/sound/soc/imx/imx-si4763.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2012 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2008-2013 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -131,7 +131,7 @@ static struct snd_soc_card snd_soc_card_imx_3stack = { .num_links = 1, }; -static int __init imx_3stack_si4763_probe(struct platform_device *pdev) +static int __devinit imx_3stack_si4763_probe(struct platform_device *pdev) { struct mxc_audio_platform_data *plat = pdev->dev.platform_data; diff --git a/sound/soc/imx/imx-wm8962.c b/sound/soc/imx/imx-wm8962.c index 50da297c50f4..fed3a7f1e07d 100644 --- a/sound/soc/imx/imx-wm8962.c +++ b/sound/soc/imx/imx-wm8962.c @@ -117,6 +117,56 @@ static void imx_hifi_shutdown(struct snd_pcm_substream *substream) return; } +static int check_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct imx_priv *priv = &card_priv; + unsigned int channels = params_channels(params); + unsigned int sample_rate = params_rate(params); + snd_pcm_format_t sample_format = params_format(params); + + substream->runtime->sample_bits = + snd_pcm_format_physical_width(sample_format); + substream->runtime->rate = sample_rate; + substream->runtime->format = sample_format; + substream->runtime->channels = channels; + + if (!priv->first_stream) { + priv->first_stream = substream; + } else { + priv->second_stream = substream; + + /* Check two sample rates of two streams */ + if (priv->first_stream->runtime->rate != + priv->second_stream->runtime->rate) { + pr_err("\n!KEEP THE SAME SAMPLE RATE: %d!\n", + priv->first_stream->runtime->rate); + return -EINVAL; + } + + /* Check two sample bits of two streams */ + if (priv->first_stream->runtime->sample_bits != + priv->second_stream->runtime->sample_bits) { + snd_pcm_format_t first_format = + priv->first_stream->runtime->format; + + pr_err("\n!KEEP THE SAME FORMAT: %s!\n", + snd_pcm_format_name(first_format)); + return -EINVAL; + } + + /* Check two channel numbers of two streams */ + if (priv->first_stream->runtime->channels != + priv->second_stream->runtime->channels) { + pr_err("\n!KEEP THE SAME CHANNEL NUMBER: %d!\n", + priv->first_stream->runtime->channels); + return -EINVAL; + } + } + + return 0; +} + static int imx_hifi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -130,10 +180,17 @@ static int imx_hifi_hw_params(struct snd_pcm_substream *substream, u32 dai_format; unsigned int pll_out; - if (!priv->first_stream) - priv->first_stream = substream; - else - priv->second_stream = substream; + /* + * WM8962 doesn't support two substreams in different parameters + * (i.e. different sample rates, audio formats, channel numbers) + * So we here check the three parameters above of two substreams + * if they are running in the same time. + */ + ret = check_hw_params(substream, params); + if (ret < 0) { + pr_err("Failed to match hw params: %d\n", ret); + return ret; + } dai_format = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM; |