Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21910896ybl; Mon, 6 Jan 2020 13:57:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwskahaoNTu1wcLaPfzKkfgeB74AtAx3RrIJa0IGR3kZCAHOb0V1PERYV0gKswhSILJNjVo X-Received: by 2002:a9d:6196:: with SMTP id g22mr122203532otk.204.1578347874923; Mon, 06 Jan 2020 13:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578347874; cv=none; d=google.com; s=arc-20160816; b=mj2yz7PcEuxLCFzqG+VTiuDXjWMlrf7QC26TnnMv4xDttqATLeWJyvYUr8pXinn3CS QLz6wwTmClbIfjdlMBUL/OliKxld6b0YTuWZDvY3g5X38TSHc1UbAlC9XQj/QzGBjkYi D6nEqgUm+PSIXZKaCns2gozSV1BLALamLpmq6gaR4aKi+COWUWzeRHu1D8cxsBuDGDcz Zh2KSjVDujx9+c7gkDS9g/VPLztBdZc36O7kSk9TsbDBRgru4xX7a+9RcZXrBYeJNg7a Xgr/P/xUlgYtU0RoX1/tpFND1uQq01HqHnBmrr0hzR+pZOxUKdk0YLhOdVAU+ZmjhH3l v57w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=cQtuipyFzDSkBPt1NIz1ZGn7R4OpJUVyTHab5u2021M=; b=wmF+ooBWu+05IWykyOrLEx8Mw3N8kmQC4kNHScBdMfUTZbCLibND/0yBHyG0IkQ2or RIjsLl1yXoEqSQS0TNVJQ528GhvZhuSfenq/IG3OWI6TujRlryTceRcG8L1Nwf8IsweT SzfcdFtXKsiCdEMb80extwbxAGYgGi8eD26vTgV+pl2qD1bmCiVvokiTLWbftKc0EnFY x9HbzChpMciJOPEkAeWDW1VYtfNU6WVfBZoof3geFqYCK57HBcrbfMk67qZGNLY/1SCn JzHrP4WfAOiljH84wVROr5sAQtXslRNmvM2fUgsPhpRd9Lw8/Fmt3foq/QHdrgOmRcYn j8Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si38429043otn.6.2020.01.06.13.57.41; Mon, 06 Jan 2020 13:57:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727074AbgAFVz4 (ORCPT + 99 others); Mon, 6 Jan 2020 16:55:56 -0500 Received: from mga07.intel.com ([134.134.136.100]:51764 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbgAFVz4 (ORCPT ); Mon, 6 Jan 2020 16:55:56 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jan 2020 13:55:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,403,1571727600"; d="scan'208";a="245719807" Received: from chewang-mobl.amr.corp.intel.com (HELO [10.254.185.10]) ([10.254.185.10]) by fmsmga004.fm.intel.com with ESMTP; 06 Jan 2020 13:55:53 -0800 Subject: Re: [PATCH] ASoC: rt5677: add SPI_MASTER dependency To: Jon Hunter , Arnd Bergmann , Mark Brown Cc: Ben Zhang , Curtis Malainey , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Jie Yang , Thierry Reding , Matthias Brugger , Charles Keepax , KaiChieh Chuang , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20191210195333.648018-1-arnd@arndb.de> From: Pierre-Louis Bossart Message-ID: <9c9169cc-0da5-f247-c8f7-f6913ca2bfb5@linux.intel.com> Date: Mon, 6 Jan 2020 15:55:53 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/11/19 4:59 AM, Jon Hunter wrote: > > On 10/12/2019 19:52, Arnd Bergmann wrote: >> When CONFIG_SPI is disabled, the newly added code for the DSP >> firmware loading fails to link: >> >> ERROR: "rt5677_spi_hotword_detected" [sound/soc/codecs/snd-soc-rt5677.ko] undefined! >> ERROR: "rt5677_spi_write" [sound/soc/codecs/snd-soc-rt5677.ko] undefined! > > Would it be better if the above functions or the functions that call > these are conditional on CONFIG_SND_SOC_RT5677_SPI? they are already conditional, with a fallback provided: #if IS_ENABLED(CONFIG_SND_SOC_RT5677_SPI) int rt5677_spi_read(u32 addr, void *rxbuf, size_t len); int rt5677_spi_write(u32 addr, const void *txbuf, size_t len); int rt5677_spi_write_firmware(u32 addr, const struct firmware *fw); void rt5677_spi_hotword_detected(void); #else static inline int rt5677_spi_read(u32 addr, void *rxbuf, size_t len) { return -EINVAL; } static inline int rt5677_spi_write(u32 addr, const void *txbuf, size_t len) { return -EINVAL; } static inline int rt5677_spi_write_firmware(u32 addr, const struct firmware *fw) { return -EINVAL; } static inline void rt5677_spi_hotword_detected(void){} #endif and since we have the following definition config SND_SOC_RT5677_SPI tristate default SND_SOC_RT5677 && SPI in theory if SPI is not enabled the fallback static inlines would always be selected? Arnd, if you can share the .config that exposes this problem it'd be nice FWIW, there are other missing dependencies, the SPI controller was not explicitly enabled so depending on the Kconfigs used by a distro the machine driver probe could fail with the spi-RT5677AA component never registered. The patch below seems to work for me (more testing needed) diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig index b149e28a2076..cf1a2fde4c47 100644 --- a/sound/soc/intel/boards/Kconfig +++ b/sound/soc/intel/boards/Kconfig @@ -50,6 +50,9 @@ config SND_SOC_INTEL_BDW_RT5677_MACH depends on I2C_DESIGNWARE_PLATFORM || COMPILE_TEST depends on GPIOLIB || COMPILE_TEST depends on X86_INTEL_LPSS || COMPILE_TEST + depends on SPI_MASTER + select SPI_PXA2XX + select SND_SOC_RT5677_SPI select SND_SOC_RT5677 help This adds support for Intel Broadwell platform based boards with