From patchwork Mon Aug 28 07:13:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yu Chao X-Patchwork-Id: 9924321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D35B060375 for ; Mon, 28 Aug 2017 07:14:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE31E2841F for ; Mon, 28 Aug 2017 07:14:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2E9028672; Mon, 28 Aug 2017 07:14:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15A232841F for ; Mon, 28 Aug 2017 07:14:05 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 37F61266DEC; Mon, 28 Aug 2017 09:14:02 +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 DA19F266E01; Mon, 28 Aug 2017 09:14:00 +0200 (CEST) Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by alsa0.perex.cz (Postfix) with ESMTP id E8305266D12 for ; Mon, 28 Aug 2017 09:13:56 +0200 (CEST) Received: by mail-pf0-f182.google.com with SMTP id k3so13736552pfc.3 for ; Mon, 28 Aug 2017 00:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=G9npPf14AlnWMa0+bDG/Et6pY/j/KF1e4bxQrHLK3/A=; b=meam1juyPBiHMz0FFa1iI3CE8ZZA+eDuzSEkWYkdr+cZaK5eHDg85D3jJ8wuk0J29i IbGghB3v7TlAydDDpzOl2MZjO7/FeY2+kgCHJ3z8NCYHoj+rA37olpEFSbRCxNHGnIPO cZyoLCOkaRxU8JS/Bw0L8YhGckGOO3cGp5Da0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=G9npPf14AlnWMa0+bDG/Et6pY/j/KF1e4bxQrHLK3/A=; b=HxARFAKqUu6+EHs7ao4Mfn2KGuI/2RxeN2x0GaPCWHrxJoJ80gFkWI6xjmqwgjhEDT xm+AZJQPbnLMlW8mr4uHs+Wi3Gwo44a96ovXkIz/pU0pSaOXOKqOhay2w0y0eldnAZV6 9Zmt6YPuq3wB5q9viKt4Ie7YVayxgHyqlI0U5cAN7I2vaQX1nEmbMNAi9fUa2QD6zrhG wKFpZd7kaF6GW7GPjuUXVLi/WTyprfI+PtFVDAQwlRq3o5zk+/a0P/3AXh4D1qlf2mga qZ4lbO4aG/CNIm6dVEBRs+V5kU9gi3szLJltsukKeOdipb9dO93wF0LG76wp6QgYnR8G IlMQ== X-Gm-Message-State: AHYfb5imv+WBNnFNRiqCdwP1+KAdq2qbA5V682hdHRbKUX3JtEiUKjgj fd2/SEnbCV5x14x6 X-Received: by 10.98.7.138 with SMTP id 10mr6388700pfh.258.1503904435266; Mon, 28 Aug 2017 00:13:55 -0700 (PDT) Received: from hychaoz840.tpe.corp.google.com ([2401:fa00:1:b:8098:bc01:a067:52bc]) by smtp.gmail.com with ESMTPSA id w81sm21565574pfk.169.2017.08.28.00.13.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 00:13:54 -0700 (PDT) From: Hsin-Yu Chao To: broonie@kernel.org, lgirdwood@gmail.com Date: Mon, 28 Aug 2017 15:13:50 +0800 Message-Id: <20170828071350.160958-1-hychao@chromium.org> X-Mailer: git-send-email 2.12.2 Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org, Hsin-Yu Chao Subject: [alsa-devel] [PATCH] ASoC: rt5514: Guard Hotword Model bytes loading 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 If the rt5514-spi driver is not enabled in kernel, hotword model will not be loaded when "DSP Voice Wake Up" is set to turn on DSP mode, and an error is logged instead. Signed-off-by: Hsin-Yu Chao --- sound/soc/codecs/rt5514.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c index 7482df8ff737..250581082e9d 100644 --- a/sound/soc/codecs/rt5514.c +++ b/sound/soc/codecs/rt5514.c @@ -299,7 +299,6 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); struct snd_soc_codec *codec = rt5514->codec; const struct firmware *fw = NULL; - int ret = 0; if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled) return 0; @@ -337,6 +336,9 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, } if (rt5514->model_buf && rt5514->model_len) { +#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI) + int ret; + ret = rt5514_spi_burst_write(0x4ff80000, rt5514->model_buf, ((rt5514->model_len / 8) + 1) * 8); @@ -345,13 +347,22 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, "Model load failed %d\n", ret); return ret; } +#else + dev_err(codec->dev, + "No SPI driver for loading firmware\n"); +#endif } else { request_firmware(&fw, RT5514_FIRMWARE3, codec->dev); if (fw) { +#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI) rt5514_spi_burst_write(0x4ff80000, fw->data, ((fw->size/8)+1)*8); +#else + dev_err(codec->dev, + "No SPI driver to load fw\n"); +#endif release_firmware(fw); fw = NULL; }