Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp209461rwd; Mon, 12 Jun 2023 12:17:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KVAw5zJiqWB7wgmoOYWiJbnmVogGhvFbR3xwUnWuSjBmpCuIpudddo5WhegGrNjTSbDE3 X-Received: by 2002:a05:6a21:329f:b0:10b:cdb1:3563 with SMTP id yt31-20020a056a21329f00b0010bcdb13563mr13097021pzb.46.1686597443960; Mon, 12 Jun 2023 12:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686597443; cv=none; d=google.com; s=arc-20160816; b=o+4mMhjjYvnWAJg+n3gzZIZe1w2YLVnlD4MX014PpIQN6CUqVwDgVsOjTZgGvBt3ee ED6nkCExhJc828kEhZcn6Rfo++lDdy+yqG+tzSoSvsAl756saZ7CTWo3qlK5rBpWMkTg gIYmEw4gkzYf14HZ8i2tGhsLaOwAYcKyAZTEEWZbZNzvH2i5adFu82nlCvRUFddFTpfF Vvw//Svm/9O+QskZJ4HO8aD20GDEgS75a5yRuJVMKTP0tf3g8GK3cX0EnoXyF8yJe3lS Lnl/IkZcmL13CU101DDrdb71to9I8gDIEmgRFKRdm4JVCQBAc5hfr1oVkytAv+E4sGCI LsMQ== 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 :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=Yb2OwQmDNc+x5zeJs8fdv3I7DtZUtAGhUBeVyt59QXA=; b=du2faM47brem+2HVWE66vUkG0EuZLeXnkGotrqOTBIW/Fs3SDFgg4UOyHnmiq/UQpD r7Nl2B8uh+SQDktoQrloIwj2FOvnxatKtq6sqRRgFq7odswLlvn1+Gbo1OMjiz280UsJ kae01zU/i3zNYfNmGRTXePFjf6iP0TRmbiWUr96ogENfCAtYkETNPtCB9iu1O5s+/Pgk zYfz9yKyNAorlkyGc1UQBhSQZbIF1DUxhuQVCjWu0zmp8Qk0RUD7n+cFNhM0nf3PMkfx QfJUAUyPyfByb7xPmFiaJmzH2orv6AMHdTgZglhoxgoFI7apva7Ii/svExDfyMQ9ciHN ATMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ed7iF1mL; 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 n17-20020a638f11000000b0054f94d41042si1568158pgd.434.2023.06.12.12.17.10; Mon, 12 Jun 2023 12:17:23 -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=Ed7iF1mL; 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 S237715AbjFLTGC (ORCPT + 99 others); Mon, 12 Jun 2023 15:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237691AbjFLTGA (ORCPT ); Mon, 12 Jun 2023 15:06:00 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 272CAB7 for ; Mon, 12 Jun 2023 12:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686596760; x=1718132760; h=message-id:date:mime-version:from:subject:to:cc: references:in-reply-to:content-transfer-encoding; bh=N/dzqJlblDp6TTKWc155X+LGbZjpw//MJhRXHQQsR5k=; b=Ed7iF1mLmKNj6fKMJxmiBCP+YAkCCcwzU91B1BbtiyqZhNHQ3lv0Ra2s 1gUCFNujExtwCVtzPIanV8ehZrEg3Y/bTydngz4r60A0lbYKpDqajQOj1 8dxGKSyJqOg0hg7EuSJWFMCQ9PtRyY2YV+dGnh3Y8HaW/Pr4Epb4kglMk KwGcJSdQJkmp/Lkesi8NAf2z3w6vWUb3dywff46c1v+rToGpQ4o+Ucofj 5RvHXxOiCpBO5mH7VFr3s6BkzdhL3QLE3zIUAXjyYILn/0jiOzEahpNMQ 2vgTtUf1z8pqMv81zwkuX7oQlEDi6HUUJ2dymumJDGlCnKUsKMUPXQUJ8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="338499170" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="338499170" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 12:05:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="776503224" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="776503224" Received: from atulpuri-mobl1.amr.corp.intel.com (HELO [10.212.234.150]) ([10.212.234.150]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 12:05:58 -0700 Message-ID: <5899c2b8-e984-fda9-5e12-190b0c9fd3b2@linux.intel.com> Date: Mon, 12 Jun 2023 13:09:26 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.11.0 From: Pierre-Louis Bossart Subject: Re: [PATCH V4 1/9] ASoC: amd: ps: create platform devices based on acp config To: Vijendar Mukunda , broonie@kernel.org Cc: alsa-devel@alsa-project.org, Basavaraj.Hiregoudar@amd.com, Sunil-kumar.Dommati@amd.com, Mastan.Katragadda@amd.com, Arungopal.kondaveeti@amd.com, mario.limonciello@amd.com, Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , open list References: <20230612095903.2113464-1-Vijendar.Mukunda@amd.com> <20230612095903.2113464-2-Vijendar.Mukunda@amd.com> Content-Language: en-US In-Reply-To: <20230612095903.2113464-2-Vijendar.Mukunda@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 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,T_SCC_BODY_TEXT_LINE 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 = > +static int sdw_amd_scan_controller(struct device *dev) > +{ > + struct acp63_dev_data *acp_data; > + struct fwnode_handle *link; > + char name[32]; > + u32 sdw_manager_bitmap; > + u8 count = 0; > + u32 acp_sdw_power_mode = 0; > + int index; > + int ret; > + > + acp_data = dev_get_drvdata(dev); > + /* > + * Current implementation is based on MIPI DisCo 2.0 spec. > + * Found controller, find links supported. > + */ > + ret = fwnode_property_read_u32_array((acp_data->sdw_fw_node), "mipi-sdw-manager-list", > + &sdw_manager_bitmap, 1); > + > + if (ret) { > + dev_err(dev, "Failed to read mipi-sdw-manager-list: %d\n", ret); > + return -EINVAL; > + } > + count = hweight32(sdw_manager_bitmap); > + /* Check count is within bounds */ > + if (count > AMD_SDW_MAX_MANAGERS) { > + dev_err(dev, "Manager count %d exceeds max %d\n", count, AMD_SDW_MAX_MANAGERS); > + return -EINVAL; > + } nit-pick: the count is not enough, you should also check that only bits 0 and 1 are set in mipi-sdw-manager-list... > + > + if (!count) { > + dev_dbg(dev, "No SoundWire Managers detected\n"); > + return -EINVAL; > + } > + dev_dbg(dev, "ACPI reports %d SoundWire Manager devices\n", count); > + acp_data->sdw_manager_count = count; > + for (index = 0; index < count; index++) { > + snprintf(name, sizeof(name), "mipi-sdw-link-%d-subproperties", index); ... otherwise this will be wrong. > + link = fwnode_get_named_child_node(acp_data->sdw_fw_node, name); > + if (!link) { > + dev_err(dev, "Manager node %s not found\n", name); > + return -EIO; > + } > + > + ret = fwnode_property_read_u32(link, "amd-sdw-power-mode", &acp_sdw_power_mode); > + if (ret) > + return ret; > + /* > + * when SoundWire configuration is selected from acp pin config, > + * based on manager instances count, acp init/de-init sequence should be > + * executed as part of PM ops only when Bus reset is applied for the active > + * SoundWire manager instances. > + */ > + if (acp_sdw_power_mode != AMD_SDW_POWER_OFF_MODE) { > + acp_data->acp_reset = false; > + return 0; > + } > + } > + return 0; > +}