All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control
@ 2010-07-20  5:32 Kuninori Morimoto
  0 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2010-07-20  5:32 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood

HeadPhone Playback Volume control register of DA7210 has
reserved area. This patch considered it as mute.

This patch add HeadPhone Playback Volume 40 as default,
because DA7210 doesn't have default volume.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

o based on ASoC's git tree
  (add #include <sound/tlv.h>)

 sound/soc/codecs/da7210.c |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index a83aa18..ec292cc 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -23,6 +23,7 @@
 #include <sound/pcm_params.h>
 #include <sound/soc-dapm.h>
 #include <sound/initval.h>
+#include <sound/tlv.h>
 
 #include "da7210.h"
 
@@ -136,6 +137,29 @@
 
 #define DA7210_VERSION "0.0.1"
 
+/*
+ * Playback Volume
+ *
+ * max		: 0x3F (+15.0 dB)
+ *		   (1.5 dB step)
+ * min		: 0x11 (-54.0 dB)
+ * mute		: 0x10
+ * reserved	: 0x00 - 0x0F
+ *
+ * ** FIXME **
+ *
+ * Reserved area are considered as "mute".
+ * -> min = -79.5 dB
+ */
+static const DECLARE_TLV_DB_SCALE(hp_out_tlv, -7950, 150, 1);
+
+static const struct snd_kcontrol_new da7210_snd_controls[] = {
+
+	SOC_DOUBLE_R_TLV("HeadPhone Playback Volume",
+			 DA7210_HP_L_VOL, DA7210_HP_R_VOL,
+			 0, 0x3F, 0, hp_out_tlv),
+};
+
 /* Codec private data */
 struct da7210_priv {
 	struct snd_soc_codec codec;
@@ -218,10 +242,6 @@ static int da7210_startup(struct snd_pcm_substream *substream,
 	struct snd_soc_codec *codec = dai->codec;
 
 	if (is_play) {
-		/* PlayBack Volume 40 */
-		snd_soc_update_bits(codec, DA7210_HP_L_VOL, 0x3F, 40);
-		snd_soc_update_bits(codec, DA7210_HP_R_VOL, 0x3F, 40);
-
 		/* Enable Out */
 		snd_soc_update_bits(codec, DA7210_OUTMIX_L, 0x1F, 0x10);
 		snd_soc_update_bits(codec, DA7210_OUTMIX_R, 0x1F, 0x10);
@@ -563,6 +583,13 @@ static int da7210_init(struct da7210_priv *da7210)
 	/* Activate all enabled subsystem */
 	da7210_write(codec, DA7210_STARTUP1, DA7210_SC_MST_EN);
 
+	/*
+	 * HeadPhone PlayBack Volume 40 is given here
+	 * because DA7210 doesn't have default volume.
+	 */
+	snd_soc_update_bits(codec, DA7210_HP_L_VOL, 0x3F, 40);
+	snd_soc_update_bits(codec, DA7210_HP_R_VOL, 0x3F, 40);
+
 	return ret;
 
 init_err:
@@ -647,6 +674,9 @@ static int da7210_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto pcm_err;
 
+	snd_soc_add_controls(da7210_codec, da7210_snd_controls,
+			     ARRAY_SIZE(da7210_snd_controls));
+
 	dev_info(&pdev->dev, "DA7210 Audio Codec %s\n", DA7210_VERSION);
 
 pcm_err:
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control
@ 2010-07-21  5:12 Kuninori Morimoto
  2010-07-21  9:57 ` Liam Girdwood
  2010-07-23  9:17 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2010-07-21  5:12 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood

HeadPhone Playback Volume control register of DA7210 has
reserved area. This patch considered it as mute.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

o remove default HeadPhone Playback Volume

 sound/soc/codecs/da7210.c |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index a83aa18..3e42d1e 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -23,6 +23,7 @@
 #include <sound/pcm_params.h>
 #include <sound/soc-dapm.h>
 #include <sound/initval.h>
+#include <sound/tlv.h>
 
 #include "da7210.h"
 
@@ -136,6 +137,29 @@
 
 #define DA7210_VERSION "0.0.1"
 
+/*
+ * Playback Volume
+ *
+ * max		: 0x3F (+15.0 dB)
+ *		   (1.5 dB step)
+ * min		: 0x11 (-54.0 dB)
+ * mute		: 0x10
+ * reserved	: 0x00 - 0x0F
+ *
+ * ** FIXME **
+ *
+ * Reserved area are considered as "mute".
+ * -> min = -79.5 dB
+ */
+static const DECLARE_TLV_DB_SCALE(hp_out_tlv, -7950, 150, 1);
+
+static const struct snd_kcontrol_new da7210_snd_controls[] = {
+
+	SOC_DOUBLE_R_TLV("HeadPhone Playback Volume",
+			 DA7210_HP_L_VOL, DA7210_HP_R_VOL,
+			 0, 0x3F, 0, hp_out_tlv),
+};
+
 /* Codec private data */
 struct da7210_priv {
 	struct snd_soc_codec codec;
@@ -218,10 +242,6 @@ static int da7210_startup(struct snd_pcm_substream *substream,
 	struct snd_soc_codec *codec = dai->codec;
 
 	if (is_play) {
-		/* PlayBack Volume 40 */
-		snd_soc_update_bits(codec, DA7210_HP_L_VOL, 0x3F, 40);
-		snd_soc_update_bits(codec, DA7210_HP_R_VOL, 0x3F, 40);
-
 		/* Enable Out */
 		snd_soc_update_bits(codec, DA7210_OUTMIX_L, 0x1F, 0x10);
 		snd_soc_update_bits(codec, DA7210_OUTMIX_R, 0x1F, 0x10);
@@ -647,6 +667,9 @@ static int da7210_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto pcm_err;
 
+	snd_soc_add_controls(da7210_codec, da7210_snd_controls,
+			     ARRAY_SIZE(da7210_snd_controls));
+
 	dev_info(&pdev->dev, "DA7210 Audio Codec %s\n", DA7210_VERSION);
 
 pcm_err:
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control
  2010-07-21  5:12 [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control Kuninori Morimoto
@ 2010-07-21  9:57 ` Liam Girdwood
  2010-07-23  9:17 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2010-07-21  9:57 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown

On Wed, 2010-07-21 at 14:12 +0900, Kuninori Morimoto wrote:
> HeadPhone Playback Volume control register of DA7210 has
> reserved area. This patch considered it as mute.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
> 
> o remove default HeadPhone Playback Volume
> 
>  sound/soc/codecs/da7210.c |   31 +++++++++++++++++++++++++++----
>  1 files changed, 27 insertions(+), 4 deletions(-)
> 
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control
  2010-07-21  5:12 [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control Kuninori Morimoto
  2010-07-21  9:57 ` Liam Girdwood
@ 2010-07-23  9:17 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-07-23  9:17 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood

On Wed, Jul 21, 2010 at 02:12:16PM +0900, Kuninori Morimoto wrote:
> HeadPhone Playback Volume control register of DA7210 has
> reserved area. This patch considered it as mute.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-23  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21  5:12 [PATCH v2] ASoC: da7210: Add HeadPhone Playback Volume control Kuninori Morimoto
2010-07-21  9:57 ` Liam Girdwood
2010-07-23  9:17 ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2010-07-20  5:32 Kuninori Morimoto

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.