[alsa-devel] [PATCH] hda-emu: Allow Realtek codecs to access node 0x51
There is sometimes a secret node 0x51 on Realtek codecs, controlling an equally secret DSP.
At least make sure the automated test suite doesn't fail when trying to access this secret node.
Signed-off-by: David Henningsson david.henningsson@canonical.com --- hda-int.c | 6 ++++++ hda-spec.c | 13 +++++++++++++ include/hda-types.h | 1 + 3 files changed, 20 insertions(+)
diff --git a/hda-int.c b/hda-int.c index fbd3cee..ef90fe8 100644 --- a/hda-int.c +++ b/hda-int.c @@ -1125,6 +1125,12 @@ int hda_cmd(struct xhda_codec *codec, unsigned int cmd) unsigned int nid = (cmd >> 20) & 0x7f; unsigned int verb = (cmd >> 8) & 0xfff;
+ if (codec->extended_cmd) { + int r = codec->extended_cmd(codec, cmd); + if (r != -ENXIO) + return r; + } + tbl = find_matching_verb(codec, verb); if (!tbl) return -ENXIO; diff --git a/hda-spec.c b/hda-spec.c index 8f95914..e4bb547 100644 --- a/hda-spec.c +++ b/hda-spec.c @@ -354,6 +354,16 @@ static struct verb_ext_list extensions[] = { { } };
+static int realtek_dsp_cmd(struct xhda_codec *codec, unsigned int cmd) +{ + unsigned int nid = (cmd >> 20) & 0x7f; + if (nid != 0x51) + return -ENXIO; + /* There might be a secret DSP connected to node 0x51 */ + codec->rc = 0; + return 0; +} + /* * fixups */ @@ -466,4 +476,7 @@ void add_codec_extensions(struct xhda_codec *codec) else if (!strcmp(codec->parsed_name, "Realtek ALC661")) hda_set_proc_coef(codec, 0x20, 0x00, 0x8020);
+ if (!strncmp(codec->parsed_name, "Realtek", strlen("Realtek"))) + codec->extended_cmd = realtek_dsp_cmd; + } diff --git a/include/hda-types.h b/include/hda-types.h index fac5084..fe6b31f 100644 --- a/include/hda-types.h +++ b/include/hda-types.h @@ -114,6 +114,7 @@ struct xhda_codec { unsigned int rc; struct xhda_verb_table *extended_verbs; struct xhda_verb_table *extended_parameters; + int (*extended_cmd) (struct xhda_codec *codec, unsigned int cmd); struct xhda_value_cache *value_cache; unsigned short pci_vendor, pci_device; unsigned short pci_subvendor, pci_subdevice;
At Fri, 19 Jul 2013 11:43:55 +0200, David Henningsson wrote:
There is sometimes a secret node 0x51 on Realtek codecs, controlling an equally secret DSP.
At least make sure the automated test suite doesn't fail when trying to access this secret node.
Signed-off-by: David Henningsson david.henningsson@canonical.com
Thanks, applied.
Takashi
hda-int.c | 6 ++++++ hda-spec.c | 13 +++++++++++++ include/hda-types.h | 1 + 3 files changed, 20 insertions(+)
diff --git a/hda-int.c b/hda-int.c index fbd3cee..ef90fe8 100644 --- a/hda-int.c +++ b/hda-int.c @@ -1125,6 +1125,12 @@ int hda_cmd(struct xhda_codec *codec, unsigned int cmd) unsigned int nid = (cmd >> 20) & 0x7f; unsigned int verb = (cmd >> 8) & 0xfff;
- if (codec->extended_cmd) {
int r = codec->extended_cmd(codec, cmd);
if (r != -ENXIO)
return r;
- }
- tbl = find_matching_verb(codec, verb); if (!tbl) return -ENXIO;
diff --git a/hda-spec.c b/hda-spec.c index 8f95914..e4bb547 100644 --- a/hda-spec.c +++ b/hda-spec.c @@ -354,6 +354,16 @@ static struct verb_ext_list extensions[] = { { } };
+static int realtek_dsp_cmd(struct xhda_codec *codec, unsigned int cmd) +{
- unsigned int nid = (cmd >> 20) & 0x7f;
- if (nid != 0x51)
return -ENXIO;
- /* There might be a secret DSP connected to node 0x51 */
- codec->rc = 0;
- return 0;
+}
/*
- fixups
*/ @@ -466,4 +476,7 @@ void add_codec_extensions(struct xhda_codec *codec) else if (!strcmp(codec->parsed_name, "Realtek ALC661")) hda_set_proc_coef(codec, 0x20, 0x00, 0x8020);
- if (!strncmp(codec->parsed_name, "Realtek", strlen("Realtek")))
codec->extended_cmd = realtek_dsp_cmd;
} diff --git a/include/hda-types.h b/include/hda-types.h index fac5084..fe6b31f 100644 --- a/include/hda-types.h +++ b/include/hda-types.h @@ -114,6 +114,7 @@ struct xhda_codec { unsigned int rc; struct xhda_verb_table *extended_verbs; struct xhda_verb_table *extended_parameters;
- int (*extended_cmd) (struct xhda_codec *codec, unsigned int cmd); struct xhda_value_cache *value_cache; unsigned short pci_vendor, pci_device; unsigned short pci_subvendor, pci_subdevice;
-- 1.7.9.5
participants (2)
-
David Henningsson
-
Takashi Iwai