From patchwork Sun Apr 19 18:35:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 11498129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BC5713B2 for ; Mon, 20 Apr 2020 06:31:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1DD32080C for ; Mon, 20 Apr 2020 06:31:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="RteV/UA8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1DD32080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 172BC15F9; Mon, 20 Apr 2020 08:30:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 172BC15F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587364272; bh=oR1psWkKj74UF42CLepyCrLj2IqgjpZgbxxcmtTBzQA=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=RteV/UA8CluFNha0pKVnvvb7clmbNfHjdyJQmbwxrNj4wGlhKiYMQsGfRxy2C0Zn3 b6JyLBC5zYJNo3VWJT2Y1lrkMyqDctcyxqVMQxhH3BBF5CBC6+iJ/8nIndo1HJPFV3 al6ztOac7PDgSy3qeyOpcC/rFrixJAt7GDQflGcc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 71FF3F8013E; Mon, 20 Apr 2020 08:30:24 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2F99FF801D9; Mon, 20 Apr 2020 08:30:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=DATE_IN_PAST_06_12, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5B860F800E7 for ; Mon, 20 Apr 2020 08:30:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5B860F800E7 IronPort-SDR: lTq3nE0/Tse9A7Vd5ETquhVM+bVUEM9pNIfuSte2kXIvREzi6adwkmT0UTfh7Aqd5YbIMYb4nm FX32Yyua80Ug== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2020 23:30:02 -0700 IronPort-SDR: fDiQbUJWQM3bnIaVkcdsLT4PwaA5IQioHQ2Wh0UQKqSpML23RWCAO1iZ+1wvBoYcsbTHhEML5R Y7kcYDEQJ6sg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,406,1580803200"; d="scan'208";a="429008169" Received: from bard-ubuntu.sh.intel.com ([10.239.13.33]) by orsmga005.jf.intel.com with ESMTP; 19 Apr 2020 23:29:58 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Subject: [PATCH] ASoC: Intel: sof_sdw: add amp number in components string for ucm Date: Mon, 20 Apr 2020 02:35:09 +0800 Message-Id: <20200419183509.4134-1-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: randerwang The number of speaker amplifiers may vary between platforms. UCM needs to check amp number to include different configuration files. This patch keeps track of the number of speaker amplifiers and stores it in components string of the card. Tested on Comet Lake platforms. Reviewed-by: Guennadi Liakhovetski Signed-off-by: randerwang Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index a64dc563b47e..c94e71563891 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -898,6 +898,7 @@ static int mc_probe(struct platform_device *pdev) struct snd_soc_card *card = &card_sof_sdw; struct snd_soc_acpi_mach *mach; struct mc_private *ctx; + int amp_num = 0, i; int ret; dev_dbg(&pdev->dev, "Entry %s\n", __func__); @@ -924,9 +925,18 @@ static int mc_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(card, ctx); + /* + * the default amp_num is zero for each codec and + * amp_num will only be increased for active amp + * codecs on used platform + */ + for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) + amp_num += codec_info_list[i].amp_num; + card->components = devm_kasprintf(card->dev, GFP_KERNEL, - "cfg-spk:%d", - (sof_sdw_quirk & SOF_SDW_FOUR_SPK) ? 4 : 2); + "cfg-spk:%d, cfg-amp:%d", + (sof_sdw_quirk & SOF_SDW_FOUR_SPK) + ? 4 : 2, amp_num); if (!card->components) return -ENOMEM;