Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp227189pxb; Wed, 13 Jan 2021 02:00:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyL4zh8umQQ84X4ot0rc1MShGp/s/ziZ6lUucBJG/s6puMNdmb/nrZwDCXbcGu1+lXCHxia X-Received: by 2002:a05:6402:41:: with SMTP id f1mr1109063edu.286.1610532012829; Wed, 13 Jan 2021 02:00:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610532012; cv=none; d=google.com; s=arc-20160816; b=nICt5+Pa6Jso6E2xgcod2T5/2Gk+1OQRIAp8mIcupCyooAIRHA7mWbvjMR1jc+qu5b Mg0a5SOOuNfhr1aO2urUlNfoCxeUrG5WYpoKzGd8GWDodC+2AjaTbzn5yAL0St4K1Lp9 l/rsGJFNeVmu7WJU75bGmpNQ6YmOCpWxokhIs9POlH/+84tOyDC6AfJkQbv5XC/hp6ho 5QgFuA/zcBfqYrYJX2Eph6qwTaf0P7Bsyanth5G3SA18jt08zB08QstZPy9DCunTAgGG z0T9I50R8gZpozD89XDY0IRoO4npGcub7TACAC1h9hVLkfLpDyorD62f8PtHACeISMND 2UrQ== 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=oOr3CygpbiO+v2t0NcXbHOu2kC+vlICwjlqUKVfZoj8XMNPn3szJmbPkR8o49c2zMr bGhMZpgS9UCKllOVDp/9MXjVPro2oXzlIbD4GhUCdPxeJXtf3IeWhGMx4Ju9LTMZT5/9 AzDukiTiOnic6fl5/j9HFF56Q9XtSdmSkP/ta945qFxkPvqhbGYpDT8sqT279IoSCjLb qlqX1AaJZinVNB+7Er6Xde+s9dOs7n2VwYTjLHF9BvxsYRrUXaSNevQ2zQL62dV1iYkl iy/R3vffpaCHA6qK9tbgdrYHCmcMsadf+fIyBETK0XbtpF4WyOF4rPsFOEV1qKHZhjrr ygMg== 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-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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si617810ejb.158.2021.01.13.01.59.49; Wed, 13 Jan 2021 02:00:12 -0800 (PST) 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=@linaro.org header.s=google header.b=PuTWWoI2; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725843AbhAMJ6O (ORCPT + 99 others); Wed, 13 Jan 2021 04:58:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbhAMJ6O (ORCPT ); Wed, 13 Jan 2021 04:58:14 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB4E8C061575 for ; Wed, 13 Jan 2021 01:57:33 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id b9so2241703ejy.0 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=V1OKI653KGmvOCrzwr37vSoQOckUaGAo0I1KJMwKVYBpoUgLOId7xSh180Cr6pB57p Yhfoyfsk5XrZK41KYL5sWJgkXfU9Ogeyyoj3tYJEhOu3e091nxeXr4g4A5/tmzsAQadt qXUFN0Jm6jciNVGK5cpF/tQDdnpYikS6dQO39bZLPxopjAKOPSIgHbN4VSQ+F+WzNBaM lfiXPM9/syA2c4WPHhOLxumPwOovlFeI1efNPsQMJLY49/rqZC/YQmBR7GRISY4FPMWm jh727cApVSmiZp1l/8hcnV8RegQQ8GJ/yaGpTQQa6ij4kDp52HMtF1MQW7EOIHfU8D/P IKMQ== X-Gm-Message-State: AOAM530CqqLA3irY6W4WlwXGmiw7KvelaajC4U2b8PvDbu1JoYHhAMFK KL3/fqX77NL8YAEAT0agWpTs3w== 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-kernel@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(-) 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; -- 2.17.1