From patchwork Sun Jul 18 10:48:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 479606 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3167749jao; Sun, 18 Jul 2021 03:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpk4ri1bGf0GE188I1lrzRcPOqrUMsxFeavfMBf/Kl3kNladTVPzGaVIsoY8lbwg5xfTG5 X-Received: by 2002:a05:6638:58e:: with SMTP id a14mr11966074jar.81.1626605358301; Sun, 18 Jul 2021 03:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626605358; cv=none; d=google.com; s=arc-20160816; b=AMNT0uS0kMxogjAcYKiE3LEnO8QUNXD5wTEsAZuNzMoYw2Nwat+uVwwkNXlhkk3mn0 xtFChyN2azD/R77qRsMbRIm1BwjUYhRolTzPTr8HCOMtpG8k9rDwTmjteBkHZzuAjzit 9Yxme5uZjdI3ha6l/jMJT2xTtIVYMOhK3jE+kibghl1l8UbCSClDSZRTGU8VwM92lc6Q 47/Dqh3r6neqwxlammaWrSkPOLmj+ouxvOjK2r7Mklr88KMI1lbT+9XSgl4ZN+n73+MU 89grl7F9dBwVLMN92fSETqFUJHM4u8RsQdx2VjBQGGghGhTm525oFpo1Vy+peYYiLFwV Ythg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iaKylTHK8D5EzB/xiSIklLRQLkt7yfSNwyCfbc/j47o=; b=H1vzM6ro/f5YR9ayXfpmYZhyPrWpWFvEbiTu1UrdXIvSx1WZWFrlpvH1oAGr/vqVAd l4zQjxL8QFDDookTWjh6TK5vkL8KGAbwpbCxDdLPGcQ86z4z6BrzF04zECvqX0kG63Tk qdAWo9OOsyecGW2KRkmauitKci0yuhL2iOrSD6wAkHLmhz2uwwcpy5UlTAvp9h9ZN7OF TtUGeY/VLPzQYsZjnfUIyTkKStBa+RuQwyLOy8F8qRQ4Y5k9Xre+hULgKK3QthKNeXGc JWpbwuNp1CJcS+NTyXBenrNqJNP7qdz2x5BmU7TRMHITOieoQJY0pLkM4xa+JmiChd/u kaxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CumnnenM; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si18586418iot.89.2021.07.18.03.49.18; Sun, 18 Jul 2021 03:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=@linaro.org header.s=google header.b=CumnnenM; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233071AbhGRKwN (ORCPT + 7 others); Sun, 18 Jul 2021 06:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233018AbhGRKwL (ORCPT ); Sun, 18 Jul 2021 06:52:11 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6569BC061766 for ; Sun, 18 Jul 2021 03:49:12 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 8so24243419lfp.9 for ; Sun, 18 Jul 2021 03:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iaKylTHK8D5EzB/xiSIklLRQLkt7yfSNwyCfbc/j47o=; b=CumnnenME8Jyt67j9cGkgxVdCUPijZ3W406ZSjfKl+O2mNfMofR/47JrDLfV3KXUOE SzvReEkCSbbMj0r2eMR7Ddw/QFIoMRIamBtsMxGDLikqCmWRKs4QwMo6uvopIW92pcSg C0bLwqobwmgNWduQlpWgZWv7oxb7s3ll6UsjFf4nny6CfNdrZakatnGd5Z7Lee6+mdKq 8RQNDtLJCb42v7dlSX35lSy2gEcCvcxcFtLL9oLzcQVdo+KC3gDf7pvCu86YOcO32tIq +D7XvmCae4PZNaxpwjhcEekYitsFQUUHvxwiopdIEf/qTCjOlARY1WNKR2No+6bLskbt t7zw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=iaKylTHK8D5EzB/xiSIklLRQLkt7yfSNwyCfbc/j47o=; b=SvfGls7Fb/Dggxvr1X1Wt2LtPkISsfji/U4UuAIpptMO/8fPjKW5rokoBgLeA/Qwx4 KiSWLKnPvLTmPOoFIo8vkFGS2rkgTD6XaJm+x0QJ3Cf/uJzZOWrzY3rdz957LKKnNUTh QT1IfZwvxNrXcEyoHJTop+EDMG8knnYNbS+VcOPXVS53sxKcWli81oV9YUZ+d1JonP7p iaSVEZ8eVLUTCgAzW8MwtwJr2r0WX+SD4JxLJqF+TFiZCqryVMfcaPAqzPwypkMCheu5 prAF0gulFNYo5u/5u469ts1yznCU9Uxtq+8umXzahScn6CZJ0wCpIbLy/rZXxdcHAPt5 pMbQ== X-Gm-Message-State: AOAM532+UikbULCBJGi5iFKSVnz5O88jA0fx7xw5EU3XKMZi7vJwpMhc aB/TOfRmnwVb5GTQG8HtgPuVvA== X-Received: by 2002:a05:6512:322a:: with SMTP id f10mr3855591lfe.625.1626605350779; Sun, 18 Jul 2021 03:49:10 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y22sm1039528lfh.154.2021.07.18.03.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 03:49:10 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Stephen Boyd , Taniya Das , Jonathan Marek , Michael Turquette Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, Bryan O'Donoghue , Mark Brown , Ulf Hansson , linux-kernel@vger.kernel.org Subject: [PATCH v5 4/9] clk: qcom: dispcc-sm8250: use runtime PM for the clock controller Date: Sun, 18 Jul 2021 13:48:56 +0300 Message-Id: <20210718104901.454843-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210718104901.454843-1-dmitry.baryshkov@linaro.org> References: <20210718104901.454843-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On sm8250 dispcc and videocc registers are powered up by the MMCX power domain. Use runtime PM calls to make sure that required power domain is powered on while we access clock controller's registers. Signed-off-by: Dmitry Baryshkov --- drivers/clk/qcom/dispcc-sm8250.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/clk/qcom/dispcc-sm8250.c b/drivers/clk/qcom/dispcc-sm8250.c index 601c7c0ba483..0625fea6d7ba 100644 --- a/drivers/clk/qcom/dispcc-sm8250.c +++ b/drivers/clk/qcom/dispcc-sm8250.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -1229,10 +1230,21 @@ MODULE_DEVICE_TABLE(of, disp_cc_sm8250_match_table); static int disp_cc_sm8250_probe(struct platform_device *pdev) { struct regmap *regmap; + int ret; + + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; + + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret) + return ret; regmap = qcom_cc_map(pdev, &disp_cc_sm8250_desc); - if (IS_ERR(regmap)) + if (IS_ERR(regmap)) { + pm_runtime_put(&pdev->dev); return PTR_ERR(regmap); + } /* note: trion == lucid, except for the prepare() op */ BUILD_BUG_ON(CLK_ALPHA_PLL_TYPE_TRION != CLK_ALPHA_PLL_TYPE_LUCID); @@ -1257,7 +1269,11 @@ static int disp_cc_sm8250_probe(struct platform_device *pdev) /* DISP_CC_XO_CLK always-on */ regmap_update_bits(regmap, 0x605c, BIT(0), BIT(0)); - return qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap); + ret = qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap); + + pm_runtime_put(&pdev->dev); + + return ret; } static struct platform_driver disp_cc_sm8250_driver = {