lkml.org 
[lkml]   [2019]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] ASoC: amd: ACP powergating should be done by controller
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

\
 
 \ /
  Last update: 2019-09-26 14:57    [W:0.087 / U:3.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site