From patchwork Wed Jan 13 09:57:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 362072 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp375639jap; Wed, 13 Jan 2021 01:59:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoTO+P/Rwhg960D23hrNJaf6mruksqJX8i3jOaryTNGLCVwj5usVDG4m/ntTAftdGmwZcV X-Received: by 2002:a05:6402:1c8a:: with SMTP id cy10mr1117425edb.151.1610531972798; Wed, 13 Jan 2021 01:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610531972; cv=none; d=google.com; s=arc-20160816; b=wLOLcGv+5oiLdnWTww0iMLL1jOPIyHtkcLNEiaFIBCgh6OplAYXORjLGNzoYCaCOFe z95W00HbB5Sz9o+15abaaFpqq0IbmiifazjfmG8fKXEZ8LeFzozxDi1700M0OvBtvPao c+BpAs4UjBqNAIyEvuo3wFoOpTo4/iugLPmLkHYgFa1FtO//LADwrcugwgD4bC019557 an5HstLLus6lHhyf8uyLm7Tzex7LcLsjtEP48HDutWFlKhiZrPX48edMQqGcIsj2aw+X uNlvrTvJTbq/6/mmbYOKwGkRp11W2rZcUsCIjOxn5PaubRsQ3+6rD1aeotvtEl3JsYxM 1oUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=L4xQZl7+36KMU2/wIiB68+QeODvGN5IdQvwifWOg93A=; b=t0DajkEKr2YDpuMkTkDpjTqg7ghJrsCSu/+S2OpdbEz2dM5wpYiWPQ42w3Y5VqM0gl YTxhCCJ4379qjQdixfyH0pWwlZgUaOo2S0n7HksK0L6uP0Z8q1nZKWD/q3iIXVYFyVit 6zmmiaZQTBFsrBhY/JJg/xrYVSkeiRsL4k252EP5O17kr3canxXvsL9Fh0TXH/eO3Pur wT3luSbpESgOdWlUXLe8ly3kvetZGw/+mvYdZhUnxZXjHsOC2j+ME1qfSrtN9TJ9uSGD PNWSHrJNoXhKoh3sGSGWZnwIrc3GOyxB7e/OJJu2V+NR+2EZEd7M9zofSTZz51Uoipk9 YJ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PuTWWoI2; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 lw15si679119ejb.535.2021.01.13.01.59.32; Wed, 13 Jan 2021 01:59:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=PuTWWoI2; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1725927AbhAMJ6O (ORCPT + 15 others); Wed, 13 Jan 2021 04:58:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725871AbhAMJ6O (ORCPT ); Wed, 13 Jan 2021 04:58:14 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7977C061794 for ; Wed, 13 Jan 2021 01:57:33 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id t16so2128872ejf.13 for ; Wed, 13 Jan 2021 01:57:33 -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; bh=L4xQZl7+36KMU2/wIiB68+QeODvGN5IdQvwifWOg93A=; b=PuTWWoI2Va9z2ZLcPYk9yFzCkLHR3Uin79vK5c4lCfplOKz+I+LQ1kcdJOF/XsWlnm plsTIkD7rWAHR4Wwg0Smsu9/k6fMxWVx90ma+clezW2v+Qkp+4/j7ElJUOFGE41n2Klm hmAUR0Yqu5FLIS+kXYZUXxAlDRHl2IwiV1OraMG4c0+ta6hTS7Tj0gfWIg/WMr6qbHnh LXJNv0ToBN5H+AjO/zOYB0DYRbl9BQt9a56leVVlW+TcGY9mk9YwoZlrch5+fE8wE4Et d5M/J15GOIXRY18c0s5/VoSUJU9UFMKovPlTaN4pYVJHMi+yagZcH/Zc5L/UnDZUvt1L IJGw== 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; bh=L4xQZl7+36KMU2/wIiB68+QeODvGN5IdQvwifWOg93A=; b=gx1+fA4wCLbtwkkSnfMGBHA6FKnl6YfI9jOEGntaTu1tcetHy93XKDvKoR0lylkgDk JP8s2CHZWjvlZ1eiNfzPnWCdLTzUfm6dhxiK7vYJ7MND6eIMb7hzng4opa2ieGwyNl5C Hi0FMdrjNDs0cFqFZJWUzrV2m1mgJcnznRgMLSrK1C38PMCdP0pBa3zdOwjd9iQLcJKl jbEflmXuCzJfS78+7arDWDU11zEXIo/h23kNotjwrzr6bSLM68vBLcQj9kqKHsqlgBLo viIy5I9bHrY836hYRkIIuL8dJissz6oR70GMuh7SNOHmHqPEmjtejnI6MsoO3ZsyP+8E zT7w== X-Gm-Message-State: AOAM5314WGGXH9TN8I1Aig8yIWDLukjAgS7KQQrPwmrulQVaJELuyR3G Cukin1JwoYm1q7d5I2C61k7gXen2MpLPlBfB X-Received: by 2002:a17:907:20f1:: with SMTP id rh17mr974811ejb.147.1610531850905; Wed, 13 Jan 2021 01:57:30 -0800 (PST) Received: from localhost.localdomain (hst-221-43.medicom.bg. [84.238.221.43]) by smtp.gmail.com with ESMTPSA id l1sm508950eje.12.2021.01.13.01.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 01:57:30 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Fritz Koenig , Dikshita Agarwal , Mansur Alisha Shaik , Stanimir Varbanov Subject: [PATCH v2] venus: pm_helpers: Control core power domain manually Date: Wed, 13 Jan 2021 11:57:16 +0200 Message-Id: <20210113095716.15802-1-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Presently we use device_link to control core power domain. But this leads to issues because the genpd doesn't guarantee synchronous on/off for supplier devices. Switch to manually control by pmruntime calls. Tested-by: Fritz Koenig Signed-off-by: Stanimir Varbanov --- changes since v1: * drop pd_dl_venus from struct description (Fritz) drivers/media/platform/qcom/venus/core.h | 2 -- .../media/platform/qcom/venus/pm_helpers.c | 36 ++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index e886023afbe9..d2482dff518e 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -91,7 +91,6 @@ struct venus_format { * @clks: an array of struct clk pointers * @vcodec0_clks: an array of vcodec0 struct clk pointers * @vcodec1_clks: an array of vcodec1 struct clk pointers - * @pd_dl_venus: pmdomain device-link for venus domain * @pmdomains: an array of pmdomains struct device pointers * @vdev_dec: a reference to video device structure for decoder instances * @vdev_enc: a reference to video device structure for encoder instances @@ -128,7 +127,6 @@ struct venus_core { struct icc_path *cpucfg_path; struct opp_table *opp_table; bool has_opp_table; - struct device_link *pd_dl_venus; struct device *pmdomains[VIDC_PMDOMAINS_NUM_MAX]; struct device_link *opp_dl_venus; struct device *opp_pmdomain; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 0011c3aa3a73..43c4e3d9e281 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -774,13 +774,6 @@ static int vcodec_domains_get(struct device *dev) core->pmdomains[i] = pd; } - core->pd_dl_venus = device_link_add(dev, core->pmdomains[0], - DL_FLAG_PM_RUNTIME | - DL_FLAG_STATELESS | - DL_FLAG_RPM_ACTIVE); - if (!core->pd_dl_venus) - return -ENODEV; - skip_pmdomains: if (!core->has_opp_table) return 0; @@ -807,14 +800,12 @@ static int vcodec_domains_get(struct device *dev) opp_dl_add_err: dev_pm_opp_detach_genpd(core->opp_table); opp_attach_err: - if (core->pd_dl_venus) { - device_link_del(core->pd_dl_venus); - for (i = 0; i < res->vcodec_pmdomains_num; i++) { - if (IS_ERR_OR_NULL(core->pmdomains[i])) - continue; - dev_pm_domain_detach(core->pmdomains[i], true); - } + for (i = 0; i < res->vcodec_pmdomains_num; i++) { + if (IS_ERR_OR_NULL(core->pmdomains[i])) + continue; + dev_pm_domain_detach(core->pmdomains[i], true); } + return ret; } @@ -827,9 +818,6 @@ static void vcodec_domains_put(struct device *dev) if (!res->vcodec_pmdomains_num) goto skip_pmdomains; - if (core->pd_dl_venus) - device_link_del(core->pd_dl_venus); - for (i = 0; i < res->vcodec_pmdomains_num; i++) { if (IS_ERR_OR_NULL(core->pmdomains[i])) continue; @@ -916,16 +904,30 @@ static void core_put_v4(struct device *dev) static int core_power_v4(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); + struct device *pmctrl = core->pmdomains[0]; int ret = 0; if (on == POWER_ON) { + if (pmctrl) { + ret = pm_runtime_get_sync(pmctrl); + if (ret < 0) { + pm_runtime_put_noidle(pmctrl); + return ret; + } + } + ret = core_clks_enable(core); + if (ret < 0 && pmctrl) + pm_runtime_put_sync(pmctrl); } else { /* Drop the performance state vote */ if (core->opp_pmdomain) dev_pm_opp_set_rate(dev, 0); core_clks_disable(core); + + if (pmctrl) + pm_runtime_put_sync(pmctrl); } return ret;