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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52F01C433EF for ; Wed, 20 Apr 2022 18:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381395AbiDTSC5 (ORCPT ); Wed, 20 Apr 2022 14:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381459AbiDTSCh (ORCPT ); Wed, 20 Apr 2022 14:02:37 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B15BED for ; Wed, 20 Apr 2022 10:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650477590; x=1682013590; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=ZPYh6ii3d6sit1IsGVPNN+fvydkX/ToCt0Ocqq0aUxE=; b=Xv+wy1P94wmB670kpEO70Am6mGM5aUl/wiAhOr0O8trgMs5v7Yiora6D p+O0ESMHuL2r7eqSROoe4JG8goXqhy5NyK91oRYGgJh6jQ3WsH3UcQb/D 3SMYRr0Ay0LyhHCWbRDQgtEqrDmF5z1/Cq7MbTZrquCFOhgRUnlPrPD4E 4wvceK9e4p4UafhY4ourdUaiKNt2oltuRKAnDwbY5lGmJqtqe9cKFl6ZR plGqe8R/UCeUu3UwopqtfazFWf4A4PwFNVeOlmOtBG2dVsY94IbTADHKx s4rBOxIl698q2Bhdz3pcdOjdPKFnF9P/oX4PmrogOd1N4ZJg4ccHLlM02 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="327013175" X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="327013175" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 10:59:47 -0700 X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="576721826" Received: from sbidasar-mobl.amr.corp.intel.com (HELO [10.209.100.171]) ([10.209.100.171]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 10:59:46 -0700 Message-ID: Date: Wed, 20 Apr 2022 12:59:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.5.0 Subject: Re: [PATCH v4] ASoC: codecs: wsa881x: add runtime pm support Content-Language: en-US To: Srinivas Kandagatla , 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: Pierre-Louis Bossart In-Reply-To: <20220228144235.24208-1-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > + > + regcache_cache_only(regmap, false); > + regcache_sync(regmap); > + > + return 0; > +} 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 79D66C433EF for ; Wed, 20 Apr 2022 18:01:24 +0000 (UTC) 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 492801B1C; Wed, 20 Apr 2022 20:00:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 492801B1C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1650477682; bh=ZPYh6ii3d6sit1IsGVPNN+fvydkX/ToCt0Ocqq0aUxE=; h=Date:Subject:To:References:From:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lVuzAV9Wsq2Y3HHtXCa44YAQCM42ee/tT30iSIVg9bG6qEygzaTC1o7Iz2+CpNyA7 p8syGlB0T/9GfGt42fgFR36AFcxerxaMIphJPAiBP6S+GysslP1/9Q2H3OPn60tm2b riP91dC9XZYMeEOAQ0yF9Aq55DHJf9IP1o5JdlvY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6F703F80254; Wed, 20 Apr 2022 20:00:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE286F80125; Wed, 20 Apr 2022 19:59:57 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 5219EF800F8 for ; Wed, 20 Apr 2022 19:59:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5219EF800F8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XD5oBf0x" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650477595; x=1682013595; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=ZPYh6ii3d6sit1IsGVPNN+fvydkX/ToCt0Ocqq0aUxE=; b=XD5oBf0xZ9XXmOCU9nP9jXb1axyt/Vk/o/1pEKFS4kOQfthsitejE4EM MhkahgoZlJCwGhjQHG9SfqqrKI+dYWiau8FwbgA7vfGAidC8Wr3BlzY1X pyHbp/JByNzgUKOqfysaViqf+SklWeHvj67NFDB5VHlB+9uAb69zrbgbs P8EP3t1rhe34fHV74HiyHUJMUiibfjrdTyNJbYWOgbLCZCiML6lv/0IkX xnhFAhHvy9UzYF7FEthDmcT4r3QT9jG4bKQwTcsAu9VB2TpD9DXXHGIgJ zxZJ14JLBFmOtbrGXL9BGjvFF74KtJ3UI657g9SvO9F5IOo7yqJ+K0ZBf w==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="263875246" X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="263875246" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 10:59:47 -0700 X-IronPort-AV: E=Sophos;i="5.90,276,1643702400"; d="scan'208";a="576721826" Received: from sbidasar-mobl.amr.corp.intel.com (HELO [10.209.100.171]) ([10.209.100.171]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2022 10:59:46 -0700 Message-ID: Date: Wed, 20 Apr 2022 12:59:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.5.0 Subject: Re: [PATCH v4] ASoC: codecs: wsa881x: add runtime pm support Content-Language: en-US To: Srinivas Kandagatla , broonie@kernel.org References: <20220228144235.24208-1-srinivas.kandagatla@linaro.org> From: Pierre-Louis Bossart In-Reply-To: <20220228144235.24208-1-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com, quic_srivasam@quicinc.com, linux-kernel@vger.kernel.org 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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? > + > + regcache_cache_only(regmap, false); > + regcache_sync(regmap); > + > + return 0; > +}