Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 100251 Details for
Bug 151761
alsa-driver patch for Conexant sound cards
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
conexant-kernel-test1.patch
conexant-kernel-test1.patch (text/plain), 14.24 KB, created by
Scott Van Der Wall
on 2006-10-22 23:51:12 UTC
(
hide
)
Description:
conexant-kernel-test1.patch
Filename:
MIME Type:
Creator:
Scott Van Der Wall
Created:
2006-10-22 23:51:12 UTC
Size:
14.24 KB
patch
obsolete
>diff -r d7fe584f7395 Documentation/ALSA-Configuration.txt >--- a/Documentation/ALSA-Configuration.txt Thu Oct 19 20:35:56 2006 +0200 >+++ b/Documentation/ALSA-Configuration.txt Sun Oct 22 10:03:13 2006 -0700 >@@ -865,6 +865,9 @@ Prior to version 0.9.0rc4 options had a > laptop 3-jack with hp-jack automute > laptop-dig ditto with SPDIF > auto auto-config reading BIOS (default) >+ >+ Conexant >+ laptop Laptop config with SPDIF > > STAC9200/9205/9220/9221/9254 > ref Reference board >diff -r d7fe584f7395 pci/hda/Makefile >--- a/pci/hda/Makefile Thu Oct 19 20:35:56 2006 +0200 >+++ b/pci/hda/Makefile Sun Oct 22 10:03:13 2006 -0700 >@@ -1,5 +1,5 @@ snd-hda-intel-objs := hda_intel.o > snd-hda-intel-objs := hda_intel.o >-snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o patch_si3054.o patch_atihdmi.o >+snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o patch_si3054.o patch_atihdmi.o patch_conexant.o > ifdef CONFIG_PROC_FS > snd-hda-codec-objs += hda_proc.o > endif >diff -r d7fe584f7395 pci/hda/hda_patch.h >--- a/pci/hda/hda_patch.h Thu Oct 19 20:35:56 2006 +0200 >+++ b/pci/hda/hda_patch.h Sun Oct 22 10:03:13 2006 -0700 >@@ -14,6 +14,8 @@ extern struct hda_codec_preset snd_hda_p > extern struct hda_codec_preset snd_hda_preset_si3054[]; > /* ATI HDMI codecs */ > extern struct hda_codec_preset snd_hda_preset_atihdmi[]; >+/* Conexant audio codec */ >+extern struct hda_codec_preset snd_hda_preset_conexant[]; > > static const struct hda_codec_preset *hda_preset_tables[] = { > snd_hda_preset_realtek, >@@ -22,5 +24,6 @@ static const struct hda_codec_preset *hd > snd_hda_preset_sigmatel, > snd_hda_preset_si3054, > snd_hda_preset_atihdmi, >+ snd_hda_preset_conexant, > NULL > }; >--- /dev/null 2006-09-13 00:29:45.000000000 -0700 >+++ b/pci/hda/patch_conexant.c 2006-10-22 09:57:06.000000000 -0700 >@@ -0,0 +1,420 @@ >+/* >+ * HD audio interface patch for Conexant HDA audio codec >+ * >+ * Copyright (c) 2006 Pototskiy Alex <alex.pototskiy@gmail.com> >+ * >+ * This driver is free software; you can redistribute it and/or modify >+ * it under the terms of the GNU General Public License as published by >+ * the Free Software Foundation; either version 2 of the License, or >+ * (at your option) any later version. >+ * >+ * This driver is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+ * GNU General Public License for more details. >+ * >+ * You should have received a copy of the GNU General Public License >+ * along with this program; if not, write to the Free Software >+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >+ */ >+ >+#include <sound/driver.h> >+#include <linux/init.h> >+#include <linux/delay.h> >+#include <linux/slab.h> >+#include <linux/pci.h> >+#include <sound/core.h> >+#include "hda_codec.h" >+#include "hda_local.h" >+ >+#define MAIN_MUX 0x1A >+#define DAC 0x10 >+#define ADC 0x12 >+#define SPDIF_OUT 0x11 >+ >+struct conexant_spec { >+ >+ struct snd_kcontrol_new *mixers[5]; >+ int num_mixers; >+ >+ const struct hda_verb *init_verbs[5]; /* initialization verbs >+ * don't forget NULL termination! >+ */ >+ unsigned int num_init_verbs; >+ >+ /* playback */ >+ struct hda_multi_out multiout; /* playback set-up >+ * max_channels, dacs must be set >+ * dig_out_nid and hp_nid are optional >+ */ >+ /* capture */ >+ unsigned int num_adc_nids; >+ hda_nid_t *adc_nids; >+ hda_nid_t dig_in_nid; /* digital-in NID; optional */ >+ >+ /* capture source */ >+ const struct hda_input_mux *input_mux; >+ hda_nid_t *capsrc_nids; >+ unsigned int cur_mux[3]; >+ >+ /* channel model */ >+ const struct hda_channel_mode *channel_mode; >+ int num_channel_mode; >+ >+ /* PCM information */ >+ struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ >+ >+ struct mutex amp_mutex; /* PCM volume/mute control mutex */ >+ unsigned int spdif_route; >+ >+ /* dynamic controls, init_verbs and input_mux */ >+ struct auto_pin_cfg autocfg; >+ unsigned int num_kctl_alloc, num_kctl_used; >+ struct snd_kcontrol_new *kctl_alloc; >+ struct hda_input_mux private_imux; >+ hda_nid_t private_dac_nids[4]; >+ >+}; >+ >+static hda_nid_t conexant_dac_nids[1] = { DAC }; >+static hda_nid_t conexant_adc_nids[1] = { ADC }; >+static hda_nid_t conexant_capsrc_nids[1] = { 0x19 }; >+ >+static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); >+} >+ >+static int conexant_playback_pcm_prepare(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ unsigned int stream_tag, >+ unsigned int format, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, >+ format, substream); >+} >+ >+static int conexant_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); >+} >+ >+/* >+ * Digital out >+ */ >+static int conexant_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ return snd_hda_multi_out_dig_open(codec, &spec->multiout); >+} >+ >+static int conexant_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ return snd_hda_multi_out_dig_close(codec, &spec->multiout); >+} >+ >+/* >+ * Analog capture >+ */ >+static int conexant_capture_pcm_prepare(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ unsigned int stream_tag, >+ unsigned int format, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], >+ stream_tag, 0, format); >+ return 0; >+} >+ >+static int conexant_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, >+ struct hda_codec *codec, >+ struct snd_pcm_substream *substream) >+{ >+ struct conexant_spec *spec = codec->spec; >+ snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], >+ 0, 0, 0); >+ return 0; >+} >+ >+ >+ >+static struct hda_pcm_stream conexant_pcm_analog_playback = { >+ .substreams = 1, >+ .channels_min = 2, >+ .channels_max = 2, >+ .nid = 0, /* fill later */ >+ .ops = { >+ .open = conexant_playback_pcm_open, >+ .prepare = conexant_playback_pcm_prepare, >+ .cleanup = conexant_playback_pcm_cleanup >+ }, >+ >+}; >+ >+static struct hda_pcm_stream conexant_pcm_analog_capture = { >+ .substreams = 1, >+ .channels_min = 2, >+ .channels_max = 2, >+ .nid = 0, /* fill later */ >+ .ops = { >+ .prepare = conexant_capture_pcm_prepare, >+ .cleanup = conexant_capture_pcm_cleanup >+ }, >+ >+}; >+ >+ >+static struct hda_pcm_stream conexant_pcm_digital_playback = { >+ .substreams = 1, >+ .channels_min = 2, >+ .channels_max = 2, >+ .nid = 0, /* fill later */ >+ .ops = { >+ .open = conexant_dig_playback_pcm_open, >+ .close = conexant_dig_playback_pcm_close >+ }, >+}; >+ >+static struct hda_pcm_stream conexant_pcm_digital_capture = { >+ .substreams = 1, >+ .channels_min = 2, >+ .channels_max = 2, >+ /* NID is set in alc_build_pcms */ >+}; >+ >+static int conexant_build_pcms(struct hda_codec *codec) { >+ struct conexant_spec *spec = codec->spec; >+ struct hda_pcm *info = spec->pcm_rec; >+ >+ codec->num_pcms = 1; >+ codec->pcm_info = info; >+ >+ info->name = "CONEXANT Analog"; >+ info->stream[SNDRV_PCM_STREAM_PLAYBACK] = conexant_pcm_analog_playback; >+ info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->multiout.max_channels; >+ info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; >+ info->stream[SNDRV_PCM_STREAM_CAPTURE] = conexant_pcm_analog_capture; >+ info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adc_nids; >+ info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; >+ >+ if (spec->multiout.dig_out_nid) { >+ info++; >+ codec->num_pcms++; >+ info->name = "Conexant Digital"; >+ info->stream[SNDRV_PCM_STREAM_PLAYBACK] = conexant_pcm_digital_playback; >+ info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; >+ if (spec->dig_in_nid) { >+ info->stream[SNDRV_PCM_STREAM_CAPTURE] = conexant_pcm_digital_capture; >+ info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; >+ } >+ } >+ >+ return 0; >+} >+/* */ >+static struct hda_input_mux conexant_capture_source = { >+ .num_items = 4, >+ .items = { >+ { "ExtMic", 0x1 }, >+ { "IntMic", 0x2 }, >+ { "Line", 0x3 }, >+ { "CD", 0x4 } >+ } >+}; >+ >+static int conexant_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) >+{ >+ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); >+ struct conexant_spec *spec = codec->spec; >+ >+ return snd_hda_input_mux_info(spec->input_mux, uinfo); >+} >+ >+static int conexant_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) >+{ >+ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); >+ struct conexant_spec *spec = codec->spec; >+ unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); >+ >+ ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; >+ return 0; >+} >+ >+static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) >+{ >+ struct hda_codec *codec = snd_kcontrol_chip(kcontrol); >+ struct conexant_spec *spec = codec->spec; >+ unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); >+ >+ return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, >+ spec->capsrc_nids[adc_idx], >+ &spec->cur_mux[adc_idx]); >+} >+ >+ >+static struct snd_kcontrol_new conexant_mixers[] = { >+ { >+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, >+ .name = "Capture Source", >+ .info = conexant_mux_enum_info, >+ .get = conexant_mux_enum_get, >+ .put = conexant_mux_enum_put >+ }, >+ HDA_CODEC_VOLUME("Mic Bypass Capture Volume",0x19,0x02,HDA_INPUT), >+ HDA_CODEC_MUTE("Mic Bypass Capture Switch",0x19,0x02,HDA_INPUT), >+ HDA_CODEC_VOLUME("Capture Volume",0x12,0x03,HDA_INPUT), >+ HDA_CODEC_MUTE("Capture Switch",0x12,0x03,HDA_INPUT), >+ HDA_CODEC_VOLUME("PCM Volume",0x10,0x00,HDA_OUTPUT), >+ HDA_CODEC_MUTE("PCM Switch",0x10,0x00,HDA_OUTPUT), >+ HDA_CODEC_VOLUME("Headphone Playback Volume",0x13,0x00,HDA_OUTPUT), >+ HDA_CODEC_MUTE("Headphone Playback Switch",0x13,0x00,HDA_OUTPUT), >+ {} >+}; >+ >+static int conexant_build_controls(struct hda_codec *codec) { >+ struct conexant_spec *spec = codec->spec; >+ unsigned int i; >+ int err; >+ >+ for (i = 0; i < spec->num_mixers; i++) { >+ err = snd_hda_add_new_ctls(codec, spec->mixers[i]); >+ if (err < 0) >+ return err; >+ } >+ if (spec->multiout.dig_out_nid) { >+ err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); >+ if (err < 0) >+ return err; >+ } >+ if (spec->dig_in_nid) { >+ err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); >+ if (err < 0) >+ return err; >+ } >+ return 0; >+} >+ >+static struct hda_verb conexant_init_verbs[] = { >+ /* Line in, Mic, Built-in Mic */ >+ {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, >+ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, >+ {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 }, >+ /* HP, Amp */ >+ {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, >+ {0x1A, AC_VERB_SET_CONNECT_SEL,0x01}, >+ {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x00}, >+ {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x03}, >+ /* Record selector: Front mic */ >+ {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, >+ {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, >+ /* SPDIF route: PCM */ >+ { 0x18, AC_VERB_SET_CONNECT_SEL, 0x0 }, >+ { } /* end */ >+}; >+ >+static int conexant_init(struct hda_codec *codec) { >+ struct conexant_spec *spec = codec->spec; >+ int i; >+ >+ for (i = 0; i < spec->num_init_verbs; i++) >+ snd_hda_sequence_write(codec, spec->init_verbs[i]); >+ return 0; >+} >+ >+static void conexant_free(struct hda_codec *codec) { >+ struct conexant_spec *spec = codec->spec; >+ unsigned int i; >+ >+ if (spec->kctl_alloc) { >+ for (i = 0; i < spec->num_kctl_used; i++) >+ kfree(spec->kctl_alloc[i].name); >+ kfree(spec->kctl_alloc); >+ } >+ >+ kfree(codec->spec); >+} >+ >+#ifdef CONFIG_PM >+static int conexant_resume(struct hda_codec *codec) >+{ >+ struct conexant_spec *spec = codec->spec; >+ int i; >+ >+ codec->patch_ops.init(codec); >+ for (i = 0; i < spec->num_mixers; i++) >+ snd_hda_resume_ctls(codec, spec->mixers[i]); >+ if (spec->multiout.dig_out_nid) >+ snd_hda_resume_spdif_out(codec); >+ if (spec->dig_in_nid) >+ snd_hda_resume_spdif_in(codec); >+ return 0; >+} >+#endif >+ >+static struct hda_codec_ops conexant_patch_ops = { >+ .build_controls = conexant_build_controls, >+ .build_pcms = conexant_build_pcms, >+ .init = conexant_init, >+ .free = conexant_free, >+#ifdef CONFIG_PM >+ .resume = conexant_resume, >+#endif >+}; >+ >+enum { CONEXANT_LAPTOP }; >+ >+static struct hda_board_config conexant_cfg_tbl[] = { >+ { .modelname = "laptop", .config = CONEXANT_LAPTOP }, >+ {} >+}; >+ >+static int patch_conexant(struct hda_codec *codec) { >+ struct conexant_spec *spec; >+ int board_config; >+ >+ spec = kzalloc(sizeof(*spec), GFP_KERNEL); >+ if ( !spec ) >+ return -ENOMEM; >+ mutex_init(&spec->amp_mutex); >+ codec->spec = spec; >+ >+ spec->multiout.max_channels = 2; >+ spec->multiout.num_dacs = ARRAY_SIZE(conexant_dac_nids); >+ spec->multiout.dac_nids = conexant_dac_nids; >+ spec->multiout.dig_out_nid = SPDIF_OUT; >+ spec->num_adc_nids = 1; >+ spec->adc_nids = conexant_adc_nids; >+ spec->capsrc_nids = conexant_capsrc_nids; >+ spec->input_mux = &conexant_capture_source; >+ spec->num_mixers = 1; >+ spec->mixers[0] = conexant_mixers; >+ spec->num_init_verbs = 1; >+ spec->init_verbs[0] = conexant_init_verbs; >+ spec->spdif_route = 0; >+ >+ codec->patch_ops = conexant_patch_ops; >+ /* Place holder for different board configurations */ >+ board_config = snd_hda_check_board_config(codec, conexant_cfg_tbl); >+ >+ return 0; >+} >+ >+struct hda_codec_preset snd_hda_preset_conexant[] = { >+ { .id = 0x14f15047, .name = "CONEXANT", .patch = patch_conexant }, >+ {} /* terminator */ >+};
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 151761
:
99904
|
100250
| 100251