From patchwork Wed Apr 19 19:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 675059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 57805C6FD18 for ; Wed, 19 Apr 2023 19:57:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 26F5FEF5; Wed, 19 Apr 2023 21:56:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 26F5FEF5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934269; bh=l2zKgQB9Ff6WxvRTLtB3FKOhE6c8T/vIQDQgz2d7EtY=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=U+ayTn0Iu17VwCgTkZVOBKYY8g3raMvk4IrmXB0gcvsb5dmxr+mSAXTlMpOyumZDD plg2ZRVPogSsWUOTWqjAQJjURJR1jzI3WBOFhcno17j9T6uOWEBb6mgfSmsSpnEoQ1 6zGznBmxB4QhVKw76atfuhdVbNyInMr5fE0JUND4= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 96CD4F8052E; Wed, 19 Apr 2023 21:56:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C740FF80212; Wed, 19 Apr 2023 21:56:06 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 DCD41F800F8 for ; Wed, 19 Apr 2023 21:56:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DCD41F800F8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=HvI+bQrB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934165; x=1713470165; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l2zKgQB9Ff6WxvRTLtB3FKOhE6c8T/vIQDQgz2d7EtY=; b=HvI+bQrBkn3m7sMLxepoxbMM21/HG6P6cEywZ9S23SzstuObXBF6fNs2 JbqkTPDCAqrcyZJXPrL0AzakbcdagrMwqqRgHInliYN9e1xQGhKPY96im MAjALGRNUCiWpW/tMefsFfBLmKlbiFWs6RbUtBLGLNDgSIYOmGHJagn83 v/0ioe5D1iuzaCGEwI9XuTSJK5sFG73tA9H8vhyiuM9W/oLIBUZ3/fpus lykb50Fc0M/jmaBx/Q5zE0M/EJk3ee8Gfk5f77lKCkFOxMafFvh1iDpH/ /rZHsfshlhHWISYe/hRUkuDpDYCf8CTGFsRzo9U3igogR2wKi7Bo9H6UM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434382" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434382" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728091" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728091" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:55:59 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 1/7] ASoC: Intel: sof_cirrus_common: Guard against missing buses Date: Wed, 19 Apr 2023 14:55:18 -0500 Message-Id: <20230419195524.46995-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: UEYBDCDIP6HC5DP5ENS5KNBJXPYXVFRJ X-Message-ID-Hash: UEYBDCDIP6HC5DP5ENS5KNBJXPYXVFRJ X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, Curtis Malainey , Pierre-Louis Bossart , Bard Liao X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Curtis Malainey Even if we find a acpi device we can still be missing the physical node. Signed-off-by: Curtis Malainey Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao --- sound/soc/intel/boards/sof_cirrus_common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/boards/sof_cirrus_common.c b/sound/soc/intel/boards/sof_cirrus_common.c index 851c516c8f5b..8b8b07e4f2fe 100644 --- a/sound/soc/intel/boards/sof_cirrus_common.c +++ b/sound/soc/intel/boards/sof_cirrus_common.c @@ -168,11 +168,16 @@ static int cs35l41_compute_codec_conf(void) continue; } physdev = get_device(acpi_get_first_physical_node(adev)); + acpi_dev_put(adev); + if (!physdev) { + pr_devel("Cannot find physical node for HID %s UID %u (%s)\n", CS35L41_HID, + uid, cs35l41_name_prefixes[uid]); + return 0; + } cs35l41_components[sz].name = dev_name(physdev); cs35l41_components[sz].dai_name = CS35L41_CODEC_DAI; cs35l41_codec_conf[sz].dlc.name = dev_name(physdev); cs35l41_codec_conf[sz].name_prefix = cs35l41_name_prefixes[uid]; - acpi_dev_put(adev); sz++; } From patchwork Wed Apr 19 19:55:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 675057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8BE20C6FD18 for ; Wed, 19 Apr 2023 19:58:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 68D2BF14; Wed, 19 Apr 2023 21:57:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 68D2BF14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934321; bh=9v9ZarbvgVm/nqh3t36oBi7X/oFk5g4InTITr9lxgVg=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uc5TxhQHOMUPs8KNm0lZN5ZB5R5G/wM6vmP8N1fhaDmL8Irgx+imrH4L0tE+tkEyF fEITMxCzxZsxEe+SnfqnIYLUx2UaMtfozHtyHh+U3LGV45aX+JqB0w9qkTDnqTTyiA m6hXg9PS2gRT+0sC9NguEiEFQ+b7wThXkfSHobNs= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 44EE8F80557; Wed, 19 Apr 2023 21:56:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6039F80544; Wed, 19 Apr 2023 21:56:12 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 EF128F8019B for ; Wed, 19 Apr 2023 21:56:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EF128F8019B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=DE3s6Nfy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934165; x=1713470165; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9v9ZarbvgVm/nqh3t36oBi7X/oFk5g4InTITr9lxgVg=; b=DE3s6NfyKNVncjlJg1tOtfsMcdLtOG2P1sPTQ0KGBWbqT3dBqAwuwq/j mu7YU3l+owyhQhcPnCbMeGy06VIFUDUMtEheGWLSlWAjRVnIBBZ9FM+5L Pqm7cwtiLhhwHYRSlJmIIxqToUZ8VF8WxJVJc4KUdihyJUTOZK345o6jl v/NlfNSYd/4dPMY6LF12Z9/bFMI0NY+zihS4268NlYoMbe7LsUyu67X4t cESv+79tON7qgH1aoAHKdw2jdRsPhP2bkLxUf10+aIlNKmw5FBT2sJTPA X/leYqQgZ44hoHFLBT9qRFPLvmwzyOfLJafPoO2kY5WloQewsbQSpMZIi Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434386" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434386" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728098" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728098" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:00 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 2/7] ASoC: Intel: soc-acpi: Add entry for rt711-sdca-sdw at link 2 in RPL match table Date: Wed, 19 Apr 2023 14:55:19 -0500 Message-Id: <20230419195524.46995-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: EIZ7VBW2SPTXWXQJ7DEGIJO7ZLTYLW2Y X-Message-ID-Hash: EIZ7VBW2SPTXWXQJ7DEGIJO7ZLTYLW2Y X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, apoorv , Pierre-Louis Bossart , Bard Liao X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: apoorv RT711 sdca sdw is added with SDW2 link for RPL-P CRB platform. Signed-off-by: apoorv Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao --- .../soc/intel/common/soc-acpi-intel-rpl-match.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-rpl-match.c b/sound/soc/intel/common/soc-acpi-intel-rpl-match.c index 13cbd8e9d41f..749d371a86ae 100644 --- a/sound/soc/intel/common/soc-acpi-intel-rpl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-rpl-match.c @@ -284,6 +284,15 @@ static const struct snd_soc_acpi_link_adr rpl_sdw_rt1316_link12_rt714_link0[] = {} }; +static const struct snd_soc_acpi_link_adr rplp_crb[] = { + { + .mask = BIT(2), + .num_adr = ARRAY_SIZE(rt711_sdca_2_adr), + .adr_d = rt711_sdca_2_adr, + }, + {} +}; + static const struct snd_soc_acpi_codecs rpl_rt5682_hp = { .num_codecs = 2, .codecs = {"10EC5682", "RTL5682"}, @@ -348,7 +357,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = { .link_mask = 0x1, /* link0 required */ .links = rpl_rvp, .drv_name = "sof_sdw", - .sof_tplg_filename = "sof-rpl-rt711.tplg", + .sof_tplg_filename = "sof-rpl-rt711-l0.tplg", + }, + { + .link_mask = 0x4, /* link2 required */ + .links = rplp_crb, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-rpl-rt711-l2.tplg", }, {}, }; From patchwork Wed Apr 19 19:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 676928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2D418C77B73 for ; Wed, 19 Apr 2023 19:57:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BA1E5F06; Wed, 19 Apr 2023 21:57:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BA1E5F06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934274; bh=1TIjV+3pmSFyRtElpQplh8V/ePhxtOCFPODPHSIZDhQ=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZfiAtZERC6dTI7AhPh7pFxZHetqjwkhA17cpVxU+dZzQwhi/YG6RGpkpAb16MryO6 Skz2LKoC1TrlH1ZB0O/ckg1TiMyRNlVWZNcBbKNCE/CZGfYiZjJa1ZqbA+fK9MSALR R4vEpmTH+5Vn/dzr1Tz4N9VJ0FxVABs4ipmcOMVE= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0ADA6F8053B; Wed, 19 Apr 2023 21:56:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2DAE9F8052E; Wed, 19 Apr 2023 21:56:08 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 EF856F80149 for ; Wed, 19 Apr 2023 21:56:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EF856F80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VpDxNH0h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934166; x=1713470166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1TIjV+3pmSFyRtElpQplh8V/ePhxtOCFPODPHSIZDhQ=; b=VpDxNH0hnpJcrub+tQRVUxupiiMBZEiT5RFRPihlCABfBR64qCAJ2jZp xP6+r3scE3ZZaghulugfeDVJbrqNlE4BFwN2fpXazpEhIODyc7trXcmS8 /nWr8uCUvaN3v2zTPVRHxHSreTfk7ELYQHo4X+VcvhY//tVTSc3y355WQ QlQ1PT3+TVQPY2bAaJQSZaI2zlKyB1Y9QkMqKTvroCC0zEPg2PkFUHBX7 TipcNkcyIqU5QpCEDJEKJGPBJ7Ef8iz+NrLf9ud9UEHyyhua64/5M7jfS aFsUzFfrRl9MDSeb77nxMx6wWDPL7k6aQF1atN3bIyXDDJbKXaYeOuhB3 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434389" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434389" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728102" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728102" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:00 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 3/7] ASoC: Intel: sof_sdw: remove late_probe flag in struct sof_sdw_codec_info Date: Wed, 19 Apr 2023 14:55:20 -0500 Message-Id: <20230419195524.46995-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 35LKAAPLXR24PXGRIBW3DJNQS32J4U47 X-Message-ID-Hash: 35LKAAPLXR24PXGRIBW3DJNQS32J4U47 X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, Yong Zhi , Pierre-Louis Bossart , Bard Liao X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Yong Zhi Just use codec_card_late_probe ptr in struct sof_sdw_codec_info for validation check and drop late_probe variable. Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 11 +++++------ sound/soc/intel/boards/sof_sdw_common.h | 1 - sound/soc/intel/boards/sof_sdw_max98373.c | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 6897705a193c..7d398b45d48f 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -621,7 +621,6 @@ static struct sof_sdw_codec_info codec_info_list[] = { .direction = {true, true}, .dai_name = "max98373-aif1", .init = sof_sdw_mx8373_init, - .codec_card_late_probe = sof_sdw_mx8373_late_probe, .codec_type = SOF_SDW_CODEC_TYPE_AMP, }, { @@ -1490,12 +1489,12 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card) int i; for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) { - if (!codec_info_list[i].late_probe) - continue; + if (codec_info_list[i].codec_card_late_probe) { + ret = codec_info_list[i].codec_card_late_probe(card); - ret = codec_info_list[i].codec_card_late_probe(card); - if (ret < 0) - return ret; + if (ret < 0) + return ret; + } } if (ctx->idisp_codec) diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 350010b0e5f4..4962dc11a088 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -74,7 +74,6 @@ struct sof_sdw_codec_info { bool playback); int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); - bool late_probe; int (*codec_card_late_probe)(struct snd_soc_card *card); }; diff --git a/sound/soc/intel/boards/sof_sdw_max98373.c b/sound/soc/intel/boards/sof_sdw_max98373.c index 77a3f32db11e..22bd1e356e22 100644 --- a/sound/soc/intel/boards/sof_sdw_max98373.c +++ b/sound/soc/intel/boards/sof_sdw_max98373.c @@ -130,7 +130,7 @@ int sof_sdw_mx8373_init(struct snd_soc_card *card, if (info->amp_num == 2) dai_links->init = spk_init; - info->late_probe = true; + info->codec_card_late_probe = sof_sdw_mx8373_late_probe; dai_links->ops = &max_98373_sdw_ops; From patchwork Wed Apr 19 19:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 676926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 02928C77B73 for ; Wed, 19 Apr 2023 19:59:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 664C4F0D; Wed, 19 Apr 2023 21:58:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 664C4F0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934344; bh=ouBKoHKhciDcxwM8EneMHAp6XS64B5Xi2KdV9i7o8mk=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uc+01hC//dr5Zwd5QSC5OCe9goiDH099p2TgBNmnv693DHt4QpWW+bjUwnos0nh7J 77yvCXD921t3+2vKFpixdJHGg3Qkgoi7diriurH8kpp5HoTl/wv7xMF+utzo9WWLIP IAlWypYNRTrOLZIl8PvDlcDUgK3j8MGCJOrX3OJY= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 14C38F80212; Wed, 19 Apr 2023 21:57:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3E68CF80212; Wed, 19 Apr 2023 21:57:04 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 D2B58F80053 for ; Wed, 19 Apr 2023 21:56:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D2B58F80053 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=cRnwDYeg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934167; x=1713470167; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ouBKoHKhciDcxwM8EneMHAp6XS64B5Xi2KdV9i7o8mk=; b=cRnwDYegN8o+azm8jmm1w42MzmkcbAC/gm/Ixd8ImPwNi2K2WCtohKkR SefJ8sjxSWc5xfYPKxuReSK2+Yw3CuIPS7Fp7p55e/L5lhRdZj50IYelQ L9+gTqSTB7n5W7nuN8heFd/HVFtSy3P4zQXPr4DoaeO/mPUA5qSmGyYPS Juk1iWQPiQ2Hq8emlWoVpElQc6N0a5Ebci3IHONnK7jNEr/v7epa/osBf 0m1Nnlfz2dCXT8IrgzjklMI1lSO5gqecxhhtnWobbe044nZgrLDxk06R5 vbi9DCQMxn08MkBVOSSnftqMRkFI8l0gTaRwlGW+49tcpdhr/xRm60x8h g==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434393" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434393" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728105" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728105" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:01 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 4/7] ASoC: Intel: sof_sdw_max98373: change sof_sdw_mx8373_late_probe to static call Date: Wed, 19 Apr 2023 14:55:21 -0500 Message-Id: <20230419195524.46995-5-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: 75H7LAZSYJJ3Q6FABIS7ZXHUUXASBSWM X-Message-ID-Hash: 75H7LAZSYJJ3Q6FABIS7ZXHUUXASBSWM X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, Yong Zhi , Pierre-Louis Bossart , Bard Liao X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Yong Zhi sof_sdw_mx8373_late_probe is only used in sof_sdw_max98373, so it should be static and rename it to 'mx8373_sdw_late_probe'. Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart Reviewed-by: Bard Liao --- sound/soc/intel/boards/sof_sdw_common.h | 2 -- sound/soc/intel/boards/sof_sdw_max98373.c | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h index 4962dc11a088..081ab7eac5b6 100644 --- a/sound/soc/intel/boards/sof_sdw_common.h +++ b/sound/soc/intel/boards/sof_sdw_common.h @@ -158,8 +158,6 @@ int sof_sdw_mx8373_init(struct snd_soc_card *card, struct sof_sdw_codec_info *info, bool playback); -int sof_sdw_mx8373_late_probe(struct snd_soc_card *card); - /* RT5682 support */ int sof_sdw_rt5682_init(struct snd_soc_card *card, const struct snd_soc_acpi_link_adr *link, diff --git a/sound/soc/intel/boards/sof_sdw_max98373.c b/sound/soc/intel/boards/sof_sdw_max98373.c index 22bd1e356e22..3d7df58c0f1d 100644 --- a/sound/soc/intel/boards/sof_sdw_max98373.c +++ b/sound/soc/intel/boards/sof_sdw_max98373.c @@ -120,6 +120,16 @@ static const struct snd_soc_ops max_98373_sdw_ops = { .shutdown = sdw_shutdown, }; +static int mx8373_sdw_late_probe(struct snd_soc_card *card) +{ + struct snd_soc_dapm_context *dapm = &card->dapm; + + /* Disable Left and Right Spk pin after boot */ + snd_soc_dapm_disable_pin(dapm, "Left Spk"); + snd_soc_dapm_disable_pin(dapm, "Right Spk"); + return snd_soc_dapm_sync(dapm); +} + int sof_sdw_mx8373_init(struct snd_soc_card *card, const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, @@ -130,19 +140,9 @@ int sof_sdw_mx8373_init(struct snd_soc_card *card, if (info->amp_num == 2) dai_links->init = spk_init; - info->codec_card_late_probe = sof_sdw_mx8373_late_probe; + info->codec_card_late_probe = mx8373_sdw_late_probe; dai_links->ops = &max_98373_sdw_ops; return 0; } - -int sof_sdw_mx8373_late_probe(struct snd_soc_card *card) -{ - struct snd_soc_dapm_context *dapm = &card->dapm; - - /* Disable Left and Right Spk pin after boot */ - snd_soc_dapm_disable_pin(dapm, "Left Spk"); - snd_soc_dapm_disable_pin(dapm, "Right Spk"); - return snd_soc_dapm_sync(dapm); -} From patchwork Wed Apr 19 19:55:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 675058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8EBEDC77B73 for ; Wed, 19 Apr 2023 19:58:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3F336F09; Wed, 19 Apr 2023 21:57:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3F336F09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934294; bh=IJ+fwitynAIAX9EKxUj/jGrAg6HhpdhNXreZieQ0oNQ=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Yg/ZYZmpFwJeSqtDshcUnGmgiBBhxPa27qF/HyG+iDgmdqXFRwLBvRU1lg4U7yLei +7QiOORpIyEkIV9DUeETzUbGe18T5MJdvY6tozmSMKeAKpuM2fqQY7+FZz2scqt6VZ U/qwvjPORH3DJ8c9DWP8UURKSM7QY3KQQSfApPu4= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E4073F80544; Wed, 19 Apr 2023 21:56:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3EC40F8052E; Wed, 19 Apr 2023 21:56:09 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 E3818F800F8 for ; Wed, 19 Apr 2023 21:56:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E3818F800F8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=L7Qmh4AS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934167; x=1713470167; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IJ+fwitynAIAX9EKxUj/jGrAg6HhpdhNXreZieQ0oNQ=; b=L7Qmh4AS8WO4OJZ/y3RiheOuX9IKO3zCJYZEHNF6uNzVnrP2af87CYad FgKoOvlFsP+48xNBS19JPBPOi4tcktge2xIzdRz/+tARvpQ+0bFqp2scs sK96MH0mxljqF+r03JI+ouAHbigbtmuNE1kpQJvqyYbp8rNWlX4DXtQRq slf64X7wHwj1zierxZjHCqluUscmRgkggq5WSoawmBenMb1mjpd1PkP28 UIldQIvdPWGMA6N1x++g4VywQnWP4+/LKHJyNXllT6XHUTiXAgd5oET8i cSIKxFhEc3T8pK9Vpchp3qgJu4gr2vbh3BYI+AoE1pYzbPPFwHFPS9AmH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434396" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434396" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728108" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728108" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:02 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 5/7] ASoC: Intel: sof_sdw: set codec_num = 1 if the device is not aggregated Date: Wed, 19 Apr 2023 14:55:22 -0500 Message-Id: <20230419195524.46995-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: SWRXX7TCJ25MEQVJFXEKO6YFBVMN4UWL X-Message-ID-Hash: SWRXX7TCJ25MEQVJFXEKO6YFBVMN4UWL X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, Bard Liao , Pierre-Louis Bossart , Rander Wang X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Bard Liao We assume adr_link->num_adr = 1 if a device is not aggregated. However, the assumption is not valid if there are different type devices on the same soundwire link. Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang --- sound/soc/intel/boards/sof_sdw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 7d398b45d48f..e5729df4fd44 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -961,6 +961,7 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, cpu_dai_id[index++] = ffs(adr_link->mask) - 1; if (!adr_d->endpoints->aggregated || no_aggregation) { *cpu_dai_num = 1; + *codec_num = 1; *group_id = 0; return 0; } From patchwork Wed Apr 19 19:55:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 675056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C4FEDC6FD18 for ; Wed, 19 Apr 2023 19:59:30 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 88421EAC; Wed, 19 Apr 2023 21:58:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 88421EAC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934368; bh=5f6r17BaOQbpLk3CSccJWvHfQtT62LGDiBh3Dw+H3R0=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uNO1HBSlCZNPjxYUii85Rbb9xspCh9S1NpxdA+36ZqtelgQY7aJi0pDztm9Drs6kc rmuj1OQIryTg0JMoqmq5FN9lCLRox57BqL6gDdT1JLDWwL2vjCk7VIU5iCBRXmU/4C Q9I2/lTrCfRdq033up6zmy8xPzsOzDllk2bUC+QI= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A248BF8056F; Wed, 19 Apr 2023 21:57:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3FF58F80510; Wed, 19 Apr 2023 21:57:06 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 DB23CF804FC for ; Wed, 19 Apr 2023 21:56:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DB23CF804FC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Uh+RYHKs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934168; x=1713470168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5f6r17BaOQbpLk3CSccJWvHfQtT62LGDiBh3Dw+H3R0=; b=Uh+RYHKs/6flCnOsBiK6FA9FnvqbM6r9DO4NXmKl24gzaNyLvwvLNayD zpx/Z8crmFWYsKFdsi8Bgc+cRZY0Ev+UpVR6sZQeMJJt59cnhCpqkxN7o j4a836mhe5Y41qaZfXjs89cXMhzHLCcRiKXMpxZQlZfYAZjg5M6P0jYpu w3AHrmGvlEQ3SVqc3P0TAHmDklt4xAL/1RLZisvLxg5S6hVWGjqI2fCVb 7yJQzrYoVLPR4RJI82A/f2RB8eugCy8ey+mVK+wM9sPiyAWbLuh6dtsBM dR9/s9AzznqR0p0a7pIMmYzZiSwbGv5ReMmPMyYjoTdpxk9KkRZNDvDvL A==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434401" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434401" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728111" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728111" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:02 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 6/7] ASoC: Intel: sof_sdw: support different devices on the same sdw link Date: Wed, 19 Apr 2023 14:55:23 -0500 Message-Id: <20230419195524.46995-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: ECRAOIDO3AZSLFYGPMNYFPEHQPMNZRYY X-Message-ID-Hash: ECRAOIDO3AZSLFYGPMNYFPEHQPMNZRYY X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, Bard Liao , Pierre-Louis Bossart , Rander Wang X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Bard Liao The existing code assumes all devices on the same soundwire link are the same devices. eg. all rt1316. This commit removes the assumption and supports different devices on the same soundwire link. Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang --- sound/soc/intel/boards/sof_sdw.c | 130 ++++++++++++++++++------------- 1 file changed, 77 insertions(+), 53 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index e5729df4fd44..6a6c81df72bd 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -732,34 +732,36 @@ static int get_sdw_dailink_info(struct device *dev, const struct snd_soc_acpi_li int stream; u64 adr; - adr = link->adr_d->adr; - codec_index = find_codec_info_part(adr); - if (codec_index < 0) - return codec_index; + for (i = 0; i < link->num_adr; i++) { + adr = link->adr_d[i].adr; + codec_index = find_codec_info_part(adr); + if (codec_index < 0) + return codec_index; - if (codec_info_list[codec_index].codec_type < _codec_type) - dev_warn(dev, - "Unexpected address table ordering. Expected order: jack -> amp -> mic\n"); + if (codec_info_list[codec_index].codec_type < _codec_type) + dev_warn(dev, + "Unexpected address table ordering. Expected order: jack -> amp -> mic\n"); - _codec_type = codec_info_list[codec_index].codec_type; + _codec_type = codec_info_list[codec_index].codec_type; - endpoint = link->adr_d->endpoints; + endpoint = link->adr_d[i].endpoints; - /* count DAI number for playback and capture */ - for_each_pcm_streams(stream) { - if (!codec_info_list[codec_index].direction[stream]) - continue; + /* count DAI number for playback and capture */ + for_each_pcm_streams(stream) { + if (!codec_info_list[codec_index].direction[stream]) + continue; - (*sdw_cpu_dai_num)++; + (*sdw_cpu_dai_num)++; - /* count BE for each non-aggregated slave or group */ - if (!endpoint->aggregated || no_aggregation || - !group_visited[endpoint->group_id]) - (*sdw_be_num)++; - } + /* count BE for each non-aggregated slave or group */ + if (!endpoint->aggregated || no_aggregation || + !group_visited[endpoint->group_id]) + (*sdw_be_num)++; + } - if (endpoint->aggregated) - group_visited[endpoint->group_id] = true; + if (endpoint->aggregated) + group_visited[endpoint->group_id] = true; + } } return 0; @@ -829,17 +831,19 @@ static int create_codec_dai_name(struct device *dev, int offset, struct snd_soc_codec_conf *codec_conf, int codec_count, - int *codec_conf_index) + int *codec_conf_index, + int adr_index) { + int _codec_index = -1; int i; /* sanity check */ - if (*codec_conf_index + link->num_adr > codec_count) { + if (*codec_conf_index + link->num_adr - adr_index > codec_count) { dev_err(dev, "codec_conf: out-of-bounds access requested\n"); return -EINVAL; } - for (i = 0; i < link->num_adr; i++) { + for (i = adr_index; i < link->num_adr; i++) { unsigned int sdw_version, unique_id, mfg_id; unsigned int link_id, part_id, class_id; int codec_index, comp_index; @@ -855,7 +859,7 @@ static int create_codec_dai_name(struct device *dev, part_id = SDW_PART_ID(adr); class_id = SDW_CLASS_ID(adr); - comp_index = i + offset; + comp_index = i - adr_index + offset; if (is_unique_device(link, sdw_version, mfg_id, part_id, class_id, i)) { codec_str = "sdw:%01x:%04x:%04x:%02x"; @@ -877,6 +881,11 @@ static int create_codec_dai_name(struct device *dev, codec_index = find_codec_info_part(adr); if (codec_index < 0) return codec_index; + if (_codec_index != -1 && codec_index != _codec_index) { + dev_dbg(dev, "Different devices on the same sdw link\n"); + break; + } + _codec_index = codec_index; codec[comp_index].dai_name = codec_info_list[codec_index].dai_name; @@ -943,16 +952,16 @@ static int set_codec_init_func(struct snd_soc_card *card, static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, struct device *dev, int *cpu_dai_id, int *cpu_dai_num, int *codec_num, unsigned int *group_id, - bool *group_generated) + bool *group_generated, int adr_index) { const struct snd_soc_acpi_adr_device *adr_d; const struct snd_soc_acpi_link_adr *adr_next; bool no_aggregation; int index = 0; + int i; no_aggregation = sof_sdw_quirk & SOF_SDW_NO_AGGREGATION; - *codec_num = adr_link->num_adr; - adr_d = adr_link->adr_d; + adr_d = &adr_link->adr_d[adr_index]; /* make sure the link mask has a single bit set */ if (!is_power_of_2(adr_link->mask)) @@ -968,6 +977,14 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, *group_id = adr_d->endpoints->group_id; + /* Count endpoints with the same group_id in the adr_link */ + *codec_num = 0; + for (i = 0; i < adr_link->num_adr; i++) { + if (adr_link->adr_d[i].endpoints->aggregated && + adr_link->adr_d[i].endpoints->group_id == *group_id) + (*codec_num)++; + } + /* gather other link ID of slaves in the same group */ for (adr_next = adr_link + 1; adr_next && adr_next->num_adr; adr_next++) { @@ -988,7 +1005,11 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, } cpu_dai_id[index++] = ffs(adr_next->mask) - 1; - *codec_num += adr_next->num_adr; + for (i = 0; i < adr_next->num_adr; i++) { + if (adr_next->adr_d[i].endpoints->aggregated && + adr_next->adr_d[i].endpoints->group_id == *group_id) + (*codec_num)++; + } } /* @@ -1011,7 +1032,8 @@ static int create_sdw_dailink(struct snd_soc_card *card, struct snd_soc_codec_conf *codec_conf, int codec_count, int *link_id, int *codec_conf_index, - bool *ignore_pch_dmic) + bool *ignore_pch_dmic, + int adr_index) { const struct snd_soc_acpi_link_adr *link_next; struct snd_soc_dai_link_component *codecs; @@ -1027,7 +1049,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int k; ret = get_slave_info(link, dev, cpu_dai_id, &cpu_dai_num, &codec_num, - &group_id, group_generated); + &group_id, group_generated, adr_index); if (ret) return ret; @@ -1050,7 +1072,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, continue; ret = create_codec_dai_name(dev, link_next, codecs, codec_idx, - codec_conf, codec_count, codec_conf_index); + codec_conf, codec_count, codec_conf_index, adr_index); if (ret < 0) return ret; @@ -1060,7 +1082,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, } /* find codec info to create BE DAI */ - codec_index = find_codec_info_part(link->adr_d[0].adr); + codec_index = find_codec_info_part(link->adr_d[adr_index].adr); if (codec_index < 0) return codec_index; @@ -1303,29 +1325,31 @@ static int sof_card_dai_links_create(struct device *dev, /* generate DAI links by each sdw link */ for (; adr_link->num_adr; adr_link++) { - const struct snd_soc_acpi_endpoint *endpoint; + for (i = 0; i < adr_link->num_adr; i++) { + const struct snd_soc_acpi_endpoint *endpoint; - endpoint = adr_link->adr_d->endpoints; - if (endpoint->aggregated && !endpoint->group_id) { - dev_err(dev, "invalid group id on link %x", - adr_link->mask); - continue; - } + endpoint = adr_link->adr_d[i].endpoints; + if (endpoint->aggregated && !endpoint->group_id) { + dev_err(dev, "invalid group id on link %x", + adr_link->mask); + continue; + } - /* this group has been generated */ - if (endpoint->aggregated && - group_generated[endpoint->group_id]) - continue; + /* this group has been generated */ + if (endpoint->aggregated && + group_generated[endpoint->group_id]) + continue; - ret = create_sdw_dailink(card, dev, &link_index, links, sdw_be_num, - sdw_cpu_dai_num, cpus, adr_link, - &cpu_id, group_generated, - codec_conf, codec_conf_count, - &be_id, &codec_conf_index, - &ignore_pch_dmic); - if (ret < 0) { - dev_err(dev, "failed to create dai link %d", link_index); - return ret; + ret = create_sdw_dailink(card, dev, &link_index, links, sdw_be_num, + sdw_cpu_dai_num, cpus, adr_link, + &cpu_id, group_generated, + codec_conf, codec_conf_count, + &be_id, &codec_conf_index, + &ignore_pch_dmic, i); + if (ret < 0) { + dev_err(dev, "failed to create dai link %d", link_index); + return ret; + } } } From patchwork Wed Apr 19 19:55:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 676927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 11BDDC6FD18 for ; Wed, 19 Apr 2023 19:58:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 75C75EEE; Wed, 19 Apr 2023 21:57:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 75C75EEE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1681934316; bh=/xTThc/vUluIgdI5z4zcpDFgrnb2lg3xpHlYJR436y8=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HAVuQIay57b44FESXwdtcKyVazS7WYa3pl5rGwLGRV6ptQGpXqI920bNEm2PAINMh Y+4DSmmssJYkbLwQW0HbdBTjMZ5iUCtnLrh7WBcQb+ySa8xJU3oBqfSFoYdRNpY9Ka pSfST8JwdVZUbwF7IYIvSLOELYxfbuXZMPb5F1Yk= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A9159F80552; Wed, 19 Apr 2023 21:56:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2DDEBF8053B; Wed, 19 Apr 2023 21:56:11 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 C808AF80149 for ; Wed, 19 Apr 2023 21:56:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C808AF80149 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=I7N3EUBY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681934169; x=1713470169; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/xTThc/vUluIgdI5z4zcpDFgrnb2lg3xpHlYJR436y8=; b=I7N3EUBYAo5n0/twnschnVP8OuadFY1qxqTHbu6uB4YW+TGDVjAdajh3 hdIFGRcwEFOLDs8mHaSnKLoYnoTXyD47YVx3S83DJTXgMu5Ptx6S+iWFP 9vDn7uuL90LZFh+2gmRjFbDcLfzALC/bunllU7Ge85tDlReonBVt5J+MT gCytovGti+LXan7KIcGtTozUqG/J7/rQp9djlIWXKRhiA3Y5MZjUJlMcn B8e38VgMg6tfWDACbh3o2Zyts5cHtfJGFSXedPBkGMrj8VEZwyMTehFYh 8RnVi1CQNVHXWvXo7wVd7/aBf22/+exnfA8U7rk41TBD7xmFtvk1cm74R A==; X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="373434406" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="373434406" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10685"; a="815728114" X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="815728114" Received: from gargicha-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.74.38]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2023 12:56:03 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 7/7] ASoC: Intel: sof_sdw: append codec type to dai link name Date: Wed, 19 Apr 2023 14:55:24 -0500 Message-Id: <20230419195524.46995-8-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> References: <20230419195524.46995-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: KQNHMVY6ZLIDPGTP34MEUN4PDODTIZIX X-Message-ID-Hash: KQNHMVY6ZLIDPGTP34MEUN4PDODTIZIX X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: tiwai@suse.de, broonie@kernel.org, Bard Liao , Pierre-Louis Bossart , Rander Wang X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Bard Liao The existing sdw_sof machine driver constructs two SoundWire interfaces by direction and sdw link id. It means that we will have exactly the same dai link name if two dai links are on the same sdw link with the same direction. The new Realtek codec has two SoundWire interfaces for jack and DMIC functions and they are treated as different codecs. To create two dai links for jack and DMIC, we need to have different dai link names. This patch suggests to append codec type if there are two or more different types of devices on the same sdw bus. Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang --- sound/soc/intel/boards/sof_sdw.c | 41 ++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 6a6c81df72bd..6faf4a43eaf5 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1022,6 +1022,8 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, return 0; } +static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic"}; + static int create_sdw_dailink(struct snd_soc_card *card, struct device *dev, int *link_index, struct snd_soc_dai_link *dai_links, @@ -1033,6 +1035,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int codec_count, int *link_id, int *codec_conf_index, bool *ignore_pch_dmic, + bool append_codec_type, int adr_index) { const struct snd_soc_acpi_link_adr *link_next; @@ -1109,14 +1112,22 @@ static int create_sdw_dailink(struct snd_soc_card *card, static const char * const sdw_stream_name[] = { "SDW%d-Playback", "SDW%d-Capture", + "SDW%d-Playback-%s", + "SDW%d-Capture-%s", }; if (!codec_info_list[codec_index].direction[stream]) continue; /* create stream name according to first link id */ - name = devm_kasprintf(dev, GFP_KERNEL, - sdw_stream_name[stream], cpu_dai_id[0]); + if (append_codec_type) { + name = devm_kasprintf(dev, GFP_KERNEL, + sdw_stream_name[stream + 2], cpu_dai_id[0], + type_strings[codec_info_list[codec_index].codec_type]); + } else { + name = devm_kasprintf(dev, GFP_KERNEL, + sdw_stream_name[stream], cpu_dai_id[0]); + } if (!name) return -ENOMEM; @@ -1232,6 +1243,7 @@ static int sof_card_dai_links_create(struct device *dev, const struct snd_soc_acpi_link_adr *adr_link; struct snd_soc_dai_link_component *cpus; struct snd_soc_codec_conf *codec_conf; + bool append_codec_type = false; bool ignore_pch_dmic = false; int codec_conf_count; int codec_conf_index = 0; @@ -1323,8 +1335,29 @@ static int sof_card_dai_links_create(struct device *dev, for (i = 0; i < SDW_MAX_GROUPS; i++) group_generated[i] = false; - /* generate DAI links by each sdw link */ for (; adr_link->num_adr; adr_link++) { + /* + * If there are two or more different devices on the same sdw link, we have to + * append the codec type to the dai link name to prevent duplicated dai link name. + * The same type devices on the same sdw link will be in the same + * snd_soc_acpi_adr_device array. They won't be described in different adr_links. + */ + for (i = 0; i < adr_link->num_adr; i++) { + for (j = 0; j < i; j++) { + if ((SDW_PART_ID(adr_link->adr_d[i].adr) != + SDW_PART_ID(adr_link->adr_d[j].adr)) || + (SDW_MFG_ID(adr_link->adr_d[i].adr) != + SDW_MFG_ID(adr_link->adr_d[i].adr))) { + append_codec_type = true; + goto out; + } + } + } + } +out: + + /* generate DAI links by each sdw link */ + for (adr_link = mach_params->links ; adr_link->num_adr; adr_link++) { for (i = 0; i < adr_link->num_adr; i++) { const struct snd_soc_acpi_endpoint *endpoint; @@ -1345,7 +1378,7 @@ static int sof_card_dai_links_create(struct device *dev, &cpu_id, group_generated, codec_conf, codec_conf_count, &be_id, &codec_conf_index, - &ignore_pch_dmic, i); + &ignore_pch_dmic, append_codec_type, i); if (ret < 0) { dev_err(dev, "failed to create dai link %d", link_index); return ret;