From patchwork Fri Feb 28 23:41:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3745451 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 CAB73BF13A for ; Fri, 28 Feb 2014 23:49:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E47DF202A7 for ; Fri, 28 Feb 2014 23:49:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5BF2D201BA for ; Fri, 28 Feb 2014 23:49:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3B463265FAE; Sat, 1 Mar 2014 00:49:12 +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 40736265A89; Sat, 1 Mar 2014 00:43:17 +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 D31DF265A80; Sat, 1 Mar 2014 00:43:15 +0100 (CET) Received: from mail-ig0-f202.google.com (mail-ig0-f202.google.com [209.85.213.202]) by alsa0.perex.cz (Postfix) with ESMTP id ACFB52659C6 for ; Sat, 1 Mar 2014 00:42:52 +0100 (CET) Received: by mail-ig0-f202.google.com with SMTP id y6so55236igj.1 for ; Fri, 28 Feb 2014 15:42:51 -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=o5bLDSwaYQyS8iEA7X0ij2EhUcmwYlySf6XO3ymRDdM=; b=E9wdroXXq9dWGqEYx/urYyXbMG17g3Hgzho90WME2aMH1Kj9p5xrWMkTNeGckn4jzK kKk4Ew3QTiHzPp01040Pbh0z7kq/u8JRKfKMtHAo6meuGkX7KXP8OCcuWbOIVVFE3yrY d9ETUYYDvytJ/NHkbT7JDbzXjbHpU1VWdnQfCr4rtoRJbv2kEXJF1uR7UqzhlEMjPku0 h+inoGcwmq9c6I16Cy4xEz+AjsaXBKfGknOrjsE84dqpCKLGyWLp93QK7OIyihqR1MWL fHtMDcMIlo5QrV2p00SINdrPEL73gBYE2niYbTN/CdMmKSfCU1WbCK6OZIGJefmyn6rg hcSw== X-Gm-Message-State: ALoCoQl5W/QprZ8xWXuMmVgxRa2NtJRqutLNeatyop2JsbZ5HjYRtNxgncL2TliA7EalmAsoHvwEokyU8onIp7Yh5sQaKO4Ok/fIFl+Oo8Csh6nU2RkGVgOGZIWnJ+3fNqfiAUqFOk9VFKaMT674xXLsqM9o4YbD9bn/zFP7Xr7jnuE/J30AKy74sGt+hze96BOeuk5G3my9oKEjUvwD247hnsFdVB0xNuy4wF6EtU18hlM608H8vAA= X-Received: by 10.50.129.74 with SMTP id nu10mr2980232igb.7.1393630971429; Fri, 28 Feb 2014 15:42:51 -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 o7si544241yhj.3.2014.02.28.15.42.51 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Feb 2014 15:42:51 -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 409CE31C1DD; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id E1AA1181DB7; Fri, 28 Feb 2014 15:42:50 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Fri, 28 Feb 2014 15:41:19 -0800 Message-Id: <1393630893-29010-9-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393630893-29010-1-git-send-email-dgreid@chromium.org> References: <1393630893-29010-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFCv2 08/22] 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 1e7d3f3..ebbeefe 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -128,6 +128,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)."); @@ -139,6 +140,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; @@ -1347,17 +1350,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; @@ -1368,7 +1366,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 @@ -1387,7 +1385,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; @@ -3568,6 +3565,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; @@ -3596,7 +3599,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