From 02b6b5b640e773eb4d4d0685fa6c1fbc660b2834 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 21 Jan 2011 13:27:39 +0100 Subject: ALSA: HDA: Refactor some redundant code for Conexant 5066/205xx Four very similar procedures - one for each model - now refactored into one. This isn't all duplicated code, but a step in the right direction. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 81 ++++++++++++------------------------------ 1 file changed, 23 insertions(+), 58 deletions(-) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 9bb030a469c..7cd59b9f0e9 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -2387,79 +2387,53 @@ static void cxt5066_hp_automute(struct hda_codec *codec) cxt5066_update_speaker(codec); } -/* unsolicited event for jack sensing */ -static void cxt5066_olpc_unsol_event(struct hda_codec *codec, unsigned int res) +/* Dispatch the right mic autoswitch function */ +static void cxt5066_automic(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; - snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); - switch (res >> 26) { - case CONEXANT_HP_EVENT: - cxt5066_hp_automute(codec); - break; - case CONEXANT_MIC_EVENT: - /* ignore mic events in DC mode; we're always using the jack */ - if (!spec->dc_enable) - cxt5066_olpc_automic(codec); - break; - } -} -/* unsolicited event for jack sensing */ -static void cxt5066_vostro_event(struct hda_codec *codec, unsigned int res) -{ - snd_printdd("CXT5066_vostro: unsol event %x (%x)\n", res, res >> 26); - switch (res >> 26) { - case CONEXANT_HP_EVENT: - cxt5066_hp_automute(codec); - break; - case CONEXANT_MIC_EVENT: + if (spec->dell_vostro) cxt5066_vostro_automic(codec); - break; - } -} - -/* unsolicited event for jack sensing */ -static void cxt5066_ideapad_event(struct hda_codec *codec, unsigned int res) -{ - snd_printdd("CXT5066_ideapad: unsol event %x (%x)\n", res, res >> 26); - switch (res >> 26) { - case CONEXANT_HP_EVENT: - cxt5066_hp_automute(codec); - break; - case CONEXANT_MIC_EVENT: + else if (spec->ideapad) cxt5066_ideapad_automic(codec); - break; - } + else if (spec->thinkpad) + cxt5066_thinkpad_automic(codec); + else if (spec->hp_laptop) + cxt5066_hp_laptop_automic(codec); } /* unsolicited event for jack sensing */ -static void cxt5066_hp_laptop_event(struct hda_codec *codec, unsigned int res) +static void cxt5066_olpc_unsol_event(struct hda_codec *codec, unsigned int res) { - snd_printdd("CXT5066_hp_laptop: unsol event %x (%x)\n", res, res >> 26); + struct conexant_spec *spec = codec->spec; + snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); switch (res >> 26) { case CONEXANT_HP_EVENT: cxt5066_hp_automute(codec); break; case CONEXANT_MIC_EVENT: - cxt5066_hp_laptop_automic(codec); + /* ignore mic events in DC mode; we're always using the jack */ + if (!spec->dc_enable) + cxt5066_olpc_automic(codec); break; } } /* unsolicited event for jack sensing */ -static void cxt5066_thinkpad_event(struct hda_codec *codec, unsigned int res) +static void cxt5066_unsol_event(struct hda_codec *codec, unsigned int res) { - snd_printdd("CXT5066_thinkpad: unsol event %x (%x)\n", res, res >> 26); + snd_printdd("CXT5066: unsol event %x (%x)\n", res, res >> 26); switch (res >> 26) { case CONEXANT_HP_EVENT: cxt5066_hp_automute(codec); break; case CONEXANT_MIC_EVENT: - cxt5066_thinkpad_automic(codec); + cxt5066_automic(codec); break; } } + static const struct hda_input_mux cxt5066_analog_mic_boost = { .num_items = 5, .items = { @@ -3039,20 +3013,11 @@ static struct hda_verb cxt5066_init_verbs_hp_laptop[] = { /* initialize jack-sensing, too */ static int cxt5066_init(struct hda_codec *codec) { - struct conexant_spec *spec = codec->spec; - snd_printdd("CXT5066: init\n"); conexant_init(codec); if (codec->patch_ops.unsol_event) { cxt5066_hp_automute(codec); - if (spec->dell_vostro) - cxt5066_vostro_automic(codec); - else if (spec->ideapad) - cxt5066_ideapad_automic(codec); - else if (spec->thinkpad) - cxt5066_thinkpad_automic(codec); - else if (spec->hp_laptop) - cxt5066_hp_laptop_automic(codec); + cxt5066_automic(codec); } cxt5066_set_mic_boost(codec); return 0; @@ -3169,7 +3134,7 @@ static int patch_cxt5066(struct hda_codec *codec) break; case CXT5066_HP_LAPTOP: codec->patch_ops.init = cxt5066_init; - codec->patch_ops.unsol_event = cxt5066_hp_laptop_event; + codec->patch_ops.unsol_event = cxt5066_unsol_event; spec->init_verbs[spec->num_init_verbs] = cxt5066_init_verbs_hp_laptop; spec->num_init_verbs++; @@ -3207,7 +3172,7 @@ static int patch_cxt5066(struct hda_codec *codec) break; case CXT5066_DELL_VOSTRO: codec->patch_ops.init = cxt5066_init; - codec->patch_ops.unsol_event = cxt5066_vostro_event; + codec->patch_ops.unsol_event = cxt5066_unsol_event; spec->init_verbs[0] = cxt5066_init_verbs_vostro; spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; spec->mixers[spec->num_mixers++] = cxt5066_mixers; @@ -3224,7 +3189,7 @@ static int patch_cxt5066(struct hda_codec *codec) break; case CXT5066_IDEAPAD: codec->patch_ops.init = cxt5066_init; - codec->patch_ops.unsol_event = cxt5066_ideapad_event; + codec->patch_ops.unsol_event = cxt5066_unsol_event; spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; spec->mixers[spec->num_mixers++] = cxt5066_mixers; spec->init_verbs[0] = cxt5066_init_verbs_ideapad; @@ -3240,7 +3205,7 @@ static int patch_cxt5066(struct hda_codec *codec) break; case CXT5066_THINKPAD: codec->patch_ops.init = cxt5066_init; - codec->patch_ops.unsol_event = cxt5066_thinkpad_event; + codec->patch_ops.unsol_event = cxt5066_unsol_event; spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; spec->mixers[spec->num_mixers++] = cxt5066_mixers; spec->init_verbs[0] = cxt5066_init_verbs_thinkpad; -- cgit v1.2.3 From a1d6906e2d2b4655e248f490ab088c27876a600a Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 21 Jan 2011 13:33:28 +0100 Subject: ALSA: HDA: Add a new model "asus" for Conexant 5066/205xx BugLink: http://bugs.launchpad.net/bugs/701271 This new model, named "asus", is identical to the "hp_laptop" model, except for the location of the internal mic, which is at pin 0x1a. It is used for Asus K52JU and Lenovo G560. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- Documentation/sound/alsa/HD-Audio-Models.txt | 1 + sound/pci/hda/patch_conexant.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 16ae4300c74..0caf77e59be 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt @@ -296,6 +296,7 @@ Conexant 5066 ============= laptop Basic Laptop config (default) hp-laptop HP laptops, e g G60 + asus Asus K52JU, Lenovo G560 dell-laptop Dell laptops dell-vostro Dell Vostro olpc-xo-1_5 OLPC XO 1.5 diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 7cd59b9f0e9..19f0daf6497 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -127,6 +127,7 @@ struct conexant_spec { unsigned int ideapad:1; unsigned int thinkpad:1; unsigned int hp_laptop:1; + unsigned int asus:1; unsigned int ext_mic_present; unsigned int recording; @@ -2312,6 +2313,19 @@ static void cxt5066_ideapad_automic(struct hda_codec *codec) } } + +/* toggle input of built-in digital mic and mic jack appropriately */ +static void cxt5066_asus_automic(struct hda_codec *codec) +{ + unsigned int present; + + present = snd_hda_jack_detect(codec, 0x1b); + snd_printdd("CXT5066: external microphone present=%d\n", present); + snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_CONNECT_SEL, + present ? 1 : 0); +} + + /* toggle input of built-in digital mic and mic jack appropriately */ static void cxt5066_hp_laptop_automic(struct hda_codec *codec) { @@ -2400,6 +2414,8 @@ static void cxt5066_automic(struct hda_codec *codec) cxt5066_thinkpad_automic(codec); else if (spec->hp_laptop) cxt5066_hp_laptop_automic(codec); + else if (spec->asus) + cxt5066_asus_automic(codec); } /* unsolicited event for jack sensing */ @@ -3045,6 +3061,7 @@ enum { CXT5066_DELL_VOSTRO, /* Dell Vostro 1015i */ CXT5066_IDEAPAD, /* Lenovo IdeaPad U150 */ CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */ + CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */ CXT5066_HP_LAPTOP, /* HP Laptop */ CXT5066_MODELS }; @@ -3056,6 +3073,7 @@ static const char * const cxt5066_models[CXT5066_MODELS] = { [CXT5066_DELL_VOSTRO] = "dell-vostro", [CXT5066_IDEAPAD] = "ideapad", [CXT5066_THINKPAD] = "thinkpad", + [CXT5066_ASUS] = "asus", [CXT5066_HP_LAPTOP] = "hp-laptop", }; @@ -3068,6 +3086,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), + SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), @@ -3077,6 +3096,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), + SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ {} }; @@ -3132,13 +3152,15 @@ static int patch_cxt5066(struct hda_codec *codec) spec->num_init_verbs++; spec->dell_automute = 1; break; + case CXT5066_ASUS: case CXT5066_HP_LAPTOP: codec->patch_ops.init = cxt5066_init; codec->patch_ops.unsol_event = cxt5066_unsol_event; spec->init_verbs[spec->num_init_verbs] = cxt5066_init_verbs_hp_laptop; spec->num_init_verbs++; - spec->hp_laptop = 1; + spec->hp_laptop = board_config == CXT5066_HP_LAPTOP; + spec->asus = board_config == CXT5066_ASUS; spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; spec->mixers[spec->num_mixers++] = cxt5066_mixers; /* no S/PDIF out */ -- cgit v1.2.3 From f6a2491ca23d26d829730e33fbdd9e44fc5d1d53 Mon Sep 17 00:00:00 2001 From: Andy Robinson Date: Mon, 24 Jan 2011 10:12:37 -0500 Subject: ALSA: HDA: cxt5066 - Use asus model for Asus U50F, select correct SPDIF output Changed the Asus A52J quirk to use the asus model instead of the hp_laptop model, which fixes the external mic input. Added an Asus U50F quirk to use the asus model. For the cxt5066 codecs, added checking of the digital output pins to determine which digital output nodes to use instead of always using node 0x21, since some systems have node 0x12 connected to a SPDIF out jack. [A slight modification for better readability by tiwai] Signed-off-by: Andy Robinson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 19f0daf6497..9867afc7895 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -85,6 +85,7 @@ struct conexant_spec { unsigned int auto_mic; int auto_mic_ext; /* autocfg.inputs[] index for ext mic */ unsigned int need_dac_fix; + hda_nid_t slave_dig_outs[2]; /* capture */ unsigned int num_adc_nids; @@ -353,6 +354,8 @@ static int conexant_build_pcms(struct hda_codec *codec) info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; } + if (spec->slave_dig_outs[0]) + codec->slave_dig_outs = spec->slave_dig_outs; } return 0; @@ -2101,7 +2104,7 @@ static int patch_cxt5051(struct hda_codec *codec) static hda_nid_t cxt5066_dac_nids[1] = { 0x10 }; static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; -#define CXT5066_SPDIF_OUT 0x21 +static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 }; /* OLPC's microphone port is DC coupled for use with external sensors, * therefore we use a 50% mic bias in order to center the input signal with @@ -2623,6 +2626,27 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec) spec->recording = 0; } +static void conexant_check_dig_outs(struct hda_codec *codec, + hda_nid_t *dig_pins, + int num_pins) +{ + struct conexant_spec *spec = codec->spec; + hda_nid_t *nid_loc = &spec->multiout.dig_out_nid; + int i; + + for (i = 0; i < num_pins; i++, dig_pins++) { + unsigned int cfg = snd_hda_codec_get_pincfg(codec, *dig_pins); + if (get_defcfg_connect(cfg) == AC_JACK_PORT_NONE) + continue; + if (snd_hda_get_connections(codec, *dig_pins, nid_loc, 1) != 1) + continue; + if (spec->slave_dig_outs[0]) + nid_loc++; + else + nid_loc = spec->slave_dig_outs; + } +} + static struct hda_input_mux cxt5066_capture_source = { .num_items = 4, .items = { @@ -3085,8 +3109,9 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), - SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), + SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), + SND_PCI_QUIRK(0x1043, 0x1993, "Asus U50F", CXT5066_ASUS), SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), @@ -3118,7 +3143,8 @@ static int patch_cxt5066(struct hda_codec *codec) spec->multiout.max_channels = 2; spec->multiout.num_dacs = ARRAY_SIZE(cxt5066_dac_nids); spec->multiout.dac_nids = cxt5066_dac_nids; - spec->multiout.dig_out_nid = CXT5066_SPDIF_OUT; + conexant_check_dig_outs(codec, cxt5066_digout_pin_nids, + ARRAY_SIZE(cxt5066_digout_pin_nids)); spec->num_adc_nids = 1; spec->adc_nids = cxt5066_adc_nids; spec->capsrc_nids = cxt5066_capsrc_nids; @@ -3164,7 +3190,8 @@ static int patch_cxt5066(struct hda_codec *codec) spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; spec->mixers[spec->num_mixers++] = cxt5066_mixers; /* no S/PDIF out */ - spec->multiout.dig_out_nid = 0; + if (board_config == CXT5066_HP_LAPTOP) + spec->multiout.dig_out_nid = 0; /* input source automatically selected */ spec->input_mux = NULL; spec->port_d_mode = 0; -- cgit v1.2.3 From c73e0c83f512012e7c357e516a0d7c0a832bfa34 Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Wed, 26 Jan 2011 16:39:37 +0200 Subject: ASoC: Fix module refcount for auxiliary devices Commit f6c2ed5 "ASoC: Fix the device references to codec and platform drivers" moved codec driver refcount increments from soc_bind_dai_link into soc_probe_codec. However, the commit didn't remove try_module_get from soc_probe_aux_dev so the auxiliary device reference counts are incremented twice as the soc_probe_codec is called from soc_probe_aux_dev too. Signed-off-by: Jarkko Nikula Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bac7291b6ff..c4b60610beb 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1664,9 +1664,6 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num) goto out; found: - if (!try_module_get(codec->dev->driver->owner)) - return -ENODEV; - ret = soc_probe_codec(card, codec); if (ret < 0) return ret; -- cgit v1.2.3 From 195938753951e70e85303301c37906c7ad72645e Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Thu, 27 Jan 2011 10:28:46 +0100 Subject: ALSA: HDA: Fix microphone(s) on Lenovo Edge 13 BugLink: http://bugs.launchpad.net/bugs/708521 This Edge 13 model has an internal mic at 0x1a and should therefore use the asus quirk. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 9867afc7895..7e1ca43bd66 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -3120,6 +3120,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), + SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ -- cgit v1.2.3 From 0fa63b69284c9bbedf876c677a9e650243cc40be Mon Sep 17 00:00:00 2001 From: "Manjunathappa, Prakash" Date: Thu, 27 Jan 2011 19:17:43 +0530 Subject: ASoC: DaVinci: fix kernel panic due to uninitialized platform_data This patch fixes the Kernel panic issue on accessing davinci_vc in cq93vc_probe function. struct davinci_vc is part of platform device's private driver data(codec->dev->p->driver_data) and this is populated by DaVinci Voice Codec MFD driver. Signed-off-by: Manjunathappa, Prakash Signed-off-by: Mark Brown --- sound/soc/codecs/cq93vc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index 46dbfd067f7..347a567b01e 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c @@ -153,7 +153,7 @@ static int cq93vc_resume(struct snd_soc_codec *codec) static int cq93vc_probe(struct snd_soc_codec *codec) { - struct davinci_vc *davinci_vc = codec->dev->platform_data; + struct davinci_vc *davinci_vc = snd_soc_codec_get_drvdata(codec); davinci_vc->cq93vc.codec = codec; codec->control_data = davinci_vc; -- cgit v1.2.3 From e9cf7049330cd44c8af43b0c5c7bef25a086c5b7 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 27 Jan 2011 14:54:05 -0700 Subject: ASoC: Fix mask/val_mask confusion snd_soc_dapm_put_volsw() snd_soc_dapm_put_volsw() has variables for both the unshifted and shifted mask for updates commit 97404f (ASoC: Do DAPM control updates in the middle of DAPM sequences) got confused between the two of these. Since there's no need to keep a copy of the unshifted mask fix this and simplify the code by using only one mask variable. [Completely rewrote the changelog to describe the issue -- broonie.] Signed-off-by: Stephen Warren Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 499730ab563..8194f150bab 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1742,7 +1742,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; - unsigned int val, val_mask; + unsigned int val; int connect, change; struct snd_soc_dapm_update update; @@ -1750,13 +1750,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, if (invert) val = max - val; - val_mask = mask << shift; + mask = mask << shift; val = val << shift; mutex_lock(&widget->codec->mutex); widget->value = val; - change = snd_soc_test_bits(widget->codec, reg, val_mask, val); + change = snd_soc_test_bits(widget->codec, reg, mask, val); if (change) { if (val) /* new connection */ -- cgit v1.2.3 From fdbc5d1b32e195b7775e103abd6263370f11af11 Mon Sep 17 00:00:00 2001 From: Amerigo Wang Date: Fri, 28 Jan 2011 16:52:00 +0800 Subject: sound: silent echo'ed messages in Makefile Silent these echo's, please. Signed-off-by: WANG Cong Signed-off-by: Takashi Iwai --- sound/oss/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/oss/Makefile b/sound/oss/Makefile index 96f14dcd0cd..90ffb99c6b1 100644 --- a/sound/oss/Makefile +++ b/sound/oss/Makefile @@ -87,7 +87,7 @@ ifeq ($(CONFIG_PSS_HAVE_BOOT),y) $(obj)/bin2hex pss_synth < $< > $@ else $(obj)/pss_boot.h: - ( \ + $(Q)( \ echo 'static unsigned char * pss_synth = NULL;'; \ echo 'static int pss_synthLen = 0;'; \ ) > $@ @@ -102,7 +102,7 @@ ifeq ($(CONFIG_TRIX_HAVE_BOOT),y) $(obj)/hex2hex -i trix_boot < $< > $@ else $(obj)/trix_boot.h: - ( \ + $(Q)( \ echo 'static unsigned char * trix_boot = NULL;'; \ echo 'static int trix_boot_len = 0;'; \ ) > $@ -- cgit v1.2.3 From efbeb0718126d277c9d7e902eec8da956acf4bd6 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 31 Jan 2011 11:47:52 +0100 Subject: ALSA: oxygen: fix output routing on Xonar DG This card uses separate I2S outputs for the front speakers and headphones, and reverses the order of the three speaker outputs. To work around this, add a model-specific callback to adjust the controller's playback routing. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/oxygen.h | 2 ++ sound/pci/oxygen/oxygen_mixer.c | 2 ++ sound/pci/oxygen/xonar_dg.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index c2ae63d17cd..f53897a708b 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h @@ -92,6 +92,8 @@ struct oxygen_model { void (*update_dac_volume)(struct oxygen *chip); void (*update_dac_mute)(struct oxygen *chip); void (*update_center_lfe_mix)(struct oxygen *chip, bool mixed); + unsigned int (*adjust_dac_routing)(struct oxygen *chip, + unsigned int play_routing); void (*gpio_changed)(struct oxygen *chip); void (*uart_input)(struct oxygen *chip); void (*ac97_switch)(struct oxygen *chip, diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 9bff14d5895..26c7e8bcb22 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c @@ -180,6 +180,8 @@ void oxygen_update_dac_routing(struct oxygen *chip) (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | (3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT); + if (chip->model.adjust_dac_routing) + reg_value = chip->model.adjust_dac_routing(chip, reg_value); oxygen_write16_masked(chip, OXYGEN_PLAY_ROUTING, reg_value, OXYGEN_PLAY_DAC0_SOURCE_MASK | OXYGEN_PLAY_DAC1_SOURCE_MASK | diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c index e1fa602eba7..bc6eb58be38 100644 --- a/sound/pci/oxygen/xonar_dg.c +++ b/sound/pci/oxygen/xonar_dg.c @@ -24,6 +24,11 @@ * * SPI 0 -> CS4245 * + * I²S 1 -> CS4245 + * I²S 2 -> CS4361 (center/LFE) + * I²S 3 -> CS4361 (surround) + * I²S 4 -> CS4361 (front) + * * GPIO 3 <- ? * GPIO 4 <- headphone detect * GPIO 5 -> route input jack to line-in (0) or mic-in (1) @@ -36,6 +41,7 @@ * input 1 <- aux * input 2 <- front mic * input 4 <- line/mic + * DAC out -> headphones * aux out -> front panel headphones */ @@ -207,6 +213,35 @@ static void set_cs4245_adc_params(struct oxygen *chip, cs4245_write_cached(chip, CS4245_ADC_CTRL, value); } +static inline unsigned int shift_bits(unsigned int value, + unsigned int shift_from, + unsigned int shift_to, + unsigned int mask) +{ + if (shift_from < shift_to) + return (value << (shift_to - shift_from)) & mask; + else + return (value >> (shift_from - shift_to)) & mask; +} + +static unsigned int adjust_dg_dac_routing(struct oxygen *chip, + unsigned int play_routing) +{ + return (play_routing & OXYGEN_PLAY_DAC0_SOURCE_MASK) | + shift_bits(play_routing, + OXYGEN_PLAY_DAC2_SOURCE_SHIFT, + OXYGEN_PLAY_DAC1_SOURCE_SHIFT, + OXYGEN_PLAY_DAC1_SOURCE_MASK) | + shift_bits(play_routing, + OXYGEN_PLAY_DAC1_SOURCE_SHIFT, + OXYGEN_PLAY_DAC2_SOURCE_SHIFT, + OXYGEN_PLAY_DAC2_SOURCE_MASK) | + shift_bits(play_routing, + OXYGEN_PLAY_DAC0_SOURCE_SHIFT, + OXYGEN_PLAY_DAC3_SOURCE_SHIFT, + OXYGEN_PLAY_DAC3_SOURCE_MASK); +} + static int output_switch_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info) { @@ -557,6 +592,7 @@ struct oxygen_model model_xonar_dg = { .resume = dg_resume, .set_dac_params = set_cs4245_dac_params, .set_adc_params = set_cs4245_adc_params, + .adjust_dac_routing = adjust_dg_dac_routing, .dump_registers = dump_cs4245_registers, .model_data_size = sizeof(struct dg), .device_config = PLAYBACK_0_TO_I2S | -- cgit v1.2.3 From acd62276773b46810a3292af0c915c9782138ff2 Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Tue, 1 Feb 2011 11:11:55 +0100 Subject: ASoC: Amstrad Delta: fix const related build error The Amstrad Delta ASoC driver used to override the digital_mute() callback, expected to be not provided by the on-board CX20442 CODEC driver, with its own implementation. While this is still posssible when substituting the whole empty snd_soc_dai_driver.ops member (the CX20442 case), replacing snd_soc_dai_ops.digital_mute only is no longer correct after the snd_soc_dai_driver.ops member has been constified, and results in build error. Drop this actually not used code path in hope the CX20442 driver never provides its own snd_soc_dai_ops structure. Created and tested against linux-2.6.38-rc2 Signed-off-by: Janusz Krzysztofik Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/omap/ams-delta.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 2101bdcee21..3167be68962 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -507,8 +507,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd) /* Set up digital mute if not provided by the codec */ if (!codec_dai->driver->ops) { codec_dai->driver->ops = &ams_delta_dai_ops; - } else if (!codec_dai->driver->ops->digital_mute) { - codec_dai->driver->ops->digital_mute = ams_delta_digital_mute; } else { ams_delta_ops.startup = ams_delta_startup; ams_delta_ops.shutdown = ams_delta_shutdown; -- cgit v1.2.3 From f019ee5feb344ff0b22b58df4568676295aae14f Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Tue, 1 Feb 2011 13:01:17 +0100 Subject: ASoC: CX20442: fix NULL pointer dereference The CX20442 codec driver never provided the snd_soc_codec_driver's .reg_cache_default member. With the latest ASoC framework changes, it seems to be referred unconditionally, resulting in a NULL pointer dereference if missing. Provide it. Created and tested on Amstrad Delta against linux-2.6.38-rc2 Signed-off-by: Janusz Krzysztofik Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/cx20442.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 03d1e860d22..bb4bf65b9e7 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -367,9 +367,12 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) return 0; } +static const u8 cx20442_reg = CX20442_TELOUT | CX20442_MIC; + static struct snd_soc_codec_driver cx20442_codec_dev = { .probe = cx20442_codec_probe, .remove = cx20442_codec_remove, + .reg_cache_default = &cx20442_reg, .reg_cache_size = 1, .reg_word_size = sizeof(u8), .read = cx20442_read_reg_cache, -- cgit v1.2.3 From 70f7db11c45a313b23922cacf248c613c3b2144c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 2 Feb 2011 17:16:38 +0100 Subject: ALSA: hda - Fix memory leaks in conexant jack arrays The Conexant codec driver adds the jack arrays in init callback which may be called also in each PM resume. This results in the addition of new jack element at each time. The fix is to check whether the requested jack is already present in the array. Reference: Novell bug 668929 https://bugzilla.novell.com/show_bug.cgi?id=668929 Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 7e1ca43bd66..fbe97d32140 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -407,10 +407,16 @@ static int conexant_add_jack(struct hda_codec *codec, struct conexant_spec *spec; struct conexant_jack *jack; const char *name; - int err; + int i, err; spec = codec->spec; snd_array_init(&spec->jacks, sizeof(*jack), 32); + + jack = spec->jacks.list; + for (i = 0; i < spec->jacks.used; i++, jack++) + if (jack->nid == nid) + return 0 ; /* already present */ + jack = snd_array_new(&spec->jacks); name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; -- cgit v1.2.3 From ddfb319926462fd9670b7c1678a1f6a14a68e421 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 2 Feb 2011 17:49:53 +0100 Subject: ALSA: use linux/io.h to fix compile warnings For helping to reduce Greert's regression list... src/sound/drivers/mtpav.c: error: implicit declaration of function 'inb' src/sound/drivers/mtpav.c: error: implicit declaration of function 'outb' ... Signed-off-by: Takashi Iwai --- sound/drivers/mtpav.c | 3 +-- sound/pcmcia/pdaudiocf/pdaudiocf.h | 2 +- sound/pcmcia/vx/vxp_ops.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index da03597fc89..5c426df8767 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -55,14 +55,13 @@ #include #include #include +#include #include #include #include #include #include -#include - /* * globals */ diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h index bd26e092aea..6ce9ad70029 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.h +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h @@ -22,7 +22,7 @@ #define __PDAUDIOCF_H #include -#include +#include #include #include #include diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index 989e04abb52..fe33e122e37 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.c @@ -23,8 +23,8 @@ #include #include #include +#include #include -#include #include "vxpocket.h" -- cgit v1.2.3