* [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
@ 2014-08-01 15:57 ` Dan Murphy
0 siblings, 0 replies; 7+ messages in thread
From: Dan Murphy @ 2014-08-01 15:57 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, linux-sound, broonie, Dan Murphy
Add DAPM calls to enable/disable the Class D amp.
Also add a DAPM call to turn off the PLL upon
the stream completing.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
v2 - Added proper audio routing map for ClassD and PLL enable/disable - https://patchwork.kernel.org/patch/4586831/
sound/soc/codecs/tas2552.c | 68 +++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index 23b3296..1ed57a7 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -78,6 +78,43 @@ struct tas2552_data {
unsigned int mclk;
};
+/* Input mux controls */
+static const char *tas2552_input_texts[] = {
+ "Digital", "Analog"
+};
+
+static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
+ tas2552_input_texts);
+
+static const struct snd_kcontrol_new tas2552_input_mux_control[] = {
+ SOC_DAPM_ENUM("Input selection", tas2552_input_mux_enum)
+};
+
+static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
+{
+ SND_SOC_DAPM_INPUT("IN"),
+
+ /* MUX Controls */
+ SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
+ tas2552_input_mux_control),
+
+ SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
+
+ SND_SOC_DAPM_OUTPUT("OUT")
+};
+
+static const struct snd_soc_dapm_route tas2552_audio_map[] = {
+ {"DAC", NULL, "DAC IN"},
+ {"Input selection", "Digital", "DAC"},
+ {"Input selection", "Analog", "IN"},
+ {"ClassD", NULL, "Input selection"},
+ {"OUT", NULL, "ClassD"},
+ {"ClassD", NULL, "PLL"},
+};
+
static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown)
{
u8 cfg1_reg;
@@ -101,10 +138,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
int d;
u8 p, j;
- /* Turn on Class D amplifier */
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN_MASK,
- TAS2552_CLASSD_EN);
-
if (!tas2552->mclk)
return -EINVAL;
@@ -147,9 +180,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
}
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE,
- TAS2552_PLL_ENABLE);
-
return 0;
}
@@ -269,19 +299,10 @@ static const struct dev_pm_ops tas2552_pm = {
NULL)
};
-static void tas2552_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_codec *codec = dai->codec;
-
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE, 0);
-}
-
static struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
.hw_params = tas2552_hw_params,
.set_sysclk = tas2552_set_dai_sysclk,
.set_fmt = tas2552_set_dai_fmt,
- .shutdown = tas2552_shutdown,
.digital_mute = tas2552_mute,
};
@@ -294,7 +315,7 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
{
.name = "tas2552-amplifier",
.playback = {
- .stream_name = "Speaker",
+ .stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
@@ -312,6 +333,7 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 24);
static const struct snd_kcontrol_new tas2552_snd_controls[] = {
SOC_SINGLE_TLV("Speaker Driver Playback Volume",
TAS2552_PGA_GAIN, 0, 0x1f, 1, dac_tlv),
+ SOC_DAPM_SINGLE("Playback AMP", SND_SOC_NOPM, 0, 1, 0),
};
static const struct reg_default tas2552_init_regs[] = {
@@ -321,6 +343,7 @@ static const struct reg_default tas2552_init_regs[] = {
static int tas2552_codec_probe(struct snd_soc_codec *codec)
{
struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret;
tas2552->codec = codec;
@@ -362,9 +385,14 @@ static int tas2552_codec_probe(struct snd_soc_codec *codec)
goto patch_fail;
}
- snd_soc_write(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN |
- TAS2552_BOOST_EN | TAS2552_APT_EN |
- TAS2552_LIM_EN);
+ snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN |
+ TAS2552_APT_EN | TAS2552_LIM_EN);
+
+ snd_soc_dapm_new_controls(dapm, tas2552_dapm_widgets,
+ ARRAY_SIZE(tas2552_dapm_widgets));
+ snd_soc_dapm_add_routes(dapm, tas2552_audio_map,
+ ARRAY_SIZE(tas2552_audio_map));
+
return 0;
patch_fail:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
@ 2014-08-01 15:57 ` Dan Murphy
0 siblings, 0 replies; 7+ messages in thread
From: Dan Murphy @ 2014-08-01 15:57 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, linux-sound, broonie, Dan Murphy
Add DAPM calls to enable/disable the Class D amp.
Also add a DAPM call to turn off the PLL upon
the stream completing.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
v2 - Added proper audio routing map for ClassD and PLL enable/disable - https://patchwork.kernel.org/patch/4586831/
sound/soc/codecs/tas2552.c | 68 +++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index 23b3296..1ed57a7 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -78,6 +78,43 @@ struct tas2552_data {
unsigned int mclk;
};
+/* Input mux controls */
+static const char *tas2552_input_texts[] = {
+ "Digital", "Analog"
+};
+
+static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
+ tas2552_input_texts);
+
+static const struct snd_kcontrol_new tas2552_input_mux_control[] = {
+ SOC_DAPM_ENUM("Input selection", tas2552_input_mux_enum)
+};
+
+static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
+{
+ SND_SOC_DAPM_INPUT("IN"),
+
+ /* MUX Controls */
+ SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
+ tas2552_input_mux_control),
+
+ SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
+
+ SND_SOC_DAPM_OUTPUT("OUT")
+};
+
+static const struct snd_soc_dapm_route tas2552_audio_map[] = {
+ {"DAC", NULL, "DAC IN"},
+ {"Input selection", "Digital", "DAC"},
+ {"Input selection", "Analog", "IN"},
+ {"ClassD", NULL, "Input selection"},
+ {"OUT", NULL, "ClassD"},
+ {"ClassD", NULL, "PLL"},
+};
+
static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown)
{
u8 cfg1_reg;
@@ -101,10 +138,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
int d;
u8 p, j;
- /* Turn on Class D amplifier */
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN_MASK,
- TAS2552_CLASSD_EN);
-
if (!tas2552->mclk)
return -EINVAL;
@@ -147,9 +180,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
}
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE,
- TAS2552_PLL_ENABLE);
-
return 0;
}
@@ -269,19 +299,10 @@ static const struct dev_pm_ops tas2552_pm = {
NULL)
};
-static void tas2552_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_codec *codec = dai->codec;
-
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE, 0);
-}
-
static struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
.hw_params = tas2552_hw_params,
.set_sysclk = tas2552_set_dai_sysclk,
.set_fmt = tas2552_set_dai_fmt,
- .shutdown = tas2552_shutdown,
.digital_mute = tas2552_mute,
};
@@ -294,7 +315,7 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
{
.name = "tas2552-amplifier",
.playback = {
- .stream_name = "Speaker",
+ .stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
@@ -312,6 +333,7 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 24);
static const struct snd_kcontrol_new tas2552_snd_controls[] = {
SOC_SINGLE_TLV("Speaker Driver Playback Volume",
TAS2552_PGA_GAIN, 0, 0x1f, 1, dac_tlv),
+ SOC_DAPM_SINGLE("Playback AMP", SND_SOC_NOPM, 0, 1, 0),
};
static const struct reg_default tas2552_init_regs[] = {
@@ -321,6 +343,7 @@ static const struct reg_default tas2552_init_regs[] = {
static int tas2552_codec_probe(struct snd_soc_codec *codec)
{
struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret;
tas2552->codec = codec;
@@ -362,9 +385,14 @@ static int tas2552_codec_probe(struct snd_soc_codec *codec)
goto patch_fail;
}
- snd_soc_write(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN |
- TAS2552_BOOST_EN | TAS2552_APT_EN |
- TAS2552_LIM_EN);
+ snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN |
+ TAS2552_APT_EN | TAS2552_LIM_EN);
+
+ snd_soc_dapm_new_controls(dapm, tas2552_dapm_widgets,
+ ARRAY_SIZE(tas2552_dapm_widgets));
+ snd_soc_dapm_add_routes(dapm, tas2552_audio_map,
+ ARRAY_SIZE(tas2552_audio_map));
+
return 0;
patch_fail:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
@ 2014-08-01 15:57 ` Dan Murphy
0 siblings, 0 replies; 7+ messages in thread
From: Dan Murphy @ 2014-08-01 15:57 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, linux-sound, broonie, Dan Murphy
Add DAPM calls to enable/disable the Class D amp.
Also add a DAPM call to turn off the PLL upon
the stream completing.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
v2 - Added proper audio routing map for ClassD and PLL enable/disable - https://patchwork.kernel.org/patch/4586831/
sound/soc/codecs/tas2552.c | 68 +++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index 23b3296..1ed57a7 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -78,6 +78,43 @@ struct tas2552_data {
unsigned int mclk;
};
+/* Input mux controls */
+static const char *tas2552_input_texts[] = {
+ "Digital", "Analog"
+};
+
+static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
+ tas2552_input_texts);
+
+static const struct snd_kcontrol_new tas2552_input_mux_control[] = {
+ SOC_DAPM_ENUM("Input selection", tas2552_input_mux_enum)
+};
+
+static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] +{
+ SND_SOC_DAPM_INPUT("IN"),
+
+ /* MUX Controls */
+ SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
+ tas2552_input_mux_control),
+
+ SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
+
+ SND_SOC_DAPM_OUTPUT("OUT")
+};
+
+static const struct snd_soc_dapm_route tas2552_audio_map[] = {
+ {"DAC", NULL, "DAC IN"},
+ {"Input selection", "Digital", "DAC"},
+ {"Input selection", "Analog", "IN"},
+ {"ClassD", NULL, "Input selection"},
+ {"OUT", NULL, "ClassD"},
+ {"ClassD", NULL, "PLL"},
+};
+
static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown)
{
u8 cfg1_reg;
@@ -101,10 +138,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
int d;
u8 p, j;
- /* Turn on Class D amplifier */
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN_MASK,
- TAS2552_CLASSD_EN);
-
if (!tas2552->mclk)
return -EINVAL;
@@ -147,9 +180,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
}
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE,
- TAS2552_PLL_ENABLE);
-
return 0;
}
@@ -269,19 +299,10 @@ static const struct dev_pm_ops tas2552_pm = {
NULL)
};
-static void tas2552_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_codec *codec = dai->codec;
-
- snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE, 0);
-}
-
static struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
.hw_params = tas2552_hw_params,
.set_sysclk = tas2552_set_dai_sysclk,
.set_fmt = tas2552_set_dai_fmt,
- .shutdown = tas2552_shutdown,
.digital_mute = tas2552_mute,
};
@@ -294,7 +315,7 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
{
.name = "tas2552-amplifier",
.playback = {
- .stream_name = "Speaker",
+ .stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
@@ -312,6 +333,7 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 24);
static const struct snd_kcontrol_new tas2552_snd_controls[] = {
SOC_SINGLE_TLV("Speaker Driver Playback Volume",
TAS2552_PGA_GAIN, 0, 0x1f, 1, dac_tlv),
+ SOC_DAPM_SINGLE("Playback AMP", SND_SOC_NOPM, 0, 1, 0),
};
static const struct reg_default tas2552_init_regs[] = {
@@ -321,6 +343,7 @@ static const struct reg_default tas2552_init_regs[] = {
static int tas2552_codec_probe(struct snd_soc_codec *codec)
{
struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret;
tas2552->codec = codec;
@@ -362,9 +385,14 @@ static int tas2552_codec_probe(struct snd_soc_codec *codec)
goto patch_fail;
}
- snd_soc_write(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN |
- TAS2552_BOOST_EN | TAS2552_APT_EN |
- TAS2552_LIM_EN);
+ snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN |
+ TAS2552_APT_EN | TAS2552_LIM_EN);
+
+ snd_soc_dapm_new_controls(dapm, tas2552_dapm_widgets,
+ ARRAY_SIZE(tas2552_dapm_widgets));
+ snd_soc_dapm_add_routes(dapm, tas2552_audio_map,
+ ARRAY_SIZE(tas2552_audio_map));
+
return 0;
patch_fail:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
2014-08-01 15:57 ` Dan Murphy
@ 2014-08-12 18:05 ` Murphy, Dan
-1 siblings, 0 replies; 7+ messages in thread
From: Murphy, Dan @ 2014-08-12 18:05 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, linux-sound, broonie
Bump for review
On 08/01/2014 10:57 AM, Murphy, Dan wrote:
> Add DAPM calls to enable/disable the Class D amp.
> Also add a DAPM call to turn off the PLL upon
> the stream completing.
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>
> v2 - Added proper audio routing map for ClassD and PLL enable/disable - https://patchwork.kernel.org/patch/4586831/
>
> sound/soc/codecs/tas2552.c | 68 +++++++++++++++++++++++++++++++-------------
> 1 file changed, 48 insertions(+), 20 deletions(-)
>
> diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
> index 23b3296..1ed57a7 100644
> --- a/sound/soc/codecs/tas2552.c
> +++ b/sound/soc/codecs/tas2552.c
> @@ -78,6 +78,43 @@ struct tas2552_data {
> unsigned int mclk;
> };
>
> +/* Input mux controls */
> +static const char *tas2552_input_texts[] = {
> + "Digital", "Analog"
> +};
> +
> +static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
> + tas2552_input_texts);
> +
> +static const struct snd_kcontrol_new tas2552_input_mux_control[] = {
> + SOC_DAPM_ENUM("Input selection", tas2552_input_mux_enum)
> +};
> +
> +static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
> +{
> + SND_SOC_DAPM_INPUT("IN"),
> +
> + /* MUX Controls */
> + SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
> + tas2552_input_mux_control),
> +
> + SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
> + SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
> + SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
> + SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
> +
> + SND_SOC_DAPM_OUTPUT("OUT")
> +};
> +
> +static const struct snd_soc_dapm_route tas2552_audio_map[] = {
> + {"DAC", NULL, "DAC IN"},
> + {"Input selection", "Digital", "DAC"},
> + {"Input selection", "Analog", "IN"},
> + {"ClassD", NULL, "Input selection"},
> + {"OUT", NULL, "ClassD"},
> + {"ClassD", NULL, "PLL"},
> +};
> +
> static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown)
> {
> u8 cfg1_reg;
> @@ -101,10 +138,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
> int d;
> u8 p, j;
>
> - /* Turn on Class D amplifier */
> - snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN_MASK,
> - TAS2552_CLASSD_EN);
> -
> if (!tas2552->mclk)
> return -EINVAL;
>
> @@ -147,9 +180,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
>
> }
>
> - snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE,
> - TAS2552_PLL_ENABLE);
> -
> return 0;
> }
>
> @@ -269,19 +299,10 @@ static const struct dev_pm_ops tas2552_pm = {
> NULL)
> };
>
> -static void tas2552_shutdown(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> -{
> - struct snd_soc_codec *codec = dai->codec;
> -
> - snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE, 0);
> -}
> -
> static struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
> .hw_params = tas2552_hw_params,
> .set_sysclk = tas2552_set_dai_sysclk,
> .set_fmt = tas2552_set_dai_fmt,
> - .shutdown = tas2552_shutdown,
> .digital_mute = tas2552_mute,
> };
>
> @@ -294,7 +315,7 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
> {
> .name = "tas2552-amplifier",
> .playback = {
> - .stream_name = "Speaker",
> + .stream_name = "Playback",
> .channels_min = 2,
> .channels_max = 2,
> .rates = SNDRV_PCM_RATE_8000_192000,
> @@ -312,6 +333,7 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 24);
> static const struct snd_kcontrol_new tas2552_snd_controls[] = {
> SOC_SINGLE_TLV("Speaker Driver Playback Volume",
> TAS2552_PGA_GAIN, 0, 0x1f, 1, dac_tlv),
> + SOC_DAPM_SINGLE("Playback AMP", SND_SOC_NOPM, 0, 1, 0),
> };
>
> static const struct reg_default tas2552_init_regs[] = {
> @@ -321,6 +343,7 @@ static const struct reg_default tas2552_init_regs[] = {
> static int tas2552_codec_probe(struct snd_soc_codec *codec)
> {
> struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec);
> + struct snd_soc_dapm_context *dapm = &codec->dapm;
> int ret;
>
> tas2552->codec = codec;
> @@ -362,9 +385,14 @@ static int tas2552_codec_probe(struct snd_soc_codec *codec)
> goto patch_fail;
> }
>
> - snd_soc_write(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN |
> - TAS2552_BOOST_EN | TAS2552_APT_EN |
> - TAS2552_LIM_EN);
> + snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN |
> + TAS2552_APT_EN | TAS2552_LIM_EN);
> +
> + snd_soc_dapm_new_controls(dapm, tas2552_dapm_widgets,
> + ARRAY_SIZE(tas2552_dapm_widgets));
> + snd_soc_dapm_add_routes(dapm, tas2552_audio_map,
> + ARRAY_SIZE(tas2552_audio_map));
> +
> return 0;
>
> patch_fail:
>
--
------------------
Dan Murphy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
@ 2014-08-12 18:05 ` Murphy, Dan
0 siblings, 0 replies; 7+ messages in thread
From: Murphy, Dan @ 2014-08-12 18:05 UTC (permalink / raw)
To: alsa-devel; +Cc: linux-kernel, linux-sound, broonie
Bump for review
On 08/01/2014 10:57 AM, Murphy, Dan wrote:
> Add DAPM calls to enable/disable the Class D amp.
> Also add a DAPM call to turn off the PLL upon
> the stream completing.
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>
> v2 - Added proper audio routing map for ClassD and PLL enable/disable - https://patchwork.kernel.org/patch/4586831/
>
> sound/soc/codecs/tas2552.c | 68 +++++++++++++++++++++++++++++++-------------
> 1 file changed, 48 insertions(+), 20 deletions(-)
>
> diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
> index 23b3296..1ed57a7 100644
> --- a/sound/soc/codecs/tas2552.c
> +++ b/sound/soc/codecs/tas2552.c
> @@ -78,6 +78,43 @@ struct tas2552_data {
> unsigned int mclk;
> };
>
> +/* Input mux controls */
> +static const char *tas2552_input_texts[] = {
> + "Digital", "Analog"
> +};
> +
> +static SOC_ENUM_SINGLE_DECL(tas2552_input_mux_enum, TAS2552_CFG_3, 7,
> + tas2552_input_texts);
> +
> +static const struct snd_kcontrol_new tas2552_input_mux_control[] = {
> + SOC_DAPM_ENUM("Input selection", tas2552_input_mux_enum)
> +};
> +
> +static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] > +{
> + SND_SOC_DAPM_INPUT("IN"),
> +
> + /* MUX Controls */
> + SND_SOC_DAPM_MUX("Input selection", SND_SOC_NOPM, 0, 0,
> + tas2552_input_mux_control),
> +
> + SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
> + SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
> + SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
> + SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
> +
> + SND_SOC_DAPM_OUTPUT("OUT")
> +};
> +
> +static const struct snd_soc_dapm_route tas2552_audio_map[] = {
> + {"DAC", NULL, "DAC IN"},
> + {"Input selection", "Digital", "DAC"},
> + {"Input selection", "Analog", "IN"},
> + {"ClassD", NULL, "Input selection"},
> + {"OUT", NULL, "ClassD"},
> + {"ClassD", NULL, "PLL"},
> +};
> +
> static void tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown)
> {
> u8 cfg1_reg;
> @@ -101,10 +138,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
> int d;
> u8 p, j;
>
> - /* Turn on Class D amplifier */
> - snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN_MASK,
> - TAS2552_CLASSD_EN);
> -
> if (!tas2552->mclk)
> return -EINVAL;
>
> @@ -147,9 +180,6 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
>
> }
>
> - snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE,
> - TAS2552_PLL_ENABLE);
> -
> return 0;
> }
>
> @@ -269,19 +299,10 @@ static const struct dev_pm_ops tas2552_pm = {
> NULL)
> };
>
> -static void tas2552_shutdown(struct snd_pcm_substream *substream,
> - struct snd_soc_dai *dai)
> -{
> - struct snd_soc_codec *codec = dai->codec;
> -
> - snd_soc_update_bits(codec, TAS2552_CFG_2, TAS2552_PLL_ENABLE, 0);
> -}
> -
> static struct snd_soc_dai_ops tas2552_speaker_dai_ops = {
> .hw_params = tas2552_hw_params,
> .set_sysclk = tas2552_set_dai_sysclk,
> .set_fmt = tas2552_set_dai_fmt,
> - .shutdown = tas2552_shutdown,
> .digital_mute = tas2552_mute,
> };
>
> @@ -294,7 +315,7 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
> {
> .name = "tas2552-amplifier",
> .playback = {
> - .stream_name = "Speaker",
> + .stream_name = "Playback",
> .channels_min = 2,
> .channels_max = 2,
> .rates = SNDRV_PCM_RATE_8000_192000,
> @@ -312,6 +333,7 @@ static DECLARE_TLV_DB_SCALE(dac_tlv, -7, 100, 24);
> static const struct snd_kcontrol_new tas2552_snd_controls[] = {
> SOC_SINGLE_TLV("Speaker Driver Playback Volume",
> TAS2552_PGA_GAIN, 0, 0x1f, 1, dac_tlv),
> + SOC_DAPM_SINGLE("Playback AMP", SND_SOC_NOPM, 0, 1, 0),
> };
>
> static const struct reg_default tas2552_init_regs[] = {
> @@ -321,6 +343,7 @@ static const struct reg_default tas2552_init_regs[] = {
> static int tas2552_codec_probe(struct snd_soc_codec *codec)
> {
> struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec);
> + struct snd_soc_dapm_context *dapm = &codec->dapm;
> int ret;
>
> tas2552->codec = codec;
> @@ -362,9 +385,14 @@ static int tas2552_codec_probe(struct snd_soc_codec *codec)
> goto patch_fail;
> }
>
> - snd_soc_write(codec, TAS2552_CFG_2, TAS2552_CLASSD_EN |
> - TAS2552_BOOST_EN | TAS2552_APT_EN |
> - TAS2552_LIM_EN);
> + snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN |
> + TAS2552_APT_EN | TAS2552_LIM_EN);
> +
> + snd_soc_dapm_new_controls(dapm, tas2552_dapm_widgets,
> + ARRAY_SIZE(tas2552_dapm_widgets));
> + snd_soc_dapm_add_routes(dapm, tas2552_audio_map,
> + ARRAY_SIZE(tas2552_audio_map));
> +
> return 0;
>
> patch_fail:
>
--
------------------
Dan Murphy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [alsa-devel] [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
2014-08-01 15:57 ` Dan Murphy
@ 2014-08-15 11:48 ` Mark Brown
-1 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-08-15 11:48 UTC (permalink / raw)
To: Dan Murphy; +Cc: alsa-devel, linux-kernel, linux-sound
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
On Fri, Aug 01, 2014 at 10:57:04AM -0500, Dan Murphy wrote:
> Add DAPM calls to enable/disable the Class D amp.
> Also add a DAPM call to turn off the PLL upon
> the stream completing.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [alsa-devel] [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL
@ 2014-08-15 11:48 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-08-15 11:48 UTC (permalink / raw)
To: Dan Murphy; +Cc: alsa-devel, linux-kernel, linux-sound
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
On Fri, Aug 01, 2014 at 10:57:04AM -0500, Dan Murphy wrote:
> Add DAPM calls to enable/disable the Class D amp.
> Also add a DAPM call to turn off the PLL upon
> the stream completing.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-08-15 11:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-01 15:57 [PATCH v2] ASoC: tas2552: Add DAPM calls for amp and PLL Dan Murphy
2014-08-01 15:57 ` Dan Murphy
2014-08-01 15:57 ` Dan Murphy
2014-08-12 18:05 ` Murphy, Dan
2014-08-12 18:05 ` Murphy, Dan
2014-08-15 11:48 ` [alsa-devel] " Mark Brown
2014-08-15 11:48 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.