Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp486785imn; Wed, 27 Jul 2022 11:33:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1scT30GShbh6oAWGXmJpyxHRj8wjT1Oa8Z/DSFW0MD8wPKjl1DAMTPuDgro8oOGBI7zlpVo X-Received: by 2002:a17:907:2ccb:b0:72b:52bb:fd51 with SMTP id hg11-20020a1709072ccb00b0072b52bbfd51mr18690299ejc.118.1658946784841; Wed, 27 Jul 2022 11:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946784; cv=none; d=google.com; s=arc-20160816; b=bIbIft2jFCznw5d1Ir6rzMAfSrvTXunLUAFpHT7lxQrKUyflGIxfVVjFfybQLUMHu4 NhmOOo6nr8+/6/VxzpaS8hN2ZdteS3ce1E0Tcq6RvzvVITf/r6P1pB2AydDfyjBYvgbB 9xb+jrWSnVPn73I/tLohtRtxFYtHLBUJulDw1E8WQl1Buc9sq28YsH+DnkxxBrIRzni5 hgSTHVlPAdBK/pOak3O3vl0Nb/002aLD6B/sqWhOdh6pgJ968O6sQy/O9MIIe3Gs0IPH f5ugXivyU2h8dbqfN69186yD2SoD8rvAdvO5u+Mf5/lWOQ7Oeba3PqbNWPk+xBgcN5tQ r3fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=TAwYDoljLFzIt9RhOSOJhjnnAa0OJko8l4/GHeHW2kc=; b=Ypg5iTqZUleqgLiHoWiuLUB++JnSFgZgRUT7iGu3sp9e24qCVDlX5xw+D6y+OI0qka DZQe5tpgwClwffar0WAu9g2dPW/ZmPh4TE3IRUTUziNbuPuIo1+slsBDeVOyuVJzEgmz MTq2MB3nokYuZcoRloIEhwRaMmhNhR9vLYxzz/lwRHkRdItF41Csz4+uQJOhpHHHVU8c fmg4hZc/C7RvS38q0QtFivt0rR5yZZrybdtQ7/iJRvnqmLASn7QZPPy7PaIt39JxKBAv eT7YCPstO6GE1lNF5ZD217DdpNlf9NOD5rEvhKPvf4WeXNyyeeFWV5KmqpjC5yRAFqpD fakA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LdcmHtpd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a1709064fd000b0072b4ad153dasi17819779ejw.635.2022.07.27.11.32.38; Wed, 27 Jul 2022 11:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LdcmHtpd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240868AbiG0RAJ (ORCPT + 99 others); Wed, 27 Jul 2022 13:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241252AbiG0Q7U (ORCPT ); Wed, 27 Jul 2022 12:59:20 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD4E67CAB for ; Wed, 27 Jul 2022 09:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658939837; x=1690475837; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=/Xu6IgGf7EmqEfszrQvOKIjQaHODWfI38AJXg11+tcA=; b=LdcmHtpdDxppgPmOvqfnDo1TKA+q+7C9clzYiQcZURl4uiD2ZmTq1jZS QPU4r3tVPvYmvTX5zyZgJwhtdqp+gfAz571lB6EP/DfVF9Kbw8KEoEgFt cNl2LpvwIEVKofPrz/HzWT3fDojCzWpHFR8pyHL1/y3wsNPntzU+cCaZH A+SYsGco5TxJ/FRjC99zt1WkOw8HnIGoDYXNDoJMu7kYzw/iot5w8GRkR hSdGDi0Lrn0sNKmNeoEpaSYY8rUgIpVU3TFTXF3aKya3UgL2DnFLVNx+g 7fBPAC6I1Hr7SbLaclyVFD/iaOvDSVVby4Aic6H2J8NRcWaL/W+NnST6Q Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10421"; a="352279806" X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="352279806" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 09:36:45 -0700 X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="628450023" Received: from lgumar-mobl.amr.corp.intel.com (HELO [10.209.151.195]) ([10.209.151.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 09:36:44 -0700 Message-ID: <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com> Date: Wed, 27 Jul 2022 11:36:43 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map correct amp to prefix Content-Language: en-US To: Stefan Binding , Mark Brown , Liam Girdwood , Brent Lu , xliu Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com, Vitaly Rodionov References: <20220727160051.3373125-1-sbinding@opensource.cirrus.com> From: Pierre-Louis Bossart In-Reply-To: <20220727160051.3373125-1-sbinding@opensource.cirrus.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +/* > + * 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. is this intentional to support all variations of 1,2,3 and 4 amplifiers being present? Or is the intent to really support 2 or 4? > + * Return number of codecs found. > + */ > +static int cs35l41_compute_codec_conf(void) > +{ > + const char * const uid_strings[] = { "0", "1", "2", "3" }; > + unsigned int uid, sz = 0; > + struct acpi_device *adev; > + struct device *physdev; > + > + for (uid = 0; uid < CS35L41_MAX_AMPS; uid++) { > + adev = 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]); A warning is a bit strong if some valid configurations don't expose all 4 codecs. > + continue; > + } > + physdev = get_device(acpi_get_first_physical_node(adev)); > + 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++; > + } > + return sz;