From db5ff9541b61ef8394bad0fb05508921b8c5b17b Mon Sep 17 00:00:00 2001 From: Nicolin Chen Date: Wed, 31 Jul 2013 20:07:05 +0800 Subject: [PATCH 1/4] ASoC: spdif: Add S20_3LE and S24_LE support for dummy codec drivers Generally, S/PDIF supports 20bit and optional 24bit samples. Thus add these two formats for the dummy codec drivers. If one S/PDIF controller has its own limitation, its CPU DAI driver should set the supported format by its own circumstance, since the soc-pcm driver will use the intersection of cpu_dai's formats and codec_dai's formats. Signed-off-by: Nicolin Chen Signed-off-by: Mark Brown --- sound/soc/codecs/spdif_receiver.c | 2 ++ sound/soc/codecs/spdif_transmitter.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/spdif_receiver.c b/sound/soc/codecs/spdif_receiver.c index e9d7881ed2c8..26d34744c677 100644 --- a/sound/soc/codecs/spdif_receiver.c +++ b/sound/soc/codecs/spdif_receiver.c @@ -25,6 +25,8 @@ #define STUB_RATES SNDRV_PCM_RATE_8000_192000 #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) static struct snd_soc_codec_driver soc_codec_spdif_dir; diff --git a/sound/soc/codecs/spdif_transmitter.c b/sound/soc/codecs/spdif_transmitter.c index 18280499fd55..efc3d88d7f8c 100644 --- a/sound/soc/codecs/spdif_transmitter.c +++ b/sound/soc/codecs/spdif_transmitter.c @@ -25,8 +25,9 @@ #define DRV_NAME "spdif-dit" #define STUB_RATES SNDRV_PCM_RATE_8000_96000 -#define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE - +#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE) static struct snd_soc_codec_driver soc_codec_spdif_dit; From 6ad709482e151068b7197f4572edeeae5eeaff93 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 4 Aug 2013 20:32:04 +0100 Subject: [PATCH 2/4] ASoC: spdif_transceiver: add output pin widget CODECs without any outputs now remain powered down, which means any paths to these codecs also remain powered down. Add an always-enabled output pin widget to the spdif transceiver codec. This enables DAPM to correctly identify that the spdif transceiver is in use when playback is enabled, which will then allow DAPM to power up any links from the CPU DAI to the S/PDIF transceiver. Signed-off-by: Russell King Signed-off-by: Mark Brown --- sound/soc/codecs/spdif_transmitter.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/spdif_transmitter.c b/sound/soc/codecs/spdif_transmitter.c index efc3d88d7f8c..4e96d10d61a2 100644 --- a/sound/soc/codecs/spdif_transmitter.c +++ b/sound/soc/codecs/spdif_transmitter.c @@ -29,7 +29,20 @@ SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_codec_driver soc_codec_spdif_dit; +static const struct snd_soc_dapm_widget dit_widgets[] = { + SND_SOC_DAPM_OUTPUT("spdif-out"), +}; + +static const const struct snd_soc_dapm_route dit_routes[] = { + { "spdif-out", NULL, "Playback" }, +}; + +static struct snd_soc_codec_driver soc_codec_spdif_dit = { + .dapm_widgets = dit_widgets, + .num_dapm_widgets = ARRAY_SIZE(dit_widgets), + .dapm_routes = dit_routes, + .num_dapm_routes = ARRAY_SIZE(dit_routes), +}; static struct snd_soc_dai_driver dit_stub_dai = { .name = "dit-hifi", From 2f6e3ba0e0645011cbbd0289e9082d8007141498 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 19 Aug 2013 12:09:39 +0100 Subject: [PATCH 3/4] ASoC: spdif: Add stub DAPM widgets for Rx Ensure that the driver continues to work with mandatory DAPM. Signed-off-by: Mark Brown --- sound/soc/codecs/spdif_receiver.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/spdif_receiver.c b/sound/soc/codecs/spdif_receiver.c index 26d34744c677..e3501f40c7b3 100644 --- a/sound/soc/codecs/spdif_receiver.c +++ b/sound/soc/codecs/spdif_receiver.c @@ -23,13 +23,26 @@ #include #include +static const struct snd_soc_dapm_widget dir_widgets[] = { + SND_SOC_DAPM_INPUT("spdif-in"), +}; + +static const struct snd_soc_dapm_route dir_routes[] = { + { "Capture", NULL, "spdif-in" }, +}; + #define STUB_RATES SNDRV_PCM_RATE_8000_192000 #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE) -static struct snd_soc_codec_driver soc_codec_spdif_dir; +static struct snd_soc_codec_driver soc_codec_spdif_dir = { + .dapm_widgets = dir_widgets, + .num_dapm_widgets = ARRAY_SIZE(dir_widgets), + .dapm_routes = dir_routes, + .num_dapm_routes = ARRAY_SIZE(dir_routes), +}; static struct snd_soc_dai_driver dir_stub_dai = { .name = "dir-hifi", From fc6061486534a8dfee02dd6b9dd523789abd9a3d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 19 Aug 2013 12:10:08 +0100 Subject: [PATCH 4/4] ASoC: spdif: Remove duplicate const Signed-off-by: Mark Brown --- sound/soc/codecs/spdif_transmitter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/spdif_transmitter.c b/sound/soc/codecs/spdif_transmitter.c index 4e96d10d61a2..a078aa31052a 100644 --- a/sound/soc/codecs/spdif_transmitter.c +++ b/sound/soc/codecs/spdif_transmitter.c @@ -33,7 +33,7 @@ static const struct snd_soc_dapm_widget dit_widgets[] = { SND_SOC_DAPM_OUTPUT("spdif-out"), }; -static const const struct snd_soc_dapm_route dit_routes[] = { +static const struct snd_soc_dapm_route dit_routes[] = { { "spdif-out", NULL, "Playback" }, };