From patchwork Mon Feb 21 13:10:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545299 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 185E9C433F5 for ; Mon, 21 Feb 2022 13:12:08 +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 2757916C8; Mon, 21 Feb 2022 14:11:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2757916C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449126; bh=LUjNgEauWdovrXpGXMhF/Hy02jEjywwCJ8JS3jPaM4Y=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qW1V3OeeEOoahLXwnLVJCDBFn0Z1Q5r2ATxBaMO9bz1ZjJUqGDg1lNDBO33jkj78B +F+usoBqQ3i9XEtd6uVxSNzA7qW482IBzg9E3+gnt5Wkg5YYRTQKKKHUbaClZ2Bq3a ixhyLtIz8+0lt75fslLLNSe5ljn8dICm6RqW64C4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 129E9F80139; Mon, 21 Feb 2022 14:10:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 06DBFF804AB; Mon, 21 Feb 2022 14:10:50 +0100 (CET) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 95310F80139 for ; Mon, 21 Feb 2022 14:10:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95310F80139 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LGamMUK0" Received: by mail-wr1-x433.google.com with SMTP id j22so923728wrb.13 for ; Mon, 21 Feb 2022 05:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CALk/6ca7iO7/xBqMHHMOaqmUFWsovsA/Kq66L5KIA8=; b=LGamMUK0B2xkMZwpcmUL37yW6Z3TUIr5n5SrtxOkaisKG1588ss/Yu5E3C/KXo3TnI MmRzj1y+mJeBasHZ/W8PcwubZM9uleE2/V0Jsv19j/FLzbdkkwzA7pShMI6wHQky4r35 2MZnwtat7HskNH3Z/KNyL/0sdhrH3mk9Xd2o75Ix5sbQISvXJ9oUFzb+0/J4dTtMVv3U OL2QixZibH0rWwZIwK4f1qMM4jCr0EKhxTpiN4AnSJQSIWeg5cYyDI/6kAS2abLHj/g8 PETLpTzdddsbeEGTn9GMinPoa/TeuwetOWA+F78ksyS2KJLXdpuYz+tKNaZnQZbLWKRU O0Cg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=CALk/6ca7iO7/xBqMHHMOaqmUFWsovsA/Kq66L5KIA8=; b=QhrfXOVVOrw/SWzOBUvzutYya33vZ9aqekMlmBao/nzMrVsXh2KyWd5/XBf5TIPWqU USgHPGlxi+s7KIJ4bCkWcMBh3YrQnpwoNO+Oh/5l1o4SSI1FQbsyYod0Y93Vat8iXf8p W6Tol7Shctov2YB+S9o+odLk1ktubHZYF42A4kJq7qMwwDArRhK07cBv/yIv8yrNrpEy Hk38XICfaZhkDr/pNaG3K5LLexHa/sHCZ5HdetOK1ghN3DzE5wKKrxMEUQ73mH4mWktF M9+m/c2psYMZKM+PDlcTFCaFtlacuNy65mr5DvJ7DpsLpuaU/LFXZcOf7YN53unhPy9e VaxA== X-Gm-Message-State: AOAM533QUjo6OuY54COf9Be0byFb81KurCkqMZjVD3DuyD9zP50fTknG qoCiOwqzZNIBhs+f8b11vGAFvg== X-Google-Smtp-Source: ABdhPJxqajVm7LxH5nEQV46AvjifUaSWOSb7GZHElKDVaAEoKDL3QMy5CpreSZ8ZutAb/8jHZlq6gQ== X-Received: by 2002:adf:e883:0:b0:1e4:b617:bc9d with SMTP id d3-20020adfe883000000b001e4b617bc9dmr15806525wrm.132.1645449041832; Mon, 21 Feb 2022 05:10:41 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:41 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 01/10] ASoC: codecs: va-macro: add runtime pm support Date: Mon, 21 Feb 2022 13:10:28 +0000 Message-Id: <20220221131037.8809-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" Add pm runtime support to VA Macro. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-va-macro.c | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c index e14c277e6a8b..0fd0139e8229 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1454,6 +1455,12 @@ static int va_macro_probe(struct platform_device *pdev) if (ret) goto err; + pm_runtime_set_autosuspend_delay(dev, 3000); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return ret; err: @@ -1471,6 +1478,34 @@ static int va_macro_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused va_macro_runtime_suspend(struct device *dev) +{ + struct va_macro *va = dev_get_drvdata(dev); + + regcache_cache_only(va->regmap, true); + regcache_mark_dirty(va->regmap); + + clk_disable_unprepare(va->clks[2].clk); + + return 0; +} + +static int __maybe_unused va_macro_runtime_resume(struct device *dev) +{ + struct va_macro *va = dev_get_drvdata(dev); + + clk_prepare_enable(va->clks[2].clk); + + regcache_cache_only(va->regmap, false); + regcache_sync(va->regmap); + return 0; +} + + +static const struct dev_pm_ops va_macro_pm_ops = { + SET_RUNTIME_PM_OPS(va_macro_runtime_suspend, va_macro_runtime_resume, NULL) +}; + static const struct of_device_id va_macro_dt_match[] = { { .compatible = "qcom,sc7280-lpass-va-macro" }, { .compatible = "qcom,sm8250-lpass-va-macro" }, @@ -1483,6 +1518,7 @@ static struct platform_driver va_macro_driver = { .name = "va_macro", .of_match_table = va_macro_dt_match, .suppress_bind_attrs = true, + .pm = &va_macro_pm_ops, }, .probe = va_macro_probe, .remove = va_macro_remove, From patchwork Mon Feb 21 13:10:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 544450 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 486B7C433EF for ; Mon, 21 Feb 2022 13:12:29 +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 7086016D7; Mon, 21 Feb 2022 14:11:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7086016D7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449147; bh=Oq4jnxdN8IhLcGlgpMIsKyJPoGRtlrm9Gv2J3yea9jg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YAF9PYrjGsCBYY+kSnvv92xJv1hBFYCq4iIAANsx8RrhkU8mTJo26++gZRYMwHalY sTdk4UF20Upr/ukILTwisgtsNIOUnrKxiLe/ysgMzumKa7asLOIvz4brjkBNq3Sb40 lyRDy5yZlY/yF5/R/oghpOdvZdVa16BdKiIMoCDE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 77D96F80519; Mon, 21 Feb 2022 14:10:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B375CF8047C; Mon, 21 Feb 2022 14:10:50 +0100 (CET) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 09574F80118 for ; Mon, 21 Feb 2022 14:10:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 09574F80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c2g0VovJ" Received: by mail-wm1-x334.google.com with SMTP id o34so9494239wms.1 for ; Mon, 21 Feb 2022 05:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zgNio1ZvxWIjmLiWAXPcv23sMXfkT0s/qjcyQ67ngqM=; b=c2g0VovJKiBK1IfUHsT9ZWkD+jMmc5eAnx8gpqpTf1nikF0NGpWBJGc5pznxONHQOi 6RXneI3djEXJ4phPE59BCMbNwBP2Y1HM9HnKs0x+xTe2HqfJUiaHUR8F4/rqS46q17MJ vvBmcjCHtbZwHRMk22pleCopI9rcxUr4SuMpoYqd5Z8bWnSwHCk7zwSIghtHBYyK1SNY Bla9OSgaMrMyQSJCOXA8r3aAroRdWcUrKx0/szRrucHrbFf/FEMN8GERHJUPFUN/KaFh 3nmLWcxKDkpiPC48lKcTC0+sJIBuXf1b5sAo6HNrlMt8e2bcBF9Qr+MC48qohzMVMAJg ZT5w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zgNio1ZvxWIjmLiWAXPcv23sMXfkT0s/qjcyQ67ngqM=; b=gMqNpEKFEy+cim62WA6WsBjkvotMgCtxT6bYptE53xgHwl5c+7Tsl+dgC3/XieIiGk Hvv7svE3WWGry5AR1yCNSFi5XV9AhltL70M8JIjsC5lqPHadqHxQ5wkfD0i+C1Tj0IQE ArrjqxTdZ3c8s5ZmrNgI05n9QWjulcJPMhjgpNk1oNyBh4LkXlszV+zBirPy366jLMsL uCoSHu7mqRfxqmOE1+AgJ08fQ6rruweMlN58jqsGwKoT3EWOz57Wrr5+QM7tIKwB7VEE YhYw6CqpxJ05Mkk0oevWkNwFowhBy6Sp+X0+qjO/yzEsjq6sgzRbKqKCmTZr8Ua8AEbw g0gg== X-Gm-Message-State: AOAM5335SODTBOotimSBrvj1U1h3YaXRN5f2vsf8VZG1CLjZPdCHU6vi LB3fkRU2zEIJQrrZdZReApHE/A== X-Google-Smtp-Source: ABdhPJyzeB8CHlxlcGvrBT+0mVWWMBylBQTmHurQddon5V0aVF2Zh2s9fbXV0IfiC6X21JW517eZaQ== X-Received: by 2002:a1c:7908:0:b0:37b:e93c:10dd with SMTP id l8-20020a1c7908000000b0037be93c10ddmr17877679wme.181.1645449042983; Mon, 21 Feb 2022 05:10:42 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:42 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 02/10] ASoC: codecs: wsa-macro: add runtime pm support Date: Mon, 21 Feb 2022 13:10:29 +0000 Message-Id: <20220221131037.8809-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-wsa-macro.c | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 21a4b8cc4a0a..a8d30f3b3fdf 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include "lpass-wsa-macro.h" @@ -2429,6 +2430,12 @@ static int wsa_macro_probe(struct platform_device *pdev) if (ret) goto err; + pm_runtime_set_autosuspend_delay(dev, 3000); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return ret; err: clk_bulk_disable_unprepare(WSA_NUM_CLKS_MAX, wsa->clks); @@ -2446,6 +2453,37 @@ static int wsa_macro_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused wsa_macro_runtime_suspend(struct device *dev) +{ + struct wsa_macro *wsa = dev_get_drvdata(dev); + + regcache_cache_only(wsa->regmap, true); + regcache_mark_dirty(wsa->regmap); + + clk_disable_unprepare(wsa->clks[2].clk); + clk_disable_unprepare(wsa->clks[3].clk); + clk_disable_unprepare(wsa->clks[4].clk); + + return 0; +} + +static int __maybe_unused wsa_macro_runtime_resume(struct device *dev) +{ + struct wsa_macro *wsa = dev_get_drvdata(dev); + + clk_prepare_enable(wsa->clks[2].clk); + clk_prepare_enable(wsa->clks[3].clk); + clk_prepare_enable(wsa->clks[4].clk); + regcache_cache_only(wsa->regmap, false); + regcache_sync(wsa->regmap); + + return 0; +} + +static const struct dev_pm_ops wsa_macro_pm_ops = { + SET_RUNTIME_PM_OPS(wsa_macro_runtime_suspend, wsa_macro_runtime_resume, NULL) +}; + static const struct of_device_id wsa_macro_dt_match[] = { {.compatible = "qcom,sc7280-lpass-wsa-macro"}, {.compatible = "qcom,sm8250-lpass-wsa-macro"}, @@ -2457,6 +2495,7 @@ static struct platform_driver wsa_macro_driver = { .driver = { .name = "wsa_macro", .of_match_table = wsa_macro_dt_match, + .pm = &wsa_macro_pm_ops, }, .probe = wsa_macro_probe, .remove = wsa_macro_remove, From patchwork Mon Feb 21 13:10:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545298 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 89AC6C433EF for ; Mon, 21 Feb 2022 13:12:43 +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 C50F316AF; Mon, 21 Feb 2022 14:11:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C50F316AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449161; bh=u1BiLCznRG8rz31uFjBClqMlMp7EKoy4qoD2AfonvWE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=D3Nks9rwQ1XDyE+9ZIFwZjZkLvait7VEKj7PtiVWRXjF03ve86dZBwJzMIoor0JbT +V5FWVy2keCARTt++S7xELIdtBRDqK9vaI/YeJ6lrTZJhczMfe+ysWvDs+Lew57/2n +CGVsW1rW1bdoowDq7oGe582VYaCVgh3nmSfcyHU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F2E34F80166; Mon, 21 Feb 2022 14:10:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EC88BF80524; Mon, 21 Feb 2022 14:10:54 +0100 (CET) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 43255F80166 for ; Mon, 21 Feb 2022 14:10:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 43255F80166 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CnZFhCDb" Received: by mail-wm1-x336.google.com with SMTP id o34so9494252wms.1 for ; Mon, 21 Feb 2022 05:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RewL+3EtNxhC0ou/pYILBVrh1qSfkoLM81IegMwgi94=; b=CnZFhCDbVNq8YUQgIUgkcn7+ZwM1cLOb2I1C7hnWQq/B7122caLSKIX1vYxPKwTVI9 tAGaU4oDRPjyZ5ZfScYain86omjfyxk0tYYwx6JxRIt+CdACoJXVIXIPObS9i7LdM43t 4GVsw7WZNQNwNYXzapJaFtgt+WwQalTTvOTIlhFjCnjRv41VHKLkHX1TPY9HEG45IV70 mKYifBTkAZZ9sCLKrnFXOhxTWnpniQc24Y6feTJb+2AHWQGbP0ex/lQX34OYpwqD1WMH 85SzasVkc/Vn44HV+j4UA83UZvQUXKkVXychSJEhW77gfKkWmlWhNOxUhvsYm/HZRcRL Du9w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=RewL+3EtNxhC0ou/pYILBVrh1qSfkoLM81IegMwgi94=; b=L1g88bxtuRYT/pUiacka6jt+zhiY8DQxYNPwZXlxVyP5a6Dd1QCrcd/5JLpZ7R9pnl kBiGDXDEl+eFKT7RK4SetluABVhiBpotr0dVJWM5yGFpriEj45UxA8eY+JLDOazq5hPs /xAh7bkcLIUCdGOEm+LXBSukR+tU5nk2xmiw0xtsXW7PiC13+4D2hTHaXEkbTOK2+bQv 2EmvZTKJfd5bqf049l0UqvB9HV+VjeJ/x3UtMliM/LeOXHudS4lL5oWf4KL0brBiiGDn emPJ+EP5rH1SMsSobV8aO+7JHHMtuTlXnh8IJhA3M9v23Xb6f4IPb8rwiaaqhNXfkSmk 3GBA== X-Gm-Message-State: AOAM533X03iqrsGttxDf6QoewxkJ738Qzt/jcvPvN/KmZLuciRjBZbH2 53nYET/hA6ePQVOfz+ff/in/KQ== X-Google-Smtp-Source: ABdhPJxGMd0Ms8x6dw0XsYi8KALi9pePtOLeIdPF5Bpu7BL8TvC7gxCHwewtjeASsZJ2rFGToWHbow== X-Received: by 2002:a05:600c:410d:b0:37b:b8f2:a1b1 with SMTP id j13-20020a05600c410d00b0037bb8f2a1b1mr16948525wmi.123.1645449044140; Mon, 21 Feb 2022 05:10:44 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:43 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 03/10] ASoC: codecs: rx-macro: add runtime pm support Date: Mon, 21 Feb 2022 13:10:30 +0000 Message-Id: <20220221131037.8809-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 45 ++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index 0ed032b220a4..fb5d4bb8bd8b 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -3568,8 +3569,17 @@ static int rx_macro_probe(struct platform_device *pdev) rx_macro_dai, ARRAY_SIZE(rx_macro_dai)); if (ret) - clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks); + goto err; + + pm_runtime_set_autosuspend_delay(dev, 3000); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return ret; +err: + clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks); return ret; } @@ -3589,11 +3599,44 @@ static const struct of_device_id rx_macro_dt_match[] = { }; MODULE_DEVICE_TABLE(of, rx_macro_dt_match); +static int __maybe_unused rx_macro_runtime_suspend(struct device *dev) +{ + struct rx_macro *rx = dev_get_drvdata(dev); + + regcache_cache_only(rx->regmap, true); + regcache_mark_dirty(rx->regmap); + + clk_disable_unprepare(rx->clks[2].clk); + clk_disable_unprepare(rx->clks[3].clk); + clk_disable_unprepare(rx->clks[4].clk); + + return 0; +} + +static int __maybe_unused rx_macro_runtime_resume(struct device *dev) +{ + struct rx_macro *rx = dev_get_drvdata(dev); + + clk_prepare_enable(rx->clks[2].clk); + clk_prepare_enable(rx->clks[3].clk); + clk_prepare_enable(rx->clks[4].clk); + regcache_cache_only(rx->regmap, false); + regcache_sync(rx->regmap); + rx->reset_swr = true; + + return 0; +} + +static const struct dev_pm_ops rx_macro_pm_ops = { + SET_RUNTIME_PM_OPS(rx_macro_runtime_suspend, rx_macro_runtime_resume, NULL) +}; + static struct platform_driver rx_macro_driver = { .driver = { .name = "rx_macro", .of_match_table = rx_macro_dt_match, .suppress_bind_attrs = true, + .pm = &rx_macro_pm_ops, }, .probe = rx_macro_probe, .remove = rx_macro_remove, From patchwork Mon Feb 21 13:10:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545297 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 60499C433F5 for ; Mon, 21 Feb 2022 13:13:20 +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 AC87916E6; Mon, 21 Feb 2022 14:12:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AC87916E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449198; bh=3IU/tRv0KjefSCVQHvgDaPsB1jiAkzW/LrK7ObF3uXc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SlIjpHgFUDVqRgX+IRseowLu5M6mcaza1oCVoAGesgCAppU/4LmohxWOb7TJJ1qX9 5+oXWWPhhIurSWPtBP2+0uJ1pMZL9DJzmeAifivJ3nkrNz5mfCMsI9G9EozBDxAwf0 z5MHSCX1riMJEurZuQLWuSsZ7AP2fORTRxTOXntM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4CFD5F8052D; Mon, 21 Feb 2022 14:11:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EC673F80527; Mon, 21 Feb 2022 14:10:56 +0100 (CET) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6189CF800D1 for ; Mon, 21 Feb 2022 14:10:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6189CF800D1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WWR2i/oD" Received: by mail-wm1-x32b.google.com with SMTP id w13so9005849wmi.2 for ; Mon, 21 Feb 2022 05:10:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u/873brHhZR6xm18sDiZdhD33uqz5ep38GtGCx69qMY=; b=WWR2i/oD1/ImYmqzvGm+tSJJ7MlYn6oWxndq5vCHMn2AFVVnhZ/RRBzCsMw6c831ag +5JoERRNMn0iyyrGiJxWZv6FFkwWZRl9yv32YVwUpqYgbh28p7CYJV7h+9P867hF010F r9gP6OdjsJuWvEZ6BIxpy84WwiSP8clBu/odr+AgHbHNqlRYq3YZ8pTwaJtxSqY3HmGy NG7tReTFSjSfIeBzXa7yaIxwjoZcEaaPtpo7mXeyubfh/lBjeNlLp5Z1qTozN0i9ub0R dq0L6M1nwXV5wBuMnUEb9/zMUQdVainoXaQ9FZp2P6Py7yg7TWFfqdRqZ0S0EVI5kF2W 6IQQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=u/873brHhZR6xm18sDiZdhD33uqz5ep38GtGCx69qMY=; b=YM48upB9hg4OmTA4+poKhu9+sbJaNnA5agKMLgouOSzu0/0GbAD5JsU+7UldS9LR2g JeRqibk2iA2DYPwXyQkXmKEJJ4++MTMdDhyQz7uEUP3dO7MUQmOxg4GZuC9DJEiplYcr SkeYuD2QhapswFsP2SQaCGMCtDX0T/knTJDTt5QSSFq+1Xerr1v3/IeQ7yUEBlvzFoks TlDCJ7Mk3koQZoe0CpUzHMm6mDI/39UHPsM2h+JfRWUbXILsVPPWqoahZvj+FjnX2WGP ZdrdIkh7hRefLub2n3fW69RzIYrmr9A06lzGsIu5ILmdJSjg0Cpe6VSfaaVmi2nSrhLl VJhQ== X-Gm-Message-State: AOAM530Jap0AvK+xwge9FvbEt7SLKzYYNH7uJe5eoqsBfUKSrp6SdFMo DHd7WbCJWHBFNPqQFmwZl1IP2Q== X-Google-Smtp-Source: ABdhPJwsozEEOuF/0rPoouuPwDOTCYZ96rRUj9bR+ckw7xR4Yo/oO3Yc462V1ta/luwtz7dIWCoRHQ== X-Received: by 2002:a05:600c:384a:b0:37b:e8ac:851f with SMTP id s10-20020a05600c384a00b0037be8ac851fmr9358623wmr.158.1645449045225; Mon, 21 Feb 2022 05:10:45 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:44 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 04/10] ASoC: codecs: tx-macro: add runtime pm support Date: Mon, 21 Feb 2022 13:10:31 +0000 Message-Id: <20220221131037.8809-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-tx-macro.c | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 7347d79a6329..1c0f0d27ed42 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -1844,6 +1845,13 @@ static int tx_macro_probe(struct platform_device *pdev) ARRAY_SIZE(tx_macro_dai)); if (ret) goto err; + + pm_runtime_set_autosuspend_delay(dev, 3000); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return ret; err: clk_bulk_disable_unprepare(TX_NUM_CLKS_MAX, tx->clks); @@ -1862,6 +1870,38 @@ static int tx_macro_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused tx_macro_runtime_suspend(struct device *dev) +{ + struct tx_macro *tx = dev_get_drvdata(dev); + + regcache_cache_only(tx->regmap, true); + regcache_mark_dirty(tx->regmap); + + clk_disable_unprepare(tx->clks[2].clk); + clk_disable_unprepare(tx->clks[3].clk); + clk_disable_unprepare(tx->clks[4].clk); + + return 0; +} + +static int __maybe_unused tx_macro_runtime_resume(struct device *dev) +{ + struct tx_macro *tx = dev_get_drvdata(dev); + + clk_prepare_enable(tx->clks[2].clk); + clk_prepare_enable(tx->clks[3].clk); + clk_prepare_enable(tx->clks[4].clk); + regcache_cache_only(tx->regmap, false); + regcache_sync(tx->regmap); + tx->reset_swr = true; + + return 0; +} + +static const struct dev_pm_ops tx_macro_pm_ops = { + SET_RUNTIME_PM_OPS(tx_macro_runtime_suspend, tx_macro_runtime_resume, NULL) +}; + static const struct of_device_id tx_macro_dt_match[] = { { .compatible = "qcom,sc7280-lpass-tx-macro" }, { .compatible = "qcom,sm8250-lpass-tx-macro" }, @@ -1873,6 +1913,7 @@ static struct platform_driver tx_macro_driver = { .name = "tx_macro", .of_match_table = tx_macro_dt_match, .suppress_bind_attrs = true, + .pm = &tx_macro_pm_ops, }, .probe = tx_macro_probe, .remove = tx_macro_remove, From patchwork Mon Feb 21 13:10:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545296 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 87A05C433F5 for ; Mon, 21 Feb 2022 13:13:50 +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 C88B716FA; Mon, 21 Feb 2022 14:12:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C88B716FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449228; bh=hqfGMiE+PTiDXZbZNl3n15ucyC2jxL+AGEd/p33/RGU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=M/ahLfqy9isyJb0h1fy1oBlTm8YVmTkriaKj3JFTJXUWi84r3JCFnVPM4CmN2LYio lJ//0UxK2zCg7IFu4F4Nk7/zdE6blcq66lQYQeM66sIpkKNN+6Kpq3FM2TCOi5Egxq nyifVg8DZM3i1Z72Cv0rAuKxD/iIdCH2Px9Ffask= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 988A2F80534; Mon, 21 Feb 2022 14:11:04 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2CD09F80534; Mon, 21 Feb 2022 14:11:01 +0100 (CET) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E9675F80511 for ; Mon, 21 Feb 2022 14:10:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E9675F80511 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qhf8qTxo" Received: by mail-wr1-x435.google.com with SMTP id h6so26983741wrb.9 for ; Mon, 21 Feb 2022 05:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lv2cURY5ctLyr3w/A6pppI7w3hfD7whTI0vMJP1Qd1k=; b=Qhf8qTxok8B+nYSoESkmhYepqk5DhUeRay0CpursGNJLagZ+rGGfLsFjJkoB+caVcv gfPZL7uWeUq+O0SjB7iwPAOE7EkmGwo9D/d8Xmt977m9bNabSyJXx4xjmp3YpL9W837T ZbduZOLtx4JTMqsQgNHPlZmERTLF79DlVMjmneW/q6Pyr3i1xv/zLvP8BI415iXBOPBd kwCgqvWY767wX+dkeJUyO12moZ8ojm6ymLq24zphhUoNAcvbyxR0D+PdWROsJOt948ku dfzq2+wUaxr6PXe2Bv6W92by1grhecHKCU41lraXGPDUv1qlg0am7Rlz5WqKi0OxpfTP hhqg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lv2cURY5ctLyr3w/A6pppI7w3hfD7whTI0vMJP1Qd1k=; b=sqNWOevMctCB191trneFB+Z/2pk1JQcjA/llcK8WIru2MmzfyfwVr7i5UpX8R/Sw0v 3KXn0XpDPne1MzfN+UKxpQMVQ5j1R1a0dVw7Rq7dbVYGJfQI2ac+ePnhUWBb7SsW3SYU GaLXE6nIxiJnZzhF+XMfCDty2jx+1QDKyMqddgq4YrigwsxaXZ3Aw1EzNaxtuQzYcwZ+ O6CaeB6QDdEfFp+l3SA8DTQeytRptEShJ8Q7G6BDD2xqJ2Fqn1WpNYtrWHZThe6I2S56 Z20gzeyB2eT1xIwznni2gbPCvLjaBJHCEk/IduKv9mhL/Wvt8T/+h8cwIpZ0RLoTnL0w F0NQ== X-Gm-Message-State: AOAM531l0jmQPV/OOt1zcI5xoV5b38jKEfeqw4RWDRfWYR4W/9+/0RPe npYAs89YR62naH9pHBRrOvYctA== X-Google-Smtp-Source: ABdhPJxmN9JoqBG+vnbmNNu11ati/Y+uONpXUxzd/ucsg+UiEuVXR6Aeymf5Rc+ZEIF67qkKuQze2Q== X-Received: by 2002:a05:6000:44:b0:1e4:b901:5f72 with SMTP id k4-20020a056000004400b001e4b9015f72mr15506187wrx.109.1645449046590; Mon, 21 Feb 2022 05:10:46 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:46 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 05/10] ASoC: codecs: wsa881x: add runtime pm support Date: Mon, 21 Feb 2022 13:10:32 +0000 Message-Id: <20220221131037.8809-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" WSA881x codecs can not cope up with clk stop and requires a full reset after suspend. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wsa881x.c | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 0222370ff95d..d851ba14fbdd 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -198,6 +199,7 @@ #define WSA881X_OCP_CTL_TIMER_SEC 2 #define WSA881X_OCP_CTL_TEMP_CELSIUS 25 #define WSA881X_OCP_CTL_POLL_TIMER_SEC 60 +#define WSA881X_PROBE_TIMEOUT 1000 #define WSA881X_PA_GAIN_TLV(xname, reg, shift, max, invert, tlv_array) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ @@ -747,6 +749,12 @@ static int wsa881x_put_pa_gain(struct snd_kcontrol *kc, unsigned int mask = (1 << fls(max)) - 1; int val, ret, min_gain, max_gain; + ret = pm_runtime_get_sync(comp->dev); + if (ret < 0 && ret != -EACCES) { + pm_runtime_put_noidle(comp->dev); + return ret; + } + max_gain = (max - ucontrol->value.integer.value[0]) & mask; /* * Gain has to set incrementally in 4 steps @@ -773,6 +781,9 @@ static int wsa881x_put_pa_gain(struct snd_kcontrol *kc, usleep_range(1000, 1010); } + pm_runtime_mark_last_busy(comp->dev); + pm_runtime_put_autosuspend(comp->dev); + return 1; } @@ -1101,6 +1112,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) { struct wsa881x_priv *wsa881x; + struct device *dev = &pdev->dev; wsa881x = devm_kzalloc(&pdev->dev, sizeof(*wsa881x), GFP_KERNEL); if (!wsa881x) @@ -1124,6 +1136,7 @@ static int wsa881x_probe(struct sdw_slave *pdev, pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0); pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; + pdev->prop.simple_clk_stop_capable = true; gpiod_direction_output(wsa881x->sd_n, 1); wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config); @@ -1132,12 +1145,52 @@ static int wsa881x_probe(struct sdw_slave *pdev, return PTR_ERR(wsa881x->regmap); } + pm_runtime_set_autosuspend_delay(dev, 3000); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return devm_snd_soc_register_component(&pdev->dev, &wsa881x_component_drv, wsa881x_dais, ARRAY_SIZE(wsa881x_dais)); } +static int __maybe_unused wsa881x_runtime_suspend(struct device *dev) +{ + struct regmap *regmap = dev_get_regmap(dev, NULL); + struct wsa881x_priv *wsa881x = dev_get_drvdata(dev); + + gpiod_direction_output(wsa881x->sd_n, 0); + + regcache_cache_only(regmap, true); + regcache_mark_dirty(regmap); + + return 0; +} + +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)); + + regcache_cache_only(regmap, false); + regcache_sync(regmap); + + return 0; +} + +static const struct dev_pm_ops wsa881x_pm_ops = { + SET_RUNTIME_PM_OPS(wsa881x_runtime_suspend, wsa881x_runtime_resume, NULL) +}; + static const struct sdw_device_id wsa881x_slave_id[] = { SDW_SLAVE_ENTRY(0x0217, 0x2010, 0), SDW_SLAVE_ENTRY(0x0217, 0x2110, 0), @@ -1151,6 +1204,7 @@ static struct sdw_driver wsa881x_codec_driver = { .id_table = wsa881x_slave_id, .driver = { .name = "wsa881x-codec", + .pm = &wsa881x_pm_ops, } }; module_sdw_driver(wsa881x_codec_driver); From patchwork Mon Feb 21 13:10:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 544448 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 63066C433F5 for ; Mon, 21 Feb 2022 13:13:35 +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 AE7E316CE; Mon, 21 Feb 2022 14:12:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AE7E316CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449213; bh=e56jG/lyd6oGBZ52c9erwIAX8hNA9r6AzEtczhHWtZo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Osx62YACI7atHj5vPRrITESb6k5UBdKimz2XA8uLXhwptgLU2t7OWqjcvGJkeILJn khOzs1A0lA3C23YlJaORhIKKOBnDi6cbDQoITQLBkGjHm8dLR4dKrNXmzd0fItbV+Y QBlCq5vywqKA3A2AyvxX+UA3V0SAGSb5jZhySevI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 24D32F800D1; Mon, 21 Feb 2022 14:11:04 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E2D63F80527; Mon, 21 Feb 2022 14:10:58 +0100 (CET) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9190FF80516 for ; Mon, 21 Feb 2022 14:10:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9190FF80516 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xT89kU+5" Received: by mail-wm1-x32d.google.com with SMTP id m126-20020a1ca384000000b0037bb8e379feso13514290wme.5 for ; Mon, 21 Feb 2022 05:10:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LfKStxRvgTEmdqhNQGyq07ydIW9Hyz4sxw/jfz5hVYw=; b=xT89kU+5gglDuZfx6otMltL5s7sd25gDnq0q4fQB0XM+AhvrbYxRIJ5l7pBHySmK/k XO6zRM7SVmSs3EEvbmC+Tg7r5/CRu8k0Vrk+9McU4UPvtv2Z5MsIkW/+FjrXgZnqQZEZ K9cx/g/gTSYk6G0eO3UwnMWCFqOL7VWBHJXIK3vaIPejk0En/mPfx4VCAeFmkrtl38ZT lcd3l8QoSrdWhRyaQpxhPhdh9JECU1aFGtuSjKOo13cdGlqRiJqgpjC3nNLK6uHsTWC7 tFi5qctN54EPThIa1wmKm4/RJEvUgrrv6nJBjfxIn+RJVJsWg02qe1t0QcGOipsKgfdh GLNg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=LfKStxRvgTEmdqhNQGyq07ydIW9Hyz4sxw/jfz5hVYw=; b=CmHBrL4yPTO2v648np0jz4a2PlGoVXLLX5i5ekuyJ8z2IYKt24TT3Oe03iKMsPU6ty JA+ukHfBE14DipU5KUb+BMGI69d2j9wCo6R76oM7DlqbvjsO0gBlgAqPuSbC/6hxgql8 hgONb8X6asrL7sf51eJWRtPuM8zDfV90eLYogpakTAKLsNz/LGFEdc8USEzKjMHSMgfP 8PFanDVfdxpHoPvXDJY9U24KbaRHLsXBH6OkXVILGKBvSy4xXiJq0T6nCt7DIK6DolRG 6a7rW9qwCVmw7kgPRNZONaQDJiW6CaShCchggx0C0D/gQYe2veSg2enSQh+qCiF7dMiV AFig== X-Gm-Message-State: AOAM533RSM/a1yGyNZPXqto5WYWUthU0okFxCGtISLDg1x2myEBCAS+T Jctr4YFQSfBFf82exIfDM7Vn0A== X-Google-Smtp-Source: ABdhPJyEohRKma9akNiOWsxMFqCf8yJ7AknxrWOekQ8wSnBWxATqwZPl0jD7d3d/0zk+IUHr41hoaw== X-Received: by 2002:a05:600c:3b85:b0:37b:baf8:f542 with SMTP id n5-20020a05600c3b8500b0037bbaf8f542mr17847152wms.26.1645449047634; Mon, 21 Feb 2022 05:10:47 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:47 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 06/10] ASoC: codecs: wcd938x: add simple clk stop support Date: Mon, 21 Feb 2022 13:10:33 +0000 Message-Id: <20220221131037.8809-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" mark WCD938x as clock stop capable. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd938x-sdw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/wcd938x-sdw.c b/sound/soc/codecs/wcd938x-sdw.c index 1fa05ec7459a..1bf3c06a2b62 100644 --- a/sound/soc/codecs/wcd938x-sdw.c +++ b/sound/soc/codecs/wcd938x-sdw.c @@ -249,6 +249,7 @@ static int wcd9380_probe(struct sdw_slave *pdev, SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; pdev->prop.lane_control_support = true; + pdev->prop.simple_clk_stop_capable = true; if (wcd->is_tx) { pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); pdev->prop.src_dpn_prop = wcd938x_dpn_prop; From patchwork Mon Feb 21 13:10:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 544449 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 72529C433EF for ; Mon, 21 Feb 2022 13:12:59 +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 4E5BB16EA; Mon, 21 Feb 2022 14:12:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4E5BB16EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449177; bh=sf/C1D3uZu2irFWKc3hKP9pwQ55D0OiPpXYgIvqHxb4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UzSphbXZkjX4+IN9j+D7TyWTGsoFGUyJZByDJ7Byu5PQHZdA8UKy0zQQAPArgsd+8 OIhD/dfo/ohi6xodANBrY966p4+y5jXF+FsPUQQDtwjZKiPPAyv8um+K++Pn//J7+n LW5jffGwMRIXKcr0Sc1oBJC119/im9j+z0FWu8t0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B9716F80526; Mon, 21 Feb 2022 14:10:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 298F8F80520; Mon, 21 Feb 2022 14:10:55 +0100 (CET) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F1BBDF8047C for ; Mon, 21 Feb 2022 14:10:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F1BBDF8047C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="T5M6rVpQ" Received: by mail-wr1-x42f.google.com with SMTP id o24so27025825wro.3 for ; Mon, 21 Feb 2022 05:10:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vyVwZE5kS8xGdR91o+WjovvMprsI53ZLyaYZnmErV2U=; b=T5M6rVpQg5CiNr0ALeXidXgJ27NA+ORiCY2Lluwps+MNSbQ6BG7XRz9qUUmz9jpiAk lO8F5HA6p6nn2XwUZ2QXVPvwzILoFklTOwYzQ8dj7F5STNqv3ZWHXR6BK/iyTsyfx/q1 qtH7bL/pdBvtx40noEamhS+8PkOAm1+FOXNWMGzCUXt4ls3KcE8E6sEKlbKgoXHS2ygq fZFtH8gyBLWxsUoMTZ4g9ekdM4Lwxip+0iYdGeSZCqcdm867uR2YqICwSm9R/ih6nvvk E9h2iZT2/iZyOQjcSTxyVGT7WHaZaH6Bf7vvtdF/t0PBj4wTAFens0KXhPeOFwqL9/fB fz7g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vyVwZE5kS8xGdR91o+WjovvMprsI53ZLyaYZnmErV2U=; b=HbuuJu2IIbrzgfv6LALnmYg5eQm5R6sYmlt8qf6rJXGmWSFNvz8BmZZXBfCPrsRUiO B0luHNONV7/vxBcieXjTnu/+ph0etBg1VaSU9skZw9XRz9Oft4GQ5oOwSBHkm+RP6uKZ yzXCGybUjG1byFVDXY7iBxSOyb7FxyPkNXTLd4WT6jb9lKMMW8ml9QV8n3h0Yi3vHAnt aL2s7H6ii9Zk9sCXFsb6K7wgVh+3y09kBzt+mzEYUGERud8jPgQixdAiofPSzUZm4zjl rTGanmo8zUxtgTYDkVupLvp4+lutAKoz+IOYYapZkE3iWsdEvv2jAX+vQuFVKcMGfX4N F3hQ== X-Gm-Message-State: AOAM532fDVeiH+Y9HXWj+tv8XV8xl/Rt8pgF5ucbHkzcepuTMyPP2f+1 1/oWEcfSVGClyptHsRIorvOWkw== X-Google-Smtp-Source: ABdhPJzoGZPyDMK/rd4UpWIt18POgV1l3Mt9/on0ljpwn4kVUcoE59SuHBLlq6qeR6BQ5cDdBUGS3A== X-Received: by 2002:a5d:6488:0:b0:1ea:7bfa:41e1 with SMTP id o8-20020a5d6488000000b001ea7bfa41e1mr394408wri.563.1645449048801; Mon, 21 Feb 2022 05:10:48 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:48 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 07/10] ASoC: codecs: wcd-mbhc: add runtime pm support Date: Mon, 21 Feb 2022 13:10:34 +0000 Message-Id: <20220221131037.8809-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" under low power state a SoundWire Wake IRQ could trigger MBHC interrupts so make sure that codec is not in suspended state when this happens. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd-mbhc-v2.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 7488a150a138..c53c2ef33e1a 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -711,6 +712,16 @@ static irqreturn_t wcd_mbhc_hphr_ocp_irq(int irq, void *data) static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc) { struct snd_soc_component *component = mbhc->component; + int ret; + + ret = pm_runtime_get_sync(component->dev); + if (ret < 0 && ret != -EACCES) { + dev_err_ratelimited(component->dev, + "pm_runtime_get_sync failed in %s, ret %d\n", + __func__, ret); + pm_runtime_put_noidle(component->dev); + return ret; + } mutex_lock(&mbhc->lock); @@ -751,6 +762,9 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc) mutex_unlock(&mbhc->lock); + pm_runtime_mark_last_busy(component->dev); + pm_runtime_put_autosuspend(component->dev); + return 0; } @@ -1078,10 +1092,19 @@ static void wcd_correct_swch_plug(struct work_struct *work) int output_mv, cross_conn, hs_threshold, try = 0, micbias_mv; bool is_spl_hs = false; bool is_pa_on; + int ret; mbhc = container_of(work, struct wcd_mbhc, correct_plug_swch); component = mbhc->component; + ret = pm_runtime_get_sync(component->dev); + if (ret < 0 && ret != -EACCES) { + dev_err_ratelimited(component->dev, + "pm_runtime_get_sync failed in %s, ret %d\n", + __func__, ret); + pm_runtime_put_noidle(component->dev); + return; + } micbias_mv = wcd_mbhc_get_micbias(mbhc); hs_threshold = wcd_mbhc_adc_get_hs_thres(mbhc); @@ -1232,6 +1255,9 @@ static void wcd_correct_swch_plug(struct work_struct *work) if (mbhc->mbhc_cb->hph_pull_down_ctrl) mbhc->mbhc_cb->hph_pull_down_ctrl(component, true); + + pm_runtime_mark_last_busy(component->dev); + pm_runtime_put_autosuspend(component->dev); } static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data) From patchwork Mon Feb 21 13:10:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545295 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 396F3C433EF for ; Mon, 21 Feb 2022 13:14:25 +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 70D5E16F3; Mon, 21 Feb 2022 14:13:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 70D5E16F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449263; bh=btdLpXPIP8zOcSYHl6uCbcLtwqYMwyFdk1m7rbd6kMk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qBLAXLrPJu6cVPyoIv/ZrTl4YCys/4Z0MPpJH6oGFAct6ote60BQ8IG1DvX1n1Y8g PSDIQAn1p1GpIh9rIlvod6mXyQjPzDyXxM8UGrRALckpRZCYskRMXIgdlRlRjhtVa4 IfcGlm7GyepIUz3b680AwwK/QRv8OVE2GYzRLM7A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AF2F0F8053C; Mon, 21 Feb 2022 14:11:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 34E40F80515; Mon, 21 Feb 2022 14:11:02 +0100 (CET) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E4736F8051C for ; Mon, 21 Feb 2022 14:10:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E4736F8051C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mbzV2rMh" Received: by mail-wr1-x42d.google.com with SMTP id h6so26984010wrb.9 for ; Mon, 21 Feb 2022 05:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=to/0VQRxET3KlmX/g/6lkGwzP14Y4zFtNFsg8ymenlA=; b=mbzV2rMh2TIubzZRZpZTj5cmoESg5T8lu0MMvfc1S98Psy4yiSSn4zn54E+r2mQPJu vCSzoIucJ27el+jkSLan/J2VU8veKAGCYUQUEovYVIXeZ8CYklNabYfZILeOtgcfXS8F EUMSjGIkqebrpIiIyGifTRr1p2NqmschAolxTVT3np5RVssz03nz3ybbxEDUHzp4ecNu 2fQerpohucN1tYDjjF89HccRxQHoiYRQmEUhxbSAC7ClcQNrme0R1rEtqsd+p6efDXZE qkXvaPwMsBGNEWqdXarP1ItkvdRYcSLf1icCdmNNSJIjnx7SaJ0dYoI4p5YpqxeqHoiY bPFQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=to/0VQRxET3KlmX/g/6lkGwzP14Y4zFtNFsg8ymenlA=; b=ptvx+x2PhHINen5etbgN+D1xWrhNSsqNcvFnV9Z0ltpt4z8Wdr4oah+UCMcfofKqLK 9YwR8Ss7qYjqr3ARJUEe5x7lo7h5mIpU2cSzWfG2zMmIcJD3oFNTaOyMfpuIQyysXO19 ebKifzURCxgtZ0NUYhRqkFJK3cK+Ry7SRp3VuFGOof6z79sKYYGtT0mGAnoM2ke8m4Kv ZAF6vgpOvNmp4x0q2cxm6yJPjP0DGLQGYKZ7lPUMSJQ5vksZChMYWss7Z4UgLZsNJ/1Y 9yhZJLQTjG3iU+HZUkyYAm+874d0Lfh/yRpWcSHH5FHbLp75a66p55yu/7itcT7gAC/0 q7BQ== X-Gm-Message-State: AOAM532CoN6dfx4iCpbZ0X0KYD0bdH2wBj3wzttF6lZQsBEqYnkbwp2U MZ7rWwggjgsdAlnhN/PZHhr/jg== X-Google-Smtp-Source: ABdhPJwVS2QIlSS1PXWjt7wJwFAbOL6vY5vnL/xglBpqQiKgDeFouZ3MoUiTvK6PusY2cD4HIY5CnA== X-Received: by 2002:a05:6000:1881:b0:1e8:f75c:591d with SMTP id a1-20020a056000188100b001e8f75c591dmr13975498wri.257.1645449050313; Mon, 21 Feb 2022 05:10:50 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:49 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 08/10] ASoC: codecs: wsa-macro: setup soundwire clks correctly Date: Mon, 21 Feb 2022 13:10:35 +0000 Message-Id: <20220221131037.8809-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" For SoundWire Frame sync to be generated correctly we need both MCLK and MCLKx2 (npl). Without pm runtime enabled these two clocks will remain on, however after adding pm runtime support its possible that NPl clock could be turned off even when SoundWire controller is active. Fix this by enabling mclk and npl clk when SoundWire clks are enabled. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-wsa-macro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index a8d30f3b3fdf..d51d6acac28b 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -2257,6 +2257,7 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) struct regmap *regmap = wsa->regmap; if (enable) { + clk_prepare_enable(wsa->clks[2].clk); wsa_macro_mclk_enable(wsa, true); /* reset swr ip */ @@ -2281,6 +2282,7 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) regmap_update_bits(regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, CDC_WSA_SWR_CLK_EN_MASK, 0); wsa_macro_mclk_enable(wsa, false); + clk_disable_unprepare(wsa->clks[2].clk); } return 0; @@ -2351,7 +2353,7 @@ static int wsa_macro_register_mclk_output(struct wsa_macro *wsa) struct clk_init_data init; int ret; - parent_clk_name = __clk_get_name(wsa->clks[2].clk); + parent_clk_name = __clk_get_name(wsa->clks[3].clk); init.name = clk_name; init.ops = &swclk_gate_ops; From patchwork Mon Feb 21 13:10:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 544447 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 93CADC433EF for ; Mon, 21 Feb 2022 13:14:08 +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 C168F16F0; Mon, 21 Feb 2022 14:13:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C168F16F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449246; bh=QilgmRm+T3CSJ6u7OADtHk14zhQyw71g+5KS3XswgiA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=daOed3iulpzfn+H1erK6pmNrZt1jl4VUmktk88nBfc2zwfYaJlFhNnrR+46TB2k9Z lnPvCQjMfrQQRd3g5Y+N/EBmmPlGz3tjcjYebaQh51xLWkNj6d849NEZK9lSq6hD37 BGLzmgIoPOvdIGQFmrcyDtIGN0eGLTlB8u/jxi7M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3444FF80536; Mon, 21 Feb 2022 14:11:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2013BF80533; Mon, 21 Feb 2022 14:11:02 +0100 (CET) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 33F05F80515 for ; Mon, 21 Feb 2022 14:10:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 33F05F80515 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="faIwDDvC" Received: by mail-wm1-x32b.google.com with SMTP id n8so9476118wms.3 for ; Mon, 21 Feb 2022 05:10:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=at3S5biHzZRQ5m3HY8Vsi7c1hMS+BWBfzlmLlepvupM=; b=faIwDDvCMFUEF365S3xjC5ACrPp7alH7moZZBT7u8h2JopCKjQv6oR0hnojsJxt4nX gW8YPghV7MzBMDBMSxDzkxge6UPqxV8PHiEwbndMtwbClQHyCV07RL1yRAs8m6hepQ/I l9x4Jryu6tq34aXWJs3Px21zIpSusUdKkGUrkhljHfU1omzZJ7myLsumwSDmpEibKffn ETCAun07s1vRNZ0kgrU+MTbScQ/wzYQlrvVeub74t2cIsLNnuVpUrLxXbaIQ3GMyLtZN twP4OWM99hLins9KsaQqWdc5M7sHE6LxCTu9lkMTQCztm1xtIsiR+Rp/iGvHdQkMuI0+ ypyw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=at3S5biHzZRQ5m3HY8Vsi7c1hMS+BWBfzlmLlepvupM=; b=1n3IU06kWUDVpNkQOpVwp3rR0RzQsxKZjZpyE4NGg0/giZPWCZ8Od9osXyP1/zIXKB ufGL22NphOEOq7z8HtDb/sLw5v6D1PGJ59aQXanyq6WjlUup7ShRk+eB28UgZdw+3X3P bHgukWc0IrL6AemUZU5+0kNXkil0ElS7JStb5/hIxyVAO4kHJrXKKTuErNY8VW5nbnKP aN61xnsk6LSPeukoHQuFZde1I3RVaaR8/bKiAXZSg2/7bLI1c5BEFlDxI2GTFnXEkrzi z5f2kzE3mHSM2GCbDYVFiJKY+6AQYTGAjsTnzYkTQR8zj+usO+0uvPMcS6A8veIZbHDp xbAA== X-Gm-Message-State: AOAM5317Smi9DZx4VJKq6CkqfqsFZnBfhqkDv7ooRUW2fmkpEm69ZB/z n3EsV5ZOcW8PtUGlJjVgUKElVA== X-Google-Smtp-Source: ABdhPJwdS0x6aEHX2AWFNqZ0uWaJOk2qtndMD9nkFanM/s2IpgpnWoYitl9TdBmG9QSBo7veMQobBQ== X-Received: by 2002:a1c:4443:0:b0:34d:a9d6:884 with SMTP id r64-20020a1c4443000000b0034da9d60884mr21774467wma.50.1645449051415; Mon, 21 Feb 2022 05:10:51 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:50 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 09/10] ASoC: codecs: tx-macro: setup soundwire clks correctly Date: Mon, 21 Feb 2022 13:10:36 +0000 Message-Id: <20220221131037.8809-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" For SoundWire Frame sync to be generated correctly we need both MCLK and MCLKx2 (npl). Without pm runtime enabled these two clocks will remain on, however after adding pm runtime support its possible that NPl clock could be turned off even when SoundWire controller is active. Fix this by enabling mclk and npl clk when SoundWire clks are enabled. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-tx-macro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 1c0f0d27ed42..f90786100d1a 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -1687,6 +1687,7 @@ static int swclk_gate_enable(struct clk_hw *hw) struct tx_macro *tx = to_tx_macro(hw); struct regmap *regmap = tx->regmap; + clk_prepare_enable(tx->clks[2].clk); tx_macro_mclk_enable(tx, true); if (tx->reset_swr) regmap_update_bits(regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, @@ -1713,6 +1714,7 @@ static void swclk_gate_disable(struct clk_hw *hw) CDC_TX_SWR_CLK_EN_MASK, 0x0); tx_macro_mclk_enable(tx, false); + clk_disable_unprepare(tx->clks[2].clk); } static int swclk_gate_is_enabled(struct clk_hw *hw) @@ -1750,7 +1752,7 @@ static struct clk *tx_macro_register_mclk_output(struct tx_macro *tx) struct clk_init_data init; int ret; - parent_clk_name = __clk_get_name(tx->clks[2].clk); + parent_clk_name = __clk_get_name(tx->clks[3].clk); init.name = clk_name; init.ops = &swclk_gate_ops; From patchwork Mon Feb 21 13:10:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 544446 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 03817C433F5 for ; Mon, 21 Feb 2022 13:14:41 +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 4D21F16AB; Mon, 21 Feb 2022 14:13:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4D21F16AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645449279; bh=jv2Gp/N67y1Ab3liSlzKJKiHePsfK1JgwEJOmyNnJBg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qEwj0g6QrywuaPGV2N/D2oncKky/a86GKrUUeLRvf8698gsTo3B3Ig9kS+1rnKqIk m7NwvxO5wRi7Fn8YTtbvVImL0pR8cZEledLSOCxK0fwGpTvx7w+BfS/YvOW9bR1aWU rbxIUoDlHqf6oJl/jooNzR5R4ep0ISYPkG+YVIn4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 357FAF80543; Mon, 21 Feb 2022 14:11:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4D9F0F80511; Mon, 21 Feb 2022 14:11:02 +0100 (CET) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 47ADFF800D1 for ; Mon, 21 Feb 2022 14:10:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 47ADFF800D1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="I+dOyBnJ" Received: by mail-wr1-x433.google.com with SMTP id d27so27016467wrc.6 for ; Mon, 21 Feb 2022 05:10:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2U8Gf3HJdH9syGZl9j1jogHOiAd7YSk+hDONNdww6Ps=; b=I+dOyBnJS4SRSq5buGKlAzEiHETqO9p+g2O0IpuK8oBLKaHrXmg2U4VlsqIUFZOSxh eHPrGLmQiOBf3HIoYDkTGaPN98bzznwbdXh4kZ5/JCdB6mvnKJgn1ezUlkZb3oV7igRG PqQFGVEL5Hhb4lwtAAQxdhR2jV9yjt5aZAekEI14NocbkQ0RIFjHUmbks6YmAjmYEQLy Z5pLb8tUjm+cV4AJvnsXVFhAWL8yEzVyaBLUqSizVaT0mLnTgq9kfHcUJwoAUJuIMjle ISSAKQptuE+8xA4n0KYfUJF610tWF/rFE/gcGKYZSLplADKsGLMN+lV33IazUFyW8Zdv eqhg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=2U8Gf3HJdH9syGZl9j1jogHOiAd7YSk+hDONNdww6Ps=; b=NKYyYUpgOgy7VLDh8w3ruLgXcEUX6TNVfEEsZdaZ0vXzD5Gh7tGrS2wWVY2ovm4eo4 W/21/XeH4hfDA/cyKqzpsAma3BXqxKJiFwEv0nLy/ZcB6yaEBYbQldJp9245/SPJoAO/ ki/ZrGgvFv/AHaWqtyoaf0hTamOMtpOj3eldcjhRUiuE2MrWmz0ZxyICvGbpg4G1NpB4 L/mpuUSy+ie5oezIbny3qwaHdGPbhlUQh9VUzfuXSfjstppdbDTlA5SdGGTcfebHsGZE Sci0tAqyW558hR5ptDPUe0ItMIU3G77u/9ShxyBQM8FlpR7mcdAQKaWJvTKQIMeSM4z6 8n4Q== X-Gm-Message-State: AOAM530V/IWn0Uz9v8tKNBR8LAWNU7afHxpjzFTpgWrjxdfjKc3IM3jE KwJW/QZfgW1amr3Ie/ZBxPauug== X-Google-Smtp-Source: ABdhPJwlbxv93gkUtu9c2GU5/Fcp1Mwcm0jj3wbGovTiBxEEh4DWuGiuIKoTxqB2wGyS9YPkIu9v0w== X-Received: by 2002:adf:e952:0:b0:1e3:39ed:d990 with SMTP id m18-20020adfe952000000b001e339edd990mr15889802wrn.215.1645449052490; Mon, 21 Feb 2022 05:10:52 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id 3sm49412801wrz.86.2022.02.21.05.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 05:10:52 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 10/10] ASoC: codecs: rx-macro: setup soundwire clks correctly Date: Mon, 21 Feb 2022 13:10:37 +0000 Message-Id: <20220221131037.8809-11-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> References: <20220221131037.8809-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com, Srinivas Kandagatla , quic_srivasam@quicinc.com 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" For SoundWire Frame sync to be generated correctly we need both MCLK and MCLKx2 (npl). Without pm runtime enabled these two clocks will remain on, however after adding pm runtime support its possible that NPl clock could be turned off even when SoundWire controller is active. Fix this by enabling mclk and npl clk when SoundWire clks are enabled. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index fb5d4bb8bd8b..9ce83cff3e1b 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -3428,6 +3428,7 @@ static int swclk_gate_enable(struct clk_hw *hw) { struct rx_macro *rx = to_rx_macro(hw); + clk_prepare_enable(rx->clks[2].clk); rx_macro_mclk_enable(rx, true); if (rx->reset_swr) regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, @@ -3453,6 +3454,7 @@ static void swclk_gate_disable(struct clk_hw *hw) CDC_RX_SWR_CLK_EN_MASK, 0); rx_macro_mclk_enable(rx, false); + clk_disable_unprepare(rx->clks[2].clk); } static int swclk_gate_is_enabled(struct clk_hw *hw) @@ -3490,7 +3492,7 @@ static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx) struct clk_init_data init; int ret; - parent_clk_name = __clk_get_name(rx->clks[2].clk); + parent_clk_name = __clk_get_name(rx->clks[3].clk); init.name = clk_name; init.ops = &swclk_gate_ops;