From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 428ADC5DF60 for ; Thu, 7 Nov 2019 17:05:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 205082166E for ; Thu, 7 Nov 2019 17:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389834AbfKGRFd (ORCPT ); Thu, 7 Nov 2019 12:05:33 -0500 Received: from mga05.intel.com ([192.55.52.43]:48853 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389813AbfKGRFa (ORCPT ); Thu, 7 Nov 2019 12:05:30 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 09:05:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,278,1569308400"; d="scan'208";a="192880789" Received: from cjense2x-mobl1.amr.corp.intel.com (HELO [10.251.130.63]) ([10.251.130.63]) by orsmga007.jf.intel.com with ESMTP; 07 Nov 2019 09:05:28 -0800 Subject: Re: [alsa-devel] [PATCH v3 6/6] ASoC: amd: Added ACP3x system resume and runtime pm To: Ravulapati Vishnu vardhan rao Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Bayyavarapu , Kuninori Morimoto , open list , Takashi Iwai , YueHaibing , Liam Girdwood , Akshu.Agrawal@amd.com, Mark Brown , djkurtz@google.com, Vijendar Mukunda , Alex Deucher , Colin Ian King , Dan Carpenter References: <1573133093-28208-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> <1573133093-28208-7-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> From: Pierre-Louis Bossart Message-ID: Date: Thu, 7 Nov 2019 09:34:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <1573133093-28208-7-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +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 < 500) { > + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS); > + if (!val) > + break; > + udelay(1); > + if (timeout > 500) { your timeout cannot reach 500, isn't this dead code? > + 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 < 500) { > + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS); > + if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_OFF) > + return 0; > + udelay(1); > + if (timeout > 500) { same here, the timeout handling looks broken > + 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 < 100) { > + val = rv_readl(acp3x_base + mmACP_SOFT_RESET); > + if ((val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) || > + timeout > 100) { and here, how can timeout > 100 if the outer loops controls it. > + if (val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) > + break; > + return -ENODEV; > + } > + cpu_relax(); > + } > + rv_writel(0, acp3x_base + mmACP_SOFT_RESET); > + timeout = 0; > + while (++timeout < 100) { > + val = rv_readl(acp3x_base + mmACP_SOFT_RESET); > + if (!val) > + break; > + if (timeout > 100) same here > +static int snd_acp3x_suspend(struct device *dev) extra spaces? > +{ > + 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"); > + > + return 0; > +} > +static int snd_acp3x_resume(struct device *dev) extra spaces? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2882C43331 for ; Thu, 7 Nov 2019 17:08:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41D5F206BA for ; Thu, 7 Nov 2019 17:08:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="DwHwJcg7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41D5F206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8C7781680; Thu, 7 Nov 2019 18:08:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8C7781680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1573146535; bh=V/vBVuvKP6Gqj7xVNf/zrf5p4GndokZVGgLJ9r/coTA=; h=To:References:From:Date:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DwHwJcg7Ve1GyK3CvJ4EM1DG9BNeo15AVsz/8EHA4xffuJBdJyaz+5gTAMyKlPkJl jqn4KWkHFsg1ziWmZeM6DpGpnsbTjXVxXQNldcLmCSOfxCxEG/I9vBsMKOXBdUi/om g2GSuO2qPuyiRLzLDqEymRBs3TZxRZSGjThvmSYY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 93437F80635; Thu, 7 Nov 2019 18:05:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8EE3DF805FF; Thu, 7 Nov 2019 18:05:35 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7232EF80291 for ; Thu, 7 Nov 2019 18:05:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7232EF80291 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 09:05:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,278,1569308400"; d="scan'208";a="192880789" Received: from cjense2x-mobl1.amr.corp.intel.com (HELO [10.251.130.63]) ([10.251.130.63]) by orsmga007.jf.intel.com with ESMTP; 07 Nov 2019 09:05:28 -0800 To: Ravulapati Vishnu vardhan rao References: <1573133093-28208-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> <1573133093-28208-7-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> From: Pierre-Louis Bossart Message-ID: Date: Thu, 7 Nov 2019 09:34:28 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <1573133093-28208-7-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> Content-Language: en-US Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Bayyavarapu , Kuninori Morimoto , Liam Girdwood , YueHaibing , open list , Takashi Iwai , Mark Brown , djkurtz@google.com, Vijendar Mukunda , Alex Deucher , Colin Ian King , Akshu.Agrawal@amd.com, Dan Carpenter Subject: Re: [alsa-devel] [PATCH v3 6/6] ASoC: amd: Added ACP3x system resume and runtime pm X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" > +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 < 500) { > + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS); > + if (!val) > + break; > + udelay(1); > + if (timeout > 500) { your timeout cannot reach 500, isn't this dead code? > + 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 < 500) { > + val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS); > + if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_OFF) > + return 0; > + udelay(1); > + if (timeout > 500) { same here, the timeout handling looks broken > + 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 < 100) { > + val = rv_readl(acp3x_base + mmACP_SOFT_RESET); > + if ((val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) || > + timeout > 100) { and here, how can timeout > 100 if the outer loops controls it. > + if (val & ACP3x_SOFT_RESET__SoftResetAudDone_MASK) > + break; > + return -ENODEV; > + } > + cpu_relax(); > + } > + rv_writel(0, acp3x_base + mmACP_SOFT_RESET); > + timeout = 0; > + while (++timeout < 100) { > + val = rv_readl(acp3x_base + mmACP_SOFT_RESET); > + if (!val) > + break; > + if (timeout > 100) same here > +static int snd_acp3x_suspend(struct device *dev) extra spaces? > +{ > + 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"); > + > + return 0; > +} > +static int snd_acp3x_resume(struct device *dev) extra spaces? _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel