From patchwork Wed Jul 9 09:27:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 4512791 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 47DE3BEEAA for ; Wed, 9 Jul 2014 09:34:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8753B2035D for ; Wed, 9 Jul 2014 09:34:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4E07A20357 for ; Wed, 9 Jul 2014 09:34:25 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5A7FE26507F; Wed, 9 Jul 2014 11:34:24 +0200 (CEST) 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 4396B2650DA; Wed, 9 Jul 2014 11:32:24 +0200 (CEST) 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 CCD55265141; Wed, 9 Jul 2014 11:32:22 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 066F0264FF9 for ; Wed, 9 Jul 2014 11:30:24 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 09 Jul 2014 02:30:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,630,1400050800"; d="scan'208";a="540770516" Received: from vkoul-udesk3.iind.intel.com (HELO localhost.localdomain) ([10.223.96.11]) by orsmga001.jf.intel.com with ESMTP; 09 Jul 2014 02:30:21 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Wed, 9 Jul 2014 14:57:54 +0530 Message-Id: <1404898076-1882-7-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1404898076-1882-1-git-send-email-vinod.koul@intel.com> References: <1404898076-1882-1-git-send-email-vinod.koul@intel.com> Cc: Vinod Koul , broonie@kernel.org, subhransu.s.prusty@intel.com, lgirdwood@gmail.com, Lars-Peter Clausen Subject: [alsa-devel] [PATCH 6/7] ASoC: Intel: sst: load firmware using async callback 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 We would like the DSP firmware to be availble in driver as soon as possible. So use the async callback in driver to probe to load the firmware as soon as usermode is up Signed-off-by: Vinod Koul --- sound/soc/intel/sst/sst.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c index cb9863c..ae1f0eb 100644 --- a/sound/soc/intel/sst/sst.c +++ b/sound/soc/intel/sst/sst.c @@ -224,6 +224,22 @@ int sst_alloc_drv_context(struct device *dev) return 0; } +int sst_request_firmware_async(struct intel_sst_drv *ctx) +{ + int ret = 0; + + snprintf(ctx->firmware_name, sizeof(ctx->firmware_name), + "%s%04x%s", "fw_sst_", + ctx->pci_id, ".bin"); + pr_debug("Requesting FW %s now...\n", ctx->firmware_name); + + ret = request_firmware_nowait(THIS_MODULE, 1, ctx->firmware_name, + ctx->dev, GFP_KERNEL, ctx, sst_firmware_load_cb); + if (ret) + pr_err("could not load firmware %s error %d\n", ctx->firmware_name, ret); + + return ret; +} /* * intel_sst_probe - PCI probe function * @@ -293,6 +309,11 @@ static int intel_sst_probe(struct pci_dev *pci, mutex_init(&stream->lock); } + ret = sst_request_firmware_async(sst_drv_ctx); + if (ret) { + pr_err("Firmware download failed:%d\n", ret); + goto do_free_mem; + } /* Init the device */ ret = pci_enable_device(pci); if (ret) {