mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: broonie@kernel.org, alsa-devel@alsa-project.org
Cc: Basavaraj.Hiregoudar@amd.com, Sunil-kumar.Dommati@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 V2 1/4] ASoC: amd: ps: implement api to retrieve acp device config
Date: Wed, 21 Dec 2022 18:00:48 +0530	[thread overview]
Message-ID: <191928a9-ef60-e274-6678-963b187752ec@amd.com> (raw)
In-Reply-To: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com>

On 21/12/22 16:56, Vijendar Mukunda wrote:
> Implement API to retrieve acp device config and calculate platform
> device count and dev mask for platform device node creation.
>
> Currently for DMIC configuration, mask and dev count are calculated.
> Same api will be used to extend support for different ACP device
> configurations.

By mistake, patch series was sent as V2 instead of V1.
>
> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
> ---
> v1->v2:
>     - used ACP_DMIC_DEV macro instead of hard coded value
>     - changed is_dmic_dev variable initialization
>     - changed debug level
>
>  sound/soc/amd/ps/acp63.h  |  7 +++++++
>  sound/soc/amd/ps/pci-ps.c | 37 +++++++++++++++++++++++++++++++++++--
>  2 files changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h
> index 5e7f9c1c1b0e..b015e845e5fa 100644
> --- a/sound/soc/amd/ps/acp63.h
> +++ b/sound/soc/amd/ps/acp63.h
> @@ -54,6 +54,11 @@
>  /* time in ms for runtime suspend delay */
>  #define ACP_SUSPEND_DELAY_MS	2000
>  
> +#define ACP63_DMIC_ADDR		2
> +#define ACP63_PDM_MODE_DEVS		3
> +#define ACP63_PDM_DEV_MASK		1
> +#define ACP_DMIC_DEV	2
> +
>  enum acp_config {
>  	ACP_CONFIG_0 = 0,
>  	ACP_CONFIG_1,
> @@ -102,4 +107,6 @@ struct acp63_dev_data {
>  	struct resource *res;
>  	bool acp63_audio_mode;
>  	struct platform_device *pdev[ACP63_DEVS];
> +	u16 pdev_mask;
> +	u16 pdev_count;
>  };
> diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
> index 489f01a20699..9066a625e501 100644
> --- a/sound/soc/amd/ps/pci-ps.c
> +++ b/sound/soc/amd/ps/pci-ps.c
> @@ -132,6 +132,38 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id)
>  	return IRQ_NONE;
>  }
>  
> +void get_acp63_device_config(u32 config, struct pci_dev *pci, struct acp63_dev_data *acp_data)
> +{
> +	struct acpi_device *dmic_dev;
> +	const union acpi_object *obj;
> +	bool is_dmic_dev = false;
> +
> +	dmic_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
> +	if (dmic_dev) {
> +		if (!acpi_dev_get_property(dmic_dev, "acp-audio-device-type",
> +					   ACPI_TYPE_INTEGER, &obj) &&
> +					   obj->integer.value == ACP_DMIC_DEV)
> +			is_dmic_dev = true;
> +	}
> +
> +	switch (config) {
> +	case ACP_CONFIG_0:
> +	case ACP_CONFIG_1:
> +	case ACP_CONFIG_2:
> +	case ACP_CONFIG_3:
> +	case ACP_CONFIG_9:
> +	case ACP_CONFIG_15:
> +		dev_dbg(&pci->dev, "Audio Mode %d\n", config);
> +		break;
> +	default:
> +		if (is_dmic_dev) {
> +			acp_data->pdev_mask = ACP63_PDM_DEV_MASK;
> +			acp_data->pdev_count = ACP63_PDM_MODE_DEVS;
> +		}
> +		break;
> +	}
> +}
> +
>  static int snd_acp63_probe(struct pci_dev *pci,
>  			   const struct pci_device_id *pci_id)
>  {
> @@ -183,6 +215,7 @@ static int snd_acp63_probe(struct pci_dev *pci,
>  	if (ret)
>  		goto release_regions;
>  	val = acp63_readl(adata->acp63_base + ACP_PIN_CONFIG);
> +	get_acp63_device_config(val, pci, adata);
>  	switch (val) {
>  	case ACP_CONFIG_0:
>  	case ACP_CONFIG_1:
> @@ -195,14 +228,14 @@ static int snd_acp63_probe(struct pci_dev *pci,
>  	default:
>  
>  		/* Checking DMIC hardware*/
> -		adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), 0x02, 0);
> +		adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP_DMIC_ADDR, 0);
>  
>  		if (!adev)
>  			break;
>  
>  		if (!acpi_dev_get_property(adev, "acp-audio-device-type",
>  					   ACPI_TYPE_INTEGER, &obj) &&
> -					   obj->integer.value == 2) {
> +					   obj->integer.value == ACP_DMIC_DEV) {
>  			adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL);
>  			if (!adata->res) {
>  				ret = -ENOMEM;


  parent reply	other threads:[~2022-12-21 12:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 11:26 Vijendar Mukunda
2022-12-21 11:26 ` [PATCH v2 2/4] ASoC: amd: ps: refactor platform device creation logic Vijendar Mukunda
2022-12-21 11:26 ` [PATCH v2 3/4] ASoC: amd: ps: update dev index value in irq handler Vijendar Mukunda
2022-12-21 11:26 ` [PATCH v2 4/4] ASoC: amd: ps: move irq handler registration Vijendar Mukunda
2022-12-21 12:30 ` Mukunda,Vijendar [this message]
2022-12-21 16:40 ` [PATCH V2 1/4] ASoC: amd: ps: implement api to retrieve acp device config kernel test robot
2022-12-21 16:55   ` Mukunda,Vijendar
2022-12-21 17:40 ` kernel test robot
2022-12-21 19:45   ` Mukunda,Vijendar
2022-12-21 17:28 Vijendar Mukunda
2022-12-27 11:57 ` Mark Brown

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=191928a9-ef60-e274-6678-963b187752ec@amd.com \
    --to=vijendar.mukunda@amd.com \
    --cc=Basavaraj.Hiregoudar@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Sunil-kumar.Dommati@amd.com \
    --cc=Syed.SabaKareem@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®