lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7161a222-8e88-704b-0a3e-a468a2639e4f@linux.intel.com>
Date:   Wed, 13 Nov 2019 10:39:53 -0600
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     Ravulapati Vishnu vardhan rao 
        <Vishnuvardhanrao.Ravulapati@....com>
Cc:     "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." 
        <alsa-devel@...a-project.org>,
        Maruthi Bayyavarapu <maruthi.bayyavarapu@....com>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        open list <linux-kernel@...r.kernel.org>,
        Takashi Iwai <tiwai@...e.com>,
        YueHaibing <yuehaibing@...wei.com>,
        Liam Girdwood <lgirdwood@...il.com>, Akshu.Agrawal@....com,
        Sanju R Mehta <sanju.mehta@....com>,
        Mark Brown <broonie@...nel.org>, djkurtz@...gle.com,
        Vijendar Mukunda <Vijendar.Mukunda@....com>,
        Alexander.Deucher@....com,
        Colin Ian King <colin.king@...onical.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [alsa-devel] [RESEND PATCH v5 6/6] ASoC: amd: Added ACP3x system
 resume and runtime pm


> diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h
> index 01b283a..c40f960 100644
> --- a/sound/soc/amd/raven/acp3x.h
> +++ b/sound/soc/amd/raven/acp3x.h
> @@ -7,6 +7,7 @@
>   
>   #include "chip_offset_byte.h"
>   
> +#define DELAY	600

you probably want a prefix here to avoid conflicts


> +static int acp3x_power_on(void __iomem *acp3x_base)
> +{
> +	u32 val;
> +	u32 timeout = 0;
> +	int ret = 0;
> +
> +	val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> +
> +	if (val == 0)
> +		return val;
> +
> +	if (!((val & ACP_PGFSM_STATUS_MASK) ==
> +				ACP_POWER_ON_IN_PROGRESS))
> +		rv_writel(ACP_PGFSM_CNTL_POWER_ON_MASK,
> +			acp3x_base + mmACP_PGFSM_CONTROL);
> +	while (++timeout < DELAY) {

so here timeout can reach 600.

> +		val  = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> +		if (!val)
> +			break;
> +		udelay(1);
> +		if (timeout > 500) {

but here you abort at 500.
Looks like the first test is not needed?

> +			pr_err("ACP is Not Powered ON\n");
> +			return -ETIMEDOUT;
> +		}
> +	}
> +}
> +static int acp3x_power_off(void __iomem *acp3x_base)
> +{
> +	u32 val;
> +	u32 timeout = 0;
> +
> +	rv_writel(ACP_PGFSM_CNTL_POWER_OFF_MASK,
> +			acp3x_base + mmACP_PGFSM_CONTROL);
> +	while (++timeout < DELAY) {

same here

> +		val  = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> +		if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_OFF)
> +			return 0;
> +		udelay(1);
> +		if (timeout > 500) {
> +			pr_err("ACP is Not Powered OFF\n");
> +			return -ETIMEDOUT;
> +		}
> +	}
> +}
> +static int acp3x_reset(void __iomem *acp3x_base)
> +{
> +	u32 val, timeout;
> +
> +	rv_writel(1, acp3x_base + mmACP_SOFT_RESET);
> +	timeout = 0;
> +	while (++timeout < DELAY) {
> +		val = rv_readl(acp3x_base + mmACP_SOFT_RESET);
> +		if ((val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) ||
> +							timeout > 100) {

and here

> +			if (val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK)
> +				break;
> +			return -ENODEV;
> +		}
> +		cpu_relax();
> +	}
> +	rv_writel(0, acp3x_base + mmACP_SOFT_RESET);
> +	timeout = 0;
> +	while (++timeout < DELAY) {
> +		val = rv_readl(acp3x_base + mmACP_SOFT_RESET);
> +		if (!val)
> +			break;
> +		if (timeout > 100)

and here.


> @@ -133,9 +248,19 @@ static int snd_acp3x_probe(struct pci_dev *pci,
>   		ret = -ENODEV;
>   		goto unmap_mmio;
>   	}
> +	pm_runtime_set_autosuspend_delay(&pci->dev, 10000);

I think it's the largest value I've ever seen for autosuspend.
It is necessary? If yes you should document why.

> +	pm_runtime_use_autosuspend(&pci->dev);
> +	pm_runtime_set_active(&pci->dev);
> +	pm_runtime_put_noidle(&pci->dev);
> +	pm_runtime_enable(&pci->dev);
>   	return 0;
>   
>   unmap_mmio:
> +	ret = acp3x_deinit(adata->acp3x_base);
> +	if (ret)
> +		dev_err(&pci->dev, "ACP de-init failed\n");
> +	else
> +		dev_info(&pci->dev, "ACP de-initialized\n");

dev_dbg?

>   	pci_disable_msi(pci);
>   	for (i = 0 ; i < ACP3x_DEVS ; i++)
>   		platform_device_unregister(adata->pdev[i]);
> @@ -148,23 +273,57 @@ static int snd_acp3x_probe(struct pci_dev *pci,
>   
>   	return ret;
>   }
> +static int  snd_acp3x_suspend(struct device *dev)
> +{
> +	int status;
> +	struct acp3x_dev_data *adata = dev_get_drvdata(dev);
> +
> +	status = acp3x_deinit(adata->acp3x_base);
> +	if (status)
> +		dev_err(dev, "ACP de-init failed\n");
> +	else
> +		dev_info(dev, "ACP de-initialized\n");

dev_dbg?


>   static void snd_acp3x_remove(struct pci_dev *pci)
>   {
> -	int i;
> +	int i, ret;
>   	struct acp3x_dev_data *adata = pci_get_drvdata(pci);
>   
>   	if (adata->acp3x_audio_mode == ACP3x_I2S_MODE) {
>   		for (i = 0 ; i <  ACP3x_DEVS ; i++)
>   			platform_device_unregister(adata->pdev[i]);
>   	}
> +	ret = acp3x_deinit(adata->acp3x_base);
> +	if (ret)
> +		dev_err(&pci->dev, "ACP de-init failed\n");
> +	else
> +		dev_info(&pci->dev, "ACP de-initialized\n");

dev_dbg?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ