From patchwork Tue Nov 9 02:25:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12609399 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3250BC433EF for ; Tue, 9 Nov 2021 02:26:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C70261350 for ; Tue, 9 Nov 2021 02:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239194AbhKIC26 (ORCPT ); Mon, 8 Nov 2021 21:28:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239204AbhKIC2z (ORCPT ); Mon, 8 Nov 2021 21:28:55 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B58E4C061766 for ; Mon, 8 Nov 2021 18:26:10 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id b11so4913923pld.12 for ; Mon, 08 Nov 2021 18:26:10 -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; bh=cUtIpl24Lggy8E41RG8ia5NQqrtzC4GKJnnWF5Zf7Y4=; b=TNXVDLeLMVW1i6+8idnFThikZi7Oh98OM81dZHFgy+VjBg1cSD4CDiq3iV6QkNCjmY jNgDp0atM+zyOYF5rsq/1Ki2S3llSRuJaPcG7DSmBob6P2ks51YEv4WaWYcKvJYu1CcQ wE8Ciw9HByqSlMYj0GCpsDkPZRRtCGrRsy9Y+UjA0Ygse/dEGlJ0ikQY0wFPx//zPjoS t1gMef0gLeQ7zf74cQr++qCJys/G3Nguxt6Er9DKFM6XoHmeb4lx8ASCoKT/71VP7QEQ v7rEDHOVk17n/nEorN5CsKPeNtQjK4Mh+B2nLzi0TGVcVS3c9XeI7TflMOCO4bV15StW JwyQ== 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; bh=cUtIpl24Lggy8E41RG8ia5NQqrtzC4GKJnnWF5Zf7Y4=; b=pjIeqzZnXQhV10ZGLHLLWgN3c4i0EpipOyG8I/uFZGM9FxAfllTxzIzK4srslfsZou l5PgdMtttxKjA+ulCFNiJaSOIOZlv1qD972YPoUwdAczNJGqgWJM9RWzJEOC2YjnWOec Xiai/YQD6XUjM76Lsno8V3NEHFXcNf9PuzXpq8Yp42nftzDstivVyiMOkbKscjSAdO5l 724EmoXMOKCr0HRTyPNJrJOKw2w79a52NcHcwKvxgDdArUWJweXoHNl+KorTTTr8gi1j 27b2aGw3xAaNnT2t9+VRR0wmSgKH5JnupwYmafzaysAmqfMVkAxYOokwJ6nxMLBnRW0o Xq1A== X-Gm-Message-State: AOAM531nG33qovcbwPjq1SogSJbti5EFnhQoGcZynOymgZAokJXn8LCV Bi5nCVdQEHK8tPHUMYjJ5F7qIg== X-Google-Smtp-Source: ABdhPJxjhrI3oT1OfkcTVxJUt3MlvPPxmulARdcSjQfwA6tXq2YHh770n8M8q+kR2JHIf/NrNLoJTg== X-Received: by 2002:a17:90b:105:: with SMTP id p5mr3357519pjz.60.1636424770274; Mon, 08 Nov 2021 18:26:10 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id om8sm589619pjb.12.2021.11.08.18.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 18:26:10 -0800 (PST) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Loic Poulain , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo Subject: [PATCH 1/3] clk: qcom: smd-rpm: Mark clock enabled in clk_smd_rpm_handoff() Date: Tue, 9 Nov 2021 10:25:56 +0800 Message-Id: <20211109022558.14529-2-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211109022558.14529-1-shawn.guo@linaro.org> References: <20211109022558.14529-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The result of clock handoff is that the clock is voted by APSS and enabled by RPM. So it should be marked as enabled. Signed-off-by: Shawn Guo --- drivers/clk/qcom/clk-smd-rpm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 26c70c2fbd26..6695a43a3d73 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -178,6 +178,8 @@ static int clk_smd_rpm_handoff(struct clk_smd_rpm *r) if (ret) return ret; + r->enabled = true; + return 0; } From patchwork Tue Nov 9 02:25:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12609401 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B489AC433F5 for ; Tue, 9 Nov 2021 02:26:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9122A619E8 for ; Tue, 9 Nov 2021 02:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239787AbhKIC3A (ORCPT ); Mon, 8 Nov 2021 21:29:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239277AbhKIC25 (ORCPT ); Mon, 8 Nov 2021 21:28:57 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E97C061570 for ; Mon, 8 Nov 2021 18:26:12 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id q17so6065301plr.11 for ; Mon, 08 Nov 2021 18:26:12 -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; bh=dn7bTjyF97h5pOYcvg0nMMFKfe5z/l5Yp8vYnJTswg8=; b=QqILa7vZYOHZqY2pTqI3VrPT91GdR0sHAynMtgr42WqpHSx7z/+WzfVs4jJls0roqq jA+AlDuXxhtm8RhjZoarggWgbuzHtDB3OIB4amt+IOWuL4MJxwA6eMjBbNkSqq1x9jY7 +FCa8zMrVrmae2jkeA12iYbP1KScPQsiwbnm6CSTCHhDhaFl7GqKiQ28UI5ot83y+zOa FaPF9DNXS9SRHrhtNww1gqmMsLXHmwiRmcmJ+qBtaT6uq8VLvYg+Vuh7mmyAdwHd8h/P gAS+zCoWOsT9lbvEhna3vu2hzv718l+itLa0E8zo64/iDwU15TJdgjGY+GsDVLv9Ii7j mr7A== 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; bh=dn7bTjyF97h5pOYcvg0nMMFKfe5z/l5Yp8vYnJTswg8=; b=xuhQqB3JDbdz2mtYTdMyWLBXOoLrSXSTsP5rf8ioEurG75nb1Hk4SMMb3c8Rc1UIQ1 k+vsC8L+rBqm/clHYdeMrvgW/pfF12gMg3RhgGM5f38lmvvo6iogkP/pKLuziJKZTWnz fNVvrcSF8ZM2R4hgBW4GCK1Pv12dubG+FbaJpoWyGYjMmRTmgcK01EFDoZRCffMY/Ri0 PCLRETpLUvHctzZKa2E2+603Jok2aNqRb34a/pZVtxbagIFlm2SKpnmzmboJ0CVj2NoW y1Tr3jEfKRl+Wth26GBIzojpNFLQtN6vj5OeEXnYMQSKMntnBYe2yPBEExIxeRDg+oJT XCfQ== X-Gm-Message-State: AOAM531i7fxc8LKiA7zLGnshmjMjJyTUcmF5MBQ1W1ZKAKl0VgPyRAqI rLTmwQ2dpdHsbG7JGKtCu8ZM8A== X-Google-Smtp-Source: ABdhPJwVqVOVLYSPs6unLVilZWisq2b4SzFrDO4tlPg6VClvc//qyIkowLHJFMBSSmaZwepLwI/kCw== X-Received: by 2002:a17:90b:3ec6:: with SMTP id rm6mr3301992pjb.41.1636424772385; Mon, 08 Nov 2021 18:26:12 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id om8sm589619pjb.12.2021.11.08.18.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 18:26:12 -0800 (PST) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Loic Poulain , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo Subject: [PATCH 2/3] clk: qcom: smd-rpm: Add .is_enabled hook Date: Tue, 9 Nov 2021 10:25:57 +0800 Message-Id: <20211109022558.14529-3-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211109022558.14529-1-shawn.guo@linaro.org> References: <20211109022558.14529-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The RPM clock enabling state can be found with 'enabled' in struct clk_smd_rpm. Add .is_enabled hook so that clk_summary in debugfs can show a correct enabling state for RPM clocks. Signed-off-by: Shawn Guo --- drivers/clk/qcom/clk-smd-rpm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index 6695a43a3d73..f8be58121bd6 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -402,18 +402,27 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) return 0; } +static int clk_smd_rpm_is_enabled(struct clk_hw *hw) +{ + struct clk_smd_rpm *r = to_clk_smd_rpm(hw); + + return r->enabled; +} + static const struct clk_ops clk_smd_rpm_ops = { .prepare = clk_smd_rpm_prepare, .unprepare = clk_smd_rpm_unprepare, .set_rate = clk_smd_rpm_set_rate, .round_rate = clk_smd_rpm_round_rate, .recalc_rate = clk_smd_rpm_recalc_rate, + .is_enabled = clk_smd_rpm_is_enabled, }; static const struct clk_ops clk_smd_rpm_branch_ops = { .prepare = clk_smd_rpm_prepare, .unprepare = clk_smd_rpm_unprepare, .recalc_rate = clk_smd_rpm_recalc_rate, + .is_enabled = clk_smd_rpm_is_enabled, }; DEFINE_CLK_SMD_RPM(msm8916, pcnoc_clk, pcnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 0); From patchwork Tue Nov 9 02:25:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12609403 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2585C4332F for ; Tue, 9 Nov 2021 02:26:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC7926134F for ; Tue, 9 Nov 2021 02:26:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240706AbhKIC3F (ORCPT ); Mon, 8 Nov 2021 21:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239712AbhKIC3A (ORCPT ); Mon, 8 Nov 2021 21:29:00 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FEBC061766 for ; Mon, 8 Nov 2021 18:26:15 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id q17so6065442plr.11 for ; Mon, 08 Nov 2021 18:26:15 -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; bh=xovCIAAU5pofSMeWtP54czW4maGEjZGkO8QeFrRIQTk=; b=e4/preGPlSWk95qmVJkS4xeVPT6dAY2jnQ3X7fvClPv3FdUT8chK7JEXCndXGoaksS Vb6eo+rqp56mN64WyzTVZ+c4m+N7FnfeGAhTQa9Rv9wloKesozNNxuPpowvQZ8MtdyK1 L4jRDCzsvFsLjjzAWmpLCsholEPqtJ4opcp8NAWVJ6drA5SYf2XRE3yh8Ncpj/dJSKX9 mRxsL0BCeitajLIrESWWEZc4NMypy+xB+zrwK8SskdmG4nSJD7GUuRc+JP82bYscWT97 oqnbJ/bRTGrj6eHKBeDsFWaYjjsjt7nhOr1WK/4tFZExWJihX6+kS4gr/tl+mj8rGkDs Awzg== 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; bh=xovCIAAU5pofSMeWtP54czW4maGEjZGkO8QeFrRIQTk=; b=VKYKsSK8gZbZkVIedmaM51jwRrgs/eXsCGaJ2HfEM6VrUW+MYR79q9u5Z+oE4C1Ren CsRnRWcc0UO1uZxal6+OPVcKqVTd/BBJTghgZ7cMP8KLIsA/yKel0ZcfGxdLBWRcBvDN 1smidFRz6FQGSMZHRgMA4/dWBvn+k2l9b2fsNs5AiK90ZVyLwMXr+4OjoyRikrsMq+Cw q26syiv0AzAzW+mpE/WZ5swyQ60EKQsa3qEaBOBaI7nGCh2+H7KdD7DleXkJoSMuwnrm 7gn2t1ab/PnZVBRyjTxve79LuI/h7W0EK3UxubA076stJ5eWixu2wqIr2CNs5JrOlJZh +HbA== X-Gm-Message-State: AOAM530x7GzWf/HAjHIRrnD1/oNqB4yUDEddj5sQhF/zkGHG6v10XpRh VNEJVr3hQIWOgLY/A4x46U0DCQ== X-Google-Smtp-Source: ABdhPJy1Hm54FpGAARbZdw+4XYxjjOEvp9yjVdUeIk/K3Cn3qlozXKR6ztdBUyoU/yvyohP7DLQqJg== X-Received: by 2002:a17:90b:2252:: with SMTP id hk18mr3307206pjb.218.1636424774426; Mon, 08 Nov 2021 18:26:14 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id om8sm589619pjb.12.2021.11.08.18.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 18:26:14 -0800 (PST) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Loic Poulain , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo Subject: [PATCH 3/3] clk: qcom: smd-rpm: Add .is_prepared hook Date: Tue, 9 Nov 2021 10:25:58 +0800 Message-Id: <20211109022558.14529-4-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211109022558.14529-1-shawn.guo@linaro.org> References: <20211109022558.14529-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The RPM clocks are enabled/disabled through clk framework prepare/unprepare hooks. Without .is_prepared hook, those unused RPM clocks will not be disabled by core function clk_unprepare_unused_subtree(), because clk_core_is_prepared() always returns 0. Add .is_prepared hook to clk_ops and return the clock prepare (enable) state, so that those unused RPM clocks can be disabled by clk framework. Signed-off-by: Shawn Guo --- drivers/clk/qcom/clk-smd-rpm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c index f8be58121bd6..c8f058720e66 100644 --- a/drivers/clk/qcom/clk-smd-rpm.c +++ b/drivers/clk/qcom/clk-smd-rpm.c @@ -409,6 +409,13 @@ static int clk_smd_rpm_is_enabled(struct clk_hw *hw) return r->enabled; } +static int clk_smd_rpm_is_prepared(struct clk_hw *hw) +{ + struct clk_smd_rpm *r = to_clk_smd_rpm(hw); + + return r->enabled; +} + static const struct clk_ops clk_smd_rpm_ops = { .prepare = clk_smd_rpm_prepare, .unprepare = clk_smd_rpm_unprepare, @@ -416,6 +423,7 @@ static const struct clk_ops clk_smd_rpm_ops = { .round_rate = clk_smd_rpm_round_rate, .recalc_rate = clk_smd_rpm_recalc_rate, .is_enabled = clk_smd_rpm_is_enabled, + .is_prepared = clk_smd_rpm_is_prepared, }; static const struct clk_ops clk_smd_rpm_branch_ops = { @@ -423,6 +431,7 @@ static const struct clk_ops clk_smd_rpm_branch_ops = { .unprepare = clk_smd_rpm_unprepare, .recalc_rate = clk_smd_rpm_recalc_rate, .is_enabled = clk_smd_rpm_is_enabled, + .is_prepared = clk_smd_rpm_is_prepared, }; DEFINE_CLK_SMD_RPM(msm8916, pcnoc_clk, pcnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 0);