public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Vijendar Mukunda <Vijendar.Mukunda@amd.com>, 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 <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Syed Saba Kareem <Syed.SabaKareem@amd.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V4 1/9] ASoC: amd: ps: create platform devices based on acp config
Date: Mon, 12 Jun 2023 13:09:26 -0500	[thread overview]
Message-ID: <5899c2b8-e984-fda9-5e12-190b0c9fd3b2@linux.intel.com> (raw)
In-Reply-To: <20230612095903.2113464-2-Vijendar.Mukunda@amd.com>

=
> +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;
> +}


  reply	other threads:[~2023-06-12 19:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230612095903.2113464-1-Vijendar.Mukunda@amd.com>
2023-06-12  9:58 ` [PATCH V4 1/9] ASoC: amd: ps: create platform devices based on acp config Vijendar Mukunda
2023-06-12 18:09   ` Pierre-Louis Bossart [this message]
2023-06-13  5:42     ` Mukunda,Vijendar
2023-06-15 16:23       ` Pierre-Louis Bossart
2023-06-12  9:58 ` [PATCH V4 2/9] ASoC: amd: ps: handle SoundWire interrupts in acp pci driver Vijendar Mukunda
2023-06-12  9:58 ` [PATCH V4 3/9] ASoC: amd: ps: add SoundWire dma driver Vijendar Mukunda
2023-06-12  9:58 ` [PATCH V4 4/9] ASoC: amd: ps: add SoundWire dma driver dma ops Vijendar Mukunda
2023-06-12 18:06   ` Pierre-Louis Bossart
2023-06-13  7:00     ` Mukunda,Vijendar
2023-06-15 15:50       ` Mukunda,Vijendar
2023-06-15 15:56         ` Mark Brown
2023-06-15 16:09           ` Mukunda,Vijendar
2023-06-15 16:12         ` Mukunda,Vijendar
2023-06-15 16:21       ` Pierre-Louis Bossart
2023-06-15 17:13         ` Mukunda,Vijendar
2023-06-12  9:58 ` [PATCH V4 5/9] ASoC: amd: ps: add support for SoundWire DMA interrupts Vijendar Mukunda
2023-06-12  9:59 ` [PATCH V4 6/9] ASoC: amd: ps: add pm ops support for SoundWire dma driver Vijendar Mukunda
2023-06-12  9:59 ` [PATCH V4 7/9] ASoC: amd: ps: enable SoundWire dma driver build Vijendar Mukunda
2023-06-12  9:59 ` [PATCH V4 8/9] ASoC: amd: update comments in Kconfig file Vijendar Mukunda
2023-06-12  9:59 ` [PATCH V4 9/9] ASoC: amd: ps: add acp_reset flag check in acp pci driver pm ops Vijendar Mukunda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5899c2b8-e984-fda9-5e12-190b0c9fd3b2@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=Arungopal.kondaveeti@amd.com \
    --cc=Basavaraj.Hiregoudar@amd.com \
    --cc=Mastan.Katragadda@amd.com \
    --cc=Sunil-kumar.Dommati@amd.com \
    --cc=Syed.SabaKareem@amd.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox