From patchwork Thu Nov 21 10:36:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 293075 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 2A1052C00E4 for ; Thu, 21 Nov 2013 21:37:26 +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 1VjRdR-0002uX-Lx; Thu, 21 Nov 2013 10:37:21 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VjRcz-0002kW-Rj for kernel-team@lists.ubuntu.com; Thu, 21 Nov 2013 10:36: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 1VjRcz-0003qr-MD; Thu, 21 Nov 2013 10:36:53 +0000 From: David Henningsson To: kernel-team@lists.ubuntu.com Subject: [PATCH 4/5] ALSA: hda - add some small convenience functions to auto parser Date: Thu, 21 Nov 2013 11:36:50 +0100 Message-Id: <1385030211-11385-5-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1385030211-11385-1-git-send-email-david.henningsson@canonical.com> References: <1385030211-11385-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 --- 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 */