From patchwork Mon Sep 11 15:10:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721549 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 0D0BFCA0EC4 for ; Mon, 11 Sep 2023 21:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240412AbjIKVKV (ORCPT ); Mon, 11 Sep 2023 17:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241534AbjIKPKi (ORCPT ); Mon, 11 Sep 2023 11:10:38 -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 845D8FA for ; Mon, 11 Sep 2023 08:10:32 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so12126334a12.1 for ; Mon, 11 Sep 2023 08:10:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445031; x=1695049831; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NUyRxR/Uia4+TvtVoZgzosqJP54jI70l0Rb5PTxSIO0=; b=Meh/e4xCpV26Fw/nFq8XX2zwuLP1q4ZYCG1BALo+J3L7bQVdN4qIrLKywp+xA/jKdo 7RrKnS8xslS0DhkF+KwETOGxqrxyJgpP78aUNLIj0icVSPxz9G9fwTIYlMKQcYxcrI3o NJkgcnLnZpPuCG+945js/6V4gTiWXlTEYguALO+eiNNFFXBOGJ4oW+shjove8XLpIZ2r bMw0Omv7Ql3gEwwb+psYIo4PC9yYxeFZhCrMgn0Z8X67EpFf/BrTxdn9YqN1mytDsvaY FjRgaPdIsPrjTQSy1L9xRORXBF6Iss9nmHNK8LwQV2KFoYPZ30ifYlq1nF15B//fsiOe KfcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445031; x=1695049831; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NUyRxR/Uia4+TvtVoZgzosqJP54jI70l0Rb5PTxSIO0=; b=kHLazg3iWxgTs7Fdf1UIa0PCbAPhJRh5et2I42JP1mpyosZbLuFLAR4Td1kLfgBV1Q 4UynpxnLTCCJWMvo3DBPXSBLJDIyEvvlg83UPh+ZpfB+iuNhj/Air9VQzp18+Qc8pP0D iPrph9xw4tlknvzENRaFHszEVh/jCh2Q28py8njQpaNHS0b5ikhrKZHRFwr5WWfEPld6 iCmxPVlAkjBesXIKxU0CFuqShCuQnDirsJYc4Knv7Lma8P55UuGDllJPOo91Vs9h4e89 cwxierVBzRV5h3JTgBmbDD/dc2EoC/TKnDcBp7ops9lryHXSyc0M+CLQFq325jWfoEHc K61Q== X-Gm-Message-State: AOJu0YxCQo0+MEgUwln5kt9B7438UAZ52QV1jZgxtepC0mySQTAP20S1 1xMPFurLlRJzLIh9fw2Gi4XgDQ== X-Google-Smtp-Source: AGHT+IE+SVOvneVGxhxBtIgNA1anBmfCL+Ck3qG8GDP0HLi2b0fxHi9SfaS964iY6COpCxibjHNRVg== X-Received: by 2002:a05:6402:4405:b0:52e:83d0:203e with SMTP id y5-20020a056402440500b0052e83d0203emr18329671eda.10.1694445030938; Mon, 11 Sep 2023 08:10:30 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:30 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:15 +0200 Subject: [PATCH RFT 01/20] media: venus: pm_helpers: Only set rate of the core clock in core_clks_enable MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-1-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=1871; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=i0/wTGlR4xRp/57GwLT2PI2teveudhcMu4mGxZQVimE=; b=qP4UIXuf88KhwG3ipF2dvMc9LqIsJxto52OAUHUVlVlc/O1A/F94OrRRd7AZqQ5j8nS2Ix201 ucrzgifxSQHAQ4TC7i+TUdhmrViXVYE4JOUlMFtKEsYXwaV5cDRdFU+ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Commit c22b1a29497c ("media: venus: core,pm: Vote for min clk freq during venus boot") intended to up the rate of the Venus core clock from the XO minimum to something more reasonable, based on the per- SoC frequency table. Unfortunately, it ended up calling set_rate with that same argument on all clocks in res->clks. Fix that using the OPP API. Fixes: c22b1a29497c ("media: venus: core,pm: Vote for min clk freq during venus boot") Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 48c9084bb4db..2bd9c63d0253 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -41,24 +41,23 @@ static int core_clks_get(struct venus_core *core) static int core_clks_enable(struct venus_core *core) { const struct venus_resources *res = core->res; - const struct freq_tbl *freq_tbl = core->res->freq_tbl; - unsigned int freq_tbl_size = core->res->freq_tbl_size; - unsigned long freq; + struct dev_pm_opp *opp; + unsigned long freq = 0; unsigned int i; int ret; - if (!freq_tbl) - return -EINVAL; + if (core->has_opp_table) { + opp = dev_pm_opp_find_freq_ceil(core->dev, &freq); + if (IS_ERR(opp)) + return PTR_ERR(opp); + dev_pm_opp_put(opp); - freq = freq_tbl[freq_tbl_size - 1].freq; + ret = dev_pm_opp_set_rate(core->dev, freq); + if (ret) + return ret; + } for (i = 0; i < res->clks_num; i++) { - if (IS_V6(core)) { - ret = clk_set_rate(core->clks[i], freq); - if (ret) - goto err; - } - ret = clk_prepare_enable(core->clks[i]); if (ret) goto err; From patchwork Mon Sep 11 15:10:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721543 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 CC592CA0EE4 for ; Mon, 11 Sep 2023 21:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245662AbjIKVLW (ORCPT ); Mon, 11 Sep 2023 17:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241538AbjIKPKj (ORCPT ); Mon, 11 Sep 2023 11:10:39 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69701E4B for ; Mon, 11 Sep 2023 08:10:34 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-501bd164fbfso7402026e87.0 for ; Mon, 11 Sep 2023 08:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445032; x=1695049832; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cRew6Oc+xnW64sLrM5CmEZevJKHbYAda+Rz+DKx8GYY=; b=c8tBQ5lftp9m9akfa7mZM7dN7m4KwCVDFJq0nKOBeqKJ4yI8VZ56cjYPI7lRFJdCM2 FKHAXbwzVjpzJJrcs7ikjGOypdQXAN1qjhL0NFep3l9fXE6K2g2IJDJndET8SnLXDyti 4cK3YafaiDpdqvomB6SJVTcu5CR1bn7vQulcO9ozcGrPOPSGfhfg1qI1BvyJGFXA/DR4 LWjtvSbIw4QYqDaFILNrBv08Mjl/OzNUTmdgB8xnD9KKtgJwDhr1joGVdqUKkhIQUm5w 055VW5VDbpFLSuGBQN9gdoVFDmNtYmmaJAcZ1A/zO913FlmnZD9BXCFwsBvqgopRNx5Z mevw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445032; x=1695049832; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cRew6Oc+xnW64sLrM5CmEZevJKHbYAda+Rz+DKx8GYY=; b=Z6+8wA9jo6ilirBoOeMh+d89sE2f7zqhmYXFj3yyAZzSHkeL+f6+aIh1pDpB1PnjI0 URuzNNdfyybF3M6Fl4C4Nzq0H6hZ3EkkltqctOkoDzj0oGVf4HDQsBJ4uF1gYmRMO8kq 9oJa7P7hVGJT7Uvq1f31R17/BuPHbhI++cSU9iqLC8vNq4KgJHXq83APT05H1y4c1W5y O1z9FOnJXdaubeNsmzFtTzE5ixh5Cz+69me0VpYahSoobVANYK3S21CXumZYhe7MUEsL JMZT4YbYWdsdGBPPYtC5qPBVMYOpsWtBHvvkAi6fE1AtFUC3eGLKV9MAN+s8XqxRda2L mMZw== X-Gm-Message-State: AOJu0Yw4TnH+R27j1XcGXezsTyxA8+BHCvnOnbLaZu8xiHII9JiLlJSK XPHsdnYbdrIILVsFs/vbyDmSZA== X-Google-Smtp-Source: AGHT+IFfkZSm2SgFnvhjGd4bD/9sLJAIYrIZkLexHdh26IJHuK5vq8c5x59Jkl+1Eo6Zxjq3cqM2ew== X-Received: by 2002:ac2:4ac7:0:b0:4fe:3364:6c20 with SMTP id m7-20020ac24ac7000000b004fe33646c20mr7707490lfp.16.1694445032494; Mon, 11 Sep 2023 08:10:32 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:32 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:16 +0200 Subject: [PATCH RFT 02/20] media: venus: pm_helpers: Rename core_clks_get to venus_clks_get MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-2-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=1211; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=TgOAgouGXSGMwv5uLVeiQ7fWctx4QlplbsMWieUzcN8=; b=FYDz7Y0MnR3QEJGVvP5GQ5j94MwMMavqPgl3u+toJr8vc2WU+Y3EduelTYlplNMbzujrBy2KX P8X+Ht03HPVDwOddKScyKYBxKIzjGzq4d9Kg3QwC/YQBudw6SoFLNX9 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org "core" is used in multiple contexts when talking about Venus, rename the function to save on confusion. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 2bd9c63d0253..e2aec0b46126 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -23,7 +23,7 @@ static bool legacy_binding; -static int core_clks_get(struct venus_core *core) +static int venus_clks_get(struct venus_core *core) { const struct venus_resources *res = core->res; struct device *dev = core->dev; @@ -294,7 +294,7 @@ static int core_get_v1(struct venus_core *core) { int ret; - ret = core_clks_get(core); + ret = venus_clks_get(core); if (ret) return ret; @@ -978,7 +978,7 @@ static int core_get_v4(struct venus_core *core) const struct venus_resources *res = core->res; int ret; - ret = core_clks_get(core); + ret = venus_clks_get(core); if (ret) return ret; From patchwork Mon Sep 11 15:10:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722231 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 3427ECA0ED5 for ; Mon, 11 Sep 2023 21:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344880AbjIKVO5 (ORCPT ); Mon, 11 Sep 2023 17:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241543AbjIKPKk (ORCPT ); Mon, 11 Sep 2023 11:10:40 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CCE9E54 for ; Mon, 11 Sep 2023 08:10:35 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-31c3df710bdso4165163f8f.1 for ; Mon, 11 Sep 2023 08:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445034; x=1695049834; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7ht2UJ2SrAZEBCW6MQUWYMxu5nJ3shvvrcqqoVglcXI=; b=TzZ3f7VlRPGg7/misLMDmmMiGHgCXV0MOieoPxMZNZeG6oPgaQ/cyw4AB9K/9+ybOJ 49quPh6n7b4ZcAdzjzObrGAMBTLBMIBJZIpUwl/PzpZOwb/Ub0tjHuA+bVCOdKQXGTgW bLZZ9XreQQro/fKY3ERiGvYpU45MpbD5aI0qORkm389GDUBbzvSZ9vMvvKLdi0iXZyNZ XuEcdxKnFwsZOaDEerfHotGWK0kztBnaFImPiLc4uSDgR6sI8yLo7HQtcng2WR1PBBIa LjfEfTy36RFefoN4ltX03Pewa7jE8o6DaRiQB4hjzoRRXJqrbxDpX06mx5Mm3WCXB1h5 Szeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445034; x=1695049834; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7ht2UJ2SrAZEBCW6MQUWYMxu5nJ3shvvrcqqoVglcXI=; b=lUD0JHwX2LhCO7viaw5r8aEOPRgiMUkJvRBLRonfURMQUR/8A4Fc50mPMFEO+EqvbA qZaGDQr7yupjNcM/cIo0GXxjA0oh0AyhFX71BvbFY23JXxl57ErS9lsEON5q2D6PJx3v osa3n62ytD57BD2L0PJzhWAiiSg5B+SzFagqhFK1YPvb2ZRp7sc59wXesya5SIZiTVx6 PvTY95fHQnO3oCe5AOfAjPnQAVCyjsxOltxujrLDs2A4rdSVZO6mIGDrs9to3AxX7qUh 2e4Cp5Dy/nyQ9Wap6SrSM22V+n+CAsZ7k2RaquSTJnU5yB/DW81c/vrq9DQDGPuv17B+ bAFQ== X-Gm-Message-State: AOJu0Yxr5dYVdUvP8LlyMKGfF2+AoVzV3n6c7OMOuOvG78asiTJoY3xH GiUrVVss+5cp+d3lDnbDEaF+1w== X-Google-Smtp-Source: AGHT+IE4nKR0UaC4vAJTRWZ8UGSUUnfSj9OlxBtzCtbNOI2rCiLWLB5iH0M/MLPczrSSHlDGkLqR7g== X-Received: by 2002:adf:ec42:0:b0:31c:6420:ff4 with SMTP id w2-20020adfec42000000b0031c64200ff4mr7695847wrn.36.1694445033966; Mon, 11 Sep 2023 08:10:33 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:33 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:17 +0200 Subject: [PATCH RFT 03/20] media: venus: pm_helpers: Add kerneldoc to venus_clks_get() MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-3-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2105; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=Vha5xF+p9BTPxJus7eqd6sGp8qGoiJe2/C4TA/PBKzk=; b=f8G7+PSq8vQ8m0fwoFb7lhAeXAZZFKJlZ2K2ok59naEqYbofKKp6JrLJUliGcyJWrNRkL2vPp 0z5kabW6X0jC391xXkpaCqPIoGArBX9faLYDIv0ZpDgQu4zdI6vQRHx X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org To make it easier to understand the various clock requirements within this driver, add kerneldoc to venus_clk_get() explaining the fluff. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index e2aec0b46126..59e3eaad97ed 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -23,6 +23,34 @@ static bool legacy_binding; +/** + * venus_clks_get() - Get Venus clocks that are not bound to a vcodec + * @core: A pointer to the venus core resource + * + * The Venus block (depending on the generation) can be split into a couple + * of clock domains: one for "main logic" and one for each video core (0-2pcs). + * + * MSM8916 (and possibly other HFIv1 users) only feature the "main logic" + * domain, so this function is the only kind if clk_get necessary there. + * + * MSM8996 (and other HFIv3 users) feature two video cores, with core0 being + * statically proclaimed a decoder and core1 an encoder, with both having + * their own clock domains. + * + * SDM845 features two video cores, each one of which may or may not be + * subdivided into 2 enc/dec threads. + * + * Other SoCs either feature a single video core (with its own clock domain) + * or 1 video core and 1 CVP (Computer Vision Processor) core. In both cases + * we treat it the same (CVP only happens to live near-by Venus on the SoC). + * + * Due to unfortunate developments in the past, we have to support bindings + * (MSM8996, SDM660, SDM845) that require specifying the clocks and + * power-domains associated with a video core domain in a bogus subnode, + * which means that additional fluff is necessary.. + * + * Return: 0 on success, negative errno on failure. + */ static int venus_clks_get(struct venus_core *core) { const struct venus_resources *res = core->res; From patchwork Mon Sep 11 15:10:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722261 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 9AD62CA0ECA for ; Mon, 11 Sep 2023 21:18:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245478AbjIKVK7 (ORCPT ); Mon, 11 Sep 2023 17:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241548AbjIKPKm (ORCPT ); Mon, 11 Sep 2023 11:10:42 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00647CCC for ; Mon, 11 Sep 2023 08:10:36 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-52e297c7c39so5729535a12.2 for ; Mon, 11 Sep 2023 08:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445035; x=1695049835; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=a74mAUWyNjQUrLkNN32VnDJFxKb6KoEOU6sRKzb9I4w=; b=AK/WtdjbYakEDa9RXDC6KeojelzjuSwH9+PJkfJ9gTPiSESTd/s7rEoGUDR2Y8O2RZ Grcord7fKnsDBx/YiG8vDnZIYF95ZSEfjRHX5Dh6uD69T59OE88qSSN284K6XL4padO4 vGKP0fefE4gE3MgRO0NSfsn0LI2Wp7Ruzasgd45wrkQWvMVbuyTQahMD/004pUw5/mab Mm+YaHh57lO6eG7Km+218fpEdTR8lD7qC+mBi3OSkWlaILYMqWyLpC+SUYqYuRLgcEkN /tuhA1ZAJt6QFydtSNbJfl6qWXgDDvkbhU9ogiZWFWz0S/3/ywdjgmKc67xuIM2Tu0ZE oyLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445035; x=1695049835; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a74mAUWyNjQUrLkNN32VnDJFxKb6KoEOU6sRKzb9I4w=; b=m441p7ssRxvakd1flejMFHvv/qzXhJYjv49IB59ypvTnn0aWcl+GwUNbZj5Aqwivuz 6wuMR2g15zqWfe0njO00HV0GRYAQzEBPdYbnflG6qXjjXzKdSlS6WAAVIU+eL+PPAYaS rTieFw/u5EQyyiqRFa0/QQf5AMK5olZpH65oYu1a1d++sqv8sZXJT9aSVJlNTE+I89We rOLNHiVuP+9g3cQSX4wUVNqDExnKCrGpwRQyTmVARqpofp6bQzPwfvsl/aR6AGJUFMwg ujDhGtakWbunJEUaZ+vygP2cQzDnkRsbQt3ij/s3cVJG2XCnPUiZdWRb1bbgUkh9hoD4 u/AQ== X-Gm-Message-State: AOJu0YzHOaMV0te79AHmi9s0Dr+Ewuyzmve0pbK11/qWTOfmFrVcl8Wm GeiNOwNXjoyv9lmMEAODhV4vkw== X-Google-Smtp-Source: AGHT+IFgjmU2G+Cish/os/XJgU5/mjj81gMqFgSuu1O6gF75c7LT4BNdQoX7X5W2JPKjCrV6VKqnjQ== X-Received: by 2002:a05:6402:510:b0:522:ca6b:ad7d with SMTP id m16-20020a056402051000b00522ca6bad7dmr8349316edv.9.1694445035554; Mon, 11 Sep 2023 08:10:35 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:35 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:18 +0200 Subject: [PATCH RFT 04/20] media: venus: core: Set OPP clkname in a common code path MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-4-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2651; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=yWKtspCHH6VembG1lbkjXWBw413nk6iKNGzpyELOez8=; b=n21L3hKCSxuzjuglNuE7A8iIdmVtwk6Vqfkoet7bRWuHYWBjVCo76Z2Ah8Ynj6I31FRrZEjgs SWe8DcyMYZcB/X1vw5cGVJjEuMOhJR3OkbLOJve02C3YZ4/PS4MvkjG X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Calling devm_pm_opp_set_clkname() is repeated for all HFI versions in pm_ops->core_power. Move it to the common codepath. This also lets us get rid of core_get_v1. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 5 +++++ drivers/media/platform/qcom/venus/pm_helpers.c | 23 ++--------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 054b8e74ba4f..f32b20c3a565 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -317,6 +318,10 @@ static int venus_probe(struct platform_device *pdev) if (!core->pm_ops) return -ENODEV; + ret = devm_pm_opp_set_clkname(dev, "core"); + if (ret) + return ret; + if (core->pm_ops->core_get) { ret = core->pm_ops->core_get(core); if (ret) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 59e3eaad97ed..9bedb3bc7223 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -318,21 +318,6 @@ static int load_scale_v1(struct venus_inst *inst) return ret; } -static int core_get_v1(struct venus_core *core) -{ - int ret; - - ret = venus_clks_get(core); - if (ret) - return ret; - - ret = devm_pm_opp_set_clkname(core->dev, "core"); - if (ret) - return ret; - - return 0; -} - static void core_put_v1(struct venus_core *core) { } @@ -350,7 +335,7 @@ static int core_power_v1(struct venus_core *core, int on) } static const struct venus_pm_ops pm_ops_v1 = { - .core_get = core_get_v1, + .core_get = venus_clks_get, .core_put = core_put_v1, .core_power = core_power_v1, .load_scale = load_scale_v1, @@ -423,7 +408,7 @@ static int venc_power_v3(struct device *dev, int on) } static const struct venus_pm_ops pm_ops_v3 = { - .core_get = core_get_v1, + .core_get = venus_clks_get, .core_put = core_put_v1, .core_power = core_power_v1, .vdec_get = vdec_get_v3, @@ -1030,10 +1015,6 @@ static int core_get_v4(struct venus_core *core) if (legacy_binding) return 0; - ret = devm_pm_opp_set_clkname(dev, "core"); - if (ret) - return ret; - ret = vcodec_domains_get(core); if (ret) return ret; From patchwork Mon Sep 11 15:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721504 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 3513ECA0ECA for ; Mon, 11 Sep 2023 21:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236223AbjIKVQ1 (ORCPT ); Mon, 11 Sep 2023 17:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241554AbjIKPKo (ORCPT ); Mon, 11 Sep 2023 11:10:44 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CD3FA for ; Mon, 11 Sep 2023 08:10:39 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-52889bc61b6so6062574a12.0 for ; Mon, 11 Sep 2023 08:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445037; x=1695049837; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hB07AWQ6+/HjqLThhLj5XIDObxfEfer4Yjs2PDgZbco=; b=ZOtQyqzyDIvSBpOgiZn5wCN03fcMB8DKKexIkzt9gck0m4rhhhRweF+RLj+E1x22b0 W7HTTlJx9v73qxNjbP4ARBv8I6j2nnXKPllW0xMgQ+HZ4HL0XNtKfm4CFi0gE31dmSp4 zdxnYymR6lcOQwNj0Hqg05RxA8xM0qHorJY4Vlp7uS53wpywrg93uT0fC5ndfp/K4iI5 ep9jV30RkrC5j3AJFzrmgI62IxTAHcjLDnNsZg1E8BdX+b6tliC/h2X7i1ss8XP70NWV NjAJ3ozguAZdqlaV5LELJY3LgGJPBO8jH3t3y+D2zNCwP8M5lbtNE808bhdwumgTSsax oFUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445037; x=1695049837; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hB07AWQ6+/HjqLThhLj5XIDObxfEfer4Yjs2PDgZbco=; b=H7sQatpi598YhjxrOxCdYt4wUP0ub5V3v5qGc9ejKJSnqNLhjP9+9xMIxK6bxrbEJf lkr6ASMa8r5lS4zo6UtQINdHDNW522EiNwFiiz7MuT41tlDeJG2uCrRKTo2+PsFs6nqb DmEaoWSjzJuED0kkkmj7IvKk/3WH/swdmyZQJDZ0pNMjZStaSR2GrQUEqpftvsRMSoEo qV3vFoxsR7xv8fE7Fcwlpc5zWRcrVMOAAqmiYnDwy5+Mqpe6LWy0jTEkMJFdJ5fkengL xkBlArEkrZLihiv4fEFUtodJtAR4AprRENcKtbucsK4Xq+UOle+1yw3NnLW/0+0XVhTV XjVA== X-Gm-Message-State: AOJu0YxD24ZlzWoVL9wT3T9AnVfLCzJcgdcX+v2MffRZPZI2GQlnjlY2 FiDGv4VrQbIqY/3Ab7YRw9+iGw== X-Google-Smtp-Source: AGHT+IHJPABWpI7Eq8rnPAY/s+Tohmf2Ji1RKKVtBhUqvuYbf4fo8qwJMluBqGhBSsrvs20bqX1bFg== X-Received: by 2002:a05:6402:8c3:b0:522:20a0:7eb8 with SMTP id d3-20020a05640208c300b0052220a07eb8mr7959403edz.33.1694445037678; Mon, 11 Sep 2023 08:10:37 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:37 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:19 +0200 Subject: [PATCH RFT 05/20] media: venus: pm_helpers: Kill dead code MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-5-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2141; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=QMvOYSIDhNKQG6pzBZaUv6e9JhH/er8ZMPeUWk6srGI=; b=XK0JQo551H+KBf+i/fiVuIM7cxliwEN1dSWCIJuOIUFCAvdHNT1EBk3XeoIB/hy/oghd/Gh6b LIBRGGfXgMcCgxb3Vkt4cp666O9latCD1vNrsCFGEnccpEky0ql/Vv1 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org A situation like: if (!foo) goto bar; for (i = 0; i < foo; i++) ...1... bar: ...2... is totally identical to: for (i = 0; i < 0; i++) // === if (0) ...1... ...2... Get rid of such boilerplate. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 9bedb3bc7223..f5130aa3ddfc 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -875,9 +875,6 @@ static int vcodec_domains_get(struct venus_core *core) struct device *pd; unsigned int i; - if (!res->vcodec_pmdomains_num) - goto skip_pmdomains; - for (i = 0; i < res->vcodec_pmdomains_num; i++) { pd = dev_pm_domain_attach_by_name(dev, res->vcodec_pmdomains[i]); @@ -886,7 +883,6 @@ static int vcodec_domains_get(struct venus_core *core) core->pmdomains[i] = pd; } -skip_pmdomains: if (!core->res->opp_pmdomain) return 0; @@ -922,16 +918,12 @@ static void vcodec_domains_put(struct venus_core *core) const struct venus_resources *res = core->res; unsigned int i; - if (!res->vcodec_pmdomains_num) - goto skip_pmdomains; - 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); } -skip_pmdomains: if (!core->has_opp_table) return; @@ -945,9 +937,6 @@ static int core_resets_reset(struct venus_core *core) unsigned int i; int ret; - if (!res->resets_num) - return 0; - for (i = 0; i < res->resets_num; i++) { ret = reset_control_assert(core->resets[i]); if (ret) @@ -970,9 +959,6 @@ static int core_resets_get(struct venus_core *core) unsigned int i; int ret; - if (!res->resets_num) - return 0; - for (i = 0; i < res->resets_num; i++) { core->resets[i] = devm_reset_control_get_exclusive(dev, res->resets[i]); From patchwork Mon Sep 11 15:10:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722232 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 A985BCA0ECE for ; Mon, 11 Sep 2023 21:21:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344850AbjIKVOz (ORCPT ); Mon, 11 Sep 2023 17:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241558AbjIKPKp (ORCPT ); Mon, 11 Sep 2023 11:10:45 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE73AE50 for ; Mon, 11 Sep 2023 08:10:40 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-52c9f1bd05dso5971452a12.3 for ; Mon, 11 Sep 2023 08:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445039; x=1695049839; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rgZree7XzpnUt+LTvm3ELxdMecDcHuNrPgAPFwwrlDc=; b=HfLJPspUIOYNlxqjTf6haE4L3OKKIt45rqYpRPXihauSxAXaOMlMLYBLONtGQXj0/X 5s7H+iegg3zpdHZufOaxrsLh3XhluTpnijUHUkbmsND9jvBGC/iAk5RpAGvOaA7zqVTg JWld6t3dAZq+J5h3jI4fyNkisU6WkdUJr37ksp2LoLRYalYQr6GeNY68S/6wPb7FWsWV p+3pRypVJDsD7jPHDm2gE2ya66l/oMJsEuhwSA62E8RVNorsULsfxbXyC38oL2KzvYwp QQv9IU1UG1eoMYHhLvSrc1TOOGog4Bbz6XbCErSoEEFVKT6uA05X61G9XKFy+JupHCf8 iExA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445039; x=1695049839; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rgZree7XzpnUt+LTvm3ELxdMecDcHuNrPgAPFwwrlDc=; b=rkAh6yf4+QskXRP4NZXogZOcRgM2soTo6QZAx9XxPhpoZMLdROXEc67hLXuM6IKopp Aj5BEnlZNFheLv+kItJuGTpH3K/UovQ4+00QQU14+eQTSr3OtY7wzNw2NQMWz0gYTK3U Ed4FANg5VFpFZmkn+JSkEgnWy8QMViHNOxlKZ6Zn1wMpYB5aEd3+K6IibXpGFtHpVwBo YJ3qWNIg428lQ1eqUq5F/VpNEjh7SpqezFkPYBaRfxZPGLIvfqlXmHvhwa5K6U/u6f/n 6bJSUJyXsSGXB6VyOFtCYcFenUpqWwOLNHlQEh0Aw1/V1CiICRhhfiv7hTaJin0Aqobq rDdA== X-Gm-Message-State: AOJu0Yy6NlCHACHrlPMNjYb2L2amFLMcHBHUAHBjL2jR7UDUU2aP7um3 zjg2r80Z9vmeBAE1V7DHsdTKqg== X-Google-Smtp-Source: AGHT+IF6Autm6BEvISkfscmZhEQqCMFFMuaMCAzipStVpgAhuvU5zXf4w1yK4J40FXA+U9ObrHJAsg== X-Received: by 2002:a05:6402:2027:b0:529:4457:92ea with SMTP id ay7-20020a056402202700b00529445792eamr7948487edb.8.1694445039213; Mon, 11 Sep 2023 08:10:39 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:38 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:20 +0200 Subject: [PATCH RFT 06/20] media: venus: pm_helpers: Move reset acquisition to common code MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-6-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2552; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=PPoQc4dWxK9IfdAY7guj4bitRzCDNn4oxWqLDhFKXac=; b=FZ9N6btphy5IyNxFeo26cRZ7A+FoWhLl00Ms967tW3PwzNaN2mpOeDvWI4FHkyMzPdVQ1I8m7 FvaHtLL+VZeDOyU38CHcpwhkyuFVIZxuTq5o9sYz4ulCmz0tCN6Ly9k X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There is no reason to keep reset_get code local to HFIv4/v6. Move it to the common part. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 9 ++++++++- drivers/media/platform/qcom/venus/pm_helpers.c | 23 ----------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index f32b20c3a565..2445a814b39f 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -284,7 +285,7 @@ static int venus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct venus_core *core; - int ret; + int i, ret; core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); if (!core) @@ -322,6 +323,12 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; + for (i = 0; i < core->res->resets_num; i++) { + core->resets[i] = devm_reset_control_get_exclusive(dev, core->res->resets[i]); + if (IS_ERR(core->resets[i])) + return PTR_ERR(core->resets[i]); + } + if (core->pm_ops->core_get) { ret = core->pm_ops->core_get(core); if (ret) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index f5130aa3ddfc..0e04da8d7eb5 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -952,25 +952,6 @@ static int core_resets_reset(struct venus_core *core) return ret; } -static int core_resets_get(struct venus_core *core) -{ - struct device *dev = core->dev; - const struct venus_resources *res = core->res; - unsigned int i; - int ret; - - for (i = 0; i < res->resets_num; i++) { - core->resets[i] = - devm_reset_control_get_exclusive(dev, res->resets[i]); - if (IS_ERR(core->resets[i])) { - ret = PTR_ERR(core->resets[i]); - return ret; - } - } - - return 0; -} - static int core_get_v4(struct venus_core *core) { struct device *dev = core->dev; @@ -994,10 +975,6 @@ static int core_get_v4(struct venus_core *core) if (ret) return ret; - ret = core_resets_get(core); - if (ret) - return ret; - if (legacy_binding) return 0; From patchwork Mon Sep 11 15:10:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721508 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 8E665CA0ECA for ; Mon, 11 Sep 2023 21:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344926AbjIKVPI (ORCPT ); Mon, 11 Sep 2023 17:15:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241574AbjIKPKs (ORCPT ); Mon, 11 Sep 2023 11:10:48 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22E93E54 for ; Mon, 11 Sep 2023 08:10:42 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-52bcb8b199aso5854758a12.3 for ; Mon, 11 Sep 2023 08:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445040; x=1695049840; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=eqksqqet9giP3P0XUk93/EO90DV32S65YoklfEthG48=; b=PEaa9Hx9TPG6zdx7IL9Bhj96ejuQ/g2a9c9PJ7/rMTSPRb5VAY30ocux9bX67LGiz2 i6Hu9+Fksk2i6VPOKnz0OphxrxN5a4UvZNqweB2ygwpLTe1BMknU8lYdApo4oNmrwe6H dWFLRauaSNljpZDKpOjANwKXLwddvKKEZemIINiTPFXzQG87OMAyr3bFNr+z8wbSE+Hp 2+7RTrpkWoSjMh1QOd+rp0BcGDxio2WU1ZyxugmMFzU6ukFwiF2sW2a3DIxPjq3+11qd c0NaeL7NtWYIk1GGNTUR1w3pxDdvrTmZEdqXDft5MulcsekKONj1WHj+kfN6080yE4mR wEEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445040; x=1695049840; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eqksqqet9giP3P0XUk93/EO90DV32S65YoklfEthG48=; b=UNoPmycNwEBdr4tKU87cs/Nxvl84lDEkxCDMm2fWdwc3waSf23gqG7S9xu1pTt9FGB G2hRrSml70hadEKp1pZw+SyqmJrug+zvJTsQTGC6pdYnN53/Jks/Hi7XtUWictFDyuIo gGPp4u27pBkPZptGFH4IAom0hRSp7ApeQhm611JAE7qOXh9T6tvnyZBiCUtP4Nw0+gqx QgSkyZ9n+ux/rOopNMeFf83xedEcOUxFLS7IN2u96iL8PBlpHqMKempO+LhF6d8jHmwq hSZTZoGumws8bQKH2JLWtfZ7fOCrJ3UAC0As3NWjFZjNtz4sQ4X7LU/Rzz6CkyejqcNn 0AEQ== X-Gm-Message-State: AOJu0Yysc/L+Tx3nWMh927kFRZpoz910tGefI3Yc5CuF9AFpJXW6a4du sk3DvCejtsOgCgvmlXXjNEgEeA== X-Google-Smtp-Source: AGHT+IE+jaw7ewPd1k+s1HIhFxPDeTMpckNkvOy0b0OZFZgjpqByn02zIajpJpJNMZQlXzZ1K2kFhQ== X-Received: by 2002:aa7:dd12:0:b0:52e:5b10:23ac with SMTP id i18-20020aa7dd12000000b0052e5b1023acmr8561749edv.36.1694445040649; Mon, 11 Sep 2023 08:10:40 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:40 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:21 +0200 Subject: [PATCH RFT 07/20] media: venus: pm_helpers: Use reset_bulk API MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-7-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=3875; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=6SOAIR/YhjKNkqDg755glJQs4TpNo65/AFLcjoekzPI=; b=wqZ3x2u5JYMEJJayRe/YHzz6FOWYQf8wpqU38EmrFxVlwAa7Qk8rxo4z+QaAzyvTpEsAiU3fs +vd7vaWRJxjD2aqUtu9qFRdDChQJXF7YzAqTZhZD2Y/crOK1RfEJapR X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org All of the resets are toggled together. Use the bulk api to save on some code complexity. Note, this change is not exactly a NOP. Instead of waiting 150-250us between each reset toggle, the behavior now is to assert all the resets, wait 150-250us and deassert all the resets. This should be fine, but the logic here is really abusive, as such assertion requirements should be expressed per-reset_control, in the provider driver. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 15 ++++++++++----- drivers/media/platform/qcom/venus/core.h | 4 ++-- drivers/media/platform/qcom/venus/pm_helpers.c | 17 +++++------------ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 2445a814b39f..be633e62263c 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -323,11 +323,16 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; - for (i = 0; i < core->res->resets_num; i++) { - core->resets[i] = devm_reset_control_get_exclusive(dev, core->res->resets[i]); - if (IS_ERR(core->resets[i])) - return PTR_ERR(core->resets[i]); - } + core->resets = devm_kcalloc(dev, core->res->resets_num, sizeof(*core->resets), GFP_KERNEL); + if (core->res->resets_num && !core->resets) + return -ENOMEM; + + for (i = 0; i < core->res->resets_num; i++) + core->resets[i].id = core->res->resets[i]; + + ret = devm_reset_control_bulk_get_exclusive(dev, core->res->resets_num, core->resets); + if (ret) + return ret; if (core->pm_ops->core_get) { ret = core->pm_ops->core_get(core); diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 4a633261ece4..515e7d78b7ab 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -137,7 +137,7 @@ struct venus_format { * @pmdomains: an array of pmdomains struct device pointers * @opp_dl_venus: an device-link for device OPP * @opp_pmdomain: an OPP power-domain - * @resets: an array of reset signals + * @resets: a reset_control_bulk_data array of hardware reset signals * @vdev_dec: a reference to video device structure for decoder instances * @vdev_enc: a reference to video device structure for encoder instances * @v4l2_dev: a holder for v4l2 device structure @@ -190,7 +190,7 @@ struct venus_core { struct device *pmdomains[VIDC_PMDOMAINS_NUM_MAX]; struct device_link *opp_dl_venus; struct device *opp_pmdomain; - struct reset_control *resets[VIDC_RESETS_NUM_MAX]; + struct reset_control_bulk_data *resets; struct video_device *vdev_dec; struct video_device *vdev_enc; struct v4l2_device v4l2_dev; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 0e04da8d7eb5..7f22a078b38a 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -934,22 +934,15 @@ static void vcodec_domains_put(struct venus_core *core) static int core_resets_reset(struct venus_core *core) { const struct venus_resources *res = core->res; - unsigned int i; int ret; - for (i = 0; i < res->resets_num; i++) { - ret = reset_control_assert(core->resets[i]); - if (ret) - goto err; + ret = reset_control_bulk_assert(res->resets_num, core->resets); + if (ret) + return ret; - usleep_range(150, 250); - ret = reset_control_deassert(core->resets[i]); - if (ret) - goto err; - } + usleep_range(150, 250); -err: - return ret; + return reset_control_bulk_deassert(res->resets_num, core->resets); } static int core_get_v4(struct venus_core *core) From patchwork Mon Sep 11 15:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721505 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 900F6CA0EC8 for ; Mon, 11 Sep 2023 21:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235920AbjIKVQX (ORCPT ); Mon, 11 Sep 2023 17:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241575AbjIKPKs (ORCPT ); Mon, 11 Sep 2023 11:10:48 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852F0E4D for ; Mon, 11 Sep 2023 08:10:43 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-52a4737a08fso5740363a12.3 for ; Mon, 11 Sep 2023 08:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445042; x=1695049842; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Y+Ee+p0MgR8f6mi4LN6zTW+Ly80MKvHlH7hIzIx/iCU=; b=Aqshvo2VtW5e0tfNPzDCC6ikf6iuO9yq9RI2WZlC7DF2r1jRGFiAWydnaYYYit5/Tu hH+yqAnblkvW03+OFHPD2kFzugN0OHusgDSGt9tl+2mSKn9FeH6AIIQGj5bUyieCy8aK GAA6gbbklHl0k99/Bdar3ERNdGacgMLfcNK/qnoWDnEOMvc13bYlSct0ovzXBbbT4CWT x5P1jUgW3z4Ife2h8ghgctbioosFDCIb5KAb0eP/OlmkfZWhjcKmL99a2myPZk/KirmM 8EobZMqOrvchPNdteVmJ8SuQKymx05+BdK4MyRfl+lPbW9BUFvPXSMFIAMJ80+WeFxVi C54w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445042; x=1695049842; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y+Ee+p0MgR8f6mi4LN6zTW+Ly80MKvHlH7hIzIx/iCU=; b=fBcfBSr0FRSDEzTDOymknakK/1pa9YxmVaK8SwY3c6toFI7GvZLmf2kAobBzgyyoNO XgRTJ5DGceUGE+MZROtreHA9ktvbnrYyIztXn8iPynrH8M6b8q56o1c4c80FgfI297mk R/KWjEJyTa12188A15WTfnbGXP6c4INHf/utVWwAo1BXgDECf/Dmg2alxcrJeSX6Qb12 TUrjEk1fCkXAKsKn/oOQ6X0/RyEBbMHB8Kh0Y5kKwwKKbfZSfbudcEvvbp3uEwn57YCs roPKtWIWkjw3FwjlgwSx7mgwn3gOddgqfjdsSSZM+q6PgtagrKNYHEhBs6INhRom6h8r bLMw== X-Gm-Message-State: AOJu0Yx8/a1rj7q0GsmKI4JIUdnv6X8WxXcdStiq1azJsN8uOQ3Scw2l j718l+Vs3s3Myg1NY8hDCn46sQ== X-Google-Smtp-Source: AGHT+IHX+V1ZfRnb2p4Ait7p0NyTMhK+xnoPHBwMKdGlpVFN5o5gm33rn7JA6oNx0OyzZg92Pk+OTA== X-Received: by 2002:aa7:d9c8:0:b0:525:6666:3551 with SMTP id v8-20020aa7d9c8000000b0052566663551mr7753512eds.27.1694445042122; Mon, 11 Sep 2023 08:10:42 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:41 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:22 +0200 Subject: [PATCH RFT 08/20] media: venus: core: Constify all members of the resource struct MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-8-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2695; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=W0g0byTl6c4puFfQRs30LwSqiMEXDbtkmuwi72umncI=; b=h+Lq+Zn8i1er1pX71A5d9g50NTac8o2WQ32FO2tyoRiMIEanxulG/HCnQs9kEGCslGEsXACs1 S5RLewuAk2JDxlr5PAQwqtuJGb+EIBjLWo3Vlc/hYGQBhvKN7+QaJ7r X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Nothing inside the resource struct needs to be mutable. Sprinkle 'const' all over it. A lot of 'const'. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.h | 56 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 515e7d78b7ab..9a38d568117a 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -57,39 +57,39 @@ enum vpu_version { }; struct venus_resources { - u64 dma_mask; - const struct freq_tbl *freq_tbl; - unsigned int freq_tbl_size; - const struct bw_tbl *bw_tbl_enc; - unsigned int bw_tbl_enc_size; - const struct bw_tbl *bw_tbl_dec; - unsigned int bw_tbl_dec_size; - const struct reg_val *reg_tbl; - unsigned int reg_tbl_size; - const struct hfi_ubwc_config *ubwc_conf; + const u64 dma_mask; + const struct freq_tbl * const freq_tbl; + const unsigned int freq_tbl_size; + const struct bw_tbl * const bw_tbl_enc; + const unsigned int bw_tbl_enc_size; + const struct bw_tbl * const bw_tbl_dec; + const unsigned int bw_tbl_dec_size; + const struct reg_val * const reg_tbl; + const unsigned int reg_tbl_size; + const struct hfi_ubwc_config * const ubwc_conf; const char * const clks[VIDC_CLKS_NUM_MAX]; - unsigned int clks_num; + const unsigned int clks_num; const char * const vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; const char * const vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; - unsigned int vcodec_clks_num; + const unsigned int vcodec_clks_num; const char * const vcodec_pmdomains[VIDC_PMDOMAINS_NUM_MAX]; - unsigned int vcodec_pmdomains_num; - const char **opp_pmdomain; - unsigned int vcodec_num; + const unsigned int vcodec_pmdomains_num; + const char * const * const opp_pmdomain; + const unsigned int vcodec_num; const char * const resets[VIDC_RESETS_NUM_MAX]; - unsigned int resets_num; - enum hfi_version hfi_version; - enum vpu_version vpu_version; - u8 num_vpp_pipes; - u32 max_load; - unsigned int vmem_id; - u32 vmem_size; - u32 vmem_addr; - u32 cp_start; - u32 cp_size; - u32 cp_nonpixel_start; - u32 cp_nonpixel_size; - const char *fwname; + const unsigned int resets_num; + const enum hfi_version hfi_version; + const enum vpu_version vpu_version; + const u8 num_vpp_pipes; + const u32 max_load; + const unsigned int vmem_id; + const u32 vmem_size; + const u32 vmem_addr; + const u32 cp_start; + const u32 cp_size; + const u32 cp_nonpixel_start; + const u32 cp_nonpixel_size; + const char * const fwname; }; enum venus_fmt { From patchwork Mon Sep 11 15:10:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722229 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 56667CA0EC8 for ; Mon, 11 Sep 2023 21:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344770AbjIKVOo (ORCPT ); Mon, 11 Sep 2023 17:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241581AbjIKPKt (ORCPT ); Mon, 11 Sep 2023 11:10:49 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D392E40 for ; Mon, 11 Sep 2023 08:10:45 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-52889bc61b6so6062766a12.0 for ; Mon, 11 Sep 2023 08:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445043; x=1695049843; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=57SqA+LXlncdOSRG7NfyWVutfyFwNDJRXLwGDrFIQwc=; b=xhy7Kiwv+rxwl6x1ytMMjhpvq3xT1Hy3kKP5dD2BwrjZxLUmsBQhRfdHlowffElaqe QKLRMkLTy0VAbbRKyjeCcqMm4+odEshO1kRIkCRNv3RwwUwQPqhvt9NOPGqSRgVWCBUm rrjmmtKXZkU1vs3ngPyWXYsyJddCuPJrrvHC/rLVFEMzXIIC1X94SXkEdSvqA7nDgyMg uNTR/W9iQDq59PoLp1lN93Ae753XEllnZ5RLST2+IH/RONl0AY98+PDuFbziv3a+uR8V /S0eZpPYnikiUf5ZX9x6lNfOpLxX6i9swHz/b3hOGyZSqhWxd2IPtC292nV5TJloVUBw cT3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445043; x=1695049843; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=57SqA+LXlncdOSRG7NfyWVutfyFwNDJRXLwGDrFIQwc=; b=kwhN91B+wsdET+fWSe1M1xvcK5kRZGHHAGZR10lmeNMh5RWmKCKqYtL6PqkiRfyOiA CJa9eFZEI960lOM6QjYyHkzFyYxlPiRbKvBJ+MB8dvXfpulLKFzlXNdoEoalFxDP1RrT 6qMlMHMu1134WUO+xT4NrxAZL/LMSp0UI+t+BhnYY05QwF9wSuNPYaCMsRSBNnbsXYGy CPOQ6bSrukk6ndsL8ie/svTo3W6Nbu2EpYZtFXgrvqYnuWd7HDhTTDoOJRCF1wd110i0 TjnEZJ1T927m/eQqMTqaEQ1aZaoUAdKP+6qrZVeL5/tpeJW+ST33B92O/6sfRxMZZFdU mO7w== X-Gm-Message-State: AOJu0Yz67hihb3N/lM7b9GA2ij1Gn+L3E84NP/K1PIqK7vPEiLlaPQ8T JGSORC6chHwcvEmqmDRDEADe/A== X-Google-Smtp-Source: AGHT+IEM1XY9Q9mfMFjuXXxZ7I4BGgfXUz25Bc65y8IWsWS3kRv9n//07VTtiG7GlZMNexyHlYlgjA== X-Received: by 2002:a05:6402:333:b0:522:3d36:ff27 with SMTP id q19-20020a056402033300b005223d36ff27mr8334041edw.31.1694445043745; Mon, 11 Sep 2023 08:10:43 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:43 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:23 +0200 Subject: [PATCH RFT 09/20] media: venus: core: Deduplicate OPP genpd names MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-9-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2397; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=kcD6HPiGF+k3gCBcQjb5aEtKWIEejr4RKDg3yYPZBxk=; b=cqHVKPHualNUKjgbmwbOyX8dv1M+FNYrsWDzSsXlebm35My/ZRPJeQY3KMnsVDeb10D3vEdzY evpaFxxtljGD0oaNimSg5uCYI/l4N6eRVMKen6RUkY3z7U1fXR4qXnI X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of redefining the same literals over and over again, define them once and point the reference to that definition. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index be633e62263c..8aac7f60fc81 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -541,6 +541,9 @@ static const struct dev_pm_ops venus_pm_ops = { SET_RUNTIME_PM_OPS(venus_runtime_suspend, venus_runtime_resume, NULL) }; +static const char * const pd_names_cx[] = { "cx", NULL }; +static const char * const pd_names_mx[] = { "mx", NULL }; + static const struct freq_tbl msm8916_freq_table[] = { { 352800, 228570000 }, /* 1920x1088 @ 30 + 1280x720 @ 30 */ { 244800, 160000000 }, /* 1920x1088 @ 30 */ @@ -724,7 +727,7 @@ static const struct venus_resources sdm845_res_v2 = { .vcodec_clks_num = 2, .vcodec_pmdomains = { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = pd_names_cx, .vcodec_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, @@ -773,7 +776,7 @@ static const struct venus_resources sc7180_res = { .vcodec_clks_num = 2, .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = pd_names_cx, .vcodec_num = 1, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -830,7 +833,7 @@ static const struct venus_resources sm8250_res = { .vcodec_clks_num = 1, .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "mx", NULL }, + .opp_pmdomain = pd_names_mx, .vcodec_num = 1, .max_load = 7833600, .hfi_version = HFI_VERSION_6XX, @@ -889,7 +892,7 @@ static const struct venus_resources sc7280_res = { .vcodec_clks_num = 2, .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = pd_names_cx, .vcodec_num = 1, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, From patchwork Mon Sep 11 15:10:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722230 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 9BE01CA0EC5 for ; Mon, 11 Sep 2023 21:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344867AbjIKVO4 (ORCPT ); Mon, 11 Sep 2023 17:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241590AbjIKPKw (ORCPT ); Mon, 11 Sep 2023 11:10:52 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13A6DE4B for ; Mon, 11 Sep 2023 08:10:47 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31f7400cb74so3734515f8f.2 for ; Mon, 11 Sep 2023 08:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445045; x=1695049845; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=spHpGVd+zWE6f7Ydbw/UHW0+Hj7H33rl1DfjyP47SF4=; b=JZcLo7Eg8ALbmFDX5fQEP6gHt0MZgrRZkScd/OEQBWQEKIKaphzqjhvhUTVzCbn3h4 //u4HuR8aNC1A6zb26GYTDYB5PWBaQL3i5V6i3yAnQ8KAtPgOHem04rNQK46mCdeOu72 28pjKCr7mMR7V/A01ahwOzuSuf0jkDTMvnYjBTgY8KJQlrmthn/kJg24tNPYTF1yTtuT pgOk2tj8gIOz11eQcqF4PzOaV7oakpWqq7WMg89H7kPtiRRmZNUWZoHC819ZrUxmKWsZ UnMgMIs/vDz3QRAlkls4y9Tu6rfPLtRGA+bQYeFX9Shpyr6V0DeK/HhlL/AB2G75O54i lWzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445045; x=1695049845; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=spHpGVd+zWE6f7Ydbw/UHW0+Hj7H33rl1DfjyP47SF4=; b=ibu+GXCkanvyH2aK9Hi5zxEn/zRcl/La9uzbBphctzV3XVIUiqu+n6AKMDD+6TbqGt l0VWZXosL/QenkO5eXcaXsX6f7k7tPaGHEHam2PM2T/DbZP8WpqsBwhZGSX1PLjfqLdC uCyh1s0WVVnJZueSffG7dMqpP701kOVskRg6e9oL8lTtYfWnS921FUyy/g8+ZuqVUKW3 QfzNpzNG+XqPJm6JH3aAe915UlEQJ7g+QmfyPz0Zw0F+Vfg0PBEEbCJxXUpPrEJQgrJf PFlKHmRQ8PDAvmFdW2r9LtN0s39NnLBF1hsHL7BHScvSWu/0iRyeQMxlpAsCuM4WbBOa jhyw== X-Gm-Message-State: AOJu0Yxu4eJgBozzeU0Xm7VEPsdsHVE51iJJws5/4oT8l8JAzXkJeGAP T0IJoAZcYwbgHQeUhKP0vXChcw== X-Google-Smtp-Source: AGHT+IF9n8CHyg52W67gOGjSdWupf5OMQPqUAhCiwoTnkFLT1nNeDkt3jhXGl7lq9AZkswN325E1+w== X-Received: by 2002:a5d:5e07:0:b0:31f:accf:bf0d with SMTP id ce7-20020a5d5e07000000b0031faccfbf0dmr2123820wrb.31.1694445045574; Mon, 11 Sep 2023 08:10:45 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:45 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:24 +0200 Subject: [PATCH RFT 10/20] media: venus: core: Get rid of vcodec_num MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-10-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=3392; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=E27PEdtMbBCeTz/SFqV5c29UzEMxfDQhGYV4gJ2hkIU=; b=eP4J6G7A9i2lLxLYhcoqh71Uc92r7ve2wbf+NBuVaQNSf9izMM8bxIK75Ts6XO4kACND90Syh 2QQ2fNoX89ABnCC6EQx1ivSgkt68Jdq1uOFNxGL5VRPfGh+iiIZU7DB X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org That field was only introduced to differentiate between the legacy and non-legacy SDM845 binding. Get rid of it. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 5 ----- drivers/media/platform/qcom/venus/core.h | 1 - drivers/media/platform/qcom/venus/pm_helpers.c | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 8aac7f60fc81..e83c790ccc80 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -654,7 +654,6 @@ static const struct venus_resources sdm660_res = { .vcodec0_clks = { "vcodec0_core" }, .vcodec1_clks = { "vcodec0_core" }, .vcodec_clks_num = 1, - .vcodec_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, .vmem_id = VIDC_RESOURCE_NONE, @@ -728,7 +727,6 @@ static const struct venus_resources sdm845_res_v2 = { .vcodec_pmdomains = { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, .opp_pmdomain = pd_names_cx, - .vcodec_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -777,7 +775,6 @@ static const struct venus_resources sc7180_res = { .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, - .vcodec_num = 1, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, .vmem_id = VIDC_RESOURCE_NONE, @@ -834,7 +831,6 @@ static const struct venus_resources sm8250_res = { .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_mx, - .vcodec_num = 1, .max_load = 7833600, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2, @@ -893,7 +889,6 @@ static const struct venus_resources sc7280_res = { .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, - .vcodec_num = 1, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 9a38d568117a..de180f8e7973 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -75,7 +75,6 @@ struct venus_resources { const char * const vcodec_pmdomains[VIDC_PMDOMAINS_NUM_MAX]; const unsigned int vcodec_pmdomains_num; const char * const * const opp_pmdomain; - const unsigned int vcodec_num; const char * const resets[VIDC_RESETS_NUM_MAX]; const unsigned int resets_num; const enum hfi_version hfi_version; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 7f22a078b38a..816d16f9153a 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -622,7 +622,7 @@ min_loaded_core(struct venus_inst *inst, u32 *min_coreid, u32 *min_load, bool lo VIDC_CORE_ID_1 : VIDC_CORE_ID_2; *min_load = min(core1_load, core2_load); - if (cores_max < VIDC_CORE_ID_2 || core->res->vcodec_num < 2) { + if (cores_max < VIDC_CORE_ID_2 || legacy_binding) { *min_coreid = VIDC_CORE_ID_1; *min_load = core1_load; } From patchwork Mon Sep 11 15:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722234 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 09465CA0EC4 for ; Mon, 11 Sep 2023 21:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344814AbjIKVOu (ORCPT ); Mon, 11 Sep 2023 17:14:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241596AbjIKPKy (ORCPT ); Mon, 11 Sep 2023 11:10:54 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B452FFA for ; Mon, 11 Sep 2023 08:10:48 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-501bd164fbfso7402577e87.0 for ; Mon, 11 Sep 2023 08:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445047; x=1695049847; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KoRoq/DrVvkmjCXseaDmK4CEsiQOZW3LoyiqrnjQB9s=; b=FL7EHe9/CZuMCn13KeDyBF2tco7gj9DSQ98KZqSXvcHD5jc7RJ3C9nRJubp9FJx9gN cjd2DrbiiU2nixHyI/s1/ny/xrha7MsqOeHVNf3srOTKQe6+d8sH45EkSOVcLdTwGRZe ncb8rkVgQr1wxxlJX5dWtvKcMC41EVn2vVkrVM/ESmxeBkZtw98+9zVERmTbpFEd52qB 12SGYPcSQUHoaPi0olbZQwHgazt3I0m6/XGMVfJeiycK6N6ddEcNz/6jjypbnCkxxWLt wJ1JmlyjEYyhtJXi5jk/xcMHg4ieMISoaeG6nS42eDcfJrqb1jf57qVLnqvTNPEEibBa Bvtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445047; x=1695049847; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KoRoq/DrVvkmjCXseaDmK4CEsiQOZW3LoyiqrnjQB9s=; b=KGIioyMwrlESuDyY/L3xaApHtLctM1mUn9971NVkxj23rN5oEtXJ0r8DnXLt+G8jzP zLxUc64bgGXESAGt/1GuJRn2dcFm5onbQvDa9fDdv1Jz2wCulrSKE5MkTwgCtNTy0eiu C0Tp2JxvRatoAzvXIR+jD5bzz6xK4VARvbvFtwBw2Uz5hRu8um68XWMDqR50dv7XCrVk 6RY8k4fsnQozEUMLYk9p89MbY7jWwvvZLXx6fJ1MGAemz1VfxueAxmnoUzsBOsMrdpGN Y7GZCUu0tA1qpArQOu6Hu5SubJCQJzmkVzuw+uiYw0mvQTTim1eXnRNiHQhkSl7+2lfZ QOxg== X-Gm-Message-State: AOJu0YyU5MgVbFTgSKOKd8O9BGrRJOJ8GzF9txGsRRbLL09vOTVfOixL qDKmTMDBcLmdATsDdp3RI4EjBw== X-Google-Smtp-Source: AGHT+IHoUjK7egly+lD/FRgwIWWwd0EnDIrheAdA1IHTTas5hH3dS+VKbAAlXhaXrbGwZUjKW8W1UA== X-Received: by 2002:a05:6512:32ce:b0:500:8725:1351 with SMTP id f14-20020a05651232ce00b0050087251351mr9174605lfg.47.1694445047031; Mon, 11 Sep 2023 08:10:47 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:46 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:25 +0200 Subject: [PATCH RFT 11/20] media: venus: core: Drop cache properties in resource struct MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-11-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=4750; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=57eNoVLc7ASkVVxqDox1DzeFGbIIkYlRHNb+x5nOma8=; b=jh0ibHJFu9sbgdYfiEbIJxIc6y4/EIqdz8xPYnEoE30HDEuwsQsATcGFHDvoManghaUvQqknx tuH6SMDJpJND4u6j71qqgAPPFNZbaCnLbKuS1YyYgEXNjLUb3PW8hU7 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently VMEM/OCMEM/LLCC is disabled on all platforms. Make it unconditional to save on space. These caches will not be enabled until the Venus driver can reference them as chunks of SRAM (they're modelled as separate devices) to avoid hardcoding magic addresses and rougely accessing the hardware, bypassing the normal accessors. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 24 ------------------------ drivers/media/platform/qcom/venus/core.h | 3 --- drivers/media/platform/qcom/venus/hfi_venus.c | 7 ++++--- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index e83c790ccc80..5d4d62751357 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -565,9 +565,6 @@ static const struct venus_resources msm8916_res = { .clks_num = 3, .max_load = 352800, /* 720p@30 + 1080p@30 */ .hfi_version = HFI_VERSION_1XX, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xddc00000 - 1, .fwname = "qcom/venus-1.8/venus.mdt", }; @@ -598,9 +595,6 @@ static const struct venus_resources msm8996_res = { .vcodec_clks_num = 1, .max_load = 2563200, .hfi_version = HFI_VERSION_3XX, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xddc00000 - 1, .fwname = "qcom/venus-4.2/venus.mdt", }; @@ -656,9 +650,6 @@ static const struct venus_resources sdm660_res = { .vcodec_clks_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .cp_start = 0, .cp_size = 0x79000000, .cp_nonpixel_start = 0x1000000, @@ -705,9 +696,6 @@ static const struct venus_resources sdm845_res = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .fwname = "qcom/venus-5.2/venus.mdt", }; @@ -730,9 +718,6 @@ static const struct venus_resources sdm845_res_v2 = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .cp_start = 0, .cp_size = 0x70800000, @@ -777,9 +762,6 @@ static const struct venus_resources sc7180_res = { .opp_pmdomain = pd_names_cx, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .cp_start = 0, .cp_size = 0x70800000, @@ -835,9 +817,6 @@ static const struct venus_resources sm8250_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2, .num_vpp_pipes = 4, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .fwname = "qcom/vpu-1.0/venus.mbn", }; @@ -892,9 +871,6 @@ static const struct venus_resources sc7280_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, - .vmem_id = VIDC_RESOURCE_NONE, - .vmem_size = 0, - .vmem_addr = 0, .dma_mask = 0xe0000000 - 1, .fwname = "qcom/vpu-2.0/venus.mbn", }; diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index de180f8e7973..fe4cb566d8e9 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -81,9 +81,6 @@ struct venus_resources { const enum vpu_version vpu_version; const u8 num_vpp_pipes; const u32 max_load; - const unsigned int vmem_id; - const u32 vmem_size; - const u32 vmem_addr; const u32 cp_start; const u32 cp_size; const u32 cp_nonpixel_start; diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index 19fc6575a489..e6db820a1d5e 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1075,9 +1075,10 @@ static irqreturn_t venus_isr_thread(struct venus_core *core) venus_process_msg_sys_error(hdev, pkt); break; case HFI_MSG_SYS_INIT: - venus_hfi_core_set_resource(core, res->vmem_id, - res->vmem_size, - res->vmem_addr, + /* Disable OCMEM/VMEM unconditionally until support is added */ + venus_hfi_core_set_resource(core, VIDC_RESOURCE_NONE, + 0, + 0, hdev); break; case HFI_MSG_SYS_RELEASE_RESOURCE: From patchwork Mon Sep 11 15:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721529 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 6F487CA0ED7 for ; Mon, 11 Sep 2023 21:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344135AbjIKVNX (ORCPT ); Mon, 11 Sep 2023 17:13:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241597AbjIKPKz (ORCPT ); Mon, 11 Sep 2023 11:10:55 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A6BCE58 for ; Mon, 11 Sep 2023 08:10:50 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-52eed139ec2so4288911a12.2 for ; Mon, 11 Sep 2023 08:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445048; x=1695049848; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JB7dev33CQqq2PRU515LRyfUHgQkgO8/svwIwjBxrso=; b=nXBvtg2cYBFaYKERUnVFQptVoWCmSUKpDt+wIKO1oTai6FfArVnq2T1YLT9ZZpdsdX RRWLEZ7II/wav8FWN1yUU9HXh3pa7Vn75G6AM1fFrcEfQWK2zuMnIH3BD78XGdbCdzgw MsK4dn9DeGiRETAcSsw+H0hBzW9qLnqa9ggd8o1yGHhyyxM6/BB5k8ljDOaXcSOyhqOJ SutHGuhrNQDIVFY6fTgm4nDXw+nAN5eTYru7nSOEwzRcy3eQUOiuMM5OsMInezlxfb7k aA31VW3sNiC1BEbiZp2lRDEqVwsHdxtSJHzAqNvIvgBzzci34zNEQ9TKUME+39PRHDiM /46g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445048; x=1695049848; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JB7dev33CQqq2PRU515LRyfUHgQkgO8/svwIwjBxrso=; b=ZsrZq6kvecn2TEq+iqcFxxmoO5R2imR7h33IaLWmodqFya0K98nK5yjDOwhdL59Vt4 JhdhCnOuVcmUrhhc8B2F0nAmqwLsohFmKPMLXvoqLwBhjEifZje5fxE1iQS19ZyhBIiU l/V9uGITIBbv0dnZU5v+N+9ijKJTTJ+YTIA03WC1ra40GIzmGVvf8OOeNv/bBzjPHqmP dD86bfDB7inP+sLPe7Z3sg5PbrdsUgcizu4PopNBuybTE/n/vjRh0mS4JJcrNlbD8kBq vDU7H2WlBmu65Ahtgcqj1aA/7HgLYK0t4iYTgoCNmRClATqobd5HXXqazYC5g/TFbBhQ qp+A== X-Gm-Message-State: AOJu0Yz+vuDbN5hGMzpKgOPeXgNx5R8DGvkFiAQF5qSYVu191qxr33b8 Zyw7jr28c2Yz0PgETQfmWgSagg== X-Google-Smtp-Source: AGHT+IHOrUawuw+u7QVtpnfwQLDVGjW95dOdTx3R9QAqJJ8vsJmZNzqMq3h8nCnS59f0knKZHoFyuw== X-Received: by 2002:a50:fc08:0:b0:522:31d5:ee8e with SMTP id i8-20020a50fc08000000b0052231d5ee8emr7942862edr.8.1694445048504; Mon, 11 Sep 2023 08:10:48 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:48 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:26 +0200 Subject: [PATCH RFT 12/20] media: venus: core: Use GENMASK for dma_mask MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-12-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2674; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=0i/wL/gXye6AMRW7xTiL3gEDEa6DSycySKcFuITtV7c=; b=9njRxETBp6BVf2eTPJnydMws8pDjU9hmhMA9EAXKj2fwspYSCUtrrbXXXzUDtbMNERpTc4XGC o9auiXwoKyfB6CwEhwV+FjPvOlFqusbM8zqbH2pm+pJ/7Xq5t3xAfWW X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The raw literals mean very little. Substitute it with more telling bitops macros. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 5d4d62751357..4dec10d21b05 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -565,7 +565,7 @@ static const struct venus_resources msm8916_res = { .clks_num = 3, .max_load = 352800, /* 720p@30 + 1080p@30 */ .hfi_version = HFI_VERSION_1XX, - .dma_mask = 0xddc00000 - 1, + .dma_mask = (GENMASK(31, 30) | GENMASK(28, 26) | GENMASK(24, 22)) - 1, .fwname = "qcom/venus-1.8/venus.mdt", }; @@ -595,7 +595,7 @@ static const struct venus_resources msm8996_res = { .vcodec_clks_num = 1, .max_load = 2563200, .hfi_version = HFI_VERSION_3XX, - .dma_mask = 0xddc00000 - 1, + .dma_mask = (GENMASK(31, 30) | GENMASK(28, 26) | GENMASK(24, 22)) - 1, .fwname = "qcom/venus-4.2/venus.mdt", }; @@ -696,7 +696,7 @@ static const struct venus_resources sdm845_res = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .fwname = "qcom/venus-5.2/venus.mdt", }; @@ -718,7 +718,7 @@ static const struct venus_resources sdm845_res_v2 = { .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, @@ -762,7 +762,7 @@ static const struct venus_resources sc7180_res = { .opp_pmdomain = pd_names_cx, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, @@ -817,7 +817,7 @@ static const struct venus_resources sm8250_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2, .num_vpp_pipes = 4, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .fwname = "qcom/vpu-1.0/venus.mbn", }; @@ -871,7 +871,7 @@ static const struct venus_resources sc7280_res = { .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, .num_vpp_pipes = 1, - .dma_mask = 0xe0000000 - 1, + .dma_mask = GENMASK(31, 29) - 1, .fwname = "qcom/vpu-2.0/venus.mbn", }; From patchwork Mon Sep 11 15:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722260 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 46536CA0ED8 for ; Mon, 11 Sep 2023 21:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236626AbjIKVK7 (ORCPT ); Mon, 11 Sep 2023 17:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241605AbjIKPK5 (ORCPT ); Mon, 11 Sep 2023 11:10:57 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F82FA for ; Mon, 11 Sep 2023 08:10:52 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-52683da3f5cso5893230a12.3 for ; Mon, 11 Sep 2023 08:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445050; x=1695049850; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dl99i48dgkFaFiuiu5aVJ8kJhbaWRuqEuatgk+IWw2o=; b=bB3xlBfauwKWWh6/VqQaM0saC7TVMEgb8exvJY+TC2Ll4kYlFjolOF0jhadlMEMFTZ tVd3b1rMiQlpIm208lr0IrvotSsC+c8xy9lzdDUTiX/gQBxo8WEaaQSKHTAQLSUkrp/b Lj70KCI6B7iQGmzmFzLgMHshxxhHzb9ltKZtloIvoSVUt/a2QcsP0FqykMtWOGUA3Jy+ mbcocYFWgSTpnvwK4OqM0FiBRAA4AyxRinXy8I8mGJlBa7RCW1YPtweMJNd6UDVo3N/m 0wG1j2lwILOR7qtPDog/Q4LUQ7PmNmZ5ScFkTcDRi61nnEAlPAomqLMOJ6pXZeXJOCAm SWcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445050; x=1695049850; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dl99i48dgkFaFiuiu5aVJ8kJhbaWRuqEuatgk+IWw2o=; b=vXGHKSokXJP/Wee55iKheJ2aFgcnJ9snZagd/rIpDCjs9Jxy6w+5NhZCRdggyrCzPn 6u18gK2JQwbYT8QzkSgzaMSpUre84/i3BzHaPtvGwej7gujwhmOBCdG0Z0600kalwMzY anu5Nf9KiFn38iOciTPVfDnimp0o9UJjGmJU3rr2T55wK68Rf/YCfsoXzfC74VfYUsil MoLBt2EJqZ3t1RVFTsxNWxEfNVMYeosRd1fTjMxGecTD8me3wLBeWiEVDVihV705RTnZ ITEEJy55pN8lcINBrLiyBn85DJ4CYYBwi8Y36c123vat1i6KmcmLAnTSAeP2+IZ/YEbm cjQg== X-Gm-Message-State: AOJu0YycS583GvKBo8MkJHcqQmo+4tGjbZOk8d7rlKmJXZZ/p1OGqUKQ X6/GpzzTb1Ee9KfURW7zx1m5DA== X-Google-Smtp-Source: AGHT+IGjTwoKuO/nF9f+giZJp6zZCYwNV0et/hED8EkqY7QJ0N5afC2ym6nB9rOu5fmSKCdB4pPe6w== X-Received: by 2002:aa7:d753:0:b0:522:2711:863 with SMTP id a19-20020aa7d753000000b0052227110863mr8641195eds.1.1694445050506; Mon, 11 Sep 2023 08:10:50 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:50 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:27 +0200 Subject: [PATCH RFT 13/20] media: venus: core: Remove cp_start MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-13-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2989; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=h53ZKh/yNo0bLYPAMV5n1Zw9RfUgxMBrX/Tc7gbPrsU=; b=MyR4nzOnMYNiQhw1jH6W3MyPjnn9iMncEi0lurWq1TO1u8q7eGsXCtmFz5wNbn4MLq1ZYMleS 2DmBMguD4EUCFp4kFzbiIdckpfA+/Nsvm4/o53Hzrpc+oIcI4AflYkB X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org It's hardcoded to be zero. Always. Ever since msm-3.10. Or maybe even before. Remove it! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 3 --- drivers/media/platform/qcom/venus/core.h | 1 - drivers/media/platform/qcom/venus/firmware.c | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 4dec10d21b05..bd624e965a92 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -650,7 +650,6 @@ static const struct venus_resources sdm660_res = { .vcodec_clks_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, - .cp_start = 0, .cp_size = 0x79000000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x28000000, @@ -719,7 +718,6 @@ static const struct venus_resources sdm845_res_v2 = { .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, .dma_mask = GENMASK(31, 29) - 1, - .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x24800000, @@ -763,7 +761,6 @@ static const struct venus_resources sc7180_res = { .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, .dma_mask = GENMASK(31, 29) - 1, - .cp_start = 0, .cp_size = 0x70800000, .cp_nonpixel_start = 0x1000000, .cp_nonpixel_size = 0x24800000, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index fe4cb566d8e9..16acf738fd6c 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -81,7 +81,6 @@ struct venus_resources { const enum vpu_version vpu_version; const u8 num_vpp_pipes; const u32 max_load; - const u32 cp_start; const u32 cp_size; const u32 cp_nonpixel_start; const u32 cp_nonpixel_size; diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index fe7da2b30482..16e578780be7 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -245,7 +245,6 @@ int venus_boot(struct venus_core *core) if (core->use_tz && res->cp_size) { /* * Clues for porting using downstream data: - * cp_start = 0 * cp_size = venus_ns/virtual-addr-pool[0] - yes, address and not size! * This works, as the non-secure context bank is placed * contiguously right after the Content Protection region. @@ -253,7 +252,7 @@ int venus_boot(struct venus_core *core) * cp_nonpixel_start = venus_sec_non_pixel/virtual-addr-pool[0] * cp_nonpixel_size = venus_sec_non_pixel/virtual-addr-pool[1] */ - ret = qcom_scm_mem_protect_video_var(res->cp_start, + ret = qcom_scm_mem_protect_video_var(0, res->cp_size, res->cp_nonpixel_start, res->cp_nonpixel_size); From patchwork Mon Sep 11 15:10:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722226 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 46AE7CA0ED2 for ; Mon, 11 Sep 2023 21:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343961AbjIKVNB (ORCPT ); Mon, 11 Sep 2023 17:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241614AbjIKPK7 (ORCPT ); Mon, 11 Sep 2023 11:10:59 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314DFE40 for ; Mon, 11 Sep 2023 08:10:54 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-52bcd4db4c0so9838379a12.0 for ; Mon, 11 Sep 2023 08:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445052; x=1695049852; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0/rSrL3Jo8Jpc/t8ZAB7UTOHWQcf4GkFtv3a0VomhNM=; b=K57uOnbpeorjFFXAGnAYpF7u5ZBIkPY3aVkTJfdW6+1lBoFkxbm+BDGlY6AqXbHVX9 n3iySFntAEFDhsJCON8WF4tvSY1Z07KvUXcL56UhvxF/uG294xWLdST/E5Wapn2aHbC8 NOdcJ/AeuDQUeY4KjIZO4wgWnSylo6YwJd1OQBm+LUmnWGfIenUnJLYvm9iUyKY+PV2i uytgIO1spitbi5P9Lmk1RrXStxYQ+BP4tiBY7p+LTENjyPA1q2+s3BMywiEe/k0qkJiq yP1Ko5n94efy2VhzcVf0dyKNA//XZB4WcdQ1uvnsWb8lJ0f1uT5JE1demc9SnpVsA/DS VHZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445052; x=1695049852; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0/rSrL3Jo8Jpc/t8ZAB7UTOHWQcf4GkFtv3a0VomhNM=; b=tRzAPeNzG6FFwyPH5dxYIFPXMEx0vUufl6gNTI+zpSk9f26yrJ29TMFPz1rctaMPzo WQPbLo8mL/RxNN9UpzJhscQA22nWPGA5x5c9ZKT+hkAQGoN+Y0Cbno1iwo5aNhCVRL/n hM+wLPlRjBOiyd2ryVWpDl3RiMIHpa4hxZAJjRxtC+kHk/cILX92KA9z98fNlmBSZFAg q+CIH39ltxqrWUSWD6uSVgQvJVCbYytlDG/N0skRU+AgPLE/oGKhKvrGTmlvhIeQoObU d4XfnIGFfKiG0Yt971sHt7GkiMZnIgGCNF2lu3FMOM8GHJB4hti/vIgwVzCiEFY/oLS4 4FRQ== X-Gm-Message-State: AOJu0YyYqQ3Z1WN6uqmZP/yzcINVCCFYv06qB27OxD3GpgePSknfQe2C /m4PUZQGNKaXQV94n9l8m6Sm4A== X-Google-Smtp-Source: AGHT+IEbHBYlsbEpKU5/53azlsQctYiikFwyyZJfwzmVd1ZxSwJ1OZjEUyLdZoi/YOdV2fu2bsZbdg== X-Received: by 2002:aa7:d858:0:b0:521:d2ab:e4df with SMTP id f24-20020aa7d858000000b00521d2abe4dfmr12498198eds.19.1694445052439; Mon, 11 Sep 2023 08:10:52 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:52 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:28 +0200 Subject: [PATCH RFT 14/20] media: venus: pm_helpers: Commonize core_power MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-14-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=4719; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=mQbHMS1CDlisVrikZ5YTbX8/UuzAFEtVfQ4RIqbJfoc=; b=ifOwzefBF+9s0GX9pPmiv0R+TszTLyxnkyiWw1XYYUYmOGigta0/hS2A2f34zh5uy6c7s4pUo hEQaodokYMBAU/3LxOUfMLYRkEjFgxGVj5Ilmk3H96n1r4MLBMB+OwS X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org core_power_v4 called with num_resets = 0 and core->pmdomains[0] == NULL does exactly the same thing as core_power_v1. Unify them! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 21 +++++++-------------- drivers/media/platform/qcom/venus/pm_helpers.c | 17 +---------------- drivers/media/platform/qcom/venus/pm_helpers.h | 2 +- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index bd624e965a92..0ae118257296 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -480,18 +480,15 @@ static void venus_core_shutdown(struct platform_device *pdev) static __maybe_unused int venus_runtime_suspend(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - const struct venus_pm_ops *pm_ops = core->pm_ops; int ret; ret = hfi_core_suspend(core); if (ret) return ret; - if (pm_ops->core_power) { - ret = pm_ops->core_power(core, POWER_OFF); - if (ret) - return ret; - } + ret = venus_core_power(core, POWER_OFF); + if (ret) + return ret; ret = icc_set_bw(core->cpucfg_path, 0, 0); if (ret) @@ -506,8 +503,7 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) err_video_path: icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); err_cpucfg_path: - if (pm_ops->core_power) - pm_ops->core_power(core, POWER_ON); + venus_core_power(core, POWER_ON); return ret; } @@ -515,7 +511,6 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) static __maybe_unused int venus_runtime_resume(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - const struct venus_pm_ops *pm_ops = core->pm_ops; int ret; ret = icc_set_bw(core->video_path, kbps_to_icc(20000), 0); @@ -526,11 +521,9 @@ static __maybe_unused int venus_runtime_resume(struct device *dev) if (ret) return ret; - if (pm_ops->core_power) { - ret = pm_ops->core_power(core, POWER_ON); - if (ret) - return ret; - } + ret = venus_core_power(core, POWER_ON); + if (ret) + return ret; return hfi_core_resume(core, false); } diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 816d16f9153a..ddaa9944fa44 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -322,22 +322,9 @@ static void core_put_v1(struct venus_core *core) { } -static int core_power_v1(struct venus_core *core, int on) -{ - int ret = 0; - - if (on == POWER_ON) - ret = core_clks_enable(core); - else - core_clks_disable(core); - - return ret; -} - static const struct venus_pm_ops pm_ops_v1 = { .core_get = venus_clks_get, .core_put = core_put_v1, - .core_power = core_power_v1, .load_scale = load_scale_v1, }; @@ -410,7 +397,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .core_get = venus_clks_get, .core_put = core_put_v1, - .core_power = core_power_v1, .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, @@ -996,7 +982,7 @@ static void core_put_v4(struct venus_core *core) vcodec_domains_put(core); } -static int core_power_v4(struct venus_core *core, int on) +int venus_core_power(struct venus_core *core, int on) { struct device *dev = core->dev; struct device *pmctrl = core->pmdomains[0]; @@ -1143,7 +1129,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .core_get = core_get_v4, .core_put = core_put_v4, - .core_power = core_power_v4, .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index a492c50c5543..77db940a265c 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -12,7 +12,6 @@ struct venus_core; struct venus_pm_ops { int (*core_get)(struct venus_core *core); void (*core_put)(struct venus_core *core); - int (*core_power)(struct venus_core *core, int on); int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); @@ -28,6 +27,7 @@ struct venus_pm_ops { }; const struct venus_pm_ops *venus_pm_get(enum hfi_version version); +int venus_core_power(struct venus_core *core, int on); static inline int venus_pm_load_scale(struct venus_inst *inst) { From patchwork Mon Sep 11 15:10:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721527 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 DEB66CA0EC8 for ; Mon, 11 Sep 2023 21:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344183AbjIKVNb (ORCPT ); Mon, 11 Sep 2023 17:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241618AbjIKPLB (ORCPT ); Mon, 11 Sep 2023 11:11:01 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E23CCC for ; Mon, 11 Sep 2023 08:10:56 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50091b91a83so7433807e87.3 for ; Mon, 11 Sep 2023 08:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445054; x=1695049854; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yvaPKLQHScYQL75NptLuZiJ3oU9JIQjkuER4G14i9nw=; b=QX3bWFBY/D9qPrzP8I/jl0O0jOHrSGNCbAQe+YUrEnHM0XWx9uw3VnFkVhBGkE1hAC wtLNSCKIHh1EnvWAlYi+HvoFHIcxKKbQnp3N2/f6GckazCRD5tPZ8rwUgBMTDVAomI1V xUehEVhKGnLqAxo7zDCeunK4a+PYrbZh23QoqZi0I331ttC9sgaMv0yPZTESWtVPbz/C l5B9Ap07iV/QrctrBSqz62bPnRWalW9a5J0hTdWv9XaNUvhdASsND0yMc3yZCTv6H9JH 1PSQOvOf8ghmzOAyB0MhRdG3oh8BDGHGu1nzTAr5TlaiITnmExqCpIa/8wO9yn5ubqhY 00/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445054; x=1695049854; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yvaPKLQHScYQL75NptLuZiJ3oU9JIQjkuER4G14i9nw=; b=ehnvibwguB7JlgEHLhWlfq3vESHZp/nXCjiS0TYt+QGCAlbDiEFdgtD0pGVQlE16TH BQ30AVlnca6rpnHBlkWguny+czkeGaIH54djSXZFy4UJYK+K1SskwLNApF3St1HuA2xx VxLIo9BzHiBlDNz6YG0kNCuco0mN7ne6HPgTSAAqxlOXi4zY03bPYZfc2MTmXM6oR/RE qwbg0TT4xKMVwhMe5DriN9LUk+mGefqvrEqceTEyhjG1M3P0kkRcCAbC1/UYcvWV4LoL d3UOTOLlHInG7hjtll7jOuybtf4XMlFs4x1x0HZI2XoO+5McyWiWvyfaWIPOI1UIxzC2 X16Q== X-Gm-Message-State: AOJu0YzkAKSrGHTtfqvwEKdIsYV2aV/bydv5He7y9+dJSeKyXMem85kN nPPB0sjQhfczfZHRRAs05KWMu2Wg6zsWG6G/QGOGeQ== X-Google-Smtp-Source: AGHT+IFRjHjMg9FMe97CBZIsu6FfosSdU73i223AsKTo+cLsnJy2LpkS9EDuYbzgskvudOnK3RPUrg== X-Received: by 2002:a05:6512:33cf:b0:502:a942:d7a8 with SMTP id d15-20020a05651233cf00b00502a942d7a8mr6878275lfg.69.1694445054562; Mon, 11 Sep 2023 08:10:54 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:54 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:29 +0200 Subject: [PATCH RFT 15/20] media: venus: pm_helpers: Remove pm_ops->core_put MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-15-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=3955; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=VFHAXP0bCqoE65EEy0HuBDwB4xJnqOaz01+cugNoC1s=; b=qbXg229K/TQjVjjbaca1jaxrvPPICpMOZ4V4ZMrNygnlbBOWJzI3VWWWe5SuTxoa4tyjwpJUu XqtCLLeSD8oC7PoC59MdQWmft1EKPBCfADaFVTRKfm+nHV0K2oL+zvH X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Without and OPP table and with vcodec_pmdomains_num (so, v1, v3 and sdm845_legacy targets), core_put_v4 is a NOP, jut like core_put_v1. Unify them! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 8 +++----- drivers/media/platform/qcom/venus/pm_helpers.c | 17 +---------------- drivers/media/platform/qcom/venus/pm_helpers.h | 2 +- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 0ae118257296..9a1b0be5d067 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -429,15 +429,14 @@ static int venus_probe(struct platform_device *pdev) err_core_deinit: hfi_core_deinit(core, false); err_core_put: - if (core->pm_ops->core_put) - core->pm_ops->core_put(core); + vcodec_domains_put(core); + return ret; } static void venus_remove(struct platform_device *pdev) { struct venus_core *core = platform_get_drvdata(pdev); - const struct venus_pm_ops *pm_ops = core->pm_ops; struct device *dev = core->dev; int ret; @@ -455,8 +454,7 @@ static void venus_remove(struct platform_device *pdev) pm_runtime_put_sync(dev); pm_runtime_disable(dev); - if (pm_ops->core_put) - pm_ops->core_put(core); + vcodec_domains_put(core); v4l2_device_unregister(&core->v4l2_dev); diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index ddaa9944fa44..9a0e2a00f383 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -318,13 +318,8 @@ static int load_scale_v1(struct venus_inst *inst) return ret; } -static void core_put_v1(struct venus_core *core) -{ -} - static const struct venus_pm_ops pm_ops_v1 = { .core_get = venus_clks_get, - .core_put = core_put_v1, .load_scale = load_scale_v1, }; @@ -396,7 +391,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .core_get = venus_clks_get, - .core_put = core_put_v1, .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, @@ -899,7 +893,7 @@ static int vcodec_domains_get(struct venus_core *core) return ret; } -static void vcodec_domains_put(struct venus_core *core) +void vcodec_domains_put(struct venus_core *core) { const struct venus_resources *res = core->res; unsigned int i; @@ -974,14 +968,6 @@ static int core_get_v4(struct venus_core *core) return 0; } -static void core_put_v4(struct venus_core *core) -{ - if (legacy_binding) - return; - - vcodec_domains_put(core); -} - int venus_core_power(struct venus_core *core, int on) { struct device *dev = core->dev; @@ -1128,7 +1114,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .core_get = core_get_v4, - .core_put = core_put_v4, .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 77db940a265c..3014b39aa6e3 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -11,7 +11,6 @@ struct venus_core; struct venus_pm_ops { int (*core_get)(struct venus_core *core); - void (*core_put)(struct venus_core *core); int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); @@ -28,6 +27,7 @@ struct venus_pm_ops { const struct venus_pm_ops *venus_pm_get(enum hfi_version version); int venus_core_power(struct venus_core *core, int on); +void vcodec_domains_put(struct venus_core *core); static inline int venus_pm_load_scale(struct venus_inst *inst) { From patchwork Mon Sep 11 15:10:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721513 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 1D640CA0EC6 for ; Mon, 11 Sep 2023 21:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344806AbjIKVOt (ORCPT ); Mon, 11 Sep 2023 17:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241629AbjIKPLH (ORCPT ); Mon, 11 Sep 2023 11:11:07 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E61D2E4B for ; Mon, 11 Sep 2023 08:10:58 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-502a7e1bdc7so3704348e87.0 for ; Mon, 11 Sep 2023 08:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445057; x=1695049857; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0gNkaBIazgKT+Y/aaQW0Dp8svWdByrrW7NRejS4t2Ug=; b=A5NXoSZwLCUoQ8zAjf6cEtcTmCKAuGGrtcWXWGyThsaeaB6lDRGc0WiOnJcVGtvNac pQlb1PQHamhoAoHdxmGotjByvy9fDDifIPJKtBrR/yU1uyoXjKcwJv6WwcXiPAbTIMGj DhDfSe2uFwKv6uKHuJTBU73wFIQqs5fPtTKgtfzUSGbV7D2ZTjW76CNIl/nzW4UbuzGi 7A14BOrQv3dbWHa9d40TpmyKJNflzxG+oIgSlZ0BuitzD9PwvzDTEJ2vbRZ4vj15MZRw pzhswA666hpq7eQAfT84y1ewKa/5bjdef8Qal/f5szLT4I52AV24Rz59NtAGURRIDYo5 koEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445057; x=1695049857; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0gNkaBIazgKT+Y/aaQW0Dp8svWdByrrW7NRejS4t2Ug=; b=OV8jpWwDG3nsQm2TSr1w+NmaULU0URqOVsqNJNrNdQul5v5zfAJ9ZdHy+bqIm8XsP8 Tc/Jh1of0z19c5gBw2zimI35BzAp2ia2LuTjFAZzFNY1N1d2PJxB3BanqyLekkZJTzBP OZjwsjA+I662ZmHZhIBKmcRz6ly7SrrOJtOvgUduNUiYZjafOWki59WLhjXguC/EoXhs dV9QYgAfOxMtY621i8j1RpFhRgiiPE42mCZTQqYeTfYvc9oQESANUD5gCrMsWT13ss9V aEnbt4QVCrtUOABEhKr9rey0QufnDcf0bFygYa9YXEmMtHgtoKRHhd8cTJ3DeYiPcPOR AyZg== X-Gm-Message-State: AOJu0Yx38v/MITFeTKvzGGyc4EFClpPpLJtJyW9fthKEzLvLwOAhjDrd CmeGgh3JkXqL6oLuMuBbVloJ+Q== X-Google-Smtp-Source: AGHT+IGRRmd9cbWKL2C+2j8g6d3N2j7KaPpQujwQ3kO7WmwflLukyxC/cY9y2L25hhkwWSAoqRej/A== X-Received: by 2002:a05:6512:3f12:b0:500:ae85:726a with SMTP id y18-20020a0565123f1200b00500ae85726amr9371919lfa.50.1694445056295; Mon, 11 Sep 2023 08:10:56 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:55 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:30 +0200 Subject: [PATCH RFT 16/20] media: venus: core: Define a pointer to core->res MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-16-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=2168; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=h0rj/gVk7sNYWd0OnhVJyfmqxcpbrM1z4NX1ZnW541Y=; b=ZTp+yrpjwxhoaPMuA3VDx8wXXn68xxaAwLIajdjPm4nahBeYbl/yf7S7ls/PvJL8MDwmdK5Gx U20wG71OwSuCLVxUYbZ+B4uDxt3mZjXMOnoc1tapNNiGX8OBrhjUiUA X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org To make the code more concise, define a new variable 'res' pointing to the abundantly referenced core->res. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 9a1b0be5d067..435f6f10a905 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -283,6 +283,7 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id) static int venus_probe(struct platform_device *pdev) { + const struct venus_resources *res; struct device *dev = &pdev->dev; struct venus_core *core; int i, ret; @@ -313,9 +314,11 @@ static int venus_probe(struct platform_device *pdev) if (!core->res) return -ENODEV; + res = core->res; + mutex_init(&core->pm_lock); - core->pm_ops = venus_pm_get(core->res->hfi_version); + core->pm_ops = venus_pm_get(res->hfi_version); if (!core->pm_ops) return -ENODEV; @@ -323,14 +326,14 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; - core->resets = devm_kcalloc(dev, core->res->resets_num, sizeof(*core->resets), GFP_KERNEL); - if (core->res->resets_num && !core->resets) + core->resets = devm_kcalloc(dev, res->resets_num, sizeof(*core->resets), GFP_KERNEL); + if (res->resets_num && !core->resets) return -ENOMEM; - for (i = 0; i < core->res->resets_num; i++) - core->resets[i].id = core->res->resets[i]; + for (i = 0; i < res->resets_num; i++) + core->resets[i].id = res->resets[i]; - ret = devm_reset_control_bulk_get_exclusive(dev, core->res->resets_num, core->resets); + ret = devm_reset_control_bulk_get_exclusive(dev, res->resets_num, core->resets); if (ret) return ret; @@ -340,7 +343,7 @@ static int venus_probe(struct platform_device *pdev) return ret; } - ret = dma_set_mask_and_coherent(dev, core->res->dma_mask); + ret = dma_set_mask_and_coherent(dev, res->dma_mask); if (ret) goto err_core_put; From patchwork Mon Sep 11 15:10:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722251 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 63FACCA0EC0 for ; Mon, 11 Sep 2023 21:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343649AbjIKVMK (ORCPT ); Mon, 11 Sep 2023 17:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241633AbjIKPLH (ORCPT ); Mon, 11 Sep 2023 11:11:07 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1D2AFA for ; Mon, 11 Sep 2023 08:11:00 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-529fb04a234so6049290a12.3 for ; Mon, 11 Sep 2023 08:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445059; x=1695049859; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7Go8soGhozFyZDdpekIDfsnoJQHz3sv19mqRqwFidsQ=; b=upDxVrujiJPei1qqYtTVWI1jVYpExNjNSDi2PlePpNnisPlLKPMla5yu35E4t8/Nyb jyPQVX1/w4+fPLwTWvXLdFrq3bPFT4g3rRkIGmgHHHHz2St+l45cYSRIAiqm+lzebCbc 0p/ro69HqkEP2bWTHvAM/bIV82XZvYum1zMhMP/jJ0viUCDY8yMfDCs3V1X4kd3k0LTq PlUzekWInp/omvFJMfAvUsb/v7KH4EdWKvGEzdOEO8wQaw9rKop1DbJvYe87Lh1uE5cQ w3pocIdbmtindNNSjs0bBpHXNSFNAiUwZf4X3Kdj2HrQrZcuA7qjY2HTIgaMnPOgJAVH VpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445059; x=1695049859; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Go8soGhozFyZDdpekIDfsnoJQHz3sv19mqRqwFidsQ=; b=Ny0/jUMdzMmZGZSrVWY2USHoyAIwlm56UN5d3XlbE29d6n8VOf4J8bEkB0YZnQEshI StogC80lrJ5dWK0vbqE3RwvFBo+9qrGYLes19zPL9IKqJ6VtJqYnMdksYJt4MoybXBo3 F0g4FeMKbRTb2vARyHGJh2/H/bZkYkGbZdl+rdMi1q04sSNghY24Bg+vF/24mjRQpKoU jLoohQTxkfD0YhGpEJonv8z5FjdYX28PTqObil/TE2eGmjHtAr7DI3Hqdsq2veSMUCbA etETGzOhp7ZzSi97PN8rpj/3ELHKdL+qbLD14BVJBXfOJ9iqubucKzfi/EnVWyG9LrBX Fx3g== X-Gm-Message-State: AOJu0YwlKLz8AHY6+9nHssNxkWP+i3oGaeqqBk7eKcmNiDtlZGFj9A5T cbRk2G4tFydglCyBEESjdrxMjMswidkfgRdU6yF+Fw== X-Google-Smtp-Source: AGHT+IHiYhxr+24cOk8gE+cu96H02Re+vpcUfn80D1q6RN1itKvte/hfail/Rq+AMq5HFWUU2P0c+g== X-Received: by 2002:aa7:d402:0:b0:52b:c980:43f3 with SMTP id z2-20020aa7d402000000b0052bc98043f3mr8132781edq.28.1694445059295; Mon, 11 Sep 2023 08:10:59 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:10:58 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:31 +0200 Subject: [PATCH RFT 17/20] media: venus: pm_helpers: Simplify vcodec clock handling MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-17-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=13444; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=6BGfkN0sVdRCleGUxSZssA0BPUP+ZuPOYmY/oEbAozY=; b=1nCUwuuaILLiPkIDfKcwswHQCilUZTknH7v5plrM7EyGYYQ8lsMzOj3KlcHD/1ZBTK8ZztY8O 31gjj1nxPffDZikPYdJC7+f9GZOJ7qK6CX2dlayHvw4Ts9C6ODVbdoj X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently the infrastructure is set up for vast expandability, but it's far too complex for what is just 0-2 clocks. Categorize the clocks and simplify their getting. One notable change is that vcodec clocks are switched to use devm_clk_get_optional, which will let us commonize the code further while leaving the burden of figuring out which SoCs need codec-specific clocks and which don't to the bindings checker. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 18 ---- drivers/media/platform/qcom/venus/core.h | 9 +- drivers/media/platform/qcom/venus/pm_helpers.c | 129 +++++++++++++------------ 3 files changed, 69 insertions(+), 87 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 435f6f10a905..42bfcef9449a 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -584,9 +584,6 @@ static const struct venus_resources msm8996_res = { .reg_tbl_size = ARRAY_SIZE(msm8996_reg_preset), .clks = {"core", "iface", "bus", "mbus" }, .clks_num = 4, - .vcodec0_clks = { "core" }, - .vcodec1_clks = { "core" }, - .vcodec_clks_num = 1, .max_load = 2563200, .hfi_version = HFI_VERSION_3XX, .dma_mask = (GENMASK(31, 30) | GENMASK(28, 26) | GENMASK(24, 22)) - 1, @@ -639,9 +636,6 @@ static const struct venus_resources sdm660_res = { .bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec), .clks = {"core", "iface", "bus", "bus_throttle" }, .clks_num = 4, - .vcodec0_clks = { "vcodec0_core" }, - .vcodec1_clks = { "vcodec0_core" }, - .vcodec_clks_num = 1, .max_load = 1036800, .hfi_version = HFI_VERSION_3XX, .cp_size = 0x79000000, @@ -683,9 +677,6 @@ static const struct venus_resources sdm845_res = { .bw_tbl_dec_size = ARRAY_SIZE(sdm845_bw_table_dec), .clks = {"core", "iface", "bus" }, .clks_num = 3, - .vcodec0_clks = { "core", "bus" }, - .vcodec1_clks = { "core", "bus" }, - .vcodec_clks_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -702,9 +693,6 @@ static const struct venus_resources sdm845_res_v2 = { .bw_tbl_dec_size = ARRAY_SIZE(sdm845_bw_table_dec), .clks = {"core", "iface", "bus" }, .clks_num = 3, - .vcodec0_clks = { "vcodec0_core", "vcodec0_bus" }, - .vcodec1_clks = { "vcodec1_core", "vcodec1_bus" }, - .vcodec_clks_num = 2, .vcodec_pmdomains = { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, .opp_pmdomain = pd_names_cx, @@ -747,8 +735,6 @@ static const struct venus_resources sc7180_res = { .bw_tbl_dec_size = ARRAY_SIZE(sc7180_bw_table_dec), .clks = {"core", "iface", "bus" }, .clks_num = 3, - .vcodec0_clks = { "vcodec0_core", "vcodec0_bus" }, - .vcodec_clks_num = 2, .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, @@ -799,8 +785,6 @@ static const struct venus_resources sm8250_res = { .clks_num = 2, .resets = { "bus", "core" }, .resets_num = 2, - .vcodec0_clks = { "vcodec0_core" }, - .vcodec_clks_num = 1, .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_mx, @@ -854,8 +838,6 @@ static const struct venus_resources sc7280_res = { .ubwc_conf = &sc7280_ubwc_config, .clks = {"core", "bus", "iface"}, .clks_num = 3, - .vcodec0_clks = {"vcodec_core", "vcodec_bus"}, - .vcodec_clks_num = 2, .vcodec_pmdomains = { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, .opp_pmdomain = pd_names_cx, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 16acf738fd6c..fd78f17c12d8 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -24,10 +24,11 @@ #define VDBGFW "VenusFW : " #define VIDC_CLKS_NUM_MAX 4 -#define VIDC_VCODEC_CLKS_NUM_MAX 2 #define VIDC_PMDOMAINS_NUM_MAX 3 #define VIDC_RESETS_NUM_MAX 2 +#define MAX_NUM_VCODECS 2 + extern int venus_fw_debug; struct freq_tbl { @@ -69,8 +70,6 @@ struct venus_resources { const struct hfi_ubwc_config * const ubwc_conf; const char * const clks[VIDC_CLKS_NUM_MAX]; const unsigned int clks_num; - const char * const vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; - const char * const vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; const unsigned int vcodec_clks_num; const char * const vcodec_pmdomains[VIDC_PMDOMAINS_NUM_MAX]; const unsigned int vcodec_pmdomains_num; @@ -177,8 +176,8 @@ struct venus_core { void __iomem *aon_base; int irq; struct clk *clks[VIDC_CLKS_NUM_MAX]; - struct clk *vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; - struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; + struct clk *vcodec_core_clks[MAX_NUM_VCODECS]; + struct clk *vcodec_bus_clks[MAX_NUM_VCODECS]; struct icc_path *video_path; struct icc_path *cpucfg_path; bool has_opp_table; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 9a0e2a00f383..741b29cc76c9 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -110,67 +110,74 @@ static void core_clks_disable(struct venus_core *core) static int core_clks_set_rate(struct venus_core *core, unsigned long freq) { - int ret; + int i, ret; ret = dev_pm_opp_set_rate(core->dev, freq); if (ret) return ret; - ret = clk_set_rate(core->vcodec0_clks[0], freq); - if (ret) - return ret; - - ret = clk_set_rate(core->vcodec1_clks[0], freq); - if (ret) - return ret; + for (i = 0; i < MAX_NUM_VCODECS; i++) { + ret = clk_set_rate(core->vcodec_core_clks[i], freq); + if (ret) + return ret; + } return 0; } -static int vcodec_clks_get(struct venus_core *core, struct device *dev, - struct clk **clks, const char * const *id) +static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) { - const struct venus_resources *res = core->res; - unsigned int i; + char buf[13] = { 0 }; /* vcodecX_core\0 */ - for (i = 0; i < res->vcodec_clks_num; i++) { - if (!id[i]) - continue; - clks[i] = devm_clk_get(dev, id[i]); - if (IS_ERR(clks[i])) - return PTR_ERR(clks[i]); + /* Best we can do is 2 cores */ + if (id > MAX_NUM_VCODECS - 1) { + dev_err(dev, "Got impossible vcodec id %u\n", id); + return -EINVAL; + }; + + snprintf(buf, sizeof(buf), "vcodec%u_core", id); + + /* First try the non-legacy name */ + core->vcodec_core_clks[id] = devm_clk_get_optional(dev, buf); + if (IS_ERR(core->vcodec_core_clks[id])) { + /* Try again, with the legacy name */ + core->vcodec_core_clks[id] = devm_clk_get_optional(dev, "core"); + if (IS_ERR(core->vcodec_core_clks[id])) + return PTR_ERR(core->vcodec_core_clks[id]); + } + + memset(buf, 0, sizeof(buf)); + snprintf(buf, sizeof(buf), "vcodec%u_bus", id); + + core->vcodec_bus_clks[id] = devm_clk_get_optional(dev, buf); + if (IS_ERR(core->vcodec_bus_clks[id])) { + core->vcodec_bus_clks[id] = devm_clk_get_optional(dev, "bus"); + if (IS_ERR(core->vcodec_bus_clks[id])) + return PTR_ERR(core->vcodec_bus_clks[id]); } return 0; } -static int vcodec_clks_enable(struct venus_core *core, struct clk **clks) +static int vcodec_clks_enable(struct venus_core *core, u8 id) { - const struct venus_resources *res = core->res; - unsigned int i; int ret; - for (i = 0; i < res->vcodec_clks_num; i++) { - ret = clk_prepare_enable(clks[i]); - if (ret) - goto err; - } + ret = clk_prepare_enable(core->vcodec_core_clks[id]); + if (ret) + return ret; - return 0; -err: - while (i--) - clk_disable_unprepare(clks[i]); + ret = clk_prepare_enable(core->vcodec_bus_clks[id]); + if (ret) + clk_disable_unprepare(core->vcodec_core_clks[id]); return ret; } -static void vcodec_clks_disable(struct venus_core *core, struct clk **clks) +static void vcodec_clks_disable(struct venus_core *core, u8 id) { - const struct venus_resources *res = core->res; - unsigned int i = res->vcodec_clks_num; - - while (i--) - clk_disable_unprepare(clks[i]); + clk_disable_unprepare(core->vcodec_bus_clks[id]); + clk_disable_unprepare(core->vcodec_core_clks[id]); } static u32 load_per_instance(struct venus_inst *inst) @@ -343,8 +350,7 @@ static int vdec_get_v3(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - return vcodec_clks_get(core, dev, core->vcodec0_clks, - core->res->vcodec0_clks); + return vcodec_clks_get(core, dev, 0); } static int vdec_power_v3(struct device *dev, int on) @@ -355,9 +361,9 @@ static int vdec_power_v3(struct device *dev, int on) vcodec_control_v3(core, VIDC_SESSION_TYPE_DEC, true); if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec0_clks); + ret = vcodec_clks_enable(core, 0); else - vcodec_clks_disable(core, core->vcodec0_clks); + vcodec_clks_disable(core, 0); vcodec_control_v3(core, VIDC_SESSION_TYPE_DEC, false); @@ -368,8 +374,7 @@ static int venc_get_v3(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - return vcodec_clks_get(core, dev, core->vcodec1_clks, - core->res->vcodec1_clks); + return vcodec_clks_get(core, dev, 1); } static int venc_power_v3(struct device *dev, int on) @@ -380,9 +385,9 @@ static int venc_power_v3(struct device *dev, int on) vcodec_control_v3(core, VIDC_SESSION_TYPE_ENC, true); if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec1_clks); + ret = vcodec_clks_enable(core, 1); else - vcodec_clks_disable(core, core->vcodec1_clks); + vcodec_clks_disable(core, 1); vcodec_control_v3(core, VIDC_SESSION_TYPE_ENC, false); @@ -441,7 +446,7 @@ static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - vcodec_clks_disable(core, core->vcodec0_clks); + vcodec_clks_disable(core, 0); ret = vcodec_control_v4(core, VIDC_CORE_ID_1, false); if (ret) @@ -457,7 +462,7 @@ static int poweroff_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - vcodec_clks_disable(core, core->vcodec1_clks); + vcodec_clks_disable(core, 1); ret = vcodec_control_v4(core, VIDC_CORE_ID_2, false); if (ret) @@ -484,7 +489,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - ret = vcodec_clks_enable(core, core->vcodec0_clks); + ret = vcodec_clks_enable(core, 0); if (ret) return ret; @@ -502,7 +507,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) if (ret) return ret; - ret = vcodec_clks_enable(core, core->vcodec1_clks); + ret = vcodec_clks_enable(core, 1); if (ret) return ret; @@ -763,20 +768,18 @@ static int vdec_get_v4(struct device *dev) if (!legacy_binding) return 0; - return vcodec_clks_get(core, dev, core->vcodec0_clks, - core->res->vcodec0_clks); + return vcodec_clks_get(core, dev, 0); } static void vdec_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - unsigned int i; if (!legacy_binding) return; - for (i = 0; i < core->res->vcodec_clks_num; i++) - core->vcodec0_clks[i] = NULL; + core->vcodec_core_clks[0] = NULL; + core->vcodec_bus_clks[0] = NULL; } static int vdec_power_v4(struct device *dev, int on) @@ -792,9 +795,9 @@ static int vdec_power_v4(struct device *dev, int on) return ret; if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec0_clks); + ret = vcodec_clks_enable(core, 0); else - vcodec_clks_disable(core, core->vcodec0_clks); + vcodec_clks_disable(core, 0); vcodec_control_v4(core, VIDC_CORE_ID_1, false); @@ -808,20 +811,18 @@ static int venc_get_v4(struct device *dev) if (!legacy_binding) return 0; - return vcodec_clks_get(core, dev, core->vcodec1_clks, - core->res->vcodec1_clks); + return vcodec_clks_get(core, dev, 1); } static void venc_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); - unsigned int i; if (!legacy_binding) return; - for (i = 0; i < core->res->vcodec_clks_num; i++) - core->vcodec1_clks[i] = NULL; + core->vcodec_core_clks[1] = NULL; + core->vcodec_bus_clks[1] = NULL; } static int venc_power_v4(struct device *dev, int on) @@ -837,9 +838,9 @@ static int venc_power_v4(struct device *dev, int on) return ret; if (on == POWER_ON) - ret = vcodec_clks_enable(core, core->vcodec1_clks); + ret = vcodec_clks_enable(core, 1); else - vcodec_clks_disable(core, core->vcodec1_clks); + vcodec_clks_disable(core, 1); vcodec_control_v4(core, VIDC_CORE_ID_2, false); @@ -940,11 +941,11 @@ static int core_get_v4(struct venus_core *core) dev_info(dev, "%s legacy binding\n", legacy_binding ? "" : "non"); - ret = vcodec_clks_get(core, dev, core->vcodec0_clks, res->vcodec0_clks); + ret = vcodec_clks_get(core, dev, 0); if (ret) return ret; - ret = vcodec_clks_get(core, dev, core->vcodec1_clks, res->vcodec1_clks); + ret = vcodec_clks_get(core, dev, 1); if (ret) return ret; From patchwork Mon Sep 11 15:10:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722244 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 BF7A4CA0EE1 for ; Mon, 11 Sep 2023 21:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344191AbjIKVNb (ORCPT ); Mon, 11 Sep 2023 17:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241643AbjIKPLJ (ORCPT ); Mon, 11 Sep 2023 11:11:09 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92888E5F for ; Mon, 11 Sep 2023 08:11:02 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-52f3ba561d9so3788030a12.1 for ; Mon, 11 Sep 2023 08:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445061; x=1695049861; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=116M1Uf4FxkGVcXqN1wBq1UncYtXwEEG2hN8+ByRx2U=; b=Z+Rk4WRCrsSSqttXHrfsPbU2dGv0kPljBb16JEutqFxIf+yVBmWSrpttdE5mUXy7ZO VqUO65FbRH3ib2FzEsmqJTetjhaMxe8doFOOXVCSfBI9Z8xqpq3GRxWvEus42o1FtA3m SkcG+GtRyqhg9HqsoA6NpOj0PrHVY6wO8ts8qpYszaSG3U1XLL+laULKRXqnzPS91gYZ JbzbmVzc9H3xfJLFdUVKspXGTBloFezXxlncrjv4MBFqwde/OkbLPZirHeXepDIx69LZ RUIc+TN/gKy0lLm4hm9aoKHM8agLxXCg9g4TKNhyETeIWx5R4SKbskROhTZoAoNjuslV UG+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445061; x=1695049861; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=116M1Uf4FxkGVcXqN1wBq1UncYtXwEEG2hN8+ByRx2U=; b=uCQvmIbmBJ4gBc+Qs+VoZ7FLE7ecgaUSDBUU7DZmdk/HTgVxDFXM0/quYs0c7EgZZC Krf6YJqwqXkYhPk7EEekaYILd7FAAiPvVQs2362DZdQ3Jbvy8vw8CdLhxCiWx4Z0Fmbr LCkwE+gnIxK/TPsaGwrZKokEJtqHk0VCORdOHsa5Mwj3eyG9DlYvl3Wy69cGH6/nDMlQ R94P7lrpybLmKSyHpZiU3ejvf2gr0hVlIseig06ZigIBjcOQ7wXi7j7EAQ87AGbQevL4 0aITTnh6zjGj9yANMkoX/EjeBLfd3h+tRSRqqAdKm1UZpHJqj8PIA8NVBIS+4B0cAbna gKkg== X-Gm-Message-State: AOJu0Yw4ShJIGcvtEgANiIALzG1jeM58ZqsnhiToEhprQJ3t2zNzOXlC zP5m7xAroYNWkaFfhzleWHF7uA== X-Google-Smtp-Source: AGHT+IEvvAGK6lqIPwjV7PEMM+tywxepjWAX/NQ/dlwbyxSX9kJBmKg9i02x5I20YkqjdqPrl/H/Hw== X-Received: by 2002:a05:6402:124f:b0:525:8124:20fe with SMTP id l15-20020a056402124f00b00525812420femr14949632edw.18.1694445061156; Mon, 11 Sep 2023 08:11:01 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:11:00 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:32 +0200 Subject: [PATCH RFT 18/20] media: venus: pm_helpers: Commonize getting clocks and GenPDs MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-18-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=3351; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=9AKWBnlvj+Q6WSygovq46dA98O8B8twaOC1bOaWKQLA=; b=laMrLpKy/LbvHFS/2/vbvWUy7x94OHugyBeOVM5X6pDzlPuwylz6rzNcHKYsAIXhTmLLk01xT kB9YPsDJwwxDP0sYjSuG/sAqkJOojLShhcDAUhZpqAzpWIXt8wnZ0TP X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As has been the story with the past few commits, much of the resource acquisition logic is totally identical between different generations and there's no good reason to invent a new function for each one. Commonize core_get() and rename it to venus_get_resources() to be more meaningful. Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/core.c | 8 +++----- drivers/media/platform/qcom/venus/pm_helpers.c | 5 +---- drivers/media/platform/qcom/venus/pm_helpers.h | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 42bfcef9449a..e8a16355d39e 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -337,11 +337,9 @@ static int venus_probe(struct platform_device *pdev) if (ret) return ret; - if (core->pm_ops->core_get) { - ret = core->pm_ops->core_get(core); - if (ret) - return ret; - } + ret = venus_get_resources(core); + if (ret) + return ret; ret = dma_set_mask_and_coherent(dev, res->dma_mask); if (ret) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 741b29cc76c9..6e282a69c7c5 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -326,7 +326,6 @@ static int load_scale_v1(struct venus_inst *inst) } static const struct venus_pm_ops pm_ops_v1 = { - .core_get = venus_clks_get, .load_scale = load_scale_v1, }; @@ -395,7 +394,6 @@ static int venc_power_v3(struct device *dev, int on) } static const struct venus_pm_ops pm_ops_v3 = { - .core_get = venus_clks_get, .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, @@ -926,7 +924,7 @@ static int core_resets_reset(struct venus_core *core) return reset_control_bulk_deassert(res->resets_num, core->resets); } -static int core_get_v4(struct venus_core *core) +int venus_get_resources(struct venus_core *core) { struct device *dev = core->dev; const struct venus_resources *res = core->res; @@ -1114,7 +1112,6 @@ static int load_scale_v4(struct venus_inst *inst) } static const struct venus_pm_ops pm_ops_v4 = { - .core_get = core_get_v4, .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 3014b39aa6e3..7a55a55029f3 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -10,8 +10,6 @@ struct venus_core; #define POWER_OFF 0 struct venus_pm_ops { - int (*core_get)(struct venus_core *core); - int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); @@ -28,6 +26,7 @@ struct venus_pm_ops { const struct venus_pm_ops *venus_pm_get(enum hfi_version version); int venus_core_power(struct venus_core *core, int on); void vcodec_domains_put(struct venus_core *core); +int venus_get_resources(struct venus_core *core); static inline int venus_pm_load_scale(struct venus_inst *inst) { From patchwork Mon Sep 11 15:10:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 721532 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 BF807CA0ECB for ; Mon, 11 Sep 2023 21:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343932AbjIKVM6 (ORCPT ); Mon, 11 Sep 2023 17:12:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241646AbjIKPLJ (ORCPT ); Mon, 11 Sep 2023 11:11:09 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FDCEE40 for ; Mon, 11 Sep 2023 08:11:04 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-31dca134c83so4573060f8f.3 for ; Mon, 11 Sep 2023 08:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445062; x=1695049862; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=asvRsf79Z4t2sQWCzoV7GsZSEWprfQh6kK1bExMAVOg=; b=xjHiblnWXtrmTuD0F5dfIJgT3GvNcDwRUV324X1CCiUrPORvIGA4tY20qPOaykDRAe Xku9M1nRl0gQwRQTZG2DFsL9IGJUBa71sKG68/yX0/rEvhedKeVLnH6gJYWBO4g/9HuO qeW0uGfemgEC3HTRyafsOYCJs9I+gqemobB7C18nIDyZxkvaP6iYdTDNgDXj5uQEGGia hq3n0F1mveVnn0cArgMG71AB7fcLw+e/P89D/ePHtURb0t+8MEE1SmYGd+zaVXZnQYAL nwIufK8zphm707623O0Gv82UE9XG+ykDSuPSurJ6JF06PXMYQ83Ql/W8Cs8SL1wpT3Oz TLsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445062; x=1695049862; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=asvRsf79Z4t2sQWCzoV7GsZSEWprfQh6kK1bExMAVOg=; b=SB2vV8xs27LbQzBGrIcSl4jowGAQBjf1N7Shd/yKtb7JMsQJW1yqVVgMnge/nCzbF3 lM0/3CnFfGfOthmWp6nrS3fYM5Ypj/NCaKzqdKl+UW0X32za7WKhspiliSfHpK+TCCWQ 8D6h24Mj3LGw17c+o0bJGFvmHrRXo4uzhsGqryzIQfHVHLk+uuy/CB6JwUfeJbHD/pCq YdDySs5SCrhQwV2tR1WEMDD2y+PnfpH5UEcn5JKOL2Xu0SHRD2HfLlvxepQKoR3VwDUP qdtQV0bcISzAMXdXorIrGK0WhF0tT2yfFtKfIIOF+a7zlwD6rDMzA/hmVtzSRv6sbT+W E/9A== X-Gm-Message-State: AOJu0YytFYRNVywdARnO0pEBbQJLd1slw4yzJDUS7zapMZ++3utkomHd QVJofWiRysry27mc+57zSm12rQ== X-Google-Smtp-Source: AGHT+IGE5+K1yW8OMCCbQ7LO7syjz0lKVcA0C/SeX6aOskGrNDSwz5DcC1WVx/LeccZYQTPTScyzVQ== X-Received: by 2002:a05:6000:183:b0:30e:19a8:4b0a with SMTP id p3-20020a056000018300b0030e19a84b0amr8128899wrx.2.1694445062479; Mon, 11 Sep 2023 08:11:02 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:11:02 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:33 +0200 Subject: [PATCH RFT 19/20] media: venus: pm_helpers: Commonize vdec_get() MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-19-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=3895; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=YlmzYA4YQxxbZ8+I823ZEVUx3rnP0v9rXONFOCmtrvs=; b=KDRi++FuxntqUR4FhQvN/znBeowYpYMg9oFJfeJ2P90qhKY2dUuXl0A5psa8vbOs8KGLaPlj7 I/3Xltr8F6xB8b3OciZAX6Y+pY/HYC9z5I6oAQo6HER3rzMArtLbLaP X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This function can be very easily commonized between the supported gens. Do so! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 21 +-------------------- drivers/media/platform/qcom/venus/pm_helpers.h | 2 +- drivers/media/platform/qcom/venus/vdec.c | 9 +++++++-- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 6e282a69c7c5..dfb89d2e7387 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -125,7 +125,7 @@ static int core_clks_set_rate(struct venus_core *core, unsigned long freq) return 0; } -static int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) +int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id) { char buf[13] = { 0 }; /* vcodecX_core\0 */ @@ -345,13 +345,6 @@ vcodec_control_v3(struct venus_core *core, u32 session_type, bool enable) writel(1, ctrl); } -static int vdec_get_v3(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - return vcodec_clks_get(core, dev, 0); -} - static int vdec_power_v3(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); @@ -394,7 +387,6 @@ static int venc_power_v3(struct device *dev, int on) } static const struct venus_pm_ops pm_ops_v3 = { - .vdec_get = vdec_get_v3, .vdec_power = vdec_power_v3, .venc_get = venc_get_v3, .venc_power = venc_power_v3, @@ -759,16 +751,6 @@ static int coreid_power_v4(struct venus_inst *inst, int on) return ret; } -static int vdec_get_v4(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - if (!legacy_binding) - return 0; - - return vcodec_clks_get(core, dev, 0); -} - static void vdec_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); @@ -1112,7 +1094,6 @@ static int load_scale_v4(struct venus_inst *inst) } static const struct venus_pm_ops pm_ops_v4 = { - .vdec_get = vdec_get_v4, .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, .venc_get = venc_get_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 7a55a55029f3..4afc57dac865 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -10,7 +10,6 @@ struct venus_core; #define POWER_OFF 0 struct venus_pm_ops { - int (*vdec_get)(struct device *dev); void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); @@ -27,6 +26,7 @@ const struct venus_pm_ops *venus_pm_get(enum hfi_version version); int venus_core_power(struct venus_core *core, int on); void vcodec_domains_put(struct venus_core *core); int venus_get_resources(struct venus_core *core); +int vcodec_clks_get(struct venus_core *core, struct device *dev, u8 id); static inline int venus_pm_load_scale(struct venus_inst *inst) { diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index dbf305cec120..610beba5ca6d 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1788,8 +1788,13 @@ static int vdec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, core); - if (core->pm_ops->vdec_get) { - ret = core->pm_ops->vdec_get(dev); + /* + * If the vcodec core clock is missing by now, it either doesn't exist + * (8916) or deprecated bindings with pre-assigned core functions and + * resources under the decoder node are in use. + */ + if (!core->vcodec_core_clks[0]) { + ret = vcodec_clks_get(core, dev, 0); if (ret) return ret; } From patchwork Mon Sep 11 15:10:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 722258 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 4BCC2CA0EE7 for ; Mon, 11 Sep 2023 21:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240665AbjIKVLM (ORCPT ); Mon, 11 Sep 2023 17:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241653AbjIKPLL (ORCPT ); Mon, 11 Sep 2023 11:11:11 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A952AE4D for ; Mon, 11 Sep 2023 08:11:05 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-52a40cf952dso6052173a12.2 for ; Mon, 11 Sep 2023 08:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694445064; x=1695049864; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HVLqCA/ecvInY4c6THAO1tIs6dKSTPnQEjLvdL4WYHk=; b=pBXgNVDCIDhRiCpll+KwCkJAwuYSnUBAmSmJ2RfBzA0adoxzdEzuS/07u00GO10jmc 1nprwi6uHOxrzAEg/aZf9oCALcvKChIMjEaHOyKw9NJ3uYCN0/G6RT1Tky2OTPi51IZ0 5OgtAA3Z+q1MGLr168WDWdR7MMZVeZO8DS/mH5trz/QficRIvIXFBwSNeHF6QST+nwk4 ScEHvVcNBkihiUg+W2vm2OUIGBVFIS+u1VWwfd+wvHGLxrBMnBaj64aHqMMecxUPwNVE +bfCLeZCT3dXUzmuuoZC2H2qiE2UWh74DpC9oAzJCfDYZUFOu6hqGjh26LfS0/em0HQb qPBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694445064; x=1695049864; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HVLqCA/ecvInY4c6THAO1tIs6dKSTPnQEjLvdL4WYHk=; b=XLnwRzNe3hEEqUabRhmIJtlf7CXfcMTg7EVdDwjVoORIfSFr8GtSYaNYY3RFiuyhb5 KueXngZ1uSTL1IwQ927a01KpxKhuF3+2RZrOzwHg/7YQ69Ibv1ZYPi8WofTjFgmeYJzC n6VWoyQwX0ctIyW/ykisCtkZM/AAv9XFnQwX5vilmwwK+9uQHVtZl1DBTKKeJVfHt/bC p178fiUQZsy+BhmzNRlF0deQ4Es+6Q1faBe2s1BWA0MCepn4w1SxZVED/Z4v0dmzsnOw kjjiCsA6QRwDMGtscw/4Trvz1+k4v48XYEIcKSz7qvhPFOjwp7kBqqO8PcAUEm8GsnRD Ogsw== X-Gm-Message-State: AOJu0YzSaPGt+Ww1IpuaJWvP4kNvZeTRDvIoiB9rMbPewKXe785hnsVI 0uHyHfp5PWVMqe0d83bnRfmIMg== X-Google-Smtp-Source: AGHT+IHNS4PmdSp7TCHy+BYzxHt4JAK6ZnEugthWVcBVLN+hPi2VGwGiI2QReNZ350wvDNw4TdzY3Q== X-Received: by 2002:aa7:c904:0:b0:525:70b3:72c2 with SMTP id b4-20020aa7c904000000b0052570b372c2mr8260935edt.14.1694445064234; Mon, 11 Sep 2023 08:11:04 -0700 (PDT) Received: from [10.167.154.1] (178235177061.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.61]) by smtp.gmail.com with ESMTPSA id n4-20020a056402060400b0052a3ad836basm4681281edv.41.2023.09.11.08.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 08:11:03 -0700 (PDT) From: Konrad Dybcio Date: Mon, 11 Sep 2023 17:10:34 +0200 Subject: [PATCH RFT 20/20] media: venus: pm_helpers: Commonize venc_get() MIME-Version: 1.0 Message-Id: <20230911-topic-mars-v1-20-a7d38bf87bdb@linaro.org> References: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> In-Reply-To: <20230911-topic-mars-v1-0-a7d38bf87bdb@linaro.org> To: Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Dikshita Agarwal , Philipp Zabel Cc: Marijn Suijten , Stanimir Varbanov , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694445027; l=3254; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=vxb2w5wVyktQxR9j1Q6sGaFooRnQRJnrKSI6AeZH57o=; b=33oCSwwyUM3j+SIJKcWOvs5hYfI+HUSZ161Pxwvi8UnJdtfQsPyPhxkcIPoZoYyPRQOt5RpZ5 YIhCik1ceBvCJQ7lLPtb6OObauaxfo62YuhZh+REfQNU9nFAd5JdjmU X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This function can be very easily commonized between the supported gens. Do so! Signed-off-by: Konrad Dybcio --- drivers/media/platform/qcom/venus/pm_helpers.c | 19 ------------------- drivers/media/platform/qcom/venus/pm_helpers.h | 1 - drivers/media/platform/qcom/venus/venc.c | 9 +++++++-- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index dfb89d2e7387..9546ad577b5d 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -362,13 +362,6 @@ static int vdec_power_v3(struct device *dev, int on) return ret; } -static int venc_get_v3(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - return vcodec_clks_get(core, dev, 1); -} - static int venc_power_v3(struct device *dev, int on) { struct venus_core *core = dev_get_drvdata(dev); @@ -388,7 +381,6 @@ static int venc_power_v3(struct device *dev, int on) static const struct venus_pm_ops pm_ops_v3 = { .vdec_power = vdec_power_v3, - .venc_get = venc_get_v3, .venc_power = venc_power_v3, .load_scale = load_scale_v1, }; @@ -784,16 +776,6 @@ static int vdec_power_v4(struct device *dev, int on) return ret; } -static int venc_get_v4(struct device *dev) -{ - struct venus_core *core = dev_get_drvdata(dev); - - if (!legacy_binding) - return 0; - - return vcodec_clks_get(core, dev, 1); -} - static void venc_put_v4(struct device *dev) { struct venus_core *core = dev_get_drvdata(dev); @@ -1096,7 +1078,6 @@ static int load_scale_v4(struct venus_inst *inst) static const struct venus_pm_ops pm_ops_v4 = { .vdec_put = vdec_put_v4, .vdec_power = vdec_power_v4, - .venc_get = venc_get_v4, .venc_put = venc_put_v4, .venc_power = venc_power_v4, .coreid_power = coreid_power_v4, diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus/pm_helpers.h index 4afc57dac865..cbf54e6c6eab 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.h +++ b/drivers/media/platform/qcom/venus/pm_helpers.h @@ -13,7 +13,6 @@ struct venus_pm_ops { void (*vdec_put)(struct device *dev); int (*vdec_power)(struct device *dev, int on); - int (*venc_get)(struct device *dev); void (*venc_put)(struct device *dev); int (*venc_power)(struct device *dev, int on); diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 44b13696cf82..fd3a1dd7f16c 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1557,8 +1557,13 @@ static int venc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, core); - if (core->pm_ops->venc_get) { - ret = core->pm_ops->venc_get(dev); + /* + * If the vcodec core clock is missing by now, it either doesn't exist + * (8916) or deprecated bindings with pre-assigned core functions and + * resources under the decoder node are in use. + */ + if (!core->vcodec_core_clks[1]) { + ret = vcodec_clks_get(core, dev, 1); if (ret) return ret; }