* [PATCH] ALSA: HDA: Fix volume control indices for Mics (Realtek)
@ 2011-01-05 10:10 David Henningsson
2011-01-10 10:20 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: David Henningsson @ 2011-01-05 10:10 UTC (permalink / raw)
To: Takashi Iwai, ALSA Development Mailing List
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
This patch assumes you applied the "Boost" => "Boost Volume" patch
posted yesterday.
If more than one mic is present with different locations,
e g "Front Mic" and "Rear Mic", they can use the same index (0),
since their names are different.
Previous behavior was to have "Front Mic" as index 1, causing it
to be ignored by e g PulseAudio.
--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
[-- Attachment #2: 0001-ALSA-HDA-Fix-volume-control-indices-for-Mics-Realtek.patch --]
[-- Type: text/x-patch, Size: 2969 bytes --]
>From 12d16508dec19b6897f6eca10fb38810a2762bc4 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Wed, 5 Jan 2011 11:03:56 +0100
Subject: [PATCH] ALSA: HDA: Fix volume control indices for Mics (Realtek)
If more than one mic is present with different locations,
e g "Front Mic" and "Rear Mic", they can use the same index (0),
since their names are different.
Previous behavior was to have "Front Mic" as index 1, causing it
to be ignored by e g PulseAudio.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
sound/pci/hda/patch_realtek.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 18d53d2..e2d2a79 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5200,7 +5200,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
{
struct alc_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->private_imux[0];
- int i, err, idx, type, type_idx = 0;
+ int i, err, idx, type_idx = 0;
+ const char *prev_label = NULL;
for (i = 0; i < cfg->num_inputs; i++) {
hda_nid_t pin;
@@ -5210,12 +5211,13 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
if (!alc_is_input_pin(codec, pin))
continue;
- type = cfg->inputs[i].type;
- if (i > 0 && type == cfg->inputs[i - 1].type)
+ label = hda_get_autocfg_input_label(codec, cfg, i);
+ if (prev_label && !strcmp(label, prev_label))
type_idx++;
else
type_idx = 0;
- label = hda_get_autocfg_input_label(codec, cfg, i);
+ prev_label = label;
+
if (mixer) {
idx = get_connection_index(codec, mixer, pin);
if (idx >= 0) {
@@ -10819,25 +10821,30 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg;
- int i, err, type;
+ int i, err;
int type_idx = 0;
hda_nid_t nid;
+ const char* prev_label = NULL;
for (i = 0; i < cfg->num_inputs; i++) {
if (cfg->inputs[i].type > AUTO_PIN_MIC)
break;
nid = cfg->inputs[i].pin;
if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
- char label[32];
- type = cfg->inputs[i].type;
- if (i > 0 && type == cfg->inputs[i - 1].type)
+ const char* label;
+ char boost_label[32];
+
+ label = hda_get_autocfg_input_label(codec, cfg, i);
+ if (prev_label && !strcmp(label, prev_label))
type_idx++;
else
type_idx = 0;
- snprintf(label, sizeof(label), "%s Boost Volume",
- hda_get_autocfg_input_label(codec, cfg, i));
- err = add_control(spec, ALC_CTL_WIDGET_VOL, label,
- type_idx,
+ prev_label = label;
+
+ snprintf(boost_label, sizeof(boost_label),
+ "%s Boost Volume", label);
+ err = add_control(spec, ALC_CTL_WIDGET_VOL,
+ boost_label, type_idx,
HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
if (err < 0)
return err;
--
1.7.1
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: HDA: Fix volume control indices for Mics (Realtek)
2011-01-05 10:10 [PATCH] ALSA: HDA: Fix volume control indices for Mics (Realtek) David Henningsson
@ 2011-01-10 10:20 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-01-10 10:20 UTC (permalink / raw)
To: David Henningsson; +Cc: ALSA Development Mailing List
At Wed, 05 Jan 2011 11:10:48 +0100,
David Henningsson wrote:
>
> This patch assumes you applied the "Boost" => "Boost Volume" patch
> posted yesterday.
>
> If more than one mic is present with different locations,
> e g "Front Mic" and "Rear Mic", they can use the same index (0),
> since their names are different.
>
> Previous behavior was to have "Front Mic" as index 1, causing it
> to be ignored by e g PulseAudio.
Thanks, applied now.
Takashi
>
> --
> David Henningsson, Canonical Ltd.
> http://launchpad.net/~diwic
> [2 0001-ALSA-HDA-Fix-volume-control-indices-for-Mics-Realtek.patch <text/x-patch (7bit)>]
> >From 12d16508dec19b6897f6eca10fb38810a2762bc4 Mon Sep 17 00:00:00 2001
> From: David Henningsson <david.henningsson@canonical.com>
> Date: Wed, 5 Jan 2011 11:03:56 +0100
> Subject: [PATCH] ALSA: HDA: Fix volume control indices for Mics (Realtek)
>
> If more than one mic is present with different locations,
> e g "Front Mic" and "Rear Mic", they can use the same index (0),
> since their names are different.
>
> Previous behavior was to have "Front Mic" as index 1, causing it
> to be ignored by e g PulseAudio.
>
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
> sound/pci/hda/patch_realtek.c | 31 +++++++++++++++++++------------
> 1 files changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 18d53d2..e2d2a79 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -5200,7 +5200,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
> {
> struct alc_spec *spec = codec->spec;
> struct hda_input_mux *imux = &spec->private_imux[0];
> - int i, err, idx, type, type_idx = 0;
> + int i, err, idx, type_idx = 0;
> + const char *prev_label = NULL;
>
> for (i = 0; i < cfg->num_inputs; i++) {
> hda_nid_t pin;
> @@ -5210,12 +5211,13 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec,
> if (!alc_is_input_pin(codec, pin))
> continue;
>
> - type = cfg->inputs[i].type;
> - if (i > 0 && type == cfg->inputs[i - 1].type)
> + label = hda_get_autocfg_input_label(codec, cfg, i);
> + if (prev_label && !strcmp(label, prev_label))
> type_idx++;
> else
> type_idx = 0;
> - label = hda_get_autocfg_input_label(codec, cfg, i);
> + prev_label = label;
> +
> if (mixer) {
> idx = get_connection_index(codec, mixer, pin);
> if (idx >= 0) {
> @@ -10819,25 +10821,30 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
> {
> struct alc_spec *spec = codec->spec;
> struct auto_pin_cfg *cfg = &spec->autocfg;
> - int i, err, type;
> + int i, err;
> int type_idx = 0;
> hda_nid_t nid;
> + const char* prev_label = NULL;
>
> for (i = 0; i < cfg->num_inputs; i++) {
> if (cfg->inputs[i].type > AUTO_PIN_MIC)
> break;
> nid = cfg->inputs[i].pin;
> if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
> - char label[32];
> - type = cfg->inputs[i].type;
> - if (i > 0 && type == cfg->inputs[i - 1].type)
> + const char* label;
> + char boost_label[32];
> +
> + label = hda_get_autocfg_input_label(codec, cfg, i);
> + if (prev_label && !strcmp(label, prev_label))
> type_idx++;
> else
> type_idx = 0;
> - snprintf(label, sizeof(label), "%s Boost Volume",
> - hda_get_autocfg_input_label(codec, cfg, i));
> - err = add_control(spec, ALC_CTL_WIDGET_VOL, label,
> - type_idx,
> + prev_label = label;
> +
> + snprintf(boost_label, sizeof(boost_label),
> + "%s Boost Volume", label);
> + err = add_control(spec, ALC_CTL_WIDGET_VOL,
> + boost_label, type_idx,
> HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
> if (err < 0)
> return err;
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-10 10:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 10:10 [PATCH] ALSA: HDA: Fix volume control indices for Mics (Realtek) David Henningsson
2011-01-10 10:20 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).