From patchwork Wed Mar 15 13:23:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 663529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 899B0C7618B for ; Wed, 15 Mar 2023 13:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232107AbjCONXm (ORCPT ); Wed, 15 Mar 2023 09:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbjCONXl (ORCPT ); Wed, 15 Mar 2023 09:23:41 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D1CD158A1 for ; Wed, 15 Mar 2023 06:23:39 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id y4so46041098edo.2 for ; Wed, 15 Mar 2023 06:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678886617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xQtrWDCM+22cQpzRRbVDJZjtR/eFtKTL53q6CUnjVrA=; b=kcCmlMd948KTeFaT82iddBgwWZPmI85qhyHyJAJKzspk0SsOyGqNByNvBE+bAMsClo fiFyE57RAgHFWGTtx0x6MMBEZbVVWGTbmc5kIMsBNu60iCBvcRghGHAaJ7BFtc87EdA4 gQIsAiC51MpVQSrv61X7jG93H+kGWQ3fc9BenKW5Kzi2S870BrFMviIX0b1INPVah++M 3WTlJCeJcP5wH/B62iolL3NhCGoDdPmtecKFbZ5qkFujaQJxgLzaNpCR+mLxefhwaoy0 m8E24qya4KdhgUG3MeW999hZMIAzUmzBGnlWzix4N893xlvhnGBj61IcTG8H96l9XN+v C7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678886617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xQtrWDCM+22cQpzRRbVDJZjtR/eFtKTL53q6CUnjVrA=; b=sgyin7JUC+6VoIhBgVD4cfRYkReHyrB2U3p7XpRhhR+HIk4uHf9SY9a2BFFp6smVGg upuPAN55tiAXpbqrQ1o6SJ8LxCN+IjIpWGPb3qFyLlbpkC3+OfyK5ilEhhM+CPLKa71q z9tibT9DAA1IkcfxZ9YTXTsj/UMtf6CpMmHwKHs4gtQveWl27t6JmsDAXF1+Xus4dYSf u44ctyFeLpJYwTFcEQgWHjw8oNW75Zs3yXrr4IbITIyJ2lueRonPdRwGH6OXrhNVtNar ZrYjTIJ+4/0tetyyZcuhV5+msHI2VqT+AH5yqVxej7OzuNt/J18W0KCGVzHyBm6FO+d3 rFlA== X-Gm-Message-State: AO0yUKUDoWTVkx9yCEHlLL9NI7l6OkpIPGlzvYkwtosARfequUbitt/E btp7iOo5WaOdgbj6acS8Kfjr3A== X-Google-Smtp-Source: AK7set+aEpLN7DIU+ICSDUHqoC29NPehGqibZ+dEU/3SKCMWs0P9gQyG0fxkTGoZVcpIiVf9y8OyVQ== X-Received: by 2002:a17:907:9708:b0:878:711d:9310 with SMTP id jg8-20020a170907970800b00878711d9310mr7626418ejc.1.1678886617534; Wed, 15 Mar 2023 06:23:37 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id pj18-20020a170906d79200b008b133f9b33dsm2497365ejb.169.2023.03.15.06.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 06:23:36 -0700 (PDT) From: Abel Vesa To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Greg Kroah-Hartman , Bjorn Andersson , Andy Gross , Konrad Dybcio , Mike Turquette , Stephen Boyd , Saravana Kannan Cc: linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Doug Anderson , Matthias Kaehlcke Subject: [RFC PATCH 2/5] soc: qcom: rpmhpd: Do proper power off when state synced Date: Wed, 15 Mar 2023 15:23:27 +0200 Message-Id: <20230315132330.450877-3-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230315132330.450877-1-abel.vesa@linaro.org> References: <20230315132330.450877-1-abel.vesa@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of aggregating different corner values on sync state callback, call the genpd API for queuing up the power off. This will also mark the domain as powered off in the debugfs genpd summary. Also, until sync state has been reached, return busy on power off request, in order to allow genpd core to know that the actual domain hasn't been powered of from the "disable unused" late initcall. Signed-off-by: Abel Vesa --- drivers/soc/qcom/rpmhpd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c index f20e2a49a669..abd999c74783 100644 --- a/drivers/soc/qcom/rpmhpd.c +++ b/drivers/soc/qcom/rpmhpd.c @@ -649,8 +649,12 @@ static int rpmhpd_power_off(struct generic_pm_domain *domain) mutex_lock(&rpmhpd_lock); ret = rpmhpd_aggregate_corner(pd, 0); - if (!ret) - pd->enabled = false; + if (!ret) { + if (!pd->state_synced) + ret = -EBUSY; + else + pd->enabled = false; + } mutex_unlock(&rpmhpd_lock); @@ -810,10 +814,8 @@ static void rpmhpd_sync_state(struct device *dev) { const struct rpmhpd_desc *desc = of_device_get_match_data(dev); struct rpmhpd **rpmhpds = desc->rpmhpds; - unsigned int corner; struct rpmhpd *pd; unsigned int i; - int ret; mutex_lock(&rpmhpd_lock); for (i = 0; i < desc->num_pds; i++) { @@ -822,14 +824,7 @@ static void rpmhpd_sync_state(struct device *dev) continue; pd->state_synced = true; - if (pd->enabled) - corner = max(pd->corner, pd->enable_corner); - else - corner = 0; - - ret = rpmhpd_aggregate_corner(pd, corner); - if (ret) - dev_err(dev, "failed to sync %s\n", pd->res_name); + genpd_queue_power_off_work(&pd->pd); } mutex_unlock(&rpmhpd_lock); } From patchwork Wed Mar 15 13:23:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 663528 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC032C6FD1D for ; Wed, 15 Mar 2023 13:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232078AbjCONXt (ORCPT ); Wed, 15 Mar 2023 09:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbjCONXp (ORCPT ); Wed, 15 Mar 2023 09:23:45 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0A0687D90 for ; Wed, 15 Mar 2023 06:23:41 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id w9so4704849edc.3 for ; Wed, 15 Mar 2023 06:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678886621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z6Q5mnwZerUqt0rPDmFb5WgXIlQQvBuhlqFXmv7x/E8=; b=v8CeUBfci+2vyzQEs4Rv2vSs3xgOflEwBGX290bxPufp8u8LNIOMlkwcnVzAd/JHTS fKtlg1yp861KIf8/L1MJwZILV+rQXo66j3Yxt9GK2ezkucnxv+S+0i/EnOuoYDUhJOV3 B6JpC0fqm3lrN2erdD+046lrlomd/a16+nW2JchX0Jb24U9w1cd/ZJNtpLSUYRhQsIlu j0VP1QxVb20iygWUI9vh2kc1KeznBSrLdSCryvv3cS+hgbtWk5/gbaQj/AD3vNkuqYPU A/IWUl2UBUfC+Ob8tJcCN4OaDEuUsJbZqVAv+jnL6QKj1HEuwp2mjGfX7wCJLSZMrfzW EfjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678886621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z6Q5mnwZerUqt0rPDmFb5WgXIlQQvBuhlqFXmv7x/E8=; b=cXG72MzVJ/UNASF6QNTvQTo1JX/6bDELkW9SUNUjGhMrMlEikPFdsJo/iXyuj8UvR2 Zc0A3wVSCGdRLNAMItcS5yplFlRXkVqimOsxjprYkuqaa7oqyV/oKGuOoBMBavvvRHxm oE+5+3oEMilSYWIXBtUfxV+uvupc0w7/sPqSHbQsxndXmCQvBJsz60dkwVjwlyJ2cwby q9BtqyzCtdHmutd/f4rWqRQLzyDAtq1EQl7t1lEZ1qVw/U/ZgiWSOXRENku/mR2P7O1/ LxR6T3jHLzatnmAEpUJgMEH8HdN33u377abSaaVIGqtbmod0VtZMl+uc4z7ZA/P7o5qt In0A== X-Gm-Message-State: AO0yUKUu7wywVtTjkn5GDqYcE9HW+tV+YQNON+zgNH10vNXe22bezCEp SLYIEY8Y99eWImCMWAEEm2ihbQ== X-Google-Smtp-Source: AK7set80lwILGeMEjE90/hXf2KxCex24k3hIxwK6a87YWNsiAs3RYf8jzg8Y/7RnlkbsWjydDWh7+g== X-Received: by 2002:a17:907:7f8e:b0:92f:1418:27f0 with SMTP id qk14-20020a1709077f8e00b0092f141827f0mr2127459ejc.34.1678886620990; Wed, 15 Mar 2023 06:23:40 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id pj18-20020a170906d79200b008b133f9b33dsm2497365ejb.169.2023.03.15.06.23.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 06:23:40 -0700 (PDT) From: Abel Vesa To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Greg Kroah-Hartman , Bjorn Andersson , Andy Gross , Konrad Dybcio , Mike Turquette , Stephen Boyd , Saravana Kannan Cc: linux-pm@vger.kernel.org, Linux Kernel Mailing List , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Doug Anderson , Matthias Kaehlcke Subject: [RFC PATCH 4/5] clk: qcom: Add sync state callback to all SC8280XP providers Date: Wed, 15 Mar 2023 15:23:29 +0200 Message-Id: <20230315132330.450877-5-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230315132330.450877-1-abel.vesa@linaro.org> References: <20230315132330.450877-1-abel.vesa@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now that we have support for sync state delayed disabling of unused power domains and a provided generic gdsc sync state callback, add it to all the providers related to the SC8280XP platform. Signed-off-by: Abel Vesa --- drivers/clk/qcom/dispcc-sc8280xp.c | 1 + drivers/clk/qcom/gcc-sc8280xp.c | 1 + drivers/clk/qcom/gpucc-sc8280xp.c | 1 + 3 files changed, 3 insertions(+) diff --git a/drivers/clk/qcom/dispcc-sc8280xp.c b/drivers/clk/qcom/dispcc-sc8280xp.c index 167470beb369..f97bda6c7e3a 100644 --- a/drivers/clk/qcom/dispcc-sc8280xp.c +++ b/drivers/clk/qcom/dispcc-sc8280xp.c @@ -3199,6 +3199,7 @@ static struct platform_driver disp_cc_sc8280xp_driver = { .driver = { .name = "disp_cc-sc8280xp", .of_match_table = disp_cc_sc8280xp_match_table, + .sync_state = gdsc_sync_state, }, }; diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c index b3198784e1c3..222bca0f8093 100644 --- a/drivers/clk/qcom/gcc-sc8280xp.c +++ b/drivers/clk/qcom/gcc-sc8280xp.c @@ -7441,6 +7441,7 @@ static struct platform_driver gcc_sc8280xp_driver = { .driver = { .name = "gcc-sc8280xp", .of_match_table = gcc_sc8280xp_match_table, + .sync_state = gdsc_sync_state, }, }; diff --git a/drivers/clk/qcom/gpucc-sc8280xp.c b/drivers/clk/qcom/gpucc-sc8280xp.c index ea1e9505c335..a9f0e7bbacce 100644 --- a/drivers/clk/qcom/gpucc-sc8280xp.c +++ b/drivers/clk/qcom/gpucc-sc8280xp.c @@ -453,6 +453,7 @@ static struct platform_driver gpu_cc_sc8280xp_driver = { .driver = { .name = "gpu_cc-sc8280xp", .of_match_table = gpu_cc_sc8280xp_match_table, + .sync_state = gdsc_sync_state, }, }; module_platform_driver(gpu_cc_sc8280xp_driver);