2018-07-24 12:48:30 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// Freescale Generic ASoC Sound Card driver with ASRC
|
|
|
|
//
|
|
|
|
// Copyright (C) 2014 Freescale Semiconductor, Inc.
|
|
|
|
//
|
|
|
|
// Author: Nicolin Chen <nicoleotsuka@gmail.com>
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/of_platform.h>
|
2015-09-19 00:00:25 +00:00
|
|
|
#if IS_ENABLED(CONFIG_SND_AC97_CODEC)
|
|
|
|
#include <sound/ac97_codec.h>
|
|
|
|
#endif
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
#include <sound/pcm_params.h>
|
|
|
|
#include <sound/soc.h>
|
2020-07-15 14:09:39 +00:00
|
|
|
#include <sound/jack.h>
|
|
|
|
#include <sound/simple_card_utils.h>
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
|
|
|
#include "fsl_esai.h"
|
|
|
|
#include "fsl_sai.h"
|
|
|
|
#include "imx-audmux.h"
|
|
|
|
|
|
|
|
#include "../codecs/sgtl5000.h"
|
|
|
|
#include "../codecs/wm8962.h"
|
2015-08-14 11:11:09 +00:00
|
|
|
#include "../codecs/wm8960.h"
|
2021-03-17 13:05:02 +00:00
|
|
|
#include "../codecs/wm8994.h"
|
2021-11-19 15:32:48 +00:00
|
|
|
#include "../codecs/tlv320aic31xx.h"
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
2016-01-29 11:01:00 +00:00
|
|
|
#define CS427x_SYSCLK_MCLK 0
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
#define RX 0
|
|
|
|
#define TX 1
|
|
|
|
|
|
|
|
/* Default DAI format without Master and Slave flag */
|
|
|
|
#define DAI_FMT_BASE (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF)
|
|
|
|
|
|
|
|
/**
|
2020-07-02 19:21:38 +00:00
|
|
|
* struct codec_priv - CODEC private data
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
* @mclk_freq: Clock rate of MCLK
|
2021-03-17 13:05:02 +00:00
|
|
|
* @free_freq: Clock rate of MCLK for hw_free()
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
* @mclk_id: MCLK (or main clock) id for set_sysclk()
|
|
|
|
* @fll_id: FLL (or secordary clock) id for set_sysclk()
|
|
|
|
* @pll_id: PLL id for set_pll()
|
|
|
|
*/
|
|
|
|
struct codec_priv {
|
|
|
|
unsigned long mclk_freq;
|
2021-03-17 13:05:02 +00:00
|
|
|
unsigned long free_freq;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
u32 mclk_id;
|
|
|
|
u32 fll_id;
|
|
|
|
u32 pll_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-07-02 19:21:38 +00:00
|
|
|
* struct cpu_priv - CPU private data
|
|
|
|
* @sysclk_freq: SYSCLK rates for set_sysclk()
|
|
|
|
* @sysclk_dir: SYSCLK directions for set_sysclk()
|
|
|
|
* @sysclk_id: SYSCLK ids for set_sysclk()
|
2014-10-24 23:48:13 +00:00
|
|
|
* @slot_width: Slot width of each frame
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
*
|
|
|
|
* Note: [1] for tx and [0] for rx
|
|
|
|
*/
|
|
|
|
struct cpu_priv {
|
|
|
|
unsigned long sysclk_freq[2];
|
|
|
|
u32 sysclk_dir[2];
|
|
|
|
u32 sysclk_id[2];
|
2014-10-24 23:48:13 +00:00
|
|
|
u32 slot_width;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-07-02 19:21:38 +00:00
|
|
|
* struct fsl_asoc_card_priv - Freescale Generic ASOC card private data
|
|
|
|
* @dai_link: DAI link structure including normal one and DPCM link
|
2020-07-15 14:09:39 +00:00
|
|
|
* @hp_jack: Headphone Jack structure
|
|
|
|
* @mic_jack: Microphone Jack structure
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
* @pdev: platform device pointer
|
|
|
|
* @codec_priv: CODEC private data
|
|
|
|
* @cpu_priv: CPU private data
|
|
|
|
* @card: ASoC card structure
|
2020-08-03 02:13:31 +00:00
|
|
|
* @streams: Mask of current active streams
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
* @sample_rate: Current sample rate
|
|
|
|
* @sample_format: Current sample format
|
|
|
|
* @asrc_rate: ASRC sample rate used by Back-Ends
|
|
|
|
* @asrc_format: ASRC sample format used by Back-Ends
|
|
|
|
* @dai_fmt: DAI format between CPU and CODEC
|
|
|
|
* @name: Card name
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct fsl_asoc_card_priv {
|
|
|
|
struct snd_soc_dai_link dai_link[3];
|
2020-07-15 14:09:39 +00:00
|
|
|
struct asoc_simple_jack hp_jack;
|
|
|
|
struct asoc_simple_jack mic_jack;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
struct platform_device *pdev;
|
|
|
|
struct codec_priv codec_priv;
|
|
|
|
struct cpu_priv cpu_priv;
|
|
|
|
struct snd_soc_card card;
|
2020-08-03 02:13:31 +00:00
|
|
|
u8 streams;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
u32 sample_rate;
|
2018-02-11 21:53:18 +00:00
|
|
|
snd_pcm_format_t sample_format;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
u32 asrc_rate;
|
2018-02-11 21:53:18 +00:00
|
|
|
snd_pcm_format_t asrc_format;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
u32 dai_fmt;
|
|
|
|
char name[32];
|
|
|
|
};
|
|
|
|
|
2020-07-02 19:21:38 +00:00
|
|
|
/*
|
2020-07-15 15:00:09 +00:00
|
|
|
* This dapm route map exists for DPCM link only.
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
* The other routes shall go through Device Tree.
|
2016-01-31 07:07:00 +00:00
|
|
|
*
|
|
|
|
* Note: keep all ASRC routes in the second half
|
|
|
|
* to drop them easily for non-ASRC cases.
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
*/
|
|
|
|
static const struct snd_soc_dapm_route audio_map[] = {
|
2016-01-31 07:07:00 +00:00
|
|
|
/* 1st half -- Normal DAPM routes */
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
{"Playback", NULL, "CPU-Playback"},
|
|
|
|
{"CPU-Capture", NULL, "Capture"},
|
2016-01-31 07:07:00 +00:00
|
|
|
/* 2nd half -- ASRC DAPM routes */
|
|
|
|
{"CPU-Playback", NULL, "ASRC-Playback"},
|
|
|
|
{"ASRC-Capture", NULL, "CPU-Capture"},
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
};
|
|
|
|
|
2015-12-20 20:34:29 +00:00
|
|
|
static const struct snd_soc_dapm_route audio_map_ac97[] = {
|
2016-01-31 07:07:00 +00:00
|
|
|
/* 1st half -- Normal DAPM routes */
|
2015-12-20 20:34:29 +00:00
|
|
|
{"Playback", NULL, "AC97 Playback"},
|
|
|
|
{"AC97 Capture", NULL, "Capture"},
|
2016-01-31 07:07:00 +00:00
|
|
|
/* 2nd half -- ASRC DAPM routes */
|
|
|
|
{"AC97 Playback", NULL, "ASRC-Playback"},
|
|
|
|
{"ASRC-Capture", NULL, "AC97 Capture"},
|
2015-12-20 20:34:29 +00:00
|
|
|
};
|
|
|
|
|
2020-06-17 04:48:25 +00:00
|
|
|
static const struct snd_soc_dapm_route audio_map_tx[] = {
|
|
|
|
/* 1st half -- Normal DAPM routes */
|
|
|
|
{"Playback", NULL, "CPU-Playback"},
|
|
|
|
/* 2nd half -- ASRC DAPM routes */
|
|
|
|
{"CPU-Playback", NULL, "ASRC-Playback"},
|
|
|
|
};
|
|
|
|
|
2020-11-30 03:57:47 +00:00
|
|
|
static const struct snd_soc_dapm_route audio_map_rx[] = {
|
|
|
|
/* 1st half -- Normal DAPM routes */
|
|
|
|
{"CPU-Capture", NULL, "Capture"},
|
|
|
|
/* 2nd half -- ASRC DAPM routes */
|
|
|
|
{"ASRC-Capture", NULL, "CPU-Capture"},
|
|
|
|
};
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
/* Add all possible widgets into here without being redundant */
|
|
|
|
static const struct snd_soc_dapm_widget fsl_asoc_card_dapm_widgets[] = {
|
|
|
|
SND_SOC_DAPM_LINE("Line Out Jack", NULL),
|
|
|
|
SND_SOC_DAPM_LINE("Line In Jack", NULL),
|
|
|
|
SND_SOC_DAPM_HP("Headphone Jack", NULL),
|
|
|
|
SND_SOC_DAPM_SPK("Ext Spk", NULL),
|
|
|
|
SND_SOC_DAPM_MIC("Mic Jack", NULL),
|
|
|
|
SND_SOC_DAPM_MIC("AMIC", NULL),
|
|
|
|
SND_SOC_DAPM_MIC("DMIC", NULL),
|
|
|
|
};
|
|
|
|
|
2015-09-19 00:00:25 +00:00
|
|
|
static bool fsl_asoc_card_is_ac97(struct fsl_asoc_card_priv *priv)
|
|
|
|
{
|
|
|
|
return priv->dai_fmt == SND_SOC_DAIFMT_AC97;
|
|
|
|
}
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *params)
|
|
|
|
{
|
2020-07-20 01:18:38 +00:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
|
|
|
|
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
2020-08-03 02:13:31 +00:00
|
|
|
struct codec_priv *codec_priv = &priv->codec_priv;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
struct cpu_priv *cpu_priv = &priv->cpu_priv;
|
|
|
|
struct device *dev = rtd->card->dev;
|
2020-08-03 02:13:31 +00:00
|
|
|
unsigned int pll_out;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
priv->sample_rate = params_rate(params);
|
|
|
|
priv->sample_format = params_format(params);
|
2020-08-03 02:13:31 +00:00
|
|
|
priv->streams |= BIT(substream->stream);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
2020-08-03 02:13:31 +00:00
|
|
|
if (fsl_asoc_card_is_ac97(priv))
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Specific configurations of DAIs starts from here */
|
2020-03-23 05:18:30 +00:00
|
|
|
ret = snd_soc_dai_set_sysclk(asoc_rtd_to_cpu(rtd, 0), cpu_priv->sysclk_id[tx],
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
cpu_priv->sysclk_freq[tx],
|
|
|
|
cpu_priv->sysclk_dir[tx]);
|
2017-09-08 05:27:33 +00:00
|
|
|
if (ret && ret != -ENOTSUPP) {
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
dev_err(dev, "failed to set sysclk for cpu dai\n");
|
2020-08-03 02:13:31 +00:00
|
|
|
goto fail;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
2014-10-24 23:48:13 +00:00
|
|
|
if (cpu_priv->slot_width) {
|
2020-03-23 05:18:30 +00:00
|
|
|
ret = snd_soc_dai_set_tdm_slot(asoc_rtd_to_cpu(rtd, 0), 0x3, 0x3, 2,
|
2014-10-24 23:48:13 +00:00
|
|
|
cpu_priv->slot_width);
|
2017-09-08 05:27:33 +00:00
|
|
|
if (ret && ret != -ENOTSUPP) {
|
2014-10-24 23:48:13 +00:00
|
|
|
dev_err(dev, "failed to set TDM slot for cpu dai\n");
|
2020-08-03 02:13:31 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Specific configuration for PLL */
|
|
|
|
if (codec_priv->pll_id && codec_priv->fll_id) {
|
|
|
|
if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
|
|
|
|
pll_out = priv->sample_rate * 384;
|
|
|
|
else
|
|
|
|
pll_out = priv->sample_rate * 256;
|
|
|
|
|
|
|
|
ret = snd_soc_dai_set_pll(asoc_rtd_to_codec(rtd, 0),
|
|
|
|
codec_priv->pll_id,
|
|
|
|
codec_priv->mclk_id,
|
|
|
|
codec_priv->mclk_freq, pll_out);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "failed to start FLL: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0),
|
|
|
|
codec_priv->fll_id,
|
|
|
|
pll_out, SND_SOC_CLOCK_IN);
|
|
|
|
|
|
|
|
if (ret && ret != -ENOTSUPP) {
|
|
|
|
dev_err(dev, "failed to set SYSCLK: %d\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
priv->streams &= ~BIT(substream->stream);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
|
|
|
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
|
|
|
|
struct codec_priv *codec_priv = &priv->codec_priv;
|
|
|
|
struct device *dev = rtd->card->dev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
priv->streams &= ~BIT(substream->stream);
|
|
|
|
|
|
|
|
if (!priv->streams && codec_priv->pll_id && codec_priv->fll_id) {
|
2021-03-17 13:05:02 +00:00
|
|
|
/* Force freq to be free_freq to avoid error message in codec */
|
2020-08-03 02:13:31 +00:00
|
|
|
ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0),
|
|
|
|
codec_priv->mclk_id,
|
2021-03-17 13:05:02 +00:00
|
|
|
codec_priv->free_freq,
|
2020-08-03 02:13:31 +00:00
|
|
|
SND_SOC_CLOCK_IN);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "failed to switch away from FLL: %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = snd_soc_dai_set_pll(asoc_rtd_to_codec(rtd, 0),
|
|
|
|
codec_priv->pll_id, 0, 0, 0);
|
|
|
|
if (ret && ret != -ENOTSUPP) {
|
|
|
|
dev_err(dev, "failed to stop FLL: %d\n", ret);
|
2014-10-24 23:48:13 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-15 14:55:50 +00:00
|
|
|
static const struct snd_soc_ops fsl_asoc_card_ops = {
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
.hw_params = fsl_asoc_card_hw_params,
|
2020-08-03 02:13:31 +00:00
|
|
|
.hw_free = fsl_asoc_card_hw_free,
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|
|
|
struct snd_pcm_hw_params *params)
|
|
|
|
{
|
|
|
|
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
|
|
|
|
struct snd_interval *rate;
|
|
|
|
struct snd_mask *mask;
|
|
|
|
|
|
|
|
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
|
|
|
|
rate->max = rate->min = priv->asrc_rate;
|
|
|
|
|
|
|
|
mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
|
|
|
snd_mask_none(mask);
|
2018-07-25 21:17:20 +00:00
|
|
|
snd_mask_set_format(mask, priv->asrc_format);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-06-06 04:15:11 +00:00
|
|
|
SND_SOC_DAILINK_DEFS(hifi,
|
2019-06-28 01:47:18 +00:00
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()),
|
2019-06-06 04:15:11 +00:00
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()),
|
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()));
|
|
|
|
|
|
|
|
SND_SOC_DAILINK_DEFS(hifi_fe,
|
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()),
|
2019-06-28 01:47:18 +00:00
|
|
|
DAILINK_COMP_ARRAY(COMP_DUMMY()),
|
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()));
|
2019-06-06 04:15:11 +00:00
|
|
|
|
|
|
|
SND_SOC_DAILINK_DEFS(hifi_be,
|
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()),
|
|
|
|
DAILINK_COMP_ARRAY(COMP_EMPTY()),
|
|
|
|
DAILINK_COMP_ARRAY(COMP_DUMMY()));
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
static struct snd_soc_dai_link fsl_asoc_card_dai[] = {
|
|
|
|
/* Default ASoC DAI Link*/
|
|
|
|
{
|
|
|
|
.name = "HiFi",
|
|
|
|
.stream_name = "HiFi",
|
|
|
|
.ops = &fsl_asoc_card_ops,
|
2019-06-06 04:15:11 +00:00
|
|
|
SND_SOC_DAILINK_REG(hifi),
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
},
|
|
|
|
/* DPCM Link between Front-End and Back-End (Optional) */
|
|
|
|
{
|
|
|
|
.name = "HiFi-ASRC-FE",
|
|
|
|
.stream_name = "HiFi-ASRC-FE",
|
|
|
|
.dpcm_playback = 1,
|
|
|
|
.dpcm_capture = 1,
|
|
|
|
.dynamic = 1,
|
2019-06-06 04:15:11 +00:00
|
|
|
SND_SOC_DAILINK_REG(hifi_fe),
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "HiFi-ASRC-BE",
|
|
|
|
.stream_name = "HiFi-ASRC-BE",
|
|
|
|
.be_hw_params_fixup = be_hw_params_fixup,
|
|
|
|
.ops = &fsl_asoc_card_ops,
|
|
|
|
.dpcm_playback = 1,
|
|
|
|
.dpcm_capture = 1,
|
|
|
|
.no_pcm = 1,
|
2019-06-06 04:15:11 +00:00
|
|
|
SND_SOC_DAILINK_REG(hifi_be),
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static int fsl_asoc_card_audmux_init(struct device_node *np,
|
|
|
|
struct fsl_asoc_card_priv *priv)
|
|
|
|
{
|
|
|
|
struct device *dev = &priv->pdev->dev;
|
|
|
|
u32 int_ptcr = 0, ext_ptcr = 0;
|
|
|
|
int int_port, ext_port;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = of_property_read_u32(np, "mux-int-port", &int_port);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "mux-int-port missing or invalid\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
ret = of_property_read_u32(np, "mux-ext-port", &ext_port);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "mux-ext-port missing or invalid\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The port numbering in the hardware manual starts at 1, while
|
|
|
|
* the AUDMUX API expects it starts at 0.
|
|
|
|
*/
|
|
|
|
int_port--;
|
|
|
|
ext_port--;
|
|
|
|
|
|
|
|
/*
|
2015-09-19 00:00:25 +00:00
|
|
|
* Use asynchronous mode (6 wires) for all cases except AC97.
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
* If only 4 wires are needed, just set SSI into
|
|
|
|
* synchronous mode and enable 4 PADs in IOMUX.
|
|
|
|
*/
|
2021-09-21 21:35:28 +00:00
|
|
|
switch (priv->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
|
|
|
case SND_SOC_DAIFMT_CBP_CFP:
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
int_ptcr = IMX_AUDMUX_V2_PTCR_RFSEL(8 | ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RCSEL(8 | ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RFSDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RCLKDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCLKDIR;
|
|
|
|
break;
|
2021-09-21 21:35:28 +00:00
|
|
|
case SND_SOC_DAIFMT_CBP_CFC:
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
int_ptcr = IMX_AUDMUX_V2_PTCR_RCSEL(8 | ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RCLKDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCLKDIR;
|
|
|
|
ext_ptcr = IMX_AUDMUX_V2_PTCR_RFSEL(8 | int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSEL(int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RFSDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSDIR;
|
|
|
|
break;
|
2021-09-21 21:35:28 +00:00
|
|
|
case SND_SOC_DAIFMT_CBC_CFP:
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
int_ptcr = IMX_AUDMUX_V2_PTCR_RFSEL(8 | ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RFSDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSDIR;
|
|
|
|
ext_ptcr = IMX_AUDMUX_V2_PTCR_RCSEL(8 | int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCSEL(int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RCLKDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCLKDIR;
|
|
|
|
break;
|
2021-09-21 21:35:28 +00:00
|
|
|
case SND_SOC_DAIFMT_CBC_CFC:
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
ext_ptcr = IMX_AUDMUX_V2_PTCR_RFSEL(8 | int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RCSEL(8 | int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSEL(int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCSEL(int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RFSDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_RCLKDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSDIR |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCLKDIR;
|
|
|
|
break;
|
|
|
|
default:
|
2015-09-19 00:00:25 +00:00
|
|
|
if (!fsl_asoc_card_is_ac97(priv))
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fsl_asoc_card_is_ac97(priv)) {
|
|
|
|
int_ptcr = IMX_AUDMUX_V2_PTCR_SYN |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TCLKDIR;
|
|
|
|
ext_ptcr = IMX_AUDMUX_V2_PTCR_SYN |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSEL(int_port) |
|
|
|
|
IMX_AUDMUX_V2_PTCR_TFSDIR;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Asynchronous mode can not be set along with RCLKDIR */
|
2015-09-19 00:00:25 +00:00
|
|
|
if (!fsl_asoc_card_is_ac97(priv)) {
|
|
|
|
unsigned int pdcr =
|
|
|
|
IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port);
|
|
|
|
|
|
|
|
ret = imx_audmux_v2_configure_port(int_port, 0,
|
|
|
|
pdcr);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "audmux internal port setup failed\n");
|
|
|
|
return ret;
|
|
|
|
}
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = imx_audmux_v2_configure_port(int_port, int_ptcr,
|
|
|
|
IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "audmux internal port setup failed\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-09-19 00:00:25 +00:00
|
|
|
if (!fsl_asoc_card_is_ac97(priv)) {
|
|
|
|
unsigned int pdcr =
|
|
|
|
IMX_AUDMUX_V2_PDCR_RXDSEL(int_port);
|
|
|
|
|
|
|
|
ret = imx_audmux_v2_configure_port(ext_port, 0,
|
|
|
|
pdcr);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "audmux external port setup failed\n");
|
|
|
|
return ret;
|
|
|
|
}
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = imx_audmux_v2_configure_port(ext_port, ext_ptcr,
|
|
|
|
IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
|
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "audmux external port setup failed\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-07-15 14:09:39 +00:00
|
|
|
static int hp_jack_event(struct notifier_block *nb, unsigned long event,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
struct snd_soc_jack *jack = (struct snd_soc_jack *)data;
|
|
|
|
struct snd_soc_dapm_context *dapm = &jack->card->dapm;
|
|
|
|
|
|
|
|
if (event & SND_JACK_HEADPHONE)
|
|
|
|
/* Disable speaker if headphone is plugged in */
|
2022-03-21 06:57:54 +00:00
|
|
|
return snd_soc_dapm_disable_pin(dapm, "Ext Spk");
|
2020-07-15 14:09:39 +00:00
|
|
|
else
|
2022-03-21 06:57:54 +00:00
|
|
|
return snd_soc_dapm_enable_pin(dapm, "Ext Spk");
|
2020-07-15 14:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct notifier_block hp_jack_nb = {
|
|
|
|
.notifier_call = hp_jack_event,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int mic_jack_event(struct notifier_block *nb, unsigned long event,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
struct snd_soc_jack *jack = (struct snd_soc_jack *)data;
|
|
|
|
struct snd_soc_dapm_context *dapm = &jack->card->dapm;
|
|
|
|
|
|
|
|
if (event & SND_JACK_MICROPHONE)
|
|
|
|
/* Disable dmic if microphone is plugged in */
|
2022-03-21 06:57:54 +00:00
|
|
|
return snd_soc_dapm_disable_pin(dapm, "DMIC");
|
2020-07-15 14:09:39 +00:00
|
|
|
else
|
2022-03-21 06:57:54 +00:00
|
|
|
return snd_soc_dapm_enable_pin(dapm, "DMIC");
|
2020-07-15 14:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct notifier_block mic_jack_nb = {
|
|
|
|
.notifier_call = mic_jack_event,
|
|
|
|
};
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
|
|
|
|
{
|
|
|
|
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card);
|
2015-11-20 17:15:20 +00:00
|
|
|
struct snd_soc_pcm_runtime *rtd = list_first_entry(
|
|
|
|
&card->rtd_list, struct snd_soc_pcm_runtime, list);
|
2020-03-23 05:18:30 +00:00
|
|
|
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
struct codec_priv *codec_priv = &priv->codec_priv;
|
|
|
|
struct device *dev = card->dev;
|
|
|
|
int ret;
|
|
|
|
|
2015-09-19 00:00:25 +00:00
|
|
|
if (fsl_asoc_card_is_ac97(priv)) {
|
|
|
|
#if IS_ENABLED(CONFIG_SND_AC97_CODEC)
|
2020-03-23 05:18:30 +00:00
|
|
|
struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
|
2017-12-05 04:23:21 +00:00
|
|
|
struct snd_ac97 *ac97 = snd_soc_component_get_drvdata(component);
|
2015-09-19 00:00:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Use slots 3/4 for S/PDIF so SSI won't try to enable
|
|
|
|
* other slots and send some samples there
|
|
|
|
* due to SLOTREQ bits for S/PDIF received from codec
|
|
|
|
*/
|
|
|
|
snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS,
|
|
|
|
AC97_EA_SPSA_SLOT_MASK, AC97_EA_SPSA_3_4);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id,
|
|
|
|
codec_priv->mclk_freq, SND_SOC_CLOCK_IN);
|
2017-09-08 05:27:33 +00:00
|
|
|
if (ret && ret != -ENOTSUPP) {
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
dev_err(dev, "failed to set sysclk in %s\n", __func__);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int fsl_asoc_card_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct device_node *cpu_np, *codec_np, *asrc_np;
|
|
|
|
struct device_node *np = pdev->dev.of_node;
|
|
|
|
struct platform_device *asrc_pdev = NULL;
|
2021-09-21 21:35:28 +00:00
|
|
|
struct device_node *bitclkprovider = NULL;
|
|
|
|
struct device_node *frameprovider = NULL;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
struct platform_device *cpu_pdev;
|
|
|
|
struct fsl_asoc_card_priv *priv;
|
2020-06-17 04:48:25 +00:00
|
|
|
struct device *codec_dev = NULL;
|
2015-08-12 20:06:12 +00:00
|
|
|
const char *codec_dai_name;
|
2020-06-17 04:48:25 +00:00
|
|
|
const char *codec_dev_name;
|
2022-07-21 10:29:51 +00:00
|
|
|
u32 asrc_fmt = 0;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
u32 width;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
|
|
|
if (!priv)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
cpu_np = of_parse_phandle(np, "audio-cpu", 0);
|
|
|
|
/* Give a chance to old DT binding */
|
|
|
|
if (!cpu_np)
|
|
|
|
cpu_np = of_parse_phandle(np, "ssi-controller", 0);
|
2015-09-19 00:00:25 +00:00
|
|
|
if (!cpu_np) {
|
|
|
|
dev_err(&pdev->dev, "CPU phandle missing or invalid\n");
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
ret = -EINVAL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
cpu_pdev = of_find_device_by_node(cpu_np);
|
|
|
|
if (!cpu_pdev) {
|
|
|
|
dev_err(&pdev->dev, "failed to find CPU DAI device\n");
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2015-09-19 00:00:25 +00:00
|
|
|
codec_np = of_parse_phandle(np, "audio-codec", 0);
|
2020-06-17 04:48:25 +00:00
|
|
|
if (codec_np) {
|
|
|
|
struct platform_device *codec_pdev;
|
|
|
|
struct i2c_client *codec_i2c;
|
|
|
|
|
|
|
|
codec_i2c = of_find_i2c_device_by_node(codec_np);
|
|
|
|
if (codec_i2c) {
|
|
|
|
codec_dev = &codec_i2c->dev;
|
|
|
|
codec_dev_name = codec_i2c->name;
|
|
|
|
}
|
|
|
|
if (!codec_dev) {
|
|
|
|
codec_pdev = of_find_device_by_node(codec_np);
|
|
|
|
if (codec_pdev) {
|
|
|
|
codec_dev = &codec_pdev->dev;
|
|
|
|
codec_dev_name = codec_pdev->name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
|
|
|
asrc_np = of_parse_phandle(np, "audio-asrc", 0);
|
|
|
|
if (asrc_np)
|
|
|
|
asrc_pdev = of_find_device_by_node(asrc_np);
|
|
|
|
|
|
|
|
/* Get the MCLK rate only, and leave it controlled by CODEC drivers */
|
2015-09-19 00:00:25 +00:00
|
|
|
if (codec_dev) {
|
2020-06-17 04:48:25 +00:00
|
|
|
struct clk *codec_clk = clk_get(codec_dev, NULL);
|
2015-09-19 00:00:25 +00:00
|
|
|
|
|
|
|
if (!IS_ERR(codec_clk)) {
|
|
|
|
priv->codec_priv.mclk_freq = clk_get_rate(codec_clk);
|
|
|
|
clk_put(codec_clk);
|
|
|
|
}
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Default sample rate and format, will be updated in hw_params() */
|
|
|
|
priv->sample_rate = 44100;
|
|
|
|
priv->sample_format = SNDRV_PCM_FORMAT_S16_LE;
|
|
|
|
|
|
|
|
/* Assign a default DAI format, and allow each card to overwrite it */
|
|
|
|
priv->dai_fmt = DAI_FMT_BASE;
|
|
|
|
|
2020-06-17 04:48:25 +00:00
|
|
|
memcpy(priv->dai_link, fsl_asoc_card_dai,
|
|
|
|
sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link));
|
|
|
|
|
|
|
|
priv->card.dapm_routes = audio_map;
|
|
|
|
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
/* Diversify the card configurations */
|
|
|
|
if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
|
2015-08-12 20:06:12 +00:00
|
|
|
codec_dai_name = "cs42888";
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq;
|
|
|
|
priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq;
|
|
|
|
priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
|
|
|
|
priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT;
|
2014-10-24 23:48:13 +00:00
|
|
|
priv->cpu_priv.slot_width = 32;
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
|
2016-01-29 11:01:00 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-cs427x")) {
|
|
|
|
codec_dai_name = "cs4271-hifi";
|
|
|
|
priv->codec_priv.mclk_id = CS427x_SYSCLK_MCLK;
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
|
2015-08-12 20:06:12 +00:00
|
|
|
codec_dai_name = "sgtl5000";
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
2020-08-21 07:11:53 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic32x4")) {
|
|
|
|
codec_dai_name = "tlv320aic32x4-hifi";
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
2021-11-19 15:32:48 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic31xx")) {
|
|
|
|
codec_dai_name = "tlv320dac31xx-hifi";
|
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
|
|
|
|
priv->dai_link[1].dpcm_capture = 0;
|
|
|
|
priv->dai_link[2].dpcm_capture = 0;
|
|
|
|
priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
|
|
|
|
priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT;
|
|
|
|
priv->card.dapm_routes = audio_map_tx;
|
|
|
|
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) {
|
2015-08-12 20:06:12 +00:00
|
|
|
codec_dai_name = "wm8962";
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK;
|
|
|
|
priv->codec_priv.fll_id = WM8962_SYSCLK_FLL;
|
|
|
|
priv->codec_priv.pll_id = WM8962_FLL;
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
2015-08-14 11:11:09 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) {
|
|
|
|
codec_dai_name = "wm8960-hifi";
|
|
|
|
priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO;
|
|
|
|
priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO;
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
2015-09-19 00:00:25 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) {
|
|
|
|
codec_dai_name = "ac97-hifi";
|
|
|
|
priv->dai_fmt = SND_SOC_DAIFMT_AC97;
|
2020-06-17 04:48:25 +00:00
|
|
|
priv->card.dapm_routes = audio_map_ac97;
|
|
|
|
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_ac97);
|
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-mqs")) {
|
|
|
|
codec_dai_name = "fsl-mqs-dai";
|
|
|
|
priv->dai_fmt = SND_SOC_DAIFMT_LEFT_J |
|
2021-09-21 21:35:28 +00:00
|
|
|
SND_SOC_DAIFMT_CBC_CFC |
|
2020-06-17 04:48:25 +00:00
|
|
|
SND_SOC_DAIFMT_NB_NF;
|
|
|
|
priv->dai_link[1].dpcm_capture = 0;
|
|
|
|
priv->dai_link[2].dpcm_capture = 0;
|
|
|
|
priv->card.dapm_routes = audio_map_tx;
|
|
|
|
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
|
2020-06-23 06:52:46 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8524")) {
|
|
|
|
codec_dai_name = "wm8524-hifi";
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
|
2020-06-23 06:52:46 +00:00
|
|
|
priv->dai_link[1].dpcm_capture = 0;
|
|
|
|
priv->dai_link[2].dpcm_capture = 0;
|
|
|
|
priv->cpu_priv.slot_width = 32;
|
|
|
|
priv->card.dapm_routes = audio_map_tx;
|
|
|
|
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
|
2020-11-30 03:57:47 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-si476x")) {
|
|
|
|
codec_dai_name = "si476x-codec";
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
|
2020-11-30 03:57:47 +00:00
|
|
|
priv->card.dapm_routes = audio_map_rx;
|
|
|
|
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_rx);
|
2021-03-17 13:05:02 +00:00
|
|
|
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8958")) {
|
|
|
|
codec_dai_name = "wm8994-aif1";
|
2021-09-21 21:35:28 +00:00
|
|
|
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
2021-03-17 13:05:02 +00:00
|
|
|
priv->codec_priv.mclk_id = WM8994_FLL_SRC_MCLK1;
|
|
|
|
priv->codec_priv.fll_id = WM8994_SYSCLK_FLL1;
|
|
|
|
priv->codec_priv.pll_id = WM8994_FLL1;
|
|
|
|
priv->codec_priv.free_freq = priv->codec_priv.mclk_freq;
|
|
|
|
priv->card.dapm_routes = NULL;
|
|
|
|
priv->card.num_dapm_routes = 0;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
} else {
|
|
|
|
dev_err(&pdev->dev, "unknown Device Tree compatible\n");
|
2015-08-31 15:07:12 +00:00
|
|
|
ret = -EINVAL;
|
|
|
|
goto asrc_fail;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
2022-01-17 13:21:08 +00:00
|
|
|
/*
|
|
|
|
* Allow setting mclk-id from the device-tree node. Otherwise, the
|
|
|
|
* default value for each card configuration is used.
|
|
|
|
*/
|
|
|
|
of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id);
|
|
|
|
|
2020-07-21 03:41:49 +00:00
|
|
|
/* Format info from DT is optional. */
|
2021-09-21 21:35:28 +00:00
|
|
|
snd_soc_daifmt_parse_clock_provider_as_phandle(np, NULL, &bitclkprovider, &frameprovider);
|
|
|
|
if (bitclkprovider || frameprovider) {
|
2021-06-14 00:57:51 +00:00
|
|
|
unsigned int daifmt = snd_soc_daifmt_parse_format(np, NULL);
|
|
|
|
|
2021-09-21 21:35:28 +00:00
|
|
|
if (codec_np == bitclkprovider)
|
|
|
|
daifmt |= (codec_np == frameprovider) ?
|
|
|
|
SND_SOC_DAIFMT_CBP_CFP : SND_SOC_DAIFMT_CBP_CFC;
|
2020-07-21 03:41:49 +00:00
|
|
|
else
|
2021-09-21 21:35:28 +00:00
|
|
|
daifmt |= (codec_np == frameprovider) ?
|
|
|
|
SND_SOC_DAIFMT_CBC_CFP : SND_SOC_DAIFMT_CBC_CFC;
|
2020-07-21 03:41:49 +00:00
|
|
|
|
|
|
|
/* Override dai_fmt with value from DT */
|
|
|
|
priv->dai_fmt = daifmt;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Change direction according to format */
|
2021-09-21 21:35:28 +00:00
|
|
|
if (priv->dai_fmt & SND_SOC_DAIFMT_CBP_CFP) {
|
2020-07-21 03:41:49 +00:00
|
|
|
priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_IN;
|
|
|
|
priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_IN;
|
|
|
|
}
|
|
|
|
|
2021-09-21 21:35:28 +00:00
|
|
|
of_node_put(bitclkprovider);
|
|
|
|
of_node_put(frameprovider);
|
2020-07-21 03:41:49 +00:00
|
|
|
|
2015-09-19 00:00:25 +00:00
|
|
|
if (!fsl_asoc_card_is_ac97(priv) && !codec_dev) {
|
2021-06-02 06:42:12 +00:00
|
|
|
dev_dbg(&pdev->dev, "failed to find codec device\n");
|
2020-06-04 06:25:30 +00:00
|
|
|
ret = -EPROBE_DEFER;
|
2015-09-19 00:00:25 +00:00
|
|
|
goto asrc_fail;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Common settings for corresponding Freescale CPU DAI driver */
|
2018-12-05 19:50:49 +00:00
|
|
|
if (of_node_name_eq(cpu_np, "ssi")) {
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
/* Only SSI needs to configure AUDMUX */
|
|
|
|
ret = fsl_asoc_card_audmux_init(np, priv);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev, "failed to init audmux\n");
|
ASoC: fsl-asoc-card: Fix build warning for maybe-uninitialized
When build fsl-asoc-card as module, there is following error:
sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe':
>> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized]
of_node_put(asrc_np);
^
vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c
531 if (width == 24)
532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
533 else
534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
535 }
536
537 /* Finish card registering */
538 platform_set_drvdata(pdev, priv);
539 snd_soc_card_set_drvdata(&priv->card, priv);
540
541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
542 if (ret)
543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
544
545 fail:
546 of_node_put(codec_np);
> 547 of_node_put(asrc_np);
548 of_node_put(cpu_np);
549
550 return ret;
551 }
552
553 static const struct of_device_id fsl_asoc_card_dt_ids[] = {
554 { .compatible = "fsl,imx-audio-cs42888", },
555 { .compatible = "fsl,imx-audio-sgtl5000", },
Add 'asrc_fail' branch for error jump after asrc_np initialized.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-18 08:38:39 +00:00
|
|
|
goto asrc_fail;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
2018-12-05 19:50:49 +00:00
|
|
|
} else if (of_node_name_eq(cpu_np, "esai")) {
|
2020-08-10 08:11:43 +00:00
|
|
|
struct clk *esai_clk = clk_get(&cpu_pdev->dev, "extal");
|
|
|
|
|
|
|
|
if (!IS_ERR(esai_clk)) {
|
|
|
|
priv->cpu_priv.sysclk_freq[TX] = clk_get_rate(esai_clk);
|
|
|
|
priv->cpu_priv.sysclk_freq[RX] = clk_get_rate(esai_clk);
|
|
|
|
clk_put(esai_clk);
|
|
|
|
} else if (PTR_ERR(esai_clk) == -EPROBE_DEFER) {
|
|
|
|
ret = -EPROBE_DEFER;
|
|
|
|
goto asrc_fail;
|
|
|
|
}
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL;
|
|
|
|
priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL;
|
2018-12-05 19:50:49 +00:00
|
|
|
} else if (of_node_name_eq(cpu_np, "sai")) {
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->cpu_priv.sysclk_id[1] = FSL_SAI_CLK_MAST1;
|
|
|
|
priv->cpu_priv.sysclk_id[0] = FSL_SAI_CLK_MAST1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize sound card */
|
|
|
|
priv->pdev = pdev;
|
|
|
|
priv->card.dev = &pdev->dev;
|
2021-05-27 16:34:09 +00:00
|
|
|
priv->card.owner = THIS_MODULE;
|
2020-06-17 04:48:25 +00:00
|
|
|
ret = snd_soc_of_parse_card_name(&priv->card, "model");
|
|
|
|
if (ret) {
|
|
|
|
snprintf(priv->name, sizeof(priv->name), "%s-audio",
|
|
|
|
fsl_asoc_card_is_ac97(priv) ? "ac97" : codec_dev_name);
|
|
|
|
priv->card.name = priv->name;
|
|
|
|
}
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->card.dai_link = priv->dai_link;
|
|
|
|
priv->card.late_probe = fsl_asoc_card_late_probe;
|
|
|
|
priv->card.dapm_widgets = fsl_asoc_card_dapm_widgets;
|
|
|
|
priv->card.num_dapm_widgets = ARRAY_SIZE(fsl_asoc_card_dapm_widgets);
|
|
|
|
|
2016-01-31 07:07:00 +00:00
|
|
|
/* Drop the second half of DAPM routes -- ASRC */
|
|
|
|
if (!asrc_pdev)
|
|
|
|
priv->card.num_dapm_routes /= 2;
|
|
|
|
|
2020-06-17 04:48:25 +00:00
|
|
|
if (of_property_read_bool(np, "audio-routing")) {
|
|
|
|
ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing");
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret);
|
|
|
|
goto asrc_fail;
|
|
|
|
}
|
2015-02-15 01:22:50 +00:00
|
|
|
}
|
|
|
|
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
/* Normal DAI Link */
|
2019-06-06 04:15:11 +00:00
|
|
|
priv->dai_link[0].cpus->of_node = cpu_np;
|
|
|
|
priv->dai_link[0].codecs->dai_name = codec_dai_name;
|
2015-09-19 00:00:25 +00:00
|
|
|
|
|
|
|
if (!fsl_asoc_card_is_ac97(priv))
|
2019-06-06 04:15:11 +00:00
|
|
|
priv->dai_link[0].codecs->of_node = codec_np;
|
2015-09-19 00:00:25 +00:00
|
|
|
else {
|
|
|
|
u32 idx;
|
|
|
|
|
|
|
|
ret = of_property_read_u32(cpu_np, "cell-index", &idx);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"cannot get CPU index property\n");
|
|
|
|
goto asrc_fail;
|
|
|
|
}
|
|
|
|
|
2019-06-06 04:15:11 +00:00
|
|
|
priv->dai_link[0].codecs->name =
|
2015-09-19 00:00:25 +00:00
|
|
|
devm_kasprintf(&pdev->dev, GFP_KERNEL,
|
|
|
|
"ac97-codec.%u",
|
|
|
|
(unsigned int)idx);
|
2019-06-06 04:15:11 +00:00
|
|
|
if (!priv->dai_link[0].codecs->name) {
|
2017-09-21 05:20:03 +00:00
|
|
|
ret = -ENOMEM;
|
|
|
|
goto asrc_fail;
|
|
|
|
}
|
2015-09-19 00:00:25 +00:00
|
|
|
}
|
|
|
|
|
2019-06-28 01:47:18 +00:00
|
|
|
priv->dai_link[0].platforms->of_node = cpu_np;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->dai_link[0].dai_fmt = priv->dai_fmt;
|
|
|
|
priv->card.num_links = 1;
|
|
|
|
|
|
|
|
if (asrc_pdev) {
|
|
|
|
/* DPCM DAI Links only if ASRC exsits */
|
2019-06-06 04:15:11 +00:00
|
|
|
priv->dai_link[1].cpus->of_node = asrc_np;
|
2019-06-28 01:47:18 +00:00
|
|
|
priv->dai_link[1].platforms->of_node = asrc_np;
|
2019-06-06 04:15:11 +00:00
|
|
|
priv->dai_link[2].codecs->dai_name = codec_dai_name;
|
|
|
|
priv->dai_link[2].codecs->of_node = codec_np;
|
|
|
|
priv->dai_link[2].codecs->name =
|
|
|
|
priv->dai_link[0].codecs->name;
|
|
|
|
priv->dai_link[2].cpus->of_node = cpu_np;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
priv->dai_link[2].dai_fmt = priv->dai_fmt;
|
|
|
|
priv->card.num_links = 3;
|
|
|
|
|
|
|
|
ret = of_property_read_u32(asrc_np, "fsl,asrc-rate",
|
|
|
|
&priv->asrc_rate);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev, "failed to get output rate\n");
|
|
|
|
ret = -EINVAL;
|
ASoC: fsl-asoc-card: Fix build warning for maybe-uninitialized
When build fsl-asoc-card as module, there is following error:
sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe':
>> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized]
of_node_put(asrc_np);
^
vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c
531 if (width == 24)
532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
533 else
534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
535 }
536
537 /* Finish card registering */
538 platform_set_drvdata(pdev, priv);
539 snd_soc_card_set_drvdata(&priv->card, priv);
540
541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
542 if (ret)
543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
544
545 fail:
546 of_node_put(codec_np);
> 547 of_node_put(asrc_np);
548 of_node_put(cpu_np);
549
550 return ret;
551 }
552
553 static const struct of_device_id fsl_asoc_card_dt_ids[] = {
554 { .compatible = "fsl,imx-audio-cs42888", },
555 { .compatible = "fsl,imx-audio-sgtl5000", },
Add 'asrc_fail' branch for error jump after asrc_np initialized.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-18 08:38:39 +00:00
|
|
|
goto asrc_fail;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
|
2022-07-21 10:29:51 +00:00
|
|
|
ret = of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt);
|
|
|
|
priv->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
if (ret) {
|
2020-04-16 12:25:33 +00:00
|
|
|
/* Fallback to old binding; translate to asrc_format */
|
|
|
|
ret = of_property_read_u32(asrc_np, "fsl,asrc-width",
|
|
|
|
&width);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev,
|
|
|
|
"failed to decide output format\n");
|
|
|
|
goto asrc_fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (width == 24)
|
|
|
|
priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
|
|
|
|
else
|
|
|
|
priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finish card registering */
|
|
|
|
platform_set_drvdata(pdev, priv);
|
|
|
|
snd_soc_card_set_drvdata(&priv->card, priv);
|
|
|
|
|
|
|
|
ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
|
2020-07-15 14:09:39 +00:00
|
|
|
if (ret) {
|
2021-12-14 02:08:34 +00:00
|
|
|
dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
|
2020-07-15 14:09:39 +00:00
|
|
|
goto asrc_fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Properties "hp-det-gpio" and "mic-det-gpio" are optional, and
|
|
|
|
* asoc_simple_init_jack uses these properties for creating
|
|
|
|
* Headphone Jack and Microphone Jack.
|
|
|
|
*
|
|
|
|
* The notifier is initialized in snd_soc_card_jack_new(), then
|
|
|
|
* snd_soc_jack_notifier_register can be called.
|
|
|
|
*/
|
|
|
|
if (of_property_read_bool(np, "hp-det-gpio")) {
|
|
|
|
ret = asoc_simple_init_jack(&priv->card, &priv->hp_jack,
|
|
|
|
1, NULL, "Headphone Jack");
|
|
|
|
if (ret)
|
|
|
|
goto asrc_fail;
|
|
|
|
|
|
|
|
snd_soc_jack_notifier_register(&priv->hp_jack.jack, &hp_jack_nb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (of_property_read_bool(np, "mic-det-gpio")) {
|
|
|
|
ret = asoc_simple_init_jack(&priv->card, &priv->mic_jack,
|
|
|
|
0, NULL, "Mic Jack");
|
|
|
|
if (ret)
|
|
|
|
goto asrc_fail;
|
|
|
|
|
|
|
|
snd_soc_jack_notifier_register(&priv->mic_jack.jack, &mic_jack_nb);
|
|
|
|
}
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
ASoC: fsl-asoc-card: Fix build warning for maybe-uninitialized
When build fsl-asoc-card as module, there is following error:
sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe':
>> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized]
of_node_put(asrc_np);
^
vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c
531 if (width == 24)
532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
533 else
534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
535 }
536
537 /* Finish card registering */
538 platform_set_drvdata(pdev, priv);
539 snd_soc_card_set_drvdata(&priv->card, priv);
540
541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
542 if (ret)
543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
544
545 fail:
546 of_node_put(codec_np);
> 547 of_node_put(asrc_np);
548 of_node_put(cpu_np);
549
550 return ret;
551 }
552
553 static const struct of_device_id fsl_asoc_card_dt_ids[] = {
554 { .compatible = "fsl,imx-audio-cs42888", },
555 { .compatible = "fsl,imx-audio-sgtl5000", },
Add 'asrc_fail' branch for error jump after asrc_np initialized.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-18 08:38:39 +00:00
|
|
|
asrc_fail:
|
|
|
|
of_node_put(asrc_np);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
of_node_put(codec_np);
|
2019-02-02 14:53:16 +00:00
|
|
|
put_device(&cpu_pdev->dev);
|
2015-09-19 00:00:25 +00:00
|
|
|
fail:
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
of_node_put(cpu_np);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id fsl_asoc_card_dt_ids[] = {
|
2015-09-19 00:00:25 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-ac97", },
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-cs42888", },
|
2016-01-29 11:01:00 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-cs427x", },
|
2020-08-21 07:11:53 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-tlv320aic32x4", },
|
2021-11-19 15:32:48 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-tlv320aic31xx", },
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-sgtl5000", },
|
|
|
|
{ .compatible = "fsl,imx-audio-wm8962", },
|
2015-08-14 11:11:09 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-wm8960", },
|
2020-06-17 04:48:25 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-mqs", },
|
2020-06-23 06:52:46 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-wm8524", },
|
2020-11-30 03:57:47 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-si476x", },
|
2021-03-17 13:05:02 +00:00
|
|
|
{ .compatible = "fsl,imx-audio-wm8958", },
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
{}
|
|
|
|
};
|
2015-09-03 10:57:47 +00:00
|
|
|
MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids);
|
ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.
The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.
So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.
The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.
As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver
The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-30 11:27:38 +00:00
|
|
|
|
|
|
|
static struct platform_driver fsl_asoc_card_driver = {
|
|
|
|
.probe = fsl_asoc_card_probe,
|
|
|
|
.driver = {
|
|
|
|
.name = "fsl-asoc-card",
|
|
|
|
.pm = &snd_soc_pm_ops,
|
|
|
|
.of_match_table = fsl_asoc_card_dt_ids,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
module_platform_driver(fsl_asoc_card_driver);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("Freescale Generic ASoC Sound Card driver with ASRC");
|
|
|
|
MODULE_AUTHOR("Nicolin Chen <nicoleotsuka@gmail.com>");
|
|
|
|
MODULE_ALIAS("platform:fsl-asoc-card");
|
|
|
|
MODULE_LICENSE("GPL");
|