From patchwork Tue Sep 3 08:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1979919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WyfGK6HY3z1ygj for ; Tue, 3 Sep 2024 18:40:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1slP5V-0001uv-JP; Tue, 03 Sep 2024 08:40:33 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1slP5U-0001pa-20 for kernel-team@lists.ubuntu.com; Tue, 03 Sep 2024 08:40:32 +0000 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 871313F215 for ; Tue, 3 Sep 2024 08:40:31 +0000 (UTC) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c24b4a57b4so1663988a12.2 for ; Tue, 03 Sep 2024 01:40:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725352831; x=1725957631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KI9jBNVK7OxQKg7CCPcfEggj1puTxJltTA2Nx/SDo7k=; b=fgihxFVYSI4E4AvYXpIyYiCzTtH4aRGcT5VjKDg0xfylNhQJntDDvFP1cOD7G+wUk6 8qIXnZxaxDof8lRxzJ8zT+I/rdI/nQ7cE1t7PUl8RXM5wuGhXNUdxgvYL4VNIxX3Yvvb tcrlNfnpWd6W417hGP7KUmkYm7xBVHXOWig5zMdICLRM8t19EvIQfOifV02tmg/lVunw X1Eg9fnmkNQyD/V+z7j95JUSEpUdrb6QRiVjTVjMnhEO2VqvuABsW6Wcw876CD8wc7PA 916hXkwKWwmTHLaEXj0GcSVODdvIn6ktj5OVpqlPUN8lT6xcfrnxsBf13gyRzMkPuiKM LN/A== X-Gm-Message-State: AOJu0YyRGpvKT08foskM1y1HDdopOj0hE+4rHNvkqGa5/UIk98Ekb4i9 eYHk09KobyvG8GDEjiweo7jmjpiSPrCfHRsFLQiLtk//j4AmLNyPHvroydoxVjBN/C5Y3XMnUM9 ncmXrzDLVdRazOY7w91A5hvtEUVZbZTEuG7m4g6Y3K3TZbbkyzixDifFHtFLvAgN8HjB+DP33zF xj+mKfEOanBg== X-Received: by 2002:a05:6402:2695:b0:5bf:257f:9ee5 with SMTP id 4fb4d7f45d1cf-5c21ed9fd2emr11070065a12.34.1725352831060; Tue, 03 Sep 2024 01:40:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrxtRq+CCGHufED677sxpSrdO8nP1f3SkamOJo/7DZtOX5mERN72qGg2rRGXJRhlBrli321Q== X-Received: by 2002:a05:6402:2695:b0:5bf:257f:9ee5 with SMTP id 4fb4d7f45d1cf-5c21ed9fd2emr11070031a12.34.1725352830224; Tue, 03 Sep 2024 01:40:30 -0700 (PDT) Received: from localhost ([81.221.247.52]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c226c6a437sm6152200a12.20.2024.09.03.01.40.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 01:40:29 -0700 (PDT) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [O][PATCH 13/21] UBUNTU: SAUCE: media: platform: venus: Add optional LLCC path Date: Tue, 3 Sep 2024 10:40:02 +0200 Message-ID: <20240903084010.3746280-14-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903084010.3746280-1-juerg.haefliger@canonical.com> References: <20240903084010.3746280-1-juerg.haefliger@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Konrad Dybcio Some newer SoCs (such as SM8350) have a third interconnect path. Add it and make it optional. Signed-off-by: Konrad Dybcio Link: https://lore.kernel.org/r/20230731-topic-8280_venus-v1-4-8c8bbe1983a5@linaro.org Signed-off-by: Johan Hovold (cherry picked from commit 9d5b86b703b1b8c7ff1d1496fe4be450cc1696b9 github.com/jhovold/linux) Signed-off-by: Juerg Haefliger --- drivers/media/platform/qcom/venus/core.c | 19 +++++++++++++++++++ drivers/media/platform/qcom/venus/core.h | 3 +++ .../media/platform/qcom/venus/pm_helpers.c | 3 +++ 3 files changed, 25 insertions(+) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index edd35e652c92..ff2b5468f85a 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -309,6 +309,15 @@ static int venus_probe(struct platform_device *pdev) if (IS_ERR(core->cpucfg_path)) return PTR_ERR(core->cpucfg_path); + core->llcc_path = devm_of_icc_get(dev, "video-llcc"); + if (IS_ERR(core->llcc_path)) { + /* LLCC path is optional */ + if (PTR_ERR(core->llcc_path) == -ENODATA) + core->llcc_path = NULL; + else + return PTR_ERR(core->llcc_path); + } + core->irq = platform_get_irq(pdev, 0); if (core->irq < 0) return core->irq; @@ -486,12 +495,18 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev) if (ret) goto err_cpucfg_path; + ret = icc_set_bw(core->llcc_path, 0, 0); + if (ret) + goto err_llcc_path; + ret = icc_set_bw(core->video_path, 0, 0); if (ret) goto err_video_path; return ret; +err_llcc_path: + icc_set_bw(core->video_path, kbps_to_icc(20000), 0); err_video_path: icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); err_cpucfg_path: @@ -511,6 +526,10 @@ static __maybe_unused int venus_runtime_resume(struct device *dev) if (ret) return ret; + ret = icc_set_bw(core->llcc_path, kbps_to_icc(20000), 0); + if (ret) + return ret; + ret = icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0); if (ret) return ret; diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index b4e60243e0ae..90a06c283cc8 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -64,6 +64,7 @@ struct venus_resources { unsigned int bw_tbl_enc_size; const struct bw_tbl *bw_tbl_dec; unsigned int bw_tbl_dec_size; + bool has_llcc_path; const struct reg_val *reg_tbl; unsigned int reg_tbl_size; const struct hfi_ubwc_config *ubwc_conf; @@ -133,6 +134,7 @@ struct venus_format { * @vcodec1_clks: an array of vcodec1 struct clk pointers * @video_path: an interconnect handle to video to/from memory path * @cpucfg_path: an interconnect handle to cpu configuration path + * @llcc_path: an interconnect handle to video to/from llcc path * @has_opp_table: does OPP table exist * @pmdomains: a pointer to a list of pmdomains * @opp_dl_venus: an device-link for device OPP @@ -187,6 +189,7 @@ struct venus_core { struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; struct icc_path *video_path; struct icc_path *cpucfg_path; + struct icc_path *llcc_path; bool has_opp_table; struct dev_pm_domain_list *pmdomains; struct device_link *opp_dl_venus; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index 4ce76ce6dd4d..9c5852d3fb92 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -237,6 +237,9 @@ static int load_scale_bw(struct venus_core *core) dev_dbg(core->dev, VDBGL "total: avg_bw: %u, peak_bw: %u\n", total_avg, total_peak); + if (core->res->has_llcc_path) + icc_set_bw(core->llcc_path, total_avg, total_peak); + return icc_set_bw(core->video_path, total_avg, total_peak); }