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 4B961C7EE2F for ; Mon, 12 Jun 2023 19:07:59 +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 E518183B; Mon, 12 Jun 2023 21:07:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E518183B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686596872; bh=N/dzqJlblDp6TTKWc155X+LGbZjpw//MJhRXHQQsR5k=; h=Date:From:Subject:To:Cc:References:In-Reply-To:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LvutRZzprscrVVVd25+jF9n4Z7uWJR/wrQvSWjFPQVBn2K3wD8bBfuJf8LDKFJAjd EP1A3Joum7KblFRLIoIIlPcNFoAF8D5w3JGIf1/oeCnq3FGDpLKDOBV+MVPvIkghlK WmgznY3pycUyCJD8bqGTyNI06iSGOzkMVrHtWXC0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 37518F80557; Mon, 12 Jun 2023 21:06:12 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C7FA8F80557; Mon, 12 Jun 2023 21:06:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 541FCF80149; Mon, 12 Jun 2023 21:06:08 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 37665F800BA for ; Mon, 12 Jun 2023 21:06:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 37665F800BA 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=fhytskk/ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686596763; x=1718132763; h=message-id:date:mime-version:from:subject:to:cc: references:in-reply-to:content-transfer-encoding; bh=N/dzqJlblDp6TTKWc155X+LGbZjpw//MJhRXHQQsR5k=; b=fhytskk/Gj2XQnF/GkfYzBR7ta0Hupclx4snuZdEnw06BwzahkFj+Fxc YwhOM1qoTHFVlrEs9bjK1cxNS8bGtETaEy13ytktLRyE74hotX5eynOBw asrjcnczDdmwSSF4M6HoKB9KyXJBO8ooJYD9FdqQCD2/dXK2ElDw08Nib 0V0owvLYCzUfTZzQM1L9HGXYhSa23lTF+cZDMHtZ+Z23pp3pe7T1rnTxk nSxIuwiripqymd3D6L8yvInhB51ASVdj8zxrhbNefkkRA4Hk37mGUgIcw T1E1ON8AaSKCZ14x0Jlltm5ZyRlu2anrzlizqX/RD+itPViw4Yewuag6D w==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="338499173" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="338499173" 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 Message-ID-Hash: X657V5XNUOZVA3HDBZR5GOG5C2TQBOLH X-Message-ID-Hash: X657V5XNUOZVA3HDBZR5GOG5C2TQBOLH 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 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: = > +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; > +}