From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4727DC00144 for ; Fri, 29 Jul 2022 14:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237014AbiG2OZZ (ORCPT ); Fri, 29 Jul 2022 10:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236921AbiG2OZX (ORCPT ); Fri, 29 Jul 2022 10:25:23 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8665D1B79D for ; Fri, 29 Jul 2022 07:25:22 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26TBvJkh009269; Fri, 29 Jul 2022 09:24:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : references : in-reply-to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=PODMain02222019; bh=hKCkz5vC7H4oaj3WOgNktGC6w/6bpup/y8bypzeNl/w=; b=ipfhot+EiJE1rBF1BsY5/GxXpAndNRvv5oggGNp3yQ9P2KtzrW37Cjss0g40wYBrvLUn 9bEB9qgi2At9Co9cVPYPGG3Hkfs0lzSDYWweL4lxJL9haYPrO9mfHZLZ0q4CQZ1kcKkO AJfj+qxQiUpqgQhqfDVwulBUvlVmdpl0VhKaCEm0EjckolfI+QDZJPKTJn1vxwRNukrK g+Tj6Kd4fFBOVvWkCSmXDrotqWUsN7z+RmZlpvp/ON6jGh5fvzv1A4q3HENLTQ49Ilh8 GiTvGPJ0g3PaH0eZZ9s5K/WnAgGmogglyuYowmgVDSMZpAdcPO+zpP3LqK5BAF1mjJ4t 1Q== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3hgddp868j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 09:24:43 -0500 Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Fri, 29 Jul 2022 09:24:42 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.9 via Frontend Transport; Fri, 29 Jul 2022 09:24:42 -0500 Received: from LONN2DGDQ73 (unknown [198.90.238.229]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 196552D4; Fri, 29 Jul 2022 14:24:42 +0000 (UTC) From: Stefan Binding To: 'Pierre-Louis Bossart' , "'Mark Brown'" , 'Liam Girdwood' , "'Brent Lu'" , 'xliu' CC: 'Vitaly Rodionov' , , , References: <20220727160051.3373125-1-sbinding@opensource.cirrus.com> <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com> In-Reply-To: <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com> Subject: RE: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map correct amp to prefix Date: Fri, 29 Jul 2022 15:24:42 +0100 Message-ID: <001c01d8a356$f1b4e9f0$d51ebdd0$@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQIu+zYjutHUxuurajS4bthg+gYcqQJYYBCXrNXz4SA= X-Proofpoint-GUID: nQKP2W_n00lxkvd5lKGmylmeBuz7MNqn X-Proofpoint-ORIG-GUID: nQKP2W_n00lxkvd5lKGmylmeBuz7MNqn X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > -----Original Message----- > From: Alsa-devel On Behalf Of > Pierre-Louis Bossart > Sent: 27 July 2022 17:37 > To: Stefan Binding ; Mark Brown > ; Liam Girdwood ; > Brent Lu ; xliu > Cc: Vitaly Rodionov ; > patches@opensource.cirrus.com; alsa-devel@alsa-project.org; linux- > kernel@vger.kernel.org > Subject: Re: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map > correct amp to prefix >=20 >=20 >=20 >=20 > > +/* > > + * Expected UIDs are integers (stored as strings). > > + * UID Mapping is fixed: > > + * UID 0x0 -> WL > > + * UID 0x1 -> WR > > + * UID 0x2 -> TL > > + * UID 0x3 -> TR > > + * Note: If there are less than 4 Amps, UIDs still map to > WL/WR/TL/TR. Dynamic code will only create > > + * dai links for UIDs which exist, and ignore non-existant ones. >=20 > is this intentional to support all variations of 1,2,3 and 4 = amplifiers > being present? >=20 > Or is the intent to really support 2 or 4? The intent was to support 2 or 4, rather than any number of amps, in case something was released with 2 amps. >=20 > > + * Return number of codecs found. > > + */ > > +static int cs35l41_compute_codec_conf(void) > > +{ > > + const char * const uid_strings[] =3D { "0", "1", "2", "3" }; > > + unsigned int uid, sz =3D 0; > > + struct acpi_device *adev; > > + struct device *physdev; > > + > > + for (uid =3D 0; uid < CS35L41_MAX_AMPS; uid++) { > > + adev =3D acpi_dev_get_first_match_dev(CS35L41_HID, > uid_strings[uid], -1); > > + if (!adev) { > > + pr_warn("Cannot find match for HID %s UID > %u (%s)\n", CS35L41_HID, uid, > > + cs35l41_name_prefixes[uid]); >=20 > A warning is a bit strong if some valid configurations don't expose = all > 4 codecs. I'll change this to a debug message, but also add an error if there is = not 2 or 4 amps found. >=20 > > + continue; > > + } > > + physdev =3D > get_device(acpi_get_first_physical_node(adev)); > > + cs35l41_components[sz].name =3D dev_name(physdev); > > + cs35l41_components[sz].dai_name =3D > CS35L41_CODEC_DAI; > > + cs35l41_codec_conf[sz].dlc.name =3D > dev_name(physdev); > > + cs35l41_codec_conf[sz].name_prefix =3D > cs35l41_name_prefixes[uid]; > > + acpi_dev_put(adev); > > + sz++; > > + } > > + return sz; Thanks, Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 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 3780EC00144 for ; Fri, 29 Jul 2022 14:25:46 +0000 (UTC) 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 6748E15CA; Fri, 29 Jul 2022 16:24:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6748E15CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1659104744; bh=4sa/AklKOgBm/cF7QLYh146fBhMA1Du5BqU7m49UU+A=; h=From:To:References:In-Reply-To:Subject:Date:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lQpo9HsfQeKnaQn+hI1Le7PgPkirHfTWRup6XIIUMzW/qV1NNbVPRtr0KSCUS+Xtv Qjj/zwFwh4+FuI6AWCzVXBmjMF/OHF78Xw8+9Ml3Ujn/rD2J6pHxpVal6GWE5bh9sL KHbQOkLtJFZATVKlwREl73wecB5Isc08bhWjSuZs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BDA85F800BD; Fri, 29 Jul 2022 16:24:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 33563F8049C; Fri, 29 Jul 2022 16:24:52 +0200 (CEST) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 0E5F4F800BD for ; Fri, 29 Jul 2022 16:24:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0E5F4F800BD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="ipfhot+E" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26TBvJkh009269; Fri, 29 Jul 2022 09:24:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : references : in-reply-to : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=PODMain02222019; bh=hKCkz5vC7H4oaj3WOgNktGC6w/6bpup/y8bypzeNl/w=; b=ipfhot+EiJE1rBF1BsY5/GxXpAndNRvv5oggGNp3yQ9P2KtzrW37Cjss0g40wYBrvLUn 9bEB9qgi2At9Co9cVPYPGG3Hkfs0lzSDYWweL4lxJL9haYPrO9mfHZLZ0q4CQZ1kcKkO AJfj+qxQiUpqgQhqfDVwulBUvlVmdpl0VhKaCEm0EjckolfI+QDZJPKTJn1vxwRNukrK g+Tj6Kd4fFBOVvWkCSmXDrotqWUsN7z+RmZlpvp/ON6jGh5fvzv1A4q3HENLTQ49Ilh8 GiTvGPJ0g3PaH0eZZ9s5K/WnAgGmogglyuYowmgVDSMZpAdcPO+zpP3LqK5BAF1mjJ4t 1Q== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3hgddp868j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 09:24:43 -0500 Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Fri, 29 Jul 2022 09:24:42 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.9 via Frontend Transport; Fri, 29 Jul 2022 09:24:42 -0500 Received: from LONN2DGDQ73 (unknown [198.90.238.229]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 196552D4; Fri, 29 Jul 2022 14:24:42 +0000 (UTC) From: Stefan Binding To: 'Pierre-Louis Bossart' , "'Mark Brown'" , 'Liam Girdwood' , "'Brent Lu'" , 'xliu' References: <20220727160051.3373125-1-sbinding@opensource.cirrus.com> <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com> In-Reply-To: <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com> Subject: RE: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map correct amp to prefix Date: Fri, 29 Jul 2022 15:24:42 +0100 Message-ID: <001c01d8a356$f1b4e9f0$d51ebdd0$@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQIu+zYjutHUxuurajS4bthg+gYcqQJYYBCXrNXz4SA= X-Proofpoint-GUID: nQKP2W_n00lxkvd5lKGmylmeBuz7MNqn X-Proofpoint-ORIG-GUID: nQKP2W_n00lxkvd5lKGmylmeBuz7MNqn X-Proofpoint-Spam-Reason: safe Cc: 'Vitaly Rodionov' , patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org 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" Hi, > -----Original Message----- > From: Alsa-devel On Behalf Of > Pierre-Louis Bossart > Sent: 27 July 2022 17:37 > To: Stefan Binding ; Mark Brown > ; Liam Girdwood ; > Brent Lu ; xliu > Cc: Vitaly Rodionov ; > patches@opensource.cirrus.com; alsa-devel@alsa-project.org; linux- > kernel@vger.kernel.org > Subject: Re: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map > correct amp to prefix >=20 >=20 >=20 >=20 > > +/* > > + * Expected UIDs are integers (stored as strings). > > + * UID Mapping is fixed: > > + * UID 0x0 -> WL > > + * UID 0x1 -> WR > > + * UID 0x2 -> TL > > + * UID 0x3 -> TR > > + * Note: If there are less than 4 Amps, UIDs still map to > WL/WR/TL/TR. Dynamic code will only create > > + * dai links for UIDs which exist, and ignore non-existant ones. >=20 > is this intentional to support all variations of 1,2,3 and 4 = amplifiers > being present? >=20 > Or is the intent to really support 2 or 4? The intent was to support 2 or 4, rather than any number of amps, in case something was released with 2 amps. >=20 > > + * Return number of codecs found. > > + */ > > +static int cs35l41_compute_codec_conf(void) > > +{ > > + const char * const uid_strings[] =3D { "0", "1", "2", "3" }; > > + unsigned int uid, sz =3D 0; > > + struct acpi_device *adev; > > + struct device *physdev; > > + > > + for (uid =3D 0; uid < CS35L41_MAX_AMPS; uid++) { > > + adev =3D acpi_dev_get_first_match_dev(CS35L41_HID, > uid_strings[uid], -1); > > + if (!adev) { > > + pr_warn("Cannot find match for HID %s UID > %u (%s)\n", CS35L41_HID, uid, > > + cs35l41_name_prefixes[uid]); >=20 > A warning is a bit strong if some valid configurations don't expose = all > 4 codecs. I'll change this to a debug message, but also add an error if there is = not 2 or 4 amps found. >=20 > > + continue; > > + } > > + physdev =3D > get_device(acpi_get_first_physical_node(adev)); > > + cs35l41_components[sz].name =3D dev_name(physdev); > > + cs35l41_components[sz].dai_name =3D > CS35L41_CODEC_DAI; > > + cs35l41_codec_conf[sz].dlc.name =3D > dev_name(physdev); > > + cs35l41_codec_conf[sz].name_prefix =3D > cs35l41_name_prefixes[uid]; > > + acpi_dev_put(adev); > > + sz++; > > + } > > + return sz; Thanks, Stefan