Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp666999iog; Thu, 30 Jun 2022 08:01:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vtz/xo+P12p35uruSkCK38CsY3z9DZmFfF8BOPoSkxKA/cNPUHmHVmJE1UoMFQNmkz0zbp X-Received: by 2002:a63:2483:0:b0:40d:7d66:a86e with SMTP id k125-20020a632483000000b0040d7d66a86emr7889152pgk.161.1656601287759; Thu, 30 Jun 2022 08:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656601287; cv=none; d=google.com; s=arc-20160816; b=lvHXZm6CpbkgDYyzgpXxqgjkzGYxMFO4uV80ldnGjbaD+hRk4/f05vdI/Ky054+Baj haZoeeuOgYuRJzTliU3Jt0T0Se8GuydgAlqpxmsnlb5lNFDjRwN3fGx7puT/YhJgzKbe 2e5NUAWWWHhlf1a/39ubGsmf9H3di4BwWGiWazJfUEIIVj5lqMfpj+tbV7UIuqxUVMya xnkw5eomhsJIRaRgOJW6WB2j6rAKQeibVgx4KxwPZkwk/sUBMLgNgbZJDInSeplyfEW1 MCUtGGKEciu8k0kfht6efmlhWnGkP8tA1KRdZ/BKYzSXK6lxA4f4/8E9eAQxFHqA9U5r 6CLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=yvb7MIjviGtB6Egm2KBl1T+LJk4BVN0kSepujZS/qd8=; b=jBECCKhv1kJAJOXaIKgzL63MuXgA2SaiF5dMUtt3Tcxm8H4xveo5gHe3mYDAOcaQNQ yimrgIFUDl8AWWmMxQlepgnSK5gRc995n5/oY06qbX1hrhhB0aTRnP4YUfuFFEukgeAm sIVv13AEkkVxYCM5aOKLThn/lAkkTJiShFemHiKnSQ+P5rw3U9E+aeAzL+OHlbN9TDTp 3Y4WISF4rku9x/rYiGgHVma4AS+wTA3sHNKAsYWNJDKMNQ9t4GSKVUvfSTswOoOzYmAV ZxTRnXvvgsgj9aDLvTApREqU24KgVmOD0+wf5VkxtkrwvH/s6bRTOViKH7rQhD5JFKeB aNtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PtLUVumo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b129-20020a633487000000b003c5e4be54bbsi23880764pga.240.2022.06.30.08.01.08; Thu, 30 Jun 2022 08:01:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PtLUVumo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235292AbiF3Nrw (ORCPT + 99 others); Thu, 30 Jun 2022 09:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235190AbiF3Nrj (ORCPT ); Thu, 30 Jun 2022 09:47:39 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C4572A409 for ; Thu, 30 Jun 2022 06:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656596858; x=1688132858; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=K6USsSMJ8UC9wOjFtx6U82V6WBAGj2etKO7gooeB8dw=; b=PtLUVumoLHtR+weM0Chw9BQYM3MlKI0eSaivfxUvvRbJMoiiLtb1NzW9 gmOEStNkAPkzPywbZy+mvT5o6r2gWduE6r19nSmjHYLN14hHz9w8v+LNO o1wylTH4H+Q7S6F/WNIlve8QQVFOvHa/U46fkF1pHku3EhRTwSLwyHgWd D4V7kro3xyuaNEu9Kl41BnwI200EMU5gGxxCHyOvjFrjbg7QrsJs0chux Qc5ZUfjp4s+qUx05KcBgjho/f12tBOrGxYXiuvP3L8KxMHnXde6WT6At9 xWj0ucVd7aoY7mvIeNghC51omSjAutQFs//kGrTfQO9OrqKW6PzgOGpAb w==; X-IronPort-AV: E=McAfee;i="6400,9594,10393"; a="307859082" X-IronPort-AV: E=Sophos;i="5.92,234,1650956400"; d="scan'208";a="307859082" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 06:47:37 -0700 X-IronPort-AV: E=Sophos;i="5.92,234,1650956400"; d="scan'208";a="617980754" Received: from jhilliar-mobl.amr.corp.intel.com (HELO [10.212.10.157]) ([10.212.10.157]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 06:47:36 -0700 Message-ID: Date: Thu, 30 Jun 2022 08:09:39 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.10.0 Subject: Re: [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path Content-Language: en-US To: Srinivas Kandagatla , broonie@kernel.org Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org References: <20220630130023.9308-1-srinivas.kandagatla@linaro.org> From: Pierre-Louis Bossart In-Reply-To: <20220630130023.9308-1-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/30/22 08:00, Srinivas Kandagatla wrote: > Currently we do not check if SoundWire slave initialization timeout > expired before continuing to access its registers. > > Its possible that the registers are not accessible if timeout is > expired. Handle this by returning timeout in resume path. > > Reported-by: Pierre-Louis Bossart > Fixes: 8dd552458361 ("ASoC: codecs: wsa881x: add runtime pm support") > Signed-off-by: Srinivas Kandagatla For the two patches Reviewed-by: Pierre-Louis Bossart > --- > sound/soc/codecs/wsa881x.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c > index dc954b85a988..6c8b1db649b8 100644 > --- a/sound/soc/codecs/wsa881x.c > +++ b/sound/soc/codecs/wsa881x.c > @@ -1173,11 +1173,17 @@ static int __maybe_unused wsa881x_runtime_resume(struct device *dev) > struct sdw_slave *slave = dev_to_sdw_dev(dev); > struct regmap *regmap = dev_get_regmap(dev, NULL); > struct wsa881x_priv *wsa881x = dev_get_drvdata(dev); > + unsigned long time; > > gpiod_direction_output(wsa881x->sd_n, 1); > > - wait_for_completion_timeout(&slave->initialization_complete, > - msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); > + time = wait_for_completion_timeout(&slave->initialization_complete, > + msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); > + if (!time) { > + dev_err(dev, "Initialization not complete, timed out\n"); > + gpiod_direction_output(wsa881x->sd_n, 0); > + return -ETIMEDOUT; > + } > > regcache_cache_only(regmap, false); > regcache_sync(regmap);