From patchwork Fri Feb 28 06:35:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3739021 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E229BF13A for ; Fri, 28 Feb 2014 06:48:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5A192026C for ; Fri, 28 Feb 2014 06:48:40 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6B60D20260 for ; Fri, 28 Feb 2014 06:48:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 451E7265974; Fri, 28 Feb 2014 07:48:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 957F2265975; Fri, 28 Feb 2014 07:38:26 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A33112651A2; Fri, 28 Feb 2014 07:38:22 +0100 (CET) Received: from mail-pa0-f73.google.com (mail-pa0-f73.google.com [209.85.220.73]) by alsa0.perex.cz (Postfix) with ESMTP id 1E6562650D4 for ; Fri, 28 Feb 2014 07:37:13 +0100 (CET) Received: by mail-pa0-f73.google.com with SMTP id kq14so34219pab.2 for ; Thu, 27 Feb 2014 22:37:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CDW0c6pYgNx+jtHVKqj1difl4AMO7zPfyvRBKpnLRP8=; b=VcLCQ4R1EKauIRceuAFW1EaZPYRFebRH4uZbG3NxBR0hDtGhq+3oA4q4DRZb95d6T+ 8UucTjOHnzixjyC8cAuif0zKT1XLuCz8zHg4lUL/YWmo9lKNuxND25l4N7LANnv6Sy5h 54Dlvm/zYVg6lHqEBGDldXUBHxIDCO/5bwVdDhEuBPO/QP7sE3KNzMgBUd88Rn0IgYji NjEDxHhg5up2IP4h1WbPZK4ReL2f3kt+yqtPP7qvbmCERAbmsYDnKc2hDNePQMJ1mvIQ RuvlYj8JRdDlWRmur3z6oTpEW1sew9UIXk7cYTiUrDTKPQrCJrbZSl89f3itqXHmYIoy jMgQ== X-Gm-Message-State: ALoCoQmuISvYq0SALMA91foU2wi1c4FNiV+qFymehrYTLJfjnVUkY3TMJ/osUROvBxElcj9ruxVquT2EOS1AD/2/Bu3EYcZWYq1x6damNiBfHXpjPf9zXSJNkuXYJ1GXZaQ7I3dtnCfP/LAGPn7xwRA0+Cz6QBPuLV67avT4DrGWx8gujVZT17/1MjgouM7CHv/CfEZgWA7ZAbj+kmu7PLQ7+kuJseUQpwftT6EiOh+a1U6WPFm6Txc= X-Received: by 10.66.166.199 with SMTP id zi7mr552509pab.30.1393569432902; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id k45si113843yhn.4.2014.02.27.22.37.12 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id B066A31C2EA; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id 4BA301820E3; Thu, 27 Feb 2014 22:37:12 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Thu, 27 Feb 2014 22:35:58 -0800 Message-Id: <1393569362-27285-16-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393569362-27285-1-git-send-email-dgreid@chromium.org> References: <1393569362-27285-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFC 15/19] ALSA: hda - Pass max_slots and power_save to codec_create X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Passing the max slots and power save arguments to codec_create will allow for its reuse by an hda_platform driver. It makes the function independent of the module params in hda_intel and ready to move to hda_shared in a following commit. Signed-off-by: Dylan Reid --- sound/pci/hda/hda_intel.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4fa4da1..a42c576 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -124,6 +124,7 @@ static struct kernel_param_ops param_ops_xint = { #define param_check_xint param_check_int static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; +static int *power_save_addr = &power_save; module_param(power_save, xint, 0644); MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " "(in second, 0 = disable)."); @@ -135,6 +136,8 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " static bool power_save_controller = 1; module_param(power_save_controller, bool, 0644); MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); +#else +static int *power_save_addr; #endif /* CONFIG_PM */ static int align_buffer_size = -1; @@ -458,17 +461,12 @@ static int get_jackpoll_interval(struct azx *chip) * Codec initialization */ -/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ -static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { - [AZX_DRIVER_NVIDIA] = 8, - [AZX_DRIVER_TERA] = 1, -}; - -static int azx_codec_create(struct azx *chip, const char *model) +static int azx_codec_create(struct azx *chip, const char *model, + unsigned int max_slots, + int *power_save_to) { struct hda_bus_template bus_temp; int c, codecs, err; - int max_slots; memset(&bus_temp, 0, sizeof(bus_temp)); bus_temp.private_data = chip; @@ -479,7 +477,7 @@ static int azx_codec_create(struct azx *chip, const char *model) bus_temp.ops.attach_pcm = azx_attach_pcm_stream; bus_temp.ops.bus_reset = azx_bus_reset; #ifdef CONFIG_PM - bus_temp.power_save = &power_save; + bus_temp.power_save = power_save_to; bus_temp.ops.pm_notify = azx_power_notify; #endif #ifdef CONFIG_SND_HDA_DSP_LOADER @@ -498,7 +496,6 @@ static int azx_codec_create(struct azx *chip, const char *model) } codecs = 0; - max_slots = azx_max_codecs[chip->driver_type]; if (!max_slots) max_slots = AZX_DEFAULT_CODECS; @@ -1619,6 +1616,12 @@ out_free: return err; } +/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ +static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { + [AZX_DRIVER_NVIDIA] = 8, + [AZX_DRIVER_TERA] = 1, +}; + static int azx_probe_continue(struct azx *chip) { struct pci_dev *pci = chip->pci; @@ -1647,7 +1650,10 @@ static int azx_probe_continue(struct azx *chip) #endif /* create codec instances */ - err = azx_codec_create(chip, model[dev]); + err = azx_codec_create(chip, model[dev], + azx_max_codecs[chip->driver_type], + power_save_addr); + if (err < 0) goto out_free; #ifdef CONFIG_SND_HDA_PATCH_LOADER