From patchwork Fri Nov 22 14:30:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 293469 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3BFC32C00EF for ; Sat, 23 Nov 2013 01:31:57 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vjrlw-0006F8-9T; Fri, 22 Nov 2013 14:31:52 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Vjrkz-0005pw-7s for kernel-team@lists.ubuntu.com; Fri, 22 Nov 2013 14:30:53 +0000 Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Vjrkz-0003Le-2K; Fri, 22 Nov 2013 14:30:53 +0000 From: David Henningsson To: kernel-team@lists.ubuntu.com Subject: [PATCH 04/15] ALSA: hda - add some small convenience functions to auto parser Date: Fri, 22 Nov 2013 15:30:48 +0100 Message-Id: <1385130659-29870-5-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1385130659-29870-1-git-send-email-david.henningsson@canonical.com> References: <1385130659-29870-1-git-send-email-david.henningsson@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com I never liked that we move our speaker and hp pins to line out if there are not any line outs; but now that we do, add some convenience functions to find hp and speaker pins even if they have been moved. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai (backported from commit 3cdbe11ae8d2eead564605b0d2193ac470d6b7e8) Conflicts: sound/pci/hda/hda_auto_parser.h Signed-off-by: David Henningsson --- sound/pci/hda/hda_auto_parser.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h index 19251b8..a4558a0 100644 --- a/sound/pci/hda/hda_auto_parser.h +++ b/sound/pci/hda/hda_auto_parser.h @@ -171,4 +171,25 @@ static inline void snd_hda_gen_free(struct hda_gen_spec *spec) snd_array_free(&spec->verbs); } +static inline int auto_cfg_hp_outs(const struct auto_pin_cfg *cfg) +{ + return (cfg->line_out_type == AUTO_PIN_HP_OUT) ? + cfg->line_outs : cfg->hp_outs; +} +static inline const hda_nid_t *auto_cfg_hp_pins(const struct auto_pin_cfg *cfg) +{ + return (cfg->line_out_type == AUTO_PIN_HP_OUT) ? + cfg->line_out_pins : cfg->hp_pins; +} +static inline int auto_cfg_speaker_outs(const struct auto_pin_cfg *cfg) +{ + return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ? + cfg->line_outs : cfg->speaker_outs; +} +static inline const hda_nid_t *auto_cfg_speaker_pins(const struct auto_pin_cfg *cfg) +{ + return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ? + cfg->line_out_pins : cfg->speaker_pins; +} + #endif /* __SOUND_HDA_AUTO_PARSER_H */