[alsa-devel] [PATCH 5/5] ASoC: amd: ACP powergating should be done by controller
Dan Carpenter
dan.carpenter at oracle.com
Thu Sep 26 14:55:38 CEST 2019
On Fri, Sep 27, 2019 at 04:37:39AM +0530, Ravulapati Vishnu vardhan rao wrote:
> +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) {
Flip this around.
if (!val)
return 0;
> + if (!((val & ACP_PGFSM_STATUS_MASK) ==
> + ACP_POWER_ON_IN_PROGRESS))
Use != insead of !(foo == bar).
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 (true) {
> + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
> + if (!val)
> + break;
return 0;
> + udelay(1);
> + if (timeout > 500) {
if (timeout++ > 500) {
> + pr_err("ACP is Not Powered ON\n");
We print two error messages. :/
> + ret = -ETIMEDOUT;
return -ETIMOUT;
> + break;
> + }
> + timeout++;
> + }
> + if (ret) {
> + pr_err("ACP is not powered on status:%d\n", ret);
> + return ret;
> + }
> + }
> + return ret;
> +}
regards,
dan carpenter
More information about the Alsa-devel
mailing list