Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp574686iog; Thu, 30 Jun 2022 06:22:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sCQODkQnEGF+VONLBYW6w9Vt+knDcuohR/c5KkDRrEl8ZMxuAgcmTNRjotRA7uTkZY80Fk X-Received: by 2002:a17:907:980a:b0:722:f4a7:e00 with SMTP id ji10-20020a170907980a00b00722f4a70e00mr8966671ejc.114.1656595358297; Thu, 30 Jun 2022 06:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656595358; cv=none; d=google.com; s=arc-20160816; b=HkhJHzNyCWOiJqb8xBBEuySWG/aFcLxrlOlpUQNPUlsSQXksLVI+0IGWrxfrKe6vG2 i+q4kka2gMvZjR1V36RVhTL+27YmeNRY5GNHh+8CCxCE1pb1l2hNfwaTzA8ZTLvprYFX IV+ZNAAxOo/z93aLTsYMhvFvs72MBvxbjDwS9NnH6msIJd0SICa4R+ktWWjhPcLfWGPO BzDwg4FjVFZJoVIQ7FJkdR7vfHrYx2ouc9M53m9lOcrgaDWCxDZaDkS8azpo8c2D2yxG 2A6lSXCqOUasYKuq7Jyoh6xnrXP7Y4D7EugN0SLfarPC/1yQQfECO9QeNVzF7NwquUTA VaUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Nh7MOeHqpu+KJjz+AQfMOAMAr6taCyP+a8n4nKC3Ilk=; b=uwR8cGgiPToQYJxXbnULdaAsNcjRAM/NxWgRYySXM7kfwf8geD7uE8jnwtp4vcoDsF s0jbQaZKQ3bThlwfCUTPU748QllEoWXtrbUCJJd7QT8JM0m8ZQcuAcsW6xUONizIJrAM KhKCGJmdEbJO5brsJQ+RZU8dpG4MuNdVLTEDRj116e7vSDpkVtMDIy6Ao/tTItrQp0N7 y2Rvro52b6B2qy2i8VukzeyWgbyF+omVnivwo2L1X7P7GaDFRx62cPJ81H7g/d9huT1z pa2EKCD4/TXlKxGVJpVT9xuUNOK//7SAa3HX5CSspLeLoKzdQOTYKQsNl6Fhfo7p9Rfd Sf8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=it46n3LR; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020aa7ce8b000000b00435817432fesi21837275edv.308.2022.06.30.06.22.11; Thu, 30 Jun 2022 06:22:38 -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=@linaro.org header.s=google header.b=it46n3LR; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234515AbiF3NAe (ORCPT + 99 others); Thu, 30 Jun 2022 09:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234766AbiF3NAb (ORCPT ); Thu, 30 Jun 2022 09:00:31 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6B540E72 for ; Thu, 30 Jun 2022 06:00:28 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id v193-20020a1cacca000000b003a051f41541so1638371wme.5 for ; Thu, 30 Jun 2022 06:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Nh7MOeHqpu+KJjz+AQfMOAMAr6taCyP+a8n4nKC3Ilk=; b=it46n3LRqtbFUNmtsO5pMTfu8XVzRaw4AkZn64FfFqiNM1TD6/fI7WCexAZ0kter1B 8V8OaDXmnLHFEVjmxaS1FdoZ/0Pf84G9bzIqI4QqQjedMkhnBmQBdU+PwdgSJrtv6ILa YojZAZPCS0q0Vzyef/v9d8v/StEujzRRvmdoxuC2JuWaNkyDRB8bjFaK+5U8690VKtQr A+dV+PdyNl/h0Za7ayvfNFEkp5xg/LIVabnTWn9hG40wAoh2NyJdEByXSjWVz2jTA68x 5s7wTsAYHACQpXHMeszYGlsMUuVIWWWm/MTFVxmXg0L7vTMs+K/LI3Fcoc+RyBlDDobT xHLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Nh7MOeHqpu+KJjz+AQfMOAMAr6taCyP+a8n4nKC3Ilk=; b=ol1ERA+3iimzRr9KJP/wgT6IDpXHHVcfMJsSmjxES2zOOb2tJB42xOOWhII8nf69Ls KQmEC6KGkAA5vYO+gCibZINw5xOm4Idih6DBbBK6kSF/Ob2NO6hrbXgd13diZaGgAn8k 8c6MYFUBdm0zj1fLAdJ0EBnoOpIjX+5Dk7WFCoSlzWUySjjuk/9mbxge4RJK6aN7V3l3 ZMSWu069/5KSdRQX4UnWC0jH7Wr2WArMV2yV2HvVK0FEz3LuL8O7atZPaBx0nfoj7ylO nVrokiDVk7GfOzgb4aqWebO72Yx8MG3RV/mAQKH/JnKt9Yjvwps0h1lyx5WZZoW8e4yd 6jvA== X-Gm-Message-State: AJIora8BKqG5VXrssWJ/TLmJufId54nDtIfTDDGLzqEJ4OLFnHpSjHPJ 63emIVNoOIUM7ipZDhKJ7cvvVQ== X-Received: by 2002:a05:600c:27d1:b0:3a1:7e0c:56bf with SMTP id l17-20020a05600c27d100b003a17e0c56bfmr3784642wmb.186.1656594026688; Thu, 30 Jun 2022 06:00:26 -0700 (PDT) Received: from srini-hackbase.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id o4-20020a5d6484000000b0020d02262664sm19273608wri.25.2022.06.30.06.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 06:00:25 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Pierre-Louis Bossart Subject: [PATCH 1/2] ASoC: codecs: wsa881x: handle timeouts in resume path Date: Thu, 30 Jun 2022 14:00:22 +0100 Message-Id: <20220630130023.9308-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 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 --- 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); -- 2.25.1