Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp672684pxu; Wed, 14 Oct 2020 10:40:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc4VJyglPqKVGoUEI9n8jMV7CCF75xiCgwjB0fakGR35ZqYrNBTS6U5QG3jebEXNjq7WB9 X-Received: by 2002:a05:6402:1d87:: with SMTP id dk7mr30625edb.222.1602697235762; Wed, 14 Oct 2020 10:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697235; cv=none; d=google.com; s=arc-20160816; b=FBVQdj0Oy0wTxGoTL6Ik8lycwe7tCqlHN2e2iP1FmP88nmLco3cMalDdZkfEkCQCr3 OTNxcw1qhG/pD1NpUEFLEElP0td3mQ3X68mZdQHIPZ7i3EVahJn9yeGvneFfpOhM188t 8mOh4gul2FxyGZDNAAtt5bt6VXuVrSs5ko6rLh1cjeEgho30DCmz/ukZUBYLAyNpWJsa pnRSZex2FDYd240edyzGmzHxmzE9KOZHbwCynBpIE/6PYUZ7T8cWgEQdlrfsivzp4AW3 IdzxlZsZjNHS9IdKJQSfNbqAH22yPsm4NrIIV6nQBEn0rPrcaPGPGdC7yrYRRUXMVlTj qtVw== 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=MKPVqt9nZ28XkBuHkl7IfJCFNBXzL2D6MJ4L8d/0r2o=; b=z4cJG6pfeo/JHDUV62xM+LQIYfDl9g3lRQVvRrqJdV0xcKrSQ4S6q269t1iY3DcRgP osfLm3FZw3W48l41z+T8cUTD1NN7L+DL4KDeN6P60jvxt8iLo5K71q9pOdNF2D4zgs0p 6PVvS8ws8mkjWBtGjeMNvjsAoco2Wb+hfWWuKPkTYWwrPSa3ybz4Q5Y5v1q7xKErO6Ca hoH5xQkV4bxsPURB01nUFiZ+kRdLRFsY2B4yD55knN0LcvmGveF1ezbX68hFlDU37FWx ZjGX3ZGoICi2iOr1lIS8IP/y50BypdtgmgxC+o82WHnTTgoCal693CypU8BvNZhhgvii UCkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Dblwm5sL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si256613ejc.552.2020.10.14.10.40.12; Wed, 14 Oct 2020 10:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Dblwm5sL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730303AbgJNP6r (ORCPT + 99 others); Wed, 14 Oct 2020 11:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727161AbgJNP6r (ORCPT ); Wed, 14 Oct 2020 11:58:47 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE1DC0613D5 for ; Wed, 14 Oct 2020 08:58:47 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id b26so57017pff.3 for ; Wed, 14 Oct 2020 08:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MKPVqt9nZ28XkBuHkl7IfJCFNBXzL2D6MJ4L8d/0r2o=; b=Dblwm5sLURfAjRk5ukv6aLUllKii/VCuBuaa147EWeGPGCmv4wLW08wD4ummGjXFp4 TpXPGzb+RaxFW3U5ZnoaRz9ZOr8CiQ+wf6/IO74QDgYQPqTnCFfopSmpFlds4Ab9hzPI Xbqsc+WVtgwGdZG7T0iIGsssoNAncFBuz/5sA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MKPVqt9nZ28XkBuHkl7IfJCFNBXzL2D6MJ4L8d/0r2o=; b=fkjDEn6T8m+K3BI8GcxgdDHsMmv5rGaLLA+a43LALvKpWW5Yw1cNYY5fhp0LesBu1A 0u0xM6mKgWgD8CnLzSB0xz2OG0VFipRQgE6HyWezOdRAvo4oQdBa7+5MaXAZuhIzA7d8 5L02rLEsKoJBmeYiNeAl5wZSbZ1a1IwD/6CGfLQK3eLORdTF4i1a4EElROBiaNQk4X2x FXzZpa8j4aAWCwHEB3iD4XjFqhA2iT2Rv4Zjxf59JyJ1cQpgJtVIpLmOrJ1G6B2rtzv3 b208jYzQGxNLCSqw6gONouObUoPjmul86TnolK5dGz0T5eDGL/TIOulPheG6LMYIS3+L i7ww== X-Gm-Message-State: AOAM530v9MAEGHuBsiToYSeWmRiTA5Te1U43Uic66fkFfDvGqgQK+9d6 e8St8e9k4pqJC3g4DuPeseNqqw== X-Received: by 2002:aa7:9af1:0:b029:152:6101:ad17 with SMTP id y17-20020aa79af10000b02901526101ad17mr2228pfp.25.1602691126765; Wed, 14 Oct 2020 08:58:46 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:42b0:34ff:fe3d:58e6]) by smtp.gmail.com with ESMTPSA id h2sm80251pjv.4.2020.10.14.08.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 08:58:46 -0700 (PDT) From: Douglas Anderson To: Stephen Boyd Cc: David Brown , Rajendra Nayak , linux-soc@vger.kernel.org, Taniya Das , Douglas Anderson , Andy Gross , Bjorn Andersson , Michael Turquette , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] clk: qcom: lpasscc: Re-configure the PLL in case lost Date: Wed, 14 Oct 2020 08:58:24 -0700 Message-Id: <20201014085758.v2.1.Id0cc5d859e2422082a29a7909658932c857f5a81@changeid> X-Mailer: git-send-email 2.28.0.1011.ga647a8990f-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Taniya Das In the case where the PLL configuration is lost, then the pm runtime resume will reconfigure before usage. Fixes: edab812d802d ("clk: qcom: lpass: Add support for LPASS clock controller for SC7180") Signed-off-by: Taniya Das Signed-off-by: Douglas Anderson --- I took the liberty of fixing my own nits that I had with Taniya's patch, AKA: https://lore.kernel.org/r/1602614008-2421-2-git-send-email-tdas@codeaurora.org Changes in v2: - Don't needlessly have a 2nd copy of dev_pm_ops and jam it in. - Check the return value of pm_clk_resume() - l_val should be unsigned int. drivers/clk/qcom/lpasscorecc-sc7180.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c index 228d08f5d26f..ee23eb5b9bf2 100644 --- a/drivers/clk/qcom/lpasscorecc-sc7180.c +++ b/drivers/clk/qcom/lpasscorecc-sc7180.c @@ -356,6 +356,25 @@ static const struct qcom_cc_desc lpass_audio_hm_sc7180_desc = { .num_gdscs = ARRAY_SIZE(lpass_audio_hm_sc7180_gdscs), }; +static int lpass_core_cc_pm_clk_resume(struct device *dev) +{ + struct regmap *regmap = dev_get_drvdata(dev); + unsigned int l_val; + int ret; + + ret = pm_clk_resume(dev); + if (ret) + return ret; + + /* Read PLL_L_VAL */ + regmap_read(regmap, 0x1004, &l_val); + if (!l_val) + clk_fabia_pll_configure(&lpass_lpaaudio_dig_pll, regmap, + &lpass_lpaaudio_dig_pll_config); + + return 0; +} + static int lpass_core_cc_sc7180_probe(struct platform_device *pdev) { const struct qcom_cc_desc *desc; @@ -373,6 +392,8 @@ static int lpass_core_cc_sc7180_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); + dev_set_drvdata(&pdev->dev, regmap); + /* * Keep the CLK always-ON * LPASS_AUDIO_CORE_SYSNOC_SWAY_CORE_CLK @@ -449,7 +470,7 @@ static int lpass_core_sc7180_probe(struct platform_device *pdev) } static const struct dev_pm_ops lpass_core_cc_pm_ops = { - SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) + SET_RUNTIME_PM_OPS(pm_clk_suspend, lpass_core_cc_pm_clk_resume, NULL) }; static struct platform_driver lpass_core_cc_sc7180_driver = { -- 2.28.0.1011.ga647a8990f-goog