From patchwork Thu Aug 17 14:38:02 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: 715474 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 8921DC30627 for ; Thu, 17 Aug 2023 14:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352021AbjHQOim (ORCPT ); Thu, 17 Aug 2023 10:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352020AbjHQOiW (ORCPT ); Thu, 17 Aug 2023 10:38:22 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BA12D7D for ; Thu, 17 Aug 2023 07:38:20 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fe5c0e57d2so71671505e9.0 for ; Thu, 17 Aug 2023 07:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692283099; x=1692887899; 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=b6XC+poJvxEFCaLIAoBJcZv+bqQts3pZAc/0VRAbwFk=; b=rwXQ0q7dzosmwQnAX940TetwmZkayCf4DgeNvSJzjtbrwJxc2bc36z7eXEKTFTst9p jioqRyeTo3T8PSelqOXPREiT1czmnEzEV2Wrxj0cihSOP0Jmt1AjAmZdX1OgPSMPqG8a GFk2TUC7beQmX9PgZSLuYklymmkYQ7bxz454y5JuRFvdEaajFMqk342kqCCjXyqAYkR5 IdjEDniLIJ07VLkiUn7SgIwKDQwBFvGvkY34IdASC/0q6vctrZ19z4dLHutXlXOQ8wAw fM1Peii0flYWpBqCcanBrTrK/CXejV3o8PjDXQxN3mGg4ebXxocnxYjdoCVC6MEUnzrY R0dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692283099; x=1692887899; 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=b6XC+poJvxEFCaLIAoBJcZv+bqQts3pZAc/0VRAbwFk=; b=MDbMn58+7vKwguBJtdIbwJgysJ4KKhUsj5IpX1zExZFUczTXpvthbTVToBlqkTvoF5 oRTfN65m7ReidtSC5xGl1iIpQmfCVLa9zU096J9po8fyHn2Pno7uezVRIu8zQZYpJQDJ M+cFVjLo/Q6rKWnmg38yiyKwzrdTxiT31vuSUXQu68xpFtsvlCPetua0M4DQMz7aYDOH 9+v59iMtoYJRc3myu6l5s0u2S8w8XgII6zWPHvs1T3u93W8kCECwBE/ZFZcaGnMvHn+z 5R4LbF9gIVPyiXVPSiGXiAct9q9YhlEU8/DgbflFZXFYQ4umE44K40ucizmEdlqnbQyP BFkA== X-Gm-Message-State: AOJu0YwwEmXgiL8tVz5+h9Ce1jh76n5D4iWLu69AF8Ih18qms6ZhcG0g 1pV8Uv1ByEcWdnrrzo7jBkM15Q== X-Google-Smtp-Source: AGHT+IHYyEqQFgpuVvYUK7qvAKntV6iBvesFlPgR/D0SWvbnckQuDcnIN3hp744UhBPvK6clYgP7IA== X-Received: by 2002:adf:9d8d:0:b0:317:5d3d:c9df with SMTP id p13-20020adf9d8d000000b003175d3dc9dfmr4583744wre.18.1692283099193; Thu, 17 Aug 2023 07:38:19 -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 i8-20020a5d4388000000b0030647449730sm25218232wrq.74.2023.08.17.07.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 07:38:18 -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 v2 03/13] media: qcom: camss: Pass icc bandwidth table as a platform parameter Date: Thu, 17 Aug 2023 15:38:02 +0100 Message-ID: <20230817143812.677554-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230817143812.677554-1-bryan.odonoghue@linaro.org> References: <20230817143812.677554-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 2f9d5ad303951..cf2ba31f698e2 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1485,21 +1485,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; @@ -1737,6 +1731,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[] = { @@ -1753,14 +1749,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; @@ -1772,17 +1764,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; };