From patchwork Mon Aug 14 16:28:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 713856 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 71FFBC04FE0 for ; Mon, 14 Aug 2023 16:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbjHNQ3l (ORCPT ); Mon, 14 Aug 2023 12:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbjHNQ3S (ORCPT ); Mon, 14 Aug 2023 12:29:18 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6260EE6E for ; Mon, 14 Aug 2023 09:29:16 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-313e742a787so2627492f8f.1 for ; Mon, 14 Aug 2023 09:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692030555; x=1692635355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ocJS1nXGrg9KUDSz6ydfTmzG4q/9Tzxynl3mXG6FazY=; b=U+xR+U4Ypv5p+nWfYUEsJK8A95hC5TSV/S6BjJk5MgR2qtuz7ZqHHGyxJrgvc2Pe+z 2h41xfpqL/vjnbw+wzMOOewTXyq9cl2Re7xSMaF7wA0vMAFIOXfOP3yDK00Qizkji7I0 ZkJduEHIEAWTbOoyrX3mUvdh63FusaiM8tZdXUDCU/N5gsYZ2HxSWLOngMSGMyqofTcI s/4DFj7Ivr2Ak0NhyJ0yvzboY1YHCUzqeEX13nem1hg5Ffx6nuX4Ix2+hbTlRsuYUFY1 KYLv9qCWGQl5XP+LniaPZN/DEE1AB/hWo7i7p/kelM/3MAC7mP7c/47+4/EXePqg32gB Xj4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692030555; x=1692635355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ocJS1nXGrg9KUDSz6ydfTmzG4q/9Tzxynl3mXG6FazY=; b=JsYo+gt2vVPcMRdJs2J5ugboWvXrjf4z/vvnIfDrE8qus7hUCtA7ohAZ3CKirxl+nQ UZHtDNYMl6bf/eWDWha0Augd3Ow9R6akhzpxY97zI14c/aWbh/Bjm7L8GiUit0Jjbj6T drum61rk8iX82MStqAkmPDaI5JoaE+NessxrpWvmSFHqW1vJasHlEBiCD8Xz25GyrzUn 32czU5yOQp01a2fNBSd377/qDL3hvRh4Np23P+PGUP0++cFTjvN5iF2b8JUmK4F79INX ViwKAVd29kjYbLDn+FiRyqOfXNoLMyfgvOiJ+YVxWTKAIo6kl+FJHw6l+pjgrOd0xz9Z c0yA== X-Gm-Message-State: AOJu0Yz3gdAKwCAOTlp6MLBN3KjmFxFY0fm5KCgJVgR2+ak00yhBw8lc 3M9PJpZqTxJEq6i/NWrLMq+DMg== X-Google-Smtp-Source: AGHT+IGbEwAy5M0yZ6nr93W2yJ6shYlS2jYv8WsGC3fFX2azKGj4UjFBH2ux7Hl5CfENVDeA0y2G8A== X-Received: by 2002:a5d:4fc3:0:b0:317:558c:c15e with SMTP id h3-20020a5d4fc3000000b00317558cc15emr9996307wrw.27.1692030554858; Mon, 14 Aug 2023 09:29:14 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id l14-20020a1c790e000000b003fc16ee2864sm14743475wme.48.2023.08.14.09.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 09:29:14 -0700 (PDT) From: Bryan O'Donoghue To: rfoss@kernel.org, todor.too@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 04/14] media: qcom: camss: Pass icc bandwidth table as a platform parameter Date: Mon, 14 Aug 2023 17:28:57 +0100 Message-ID: <20230814162907.3878421-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230814162907.3878421-1-bryan.odonoghue@linaro.org> References: <20230814162907.3878421-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Pass the bandwidth table as a platform parameter not if/else derived pointer to the static table. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss.c | 29 +++++++---------------- drivers/media/platform/qcom/camss/camss.h | 3 ++- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 68eb45b2c0aaa..1a195eb4298a5 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1484,21 +1484,15 @@ static int camss_configure_pd(struct camss *camss) static int camss_icc_get(struct camss *camss) { const struct resources_icc *icc_res; - int nbr_icc_paths = 0; int i; - if (camss->version == CAMSS_8250) { - icc_res = &icc_res_sm8250[0]; - nbr_icc_paths = ICC_SM8250_COUNT; - } + icc_res = camss->res->icc_res; - for (i = 0; i < nbr_icc_paths; i++) { + for (i = 0; i < camss->res->icc_path_num; i++) { camss->icc_path[i] = devm_of_icc_get(camss->dev, icc_res[i].name); if (IS_ERR(camss->icc_path[i])) return PTR_ERR(camss->icc_path[i]); - - camss->icc_bw_tbl[i] = icc_res[i].icc_bw_tbl; } return 0; @@ -1736,6 +1730,8 @@ static const struct camss_resources sm8250_resources = { .csiphy_res = csiphy_res_8250, .csid_res = csid_res_8250, .vfe_res = vfe_res_8250, + .icc_res = icc_res_sm8250, + .icc_path_num = ARRAY_SIZE(icc_res_sm8250), }; static const struct of_device_id camss_dt_match[] = { @@ -1752,14 +1748,10 @@ MODULE_DEVICE_TABLE(of, camss_dt_match); static int __maybe_unused camss_runtime_suspend(struct device *dev) { struct camss *camss = dev_get_drvdata(dev); - int nbr_icc_paths = 0; int i; int ret; - if (camss->version == CAMSS_8250) - nbr_icc_paths = ICC_SM8250_COUNT; - - for (i = 0; i < nbr_icc_paths; i++) { + for (i = 0; i < camss->res->icc_path_num; i++) { ret = icc_set_bw(camss->icc_path[i], 0, 0); if (ret) return ret; @@ -1771,17 +1763,14 @@ static int __maybe_unused camss_runtime_suspend(struct device *dev) static int __maybe_unused camss_runtime_resume(struct device *dev) { struct camss *camss = dev_get_drvdata(dev); - int nbr_icc_paths = 0; + const struct resources_icc *icc_res = camss->res->icc_res; int i; int ret; - if (camss->version == CAMSS_8250) - nbr_icc_paths = ICC_SM8250_COUNT; - - for (i = 0; i < nbr_icc_paths; i++) { + for (i = 0; i < camss->res->icc_path_num; i++) { ret = icc_set_bw(camss->icc_path[i], - camss->icc_bw_tbl[i].avg, - camss->icc_bw_tbl[i].peak); + icc_res[i].icc_bw_tbl.avg, + icc_res[i].icc_bw_tbl.peak); if (ret) return ret; } diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h index f632ee49ad83e..988c313b63551 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -84,6 +84,8 @@ struct camss_resources { const struct resources *csid_res; const struct resources *ispif_res; const struct resources *vfe_res; + const struct resources_icc *icc_res; + const int icc_path_num; }; struct camss { @@ -105,7 +107,6 @@ struct camss { struct device **genpd; struct device_link **genpd_link; struct icc_path *icc_path[ICC_SM8250_COUNT]; - struct icc_bw_tbl icc_bw_tbl[ICC_SM8250_COUNT]; const struct camss_resources *res; };