From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 069/112] ALSA: hda - Refactor init_extra_out() in hda_generic.c
Date: Tue, 8 Jan 2013 12:39:02 +0100 [thread overview]
Message-ID: <1357645185-7645-70-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1357645185-7645-1-git-send-email-tiwai@suse.de>
Just a small clean up by splitting a function.
No functional changes at all.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/hda_generic.c | 49 ++++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b7b8d7e..96c779b 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3389,45 +3389,44 @@ static void init_multi_out(struct hda_codec *codec)
}
}
-/* initialize hp and speaker paths */
-static void init_extra_out(struct hda_codec *codec)
+
+static void __init_extra_out(struct hda_codec *codec, int num_outs,
+ hda_nid_t *pins, hda_nid_t *dacs, int type)
{
struct hda_gen_spec *spec = codec->spec;
int i;
hda_nid_t pin, dac;
- for (i = 0; i < spec->autocfg.hp_outs; i++) {
- if (spec->autocfg.line_out_type == AUTO_PIN_HP_OUT)
- break;
- pin = spec->autocfg.hp_pins[i];
- if (!pin)
- break;
- dac = spec->multiout.hp_out_nid[i];
- if (!dac) {
- if (i > 0 && spec->multiout.hp_out_nid[0])
- dac = spec->multiout.hp_out_nid[0];
- else
- dac = spec->multiout.dac_nids[0];
- }
- set_output_and_unmute(codec, pin, PIN_HP, dac);
- }
- for (i = 0; i < spec->autocfg.speaker_outs; i++) {
- if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
- break;
- pin = spec->autocfg.speaker_pins[i];
+ for (i = 0; i < num_outs; i++) {
+ pin = pins[i];
if (!pin)
break;
- dac = spec->multiout.extra_out_nid[i];
+ dac = dacs[i];
if (!dac) {
- if (i > 0 && spec->multiout.extra_out_nid[0])
- dac = spec->multiout.extra_out_nid[0];
+ if (i > 0 && dacs[0])
+ dac = dacs[0];
else
dac = spec->multiout.dac_nids[0];
}
- set_output_and_unmute(codec, pin, PIN_OUT, dac);
+ set_output_and_unmute(codec, pin, type, dac);
}
}
+/* initialize hp and speaker paths */
+static void init_extra_out(struct hda_codec *codec)
+{
+ struct hda_gen_spec *spec = codec->spec;
+
+ if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT)
+ __init_extra_out(codec, spec->autocfg.hp_outs,
+ spec->autocfg.hp_pins,
+ spec->multiout.hp_out_nid, PIN_HP);
+ if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT)
+ __init_extra_out(codec, spec->autocfg.speaker_outs,
+ spec->autocfg.speaker_pins,
+ spec->multiout.extra_out_nid, PIN_OUT);
+}
+
/* initialize multi-io paths */
static void init_multi_io(struct hda_codec *codec)
{
--
1.8.0.1
next prev parent reply other threads:[~2013-01-08 11:40 UTC|newest]
Thread overview: 123+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 11:37 [PATCH RFC 000/112] HD-audio generic parser improvements Takashi Iwai
2013-01-08 11:37 ` [PATCH 001/112] ALSA: hda/realtek - Simplify alc_auto_is_dac_reachable() Takashi Iwai
2013-01-08 11:37 ` [PATCH 002/112] ALSA: hda/realtek - List up all available DACs Takashi Iwai
2013-01-08 11:37 ` [PATCH 003/112] ALSA: hda/realtek - Add output path parser Takashi Iwai
2013-01-08 11:37 ` [PATCH 004/112] ALSA: hda/realtek - Manage mixer controls in out_path list Takashi Iwai
2013-01-08 11:37 ` [PATCH 005/112] ALSA: hda - Fix mono amp values in proc output Takashi Iwai
2013-01-08 11:37 ` [PATCH 006/112] ALSA: hda/realtek - Reduce vol/mute ctl lookups at parsing codec Takashi Iwai
2013-01-08 11:38 ` [PATCH 007/112] ALSA: hda/realtek - Simplify the output volume initialization Takashi Iwai
2013-01-08 11:38 ` [PATCH 008/112] ALSA: hda/realtek - Make path->idx[] and path->multi[] consistent Takashi Iwai
2013-01-08 11:38 ` [PATCH 009/112] ALSA: hda/realtek - Parse input paths Takashi Iwai
2013-01-08 11:38 ` [PATCH 010/112] ALSA: hda/realtek - Parse analog loopback paths more generically Takashi Iwai
2013-01-08 11:38 ` [PATCH 011/112] ALSA: hda/realtek - Check amp capabilities of aa-mixer widget Takashi Iwai
2013-01-08 11:38 ` [PATCH 012/112] ALSA: hda/realtek - Fix initialization of input amps in output paths Takashi Iwai
2013-01-08 11:38 ` [PATCH 013/112] ALSA: hda - Remove snd_hda_codec_amp_update() call from patch_*.c Takashi Iwai
2013-01-08 11:38 ` [PATCH 014/112] ALSA: hda - Introduce cache & flush cmd / amp writes Takashi Iwai
2013-01-08 11:38 ` [PATCH 015/112] ALSA: hda - Introduce snd_hda_codec_amp_init*() Takashi Iwai
2013-01-08 11:38 ` [PATCH 016/112] ALSA: hda/realtek - Remove non-standard automute mode Takashi Iwai
2013-01-08 11:38 ` [PATCH 017/112] ALSA: hda/realtek - Add path active flag Takashi Iwai
2013-01-08 11:38 ` [PATCH 018/112] ALSA: hda/realtek - Consolidate is_reachable_path() Takashi Iwai
2013-01-08 11:38 ` [PATCH 019/112] ALSA: hda/realtek - Consolidate to a single path list Takashi Iwai
2013-01-08 11:38 ` [PATCH 020/112] ALSA: hda/realtek - Use path-based parser for digital outputs Takashi Iwai
2013-01-08 11:38 ` [PATCH 021/112] ALSA: hda/realtek - Rename get_out_path() to get_nid_path() Takashi Iwai
2013-01-08 11:38 ` [PATCH 022/112] ALSA: hda/realtek - Fix the initialization of pin amp-in Takashi Iwai
2013-01-08 11:38 ` [PATCH 023/112] ALSA: hda/realtek - Add missing initialization of multi-io routes Takashi Iwai
2013-01-08 11:38 ` [PATCH 024/112] ALSA: hda/realtek - Add boost volumes to path list Takashi Iwai
2013-01-08 11:38 ` [PATCH 025/112] ALSA: hda/realtek - Initialize loopback paths properly Takashi Iwai
2013-01-08 11:38 ` [PATCH 026/112] ALSA: hda/realtek - Don't change connection at path deactivation Takashi Iwai
2013-01-08 11:38 ` [PATCH 027/112] ALSA: hda/realtek - Make input path parser more generic Takashi Iwai
2013-01-08 11:38 ` [PATCH 028/112] ALSA: hda/realtek - Clean up some spec fields Takashi Iwai
2013-01-08 11:38 ` [PATCH 029/112] ALSA: hda/realtek - Remove superfluous input amp init Takashi Iwai
2013-01-08 11:38 ` [PATCH 030/112] ALSA: hda/realtek - Rename add_new_out_path() with add_new_nid_path() Takashi Iwai
2013-01-08 11:38 ` [PATCH 031/112] ALSA: hda/realtek - Parse digital input path Takashi Iwai
2013-01-08 11:38 ` [PATCH 032/112] ALSA: hda/realtek - Allow different pins for shared hp/mic vref check Takashi Iwai
2013-01-08 11:38 ` [PATCH 033/112] ALSA: hda/realtek - Drop auto_mic_valid_imux flag Takashi Iwai
2013-01-08 11:38 ` [PATCH 034/112] ALSA: hda/realtek - Remove unused fields and macro definitions Takashi Iwai
2013-01-08 11:38 ` [PATCH 035/112] ALSA: hda/realtek - Handle vmaster hook in the parser side Takashi Iwai
2013-01-08 11:38 ` [PATCH 036/112] ALSA: hda/realtek - Assign Master mixer when possible Takashi Iwai
2013-01-08 11:38 ` [PATCH 037/112] ALSA: hda/realtek - Merge a few split functions Takashi Iwai
2013-01-08 11:38 ` [PATCH 038/112] ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new() Takashi Iwai
2013-01-08 11:38 ` [PATCH 039/112] ALSA: hda/realtek - Allow multiple individual capture volume/switch controls Takashi Iwai
2013-01-08 11:38 ` [PATCH 040/112] ALSA: hda/realtek - Add conexant-style inverted dmic handling Takashi Iwai
2013-01-08 11:38 ` [PATCH 041/112] ALSA: hda - Move fixup code into struct hda_codec Takashi Iwai
2013-01-08 11:38 ` [PATCH 042/112] ALSA: hda/realtek - Fix split stereo dmic code Takashi Iwai
2013-01-08 11:38 ` [PATCH 043/112] ALSA: hda - Rearrange INPUT_PIN_ATTR_* Takashi Iwai
2013-01-08 11:38 ` [PATCH 044/112] ALSA: hda - More generic auto-mic switching for Realtek codecs Takashi Iwai
2013-01-10 0:41 ` Raymond Yau
2013-01-10 15:08 ` Takashi Iwai
2013-01-17 2:47 ` FF
2013-01-08 11:38 ` [PATCH 045/112] ALSA: hda/realtek - Remove redundant argument from alc_mux_select() Takashi Iwai
2013-01-08 11:38 ` [PATCH 046/112] ALSA: hda - Merge Realtek parser code to generic parser Takashi Iwai
2013-01-08 11:38 ` [PATCH 047/112] ALSA: hda - Add EAPD control " Takashi Iwai
2013-01-08 11:38 ` [PATCH 048/112] ALSA: hda - Export snd_hda_gen_add_kctl() Takashi Iwai
2013-01-08 11:38 ` [PATCH 049/112] ALSA: hda - Move the call of snd_hda_parse_pin_defcfg() from snd_hda_gen_parse_auto_config() Takashi Iwai
2013-01-08 11:38 ` [PATCH 050/112] ALSA: hda - Fix NULL dereference in snd_hda_gen_build_controls() Takashi Iwai
2013-01-08 11:38 ` [PATCH 051/112] ALSA: hda - Export standard jack event handlers for generic parser Takashi Iwai
2013-01-08 11:38 ` [PATCH 052/112] ALSA: hda - Use generic parser codes for Realtek driver Takashi Iwai
2013-01-08 11:38 ` [PATCH 053/112] ALSA: hda - Use "Capture Source" for single sources Takashi Iwai
2013-01-08 11:38 ` [PATCH 054/112] ALSA: hda - Allow one chance for zero NID in connection list Takashi Iwai
2013-01-08 11:38 ` [PATCH 055/112] ALSA: hda - Clear dirty flag upon cache write Takashi Iwai
2013-01-08 11:38 ` [PATCH 056/112] ALSA: hda - Clear cached_write flag in snd_hda_codec_resume_*() Takashi Iwai
2013-01-08 11:38 ` [PATCH 057/112] ALSA: hda - Check CORB overflow Takashi Iwai
2013-01-08 11:38 ` [PATCH 058/112] ALSA: hda - Flush dirty amp caches before writing inv_dmic fix Takashi Iwai
2013-01-08 11:38 ` [PATCH 059/112] ALSA: hda - Add snd_hda_codec_flush_*_cache() aliases Takashi Iwai
2013-01-08 11:38 ` [PATCH 060/112] ALSA: hda - Add missing amp cache flush for bound capture vol/sw ctls Takashi Iwai
2013-01-08 11:38 ` [PATCH 061/112] ALSA: hda - Add / fix comments about capture vol/sw controls in hda_generic.c Takashi Iwai
2013-01-08 11:38 ` [PATCH 062/112] ALSA: hda - Do sequential writes in snd_hda_gen_init() Takashi Iwai
2013-01-08 11:38 ` [PATCH 063/112] ALSA: hda - Fix wrong dirty check in snd_hda_codec_resume_amp() Takashi Iwai
2013-01-08 11:38 ` [PATCH 064/112] ALSA: hda - Avoid access of amp cache element outside mutex Takashi Iwai
2013-01-08 11:38 ` [PATCH 065/112] ALSA: hda - Increase the max depth of widget connections Takashi Iwai
2013-01-08 11:38 ` [PATCH 066/112] ALSA: hda - Begin HDA_GEN_* event tag from 1 Takashi Iwai
2013-01-08 11:39 ` [PATCH 067/112] ALSA: hda - Add spec->vmaster_mute_enum flag to generic parser Takashi Iwai
2013-01-08 11:39 ` [PATCH 068/112] ALSA: hda - Clear unsol enable bits on unused pins in " Takashi Iwai
2013-01-08 11:39 ` Takashi Iwai [this message]
2013-01-08 11:39 ` [PATCH 070/112] ALSA: hda - Fix initialization of primary outputs in hda_generic.c Takashi Iwai
2013-01-08 11:39 ` [PATCH 071/112] ALSA: hda - Dynamically turn on/off EAPD in generic codec driver Takashi Iwai
2013-01-08 11:39 ` [PATCH 072/112] ALSA: hda - Use cached version for changing pins in hda_generic.c Takashi Iwai
2013-01-08 11:39 ` [PATCH 073/112] ALSA: hda - Fix PCM name string for generic parser Takashi Iwai
2013-01-08 11:39 ` [PATCH 074/112] ALSA: hda - Drop spec->channel_mode field from hda_gen_spec Takashi Iwai
2013-01-08 11:39 ` [PATCH 075/112] ALSA: hda - Add more debug prints about new paths Takashi Iwai
2013-01-08 11:39 ` [PATCH 076/112] ALSA: hda - Fix typos in debug_show_configs() Takashi Iwai
2013-01-08 11:39 ` [PATCH 077/112] ALSA: hda - Define HDA_PARSE_* for snd_hda_parse_nid_path() argument Takashi Iwai
2013-01-08 11:39 ` [PATCH 078/112] ALSA: hda - Allow aamix in the primary output path Takashi Iwai
2013-01-08 11:39 ` [PATCH 079/112] ALSA: hda - Implement independent HP control Takashi Iwai
2013-01-08 11:39 ` [PATCH 080/112] ALSA: hda - Add inv_eapd flag to struct hda_codec Takashi Iwai
2013-01-08 11:39 ` [PATCH 081/112] ALSA: hda - Add codec->inv_jack_detect flag Takashi Iwai
2013-01-08 11:39 ` [PATCH 082/112] ALSA: hda - Revive snd_hda_get_conn_list() Takashi Iwai
2013-01-08 11:39 ` [PATCH 083/112] ALSA: hda - Add hooks for HP/line/mic auto switching Takashi Iwai
2013-01-08 11:39 ` [PATCH 084/112] ALSA: hda - Don't skip amp init for activated paths Takashi Iwai
2013-01-08 11:39 ` [PATCH 085/112] ALSA: hda - Initialize output paths with current active states Takashi Iwai
2013-01-08 11:39 ` [PATCH 086/112] ALSA: hda - Avoid duplicated path creations Takashi Iwai
2013-01-08 11:39 ` [PATCH 087/112] ALSA: hda - Check the existing path in snd_hda_add_new_path() Takashi Iwai
2013-01-08 11:39 ` [PATCH 088/112] ALSA: hda - Simplify the multi-io assignment with multi speakers Takashi Iwai
2013-01-08 11:39 ` [PATCH 089/112] ALSA: hda - Fix multi-io pin assignment in create_multi_out_ctls() Takashi Iwai
2013-01-08 11:39 ` [PATCH 090/112] ALSA: hda - Manage using output/loopback path indices Takashi Iwai
2013-01-08 11:39 ` [PATCH 091/112] ALSA: hda - Initialize digital-input path properly Takashi Iwai
2013-01-08 11:39 ` [PATCH 092/112] ALSA: hda - Correct aamix output paths Takashi Iwai
2013-01-08 11:39 ` [PATCH 093/112] ALSA: hda - Add Loopback Mixing control Takashi Iwai
2013-01-08 11:39 ` [PATCH 094/112] ALSA: hda - Fix truncated control names Takashi Iwai
2013-01-08 11:39 ` [PATCH 095/112] ALSA: hda - Prefer binding the primary CLFE output Takashi Iwai
2013-01-08 11:39 ` [PATCH 096/112] ALSA: hda - Add missing slave names for Speaker Surround, etc Takashi Iwai
2013-01-08 11:39 ` [PATCH 097/112] ALSA: hda - Drop unneeded pin argument from set_output_and_unmute() Takashi Iwai
2013-01-08 11:39 ` [PATCH 098/112] ALSA: hda - Drop bind-volume workaround Takashi Iwai
2013-01-08 11:39 ` [PATCH 099/112] ALSA: hda - Add pcm_playback_hook to hda_gen_spec Takashi Iwai
2013-01-08 11:39 ` [PATCH 100/112] ALSA: hda - Allow jack detection when polling is enabled Takashi Iwai
2013-01-08 11:39 ` [PATCH 101/112] ALSA: hda - Add snd_hda_gen_free() and snd_hda_gen_check_power_status() Takashi Iwai
2013-01-08 11:39 ` [PATCH 102/112] ALSA: hda - Remove dead HDA_CTL_BIND_VOL and HDA_CTL_BIND_SW codes Takashi Iwai
2013-01-08 11:39 ` [PATCH 103/112] ALSA: hda - Add brief comments to exported snd_hda_gen_*_() functions Takashi Iwai
2013-01-08 11:39 ` [PATCH 104/112] ALSA: hda - Clear path indices properly at each re-evaluation Takashi Iwai
2013-01-08 11:39 ` [PATCH 105/112] ALSA: hda - Use direct path reference in assign_out_path_ctls() Takashi Iwai
2013-01-08 11:39 ` [PATCH 106/112] ALSA: hda - Remove unused dac reference in create_multi_out_ctls() Takashi Iwai
2013-01-08 11:39 ` [PATCH 107/112] ALSA: hda - Don't set up active streams twice Takashi Iwai
2013-01-08 11:39 ` [PATCH 108/112] ALSA: hda - Fix multi-io channel mode management Takashi Iwai
2013-02-21 8:03 ` Raymond Yau
2013-01-08 11:39 ` [PATCH 109/112] ALSA: hda - Manage input paths via path indices Takashi Iwai
2013-01-08 11:39 ` [PATCH 110/112] ALSA: hda - Re-define snd_hda_parse_nid_path() Takashi Iwai
2013-01-08 11:39 ` [PATCH 111/112] ALSA: hda - Handle BOTH jack port as a fixed output Takashi Iwai
2013-01-08 11:39 ` [PATCH 112/112] ALSA: hda - Add a flag to suppress mic auto-switch Takashi Iwai
2013-01-08 11:47 ` [PATCH RFC 000/112] HD-audio generic parser improvements Takashi Iwai
2013-01-08 12:20 ` David Henningsson
2013-01-08 12:44 ` Takashi Iwai
2013-01-08 13:03 ` Jaroslav Kysela
2013-01-08 13:20 ` Takashi Iwai
2013-01-08 14:10 ` Jaroslav Kysela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357645185-7645-70-git-send-email-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).