Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp804024pxb; Fri, 22 Apr 2022 11:29:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8lcV+m1gA+Ovauq0yMsEAVSO4R8wByJ/DfXz1fxBjUhNWljpHQrC1Ehx12Xbo4cp/KAhq X-Received: by 2002:a05:6a00:228c:b0:50c:6a9a:a325 with SMTP id f12-20020a056a00228c00b0050c6a9aa325mr6042275pfe.79.1650652158342; Fri, 22 Apr 2022 11:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650652158; cv=none; d=google.com; s=arc-20160816; b=ScQADX5tMcYJLgEyZadbjBtQVGgvQhxcruStS4gdyLQtmhl12XJ2oWYx3sYEs+PIEv Zq6OtqvvV68ChBvcWgWWF2ftT350W0i7NH2C/2GA6ULLPRdmWRfsQiDrSOE9vs4Kdbyo i8/4T9ePOLbm+BUvhmMmvBC5v2frtKOd16Eu7b7a21hUX9VLqSLtyqG3log+ZP07yiPE C47w6Jz2a290wMM2jG2lJ9+ngCVxo9AxJevAY7igT3Vpr3vAn0H0cEWi0Gx3iq24Fcfb /+oGtRNX2Ti24ocyglcnrAYNnPjM88DZUFV6eMhIbc6ENqAfF+xupCxs6WYSscBftlcV 9Fnw== 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=NpVbGkWT0mxI2z+QAaSeB8XReImeuL8/00d31gyn1MM=; b=nWdDRMAOiqUO65yOHRbXlp0b9nWFk614heE92+rnft7RRUjBXis8W98rEjPAb4zAJX nq1YHDyoiowpKrnHMuCymoYVVhgem1HNdWiTicvZ2e78sp8AG8j8bvgm9o03IpoO8Zd+ 5ey3iYyGsmgvnH8z5vCYKxTl23PuYmkOEpcNvr3ll1YZSTpdAlJIa/3MfjcrSyo/UJZS BCDEZik4beytoxVmPHtslC5/n3kQBwx3wAm61c05L2/JibA8d3GRhtHOHBtwJJ5z2WCM gdwHTc+bPVILNLlFURK8/RFuZaubWbQaY1LppOiFGoZ85c+MlO2BtPOCAJJkgMciRe8E nVig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NY9XSGic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h2-20020a636c02000000b003aa6361c73csi8359335pgc.368.2022.04.22.11.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 11:29:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NY9XSGic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0294A14C3D0; Fri, 22 Apr 2022 10:58:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387675AbiDUJeW (ORCPT + 99 others); Thu, 21 Apr 2022 05:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387684AbiDUJeT (ORCPT ); Thu, 21 Apr 2022 05:34:19 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8427B1A80E for ; Thu, 21 Apr 2022 02:31:26 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso5441393wme.5 for ; Thu, 21 Apr 2022 02:31:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=NpVbGkWT0mxI2z+QAaSeB8XReImeuL8/00d31gyn1MM=; b=NY9XSGico1KIM7Fqq1EwGMyOn23m25iSrqopxZzF4wmajHZm5QZcwf++tU2uNOffNB UeVQd/I1bq4JozXtv6evYNUmcNwYfU/KfNtBG7MDWdWVG2JUYJIFJJHAM0H15lRuEZKa R9S3PYlmM9lI7sako+G/6+A4F4ltAbThft8OH+6SbmAVH38hR1PdfkQvBJOGJz5OSt1B oRx1boWIrxsw5sr7IU6KGuPsr1cOnaZuvL0KyAF8dmMrwqhEs803oPzeNQB8MlrYOMGT cbVboZi+ArEXiI1u2DpaENkXwf7cCecA0XbX8tQTiI38P52z3Gws4A5MFjd9jVeSaXlF HoEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=NpVbGkWT0mxI2z+QAaSeB8XReImeuL8/00d31gyn1MM=; b=msS3eNajVxsN+ZTtLGQJlULSlK+aMu6GonKLHhKGjJwJzh9PIuHHECj9bhj+PU/776 A+oLVKOW9Rpa3V/1SgZmMK4/kquvxE4ZFtLZAKwrF93dVjNU3m1LJvDSAmI2A3Zs2DE9 m9x+8qX4Bx4VhlOM79V1wmhLHl+gqo6WFqTuDzCC6CQfw8mdD2ew8mTz0BckWuOJnq3a kkU+UO1eMeU7vJ1xWU9jpLY3H6a6NqBTVIgF+G97WPs+l+ozlkOY+/3EuXoI4MEqYBQM WA2krxN3+rm+fvwX/gnbywQHjK27UhzR9r77Mbtm8TlJErBDfZy7Upx5W0M+Fl5jsLq1 Nvrg== X-Gm-Message-State: AOAM530qD8/W49575xRdsQaSJEJuIHbTMvaTPJviGTrPQsMGRgS/d8Ei b6teacHc9QvNbHyGmGDftr44aQ== X-Received: by 2002:a05:600c:a06:b0:392:a4f2:2097 with SMTP id z6-20020a05600c0a0600b00392a4f22097mr7718250wmp.97.1650533485120; Thu, 21 Apr 2022 02:31:25 -0700 (PDT) Received: from [192.168.86.34] (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.googlemail.com with ESMTPSA id v13-20020a5d4b0d000000b00207a8815063sm1795043wrq.2.2022.04.21.02.31.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Apr 2022 02:31:24 -0700 (PDT) Message-ID: <8a91822c-d68a-a2d8-6865-3985f2f85c0b@linaro.org> Date: Thu, 21 Apr 2022 10:31:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v4] ASoC: codecs: wsa881x: add runtime pm support Content-Language: en-US To: Pierre-Louis Bossart , broonie@kernel.org Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, tiwai@suse.com, quic_srivasam@quicinc.com References: <20220228144235.24208-1-srinivas.kandagatla@linaro.org> From: Srinivas Kandagatla In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 20/04/2022 18:59, Pierre-Louis Bossart wrote: > Hi Srini, > >> +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); >> + >> + gpiod_direction_output(wsa881x->sd_n, 1); >> + >> + wait_for_completion_timeout(&slave->initialization_complete, >> + msecs_to_jiffies(WSA881X_PROBE_TIMEOUT)); > > while I was revisiting pm_runtime support, I also saw that this codec driver is the only one that doesn't check for errors > > max98373-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt1308-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt1316-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt5682-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt5682.c: &slave->initialization_complete, > > rt700-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt711-sdca-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt711-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > rt715-sdw.c: time = wait_for_completion_timeout(&slave->initialization_complete, > > wsa881x.c: wait_for_completion_timeout(&slave->initialization_complete, > > > If the attachment fails for some reason, you probably want to avoid starting regmap syncs that will fail by construction, no? Thanks Pierre for auditing the calls. Yes syncs would fail on reg writes if initialization timeout. Do you already have fix patch to this or do you want me to send one? Am also trying to understand what is the expected behavior in the resume failure cases, should pm attempt to resume the codec after some time, if so returning -ETIMEOUT is the right error code? --srini > >> + >> + regcache_cache_only(regmap, false); >> + regcache_sync(regmap); >> + >> + return 0; >> +}