Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1401179 > unrolled thread
| Started by | Peter Rosin <peda@axentia.se> |
|---|---|
| First post | 2016-05-16 04:10 +0200 |
| Last post | 2016-05-16 04:10 +0200 |
| Articles | 7 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v4 0/4] ASoC: MAX9860: new driver Peter Rosin <peda@axentia.se> - 2016-05-16 04:10 +0200
[PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec Peter Rosin <peda@axentia.se> - 2016-05-16 04:10 +0200
Re: [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec Mark Brown <broonie@kernel.org> - 2016-05-27 22:30 +0200
Re: [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec Peter Rosin <peda@axentia.se> - 2016-05-27 22:50 +0200
Re: [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec Mark Brown <broonie@kernel.org> - 2016-05-27 22:50 +0200
[PATCH v4 4/4] ASoC: MAX9860: add sidetone mixer control Peter Rosin <peda@axentia.se> - 2016-05-16 04:10 +0200
[PATCH v4 3/4] ASoC: dapm: support mixer controls with mute at non-zero value Peter Rosin <peda@axentia.se> - 2016-05-16 04:10 +0200
| From | Peter Rosin <peda@axentia.se> |
|---|---|
| Date | 2016-05-16 04:10 +0200 |
| Subject | [PATCH v4 0/4] ASoC: MAX9860: new driver |
| Message-ID | <rzg8Q-u7-79@gated-at.bofh.it> |
Hi! I kept the sidetone changes in separate patches since I don't know if I solved the DAPM-off issue cleanly enough. Also, a new driver may still have a chance to make 4.7, but maybe it's too late for the DAPM changes? Finally, I wonder if the device tree crowd prefers seeing the whole of a series such as this, or only the bindings patch? Cheers, Peter New in v4: - Split out the device tree bindings in its own patch. - Move format check from ->startup to ->set_fmt. - Don't spam the log on probe defer. - Follow-up patches for the backwards sidetone control. New in v3: - The updated bindings file went missing in v2. Sorry for the confusion. New in v2: - Add comment about fall through when Integer Clock Mode is not possible. - Drop export of max9860_probe. - Ignore clk docs and read the mclk rate w/o enabling the clock. - Manage the DVDDIO supply. Peter Rosin (4): dt-bindings: sound: add bindings for the max9860 codec ASoC: MAX9860: new driver ASoC: dapm: support mixer controls with mute at non-zero value ASoC: MAX9860: add sidetone mixer control .../devicetree/bindings/sound/max9860.txt | 28 + MAINTAINERS | 7 + sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max9860.c | 765 +++++++++++++++++++++ sound/soc/codecs/max9860.h | 162 +++++ sound/soc/soc-dapm.c | 38 +- 7 files changed, 1005 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/max9860.txt create mode 100644 sound/soc/codecs/max9860.c create mode 100644 sound/soc/codecs/max9860.h -- 2.1.4
[toc] | [next] | [standalone]
| From | Peter Rosin <peda@axentia.se> |
|---|---|
| Date | 2016-05-16 04:10 +0200 |
| Subject | [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec |
| Message-ID | <rzg8S-u7-129@gated-at.bofh.it> |
| In reply to | #1401179 |
This adds the device tree binding documentation for the Maxim Integrated
MAX9860 mono audio voice codec.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
.../devicetree/bindings/sound/max9860.txt | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/max9860.txt
diff --git a/Documentation/devicetree/bindings/sound/max9860.txt b/Documentation/devicetree/bindings/sound/max9860.txt
new file mode 100644
index 000000000000..e0d4e95e31b3
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max9860.txt
@@ -0,0 +1,28 @@
+MAX9860 Mono Audio Voice Codec
+
+Required properties:
+
+ - compatible : "maxim,max9860"
+
+ - reg : the I2C address of the device
+
+ - AVDD-supply, DVDD-supply and DVDDIO-supply : power supplies for
+ the device, as covered in bindings/regulator/regulator.txt
+
+ - clock-names : Required element: "mclk".
+
+ - clocks : A clock specifier for the clock connected as MCLK.
+
+Examples:
+
+ max9860: max9860@10 {
+ compatible = "maxim,max9860";
+ reg = <0x10>;
+
+ AVDD-supply = <®_1v8>;
+ DVDD-supply = <®_1v8>;
+ DVDDIO-supply = <®_3v0>;
+
+ clock-names = "mclk";
+ clocks = <&pck2>;
+ };
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2016-05-27 22:30 +0200 |
| Subject | Re: [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec |
| Message-ID | <rDwym-82g-5@gated-at.bofh.it> |
| In reply to | #1401193 |
[Multipart message — attachments visible in raw view] — view raw
On Sat, May 14, 2016 at 11:09:38PM +0200, Peter Rosin wrote: > This adds the device tree binding documentation for the Maxim Integrated > MAX9860 mono audio voice codec. Please submit patches using subject lines reflecting the style for the subsystem. This makes it easier for people to identify relevant patches.
[toc] | [prev] | [next] | [standalone]
| From | Peter Rosin <peda@axentia.se> |
|---|---|
| Date | 2016-05-27 22:50 +0200 |
| Subject | Re: [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec |
| Message-ID | <rDwRI-8aV-15@gated-at.bofh.it> |
| In reply to | #1408275 |
On 2016-05-27 22:24, Mark Brown wrote: > On Sat, May 14, 2016 at 11:09:38PM +0200, Peter Rosin wrote: >> This adds the device tree binding documentation for the Maxim Integrated >> MAX9860 mono audio voice codec. > > Please submit patches using subject lines reflecting the style for the > subsystem. This makes it easier for people to identify relevant > patches. Ok, but to me it was obviously not obvious if I submitted this patch to ASoC or if I submitted it to devicetree. Should I resend over this detail or will you fix it up? Cheers, Peter
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2016-05-27 22:50 +0200 |
| Subject | Re: [PATCH v4 1/4] dt-bindings: sound: add bindings for the max9860 codec |
| Message-ID | <rDwRI-8aV-25@gated-at.bofh.it> |
| In reply to | #1408305 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, May 27, 2016 at 10:40:07PM +0200, Peter Rosin wrote: > Ok, but to me it was obviously not obvious if I submitted this patch to > ASoC or if I submitted it to devicetree. > Should I resend over this detail or will you fix it up? It's OK, I've applied it already.
[toc] | [prev] | [next] | [standalone]
| From | Peter Rosin <peda@axentia.se> |
|---|---|
| Date | 2016-05-16 04:10 +0200 |
| Subject | [PATCH v4 4/4] ASoC: MAX9860: add sidetone mixer control |
| Message-ID | <rzg8W-u7-217@gated-at.bofh.it> |
| In reply to | #1401179 |
Signed-off-by: Peter Rosin <peda@axentia.se>
---
sound/soc/codecs/max9860.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/max9860.c b/sound/soc/codecs/max9860.c
index 2b0dd6a18dad..8d257cc20ef7 100644
--- a/sound/soc/codecs/max9860.c
+++ b/sound/soc/codecs/max9860.c
@@ -3,9 +3,6 @@
*
* https://datasheets.maximintegrated.com/en/ds/MAX9860.pdf
*
- * The driver does not support sidetone since the DVST register field is
- * backwards with the mute near the maximum level instead of the minimum.
- *
* Author: Peter Rosin <peda@axentia.s>
* Copyright 2016 Axentia Technologies
*
@@ -135,6 +132,10 @@ const struct regmap_config max9860_regmap = {
static const DECLARE_TLV_DB_SCALE(dva_tlv, -9100, 100, 1);
static const DECLARE_TLV_DB_SCALE(dvg_tlv, 0, 600, 0);
static const DECLARE_TLV_DB_SCALE(adc_tlv, -1200, 100, 0);
+/* The dvst field has its mute in the wrong end. Sigh. */
+static const DECLARE_TLV_DB_RANGE(dvst_tlv,
+ 0, MAX9860_DVST_MIN - 1, TLV_DB_SCALE_ITEM(-6000, 200, 0),
+ MAX9860_DVST_MIN, MAX9860_DVST_MIN, TLV_DB_SCALE_ITEM(0, 0, 1));
static const DECLARE_TLV_DB_RANGE(pam_tlv,
0, MAX9860_PAM_MAX - 1, TLV_DB_SCALE_ITEM(-2000, 2000, 1),
MAX9860_PAM_MAX, MAX9860_PAM_MAX, TLV_DB_SCALE_ITEM(3000, 0, 0));
@@ -214,6 +215,11 @@ SOC_ENUM("ADC Filter", avflt_enum),
SOC_ENUM("DAC Filter", dvflt_enum),
};
+static const struct snd_kcontrol_new max9860_mixer_controls[] = {
+SOC_DAPM_SINGLE_TLV("Sidetone Volume", MAX9860_DACGAIN,
+ MAX9860_DVST_SHIFT, MAX9860_DVST_MIN, 1, dvst_tlv),
+};
+
static const struct snd_soc_dapm_widget max9860_dapm_widgets[] = {
SND_SOC_DAPM_INPUT("MICL"),
SND_SOC_DAPM_INPUT("MICR"),
@@ -224,6 +230,10 @@ SND_SOC_DAPM_ADC("ADCR", NULL, MAX9860_PWRMAN, MAX9860_ADCREN_SHIFT, 0),
SND_SOC_DAPM_AIF_OUT("AIFOUTL", "Capture", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_OUT("AIFOUTR", "Capture", 1, SND_SOC_NOPM, 0, 0),
+SND_SOC_DAPM_MIXER("Mixer", SND_SOC_NOPM, 0, 0,
+ max9860_mixer_controls,
+ ARRAY_SIZE(max9860_mixer_controls)),
+
SND_SOC_DAPM_AIF_IN("AIFINL", "Playback", 0, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_AIF_IN("AIFINR", "Playback", 1, SND_SOC_NOPM, 0, 0),
@@ -244,8 +254,10 @@ static const struct snd_soc_dapm_route max9860_dapm_routes[] = {
{ "AIFOUTL", NULL, "ADCL" },
{ "AIFOUTR", NULL, "ADCR" },
- { "DAC", NULL, "AIFINL" },
- { "DAC", NULL, "AIFINR" },
+ { "Mixer", NULL, "AIFINL" },
+ { "Mixer", NULL, "AIFINR" },
+ { "Mixer", "Sidetone Volume", "ADCL" },
+ { "DAC", NULL, "Mixer" },
{ "OUT", NULL, "DAC" },
{ "Supply", NULL, "AVDD" },
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Peter Rosin <peda@axentia.se> |
|---|---|
| Date | 2016-05-16 04:10 +0200 |
| Subject | [PATCH v4 3/4] ASoC: dapm: support mixer controls with mute at non-zero value |
| Message-ID | <rzg8X-u7-261@gated-at.bofh.it> |
| In reply to | #1401179 |
The max9860 codec has a mixer control field that has its mute/disable at
the wrong end of the scale. I.e. you turn the volume up and up, and then
as the final step the volume is off. This does not sit well with DAPM,
which assumes the mute/off is at the minimum value.
Add support for such backwards controls with code that searches TLV ranges
for the mute value and use that as trigger for DAPM off.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
sound/soc/soc-dapm.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c4464858bf01..8a1131781339 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -42,6 +42,7 @@
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
+#include <sound/tlv.h>
#include <trace/events/asoc.h>
@@ -722,16 +723,46 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
return -ENODEV;
}
+static int dapm_find_tlv_mute(const unsigned int *tlv)
+{
+ int cnt;
+ const unsigned int *range;
+
+ if (!tlv || tlv[0] != SNDRV_CTL_TLVT_DB_RANGE)
+ return 0;
+
+ cnt = tlv[1] / sizeof(unsigned int);
+
+ /*
+ * Each group of six values should be
+ * { start end type len min step/mute }
+ */
+ for (range = &tlv[2]; cnt >= 6; cnt -= 6, range += 6) {
+ if (range[2] != SNDRV_CTL_TLVT_DB_SCALE)
+ return 0; /* wrong type, terminate */
+ if (range[3] != 2 * sizeof(unsigned int))
+ return 0; /* wrong len, terminate */
+ if (!(range[5] & TLV_DB_SCALE_MUTE))
+ continue; /* no mute in this range */
+ return range[0]; /* start of this range is the mute value */
+ }
+
+ return 0;
+}
+
/* set up initial codec paths */
static void dapm_set_mixer_path_status(struct snd_soc_dapm_path *p, int i)
{
+ const struct snd_kcontrol_new *kcontrol_new
+ = &p->sink->kcontrol_news[i];
struct soc_mixer_control *mc = (struct soc_mixer_control *)
- p->sink->kcontrol_news[i].private_value;
+ kcontrol_new->private_value;
unsigned int reg = mc->reg;
unsigned int shift = mc->shift;
unsigned int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
+ int mute_value = dapm_find_tlv_mute(kcontrol_new->tlv.p);
unsigned int val;
if (reg != SND_SOC_NOPM) {
@@ -739,7 +770,7 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_path *p, int i)
val = (val >> shift) & mask;
if (invert)
val = max - val;
- p->connect = !!val;
+ p->connect = val != mute_value;
} else {
p->connect = 0;
}
@@ -3045,6 +3076,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
int max = mc->max;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
+ int mute_value = dapm_find_tlv_mute(kcontrol->tlv.p);
unsigned int val;
int connect, change, reg_change = 0;
struct snd_soc_dapm_update update;
@@ -3056,7 +3088,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
kcontrol->id.name);
val = (ucontrol->value.integer.value[0] & mask);
- connect = !!val;
+ connect = val != mute_value;
if (invert)
val = max - val;
--
2.1.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web