From nobody Wed Dec 17 05:57:14 2025 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 2B3D1EE49B2 for ; Wed, 23 Aug 2023 10:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233971AbjHWKpA (ORCPT ); Wed, 23 Aug 2023 06:45:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbjHWKoy (ORCPT ); Wed, 23 Aug 2023 06:44:54 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC12CDF for ; Wed, 23 Aug 2023 03:44:51 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fef2f05356so26215585e9.0 for ; Wed, 23 Aug 2023 03:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787490; x=1693392290; 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=bLS0B+SArRid/e9AB/VEkQGWQx14zSatlMTcSargJZU=; b=nXV88WHPOYY9HGbq1FnGn9LiAQCFnGn0qNe6AauoCnz4hWRTn+NY8kZMklHW4eL4uy aD8ZXPNs5wS25inqE9OxVjMAVdkApSUr7ZXtWSMgqtZovmKgKofmwtDutfwdirhvo/0h WQqqbTc5O0GPEvgumuhXiocAPtHCfPHhHgLN3ZT5jviOg5e4+9CBcx/PgtJiv0dJBOH6 j20EfmTZhMZOlBIWDnHE9hNp18DLpLweG2RefVl6QE8uq0ilTsxD6t1E4TQy3ubnJlvu qG7JipC3pHX2uEztcQBlIFCnFGxMVWv6ZDKltTuXeiQuuzAozLtu0MIigSmoge2Ji/+0 xsoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787490; x=1693392290; 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=bLS0B+SArRid/e9AB/VEkQGWQx14zSatlMTcSargJZU=; b=leba/xPHVByfQCS/YybIOOd26gzf9xk+IxsJsQ2pzK+0qzg+iZz6/IDAGJxI7v9sNT S6RO5FtZ2uG5Q3ZQOL3cyHKtOWhE9Kry2obM9VgMtpq/g/BaK6L4ge2h9MY59kWZJMFo CM8Nka9jwQeq1iaDnLqXjE2ASTLlVhQ9ftlVqsrqBU2bIm9Q0qp05wlNr62LwcFDP9YP tiEnx6TALoYV+wx0mHCZtNCa0ULgI5BR/hA1ABN7EQRpl/6TE/bdAj4FiuI9UHm90aXD /ffcebiWoZccG3m4K1VSgGzOwUFtocW1ltU5AypvSCsa2K8p+LhZ3CObKhAj/lEYunPH dEng== X-Gm-Message-State: AOJu0Yx1gIiU0S8EqPblQDHlfAz7bJVFSdj6Ael1FYpk7K7vMLnRMPsK wMS+8QNfmwXrvdgmIn5oxKW/lekJ3fzEfNM0iQo= X-Google-Smtp-Source: AGHT+IGTCInGt3SIRkdiOlVQctVvqEx6n0AIAtNdDfsbxUsOSKf+y4irFY7Qqvc2cY3q8ANvkzwpyQ== X-Received: by 2002:a1c:f304:0:b0:3fe:4900:db95 with SMTP id q4-20020a1cf304000000b003fe4900db95mr10142976wmq.37.1692787490508; Wed, 23 Aug 2023 03:44:50 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:49 -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 v3 01/15] media: qcom: camss: Amalgamate struct resource with struct resource_ispif Date: Wed, 23 Aug 2023 11:44:30 +0100 Message-ID: <20230823104444.1954663-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is no good reason to differentiate the two resource structures here. As part of a general tidyup of the declaration and passing of resources within in the CAMSS driver it will be advantageous to have one unified resource structure. The two structures are very similar anyway thus leading more credence still to the argument there should be only one. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss-ispif.c | 4 ++-- drivers/media/platform/qcom/camss/camss-ispif.h | 4 ++-- drivers/media/platform/qcom/camss/camss.c | 14 +++++++------- drivers/media/platform/qcom/camss/camss.h | 8 +------- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/medi= a/platform/qcom/camss/camss-ispif.c index 1c7e4b1b49401..61765b874b9a2 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -1095,7 +1095,7 @@ static int ispif_init_formats(struct v4l2_subdev *sd,= struct v4l2_subdev_fh *fh) * Return 0 on success or a negative error code otherwise */ int msm_ispif_subdev_init(struct camss *camss, - const struct resources_ispif *res) + const struct resources *res) { struct device *dev =3D camss->dev; struct ispif_device *ispif =3D camss->ispif; @@ -1152,7 +1152,7 @@ int msm_ispif_subdev_init(struct camss *camss, =20 /* Interrupt */ =20 - ret =3D platform_get_irq_byname(pdev, res->interrupt); + ret =3D platform_get_irq_byname(pdev, res->interrupt[0]); if (ret < 0) return ret; =20 diff --git a/drivers/media/platform/qcom/camss/camss-ispif.h b/drivers/medi= a/platform/qcom/camss/camss-ispif.h index fdf28e68cc7d8..c7c41f7afcaad 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.h +++ b/drivers/media/platform/qcom/camss/camss-ispif.h @@ -66,10 +66,10 @@ struct ispif_device { struct camss *camss; }; =20 -struct resources_ispif; +struct resources; =20 int msm_ispif_subdev_init(struct camss *camss, - const struct resources_ispif *res); + const struct resources *res); =20 int msm_ispif_register_entities(struct ispif_device *ispif, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index f4948bdf3f8f9..de39dc987444f 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -93,14 +93,14 @@ static const struct resources csid_res_8x16[] =3D { }, }; =20 -static const struct resources_ispif ispif_res_8x16 =3D { +static const struct resources ispif_res_8x16 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", "csi1", "csi1_pix", "csi1_rdi" }, .clock_for_reset =3D { "vfe0", "csi_vfe0" }, .reg =3D { "ispif", "csi_clk_mux" }, - .interrupt =3D "ispif" + .interrupt =3D { "ispif" } =20 }; =20 @@ -234,7 +234,7 @@ static const struct resources csid_res_8x96[] =3D { } }; =20 -static const struct resources_ispif ispif_res_8x96 =3D { +static const struct resources ispif_res_8x96 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -243,7 +243,7 @@ static const struct resources_ispif ispif_res_8x96 =3D { "csi3", "csi3_pix", "csi3_rdi" }, .clock_for_reset =3D { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, .reg =3D { "ispif", "csi_clk_mux" }, - .interrupt =3D "ispif" + .interrupt =3D { "ispif" } }; =20 static const struct resources vfe_res_8x96[] =3D { @@ -410,7 +410,7 @@ static const struct resources csid_res_660[] =3D { } }; =20 -static const struct resources_ispif ispif_res_660 =3D { +static const struct resources ispif_res_660 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -419,7 +419,7 @@ static const struct resources_ispif ispif_res_660 =3D { "csi3", "csi3_pix", "csi3_rdi" }, .clock_for_reset =3D { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, .reg =3D { "ispif", "csi_clk_mux" }, - .interrupt =3D "ispif" + .interrupt =3D { "ispif" } }; =20 static const struct resources vfe_res_660[] =3D { @@ -1122,7 +1122,7 @@ static int camss_init_subdevices(struct camss *camss) { const struct resources *csiphy_res; const struct resources *csid_res; - const struct resources_ispif *ispif_res; + const struct resources *ispif_res; const struct resources *vfe_res; unsigned int i; int ret; diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index f6c326cb853b8..e95211cdb1fd6 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -44,18 +44,12 @@ struct resources { char *regulators[CAMSS_RES_MAX]; char *clock[CAMSS_RES_MAX]; + char *clock_for_reset[CAMSS_RES_MAX]; u32 clock_rate[CAMSS_RES_MAX][CAMSS_RES_MAX]; char *reg[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX]; }; =20 -struct resources_ispif { - char *clock[CAMSS_RES_MAX]; - char *clock_for_reset[CAMSS_RES_MAX]; - char *reg[CAMSS_RES_MAX]; - char *interrupt; -}; - struct icc_bw_tbl { u32 avg; u32 peak; --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 B7494EE49B5 for ; Wed, 23 Aug 2023 10:45:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234019AbjHWKpF (ORCPT ); Wed, 23 Aug 2023 06:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbjHWKo4 (ORCPT ); Wed, 23 Aug 2023 06:44:56 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B65ECD6 for ; Wed, 23 Aug 2023 03:44:53 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-31c65820134so1053594f8f.1 for ; Wed, 23 Aug 2023 03:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787492; x=1693392292; 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=UOQMt6LGnjx7JhmDLSzLt0JBb4ekUa1o7TXj57fmgKw=; b=aAlVefWk5VXwjsl7lYEYrnPHSnzKakhaD+iLz4yyio6BX239d6x/oyaSC7AYa2DFtK Pk+fbMBaZSIbzl//i+vOR9SGev4RiF4SWtJGiNnXOthzCCFFsvx/Fr2AsCLwF+LpKwiR 4zQZnhnVmpiebjQlZ4NN0ctMbkSe7Kj0j+6EzDPOy+ojkCzCa3XF4wXcMch0D9qK7qKf XQljBhbD8VMWP+//HvV+afYbuem/mowsamPWe4RgZNcD2mT5+7cYz8OQgxpMuNIyZyej 4SckOtoI7+P+tnNEBmZv0so4sdnKpGzlXn8mF3TvQbZYDlZsqQ1UCSyaJWqWhEUniPvF i+KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787492; x=1693392292; 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=UOQMt6LGnjx7JhmDLSzLt0JBb4ekUa1o7TXj57fmgKw=; b=TPLHvnv8YazCO/T2nzRim5bdrmv/489vvZs3zVDE9beYyDXB0vP2CuPQgAXlUyNDMr SXIXHVfr+BxPIJhkuQCVzvDdjy4dor2VfBANn69fx2g/mA3bfnlSbULYpz2UhK9HR+Ug pe2csdMJY0SEQZ7SGeHxApFRiOMr0qmCDwfOO3A7EpIJf1pEgE0zmX/U4w8YV5niIfqy 76kzyuDzzCTcADLPodT+9HrI8ryRLDh1XfxfXMU5OZMo3iOE+9Xpo1dUE3PmuOelZQTu UE1sv48dEaPHis+7Ha7yH8ACSDTILgARYxIXRdmelOQakzPS8JNBMKFVNNUlLy8mFKTA LVBw== X-Gm-Message-State: AOJu0Yy+nf0422eymrMZnwDRJP7Jwik1HryqYNut92MxvgONqQrzQ+rp 9z8m5qKE4G+Xa368DGTjIhZ78A== X-Google-Smtp-Source: AGHT+IEac0jXj8QYVhRmaIXUyYJmaQ3WFnigyldaBST+Yb8q9e7RTxgE883VTYbEoEPizJnWSWm8vw== X-Received: by 2002:a5d:55c3:0:b0:319:7a9f:c63 with SMTP id i3-20020a5d55c3000000b003197a9f0c63mr9112677wrw.50.1692787491845; Wed, 23 Aug 2023 03:44:51 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:51 -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 v3 02/15] media: qcom: camss: Start to move to module compat matched resources Date: Wed, 23 Aug 2023 11:44:31 +0100 Message-ID: <20230823104444.1954663-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is a lot of unnecessary if/elsing in this code that arguably should never have made it upstream when adding a second let alone subsequent SoC. I'm guilty of not fixing the mess myself when adding in the sm8250. Before adding in any new SoCs or resources lets take the time to cleanup the resource passing. First step is to pass the generic struct camss_resources as a parameter per the compatible list. Subsequent patches will address the other somewhat dispirate strutures which we are also doing if/else on and assigning statically. Squashed down a commit to drop useless NULL assignment for ispif resources. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss.c | 92 ++++++++++++----------- drivers/media/platform/qcom/camss/camss.h | 8 ++ 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index de39dc987444f..82e679c8ca011 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1120,47 +1121,13 @@ static int camss_of_parse_ports(struct camss *camss) */ static int camss_init_subdevices(struct camss *camss) { - const struct resources *csiphy_res; - const struct resources *csid_res; - const struct resources *ispif_res; - const struct resources *vfe_res; + const struct camss_resources *res =3D camss->res; unsigned int i; int ret; =20 - if (camss->version =3D=3D CAMSS_8x16) { - csiphy_res =3D csiphy_res_8x16; - csid_res =3D csid_res_8x16; - ispif_res =3D &ispif_res_8x16; - vfe_res =3D vfe_res_8x16; - } else if (camss->version =3D=3D CAMSS_8x96) { - csiphy_res =3D csiphy_res_8x96; - csid_res =3D csid_res_8x96; - ispif_res =3D &ispif_res_8x96; - vfe_res =3D vfe_res_8x96; - } else if (camss->version =3D=3D CAMSS_660) { - csiphy_res =3D csiphy_res_660; - csid_res =3D csid_res_660; - ispif_res =3D &ispif_res_660; - vfe_res =3D vfe_res_660; - } else if (camss->version =3D=3D CAMSS_845) { - csiphy_res =3D csiphy_res_845; - csid_res =3D csid_res_845; - /* Titan VFEs don't have an ISPIF */ - ispif_res =3D NULL; - vfe_res =3D vfe_res_845; - } else if (camss->version =3D=3D CAMSS_8250) { - csiphy_res =3D csiphy_res_8250; - csid_res =3D csid_res_8250; - /* Titan VFEs don't have an ISPIF */ - ispif_res =3D NULL; - vfe_res =3D vfe_res_8250; - } else { - return -EINVAL; - } - for (i =3D 0; i < camss->csiphy_num; i++) { ret =3D msm_csiphy_subdev_init(camss, &camss->csiphy[i], - &csiphy_res[i], i); + &res->csiphy_res[i], i); if (ret < 0) { dev_err(camss->dev, "Failed to init csiphy%d sub-device: %d\n", @@ -1172,7 +1139,7 @@ static int camss_init_subdevices(struct camss *camss) /* note: SM8250 requires VFE to be initialized before CSID */ for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) { ret =3D msm_vfe_subdev_init(camss, &camss->vfe[i], - &vfe_res[i], i); + &res->vfe_res[i], i); if (ret < 0) { dev_err(camss->dev, "Fail to init vfe%d sub-device: %d\n", i, ret); @@ -1182,7 +1149,7 @@ static int camss_init_subdevices(struct camss *camss) =20 for (i =3D 0; i < camss->csid_num; i++) { ret =3D msm_csid_subdev_init(camss, &camss->csid[i], - &csid_res[i], i); + &res->csid_res[i], i); if (ret < 0) { dev_err(camss->dev, "Failed to init csid%d sub-device: %d\n", @@ -1191,7 +1158,7 @@ static int camss_init_subdevices(struct camss *camss) } } =20 - ret =3D msm_ispif_subdev_init(camss, ispif_res); + ret =3D msm_ispif_subdev_init(camss, res->ispif_res); if (ret < 0) { dev_err(camss->dev, "Failed to init ispif sub-device: %d\n", ret); @@ -1554,6 +1521,10 @@ static int camss_probe(struct platform_device *pdev) if (!camss) return -ENOMEM; =20 + camss->res =3D of_device_get_match_data(dev); + if (!camss->res) + return -ENODEV; + atomic_set(&camss->ref_count, 0); camss->dev =3D dev; platform_set_drvdata(pdev, camss); @@ -1735,12 +1706,45 @@ static void camss_remove(struct platform_device *pd= ev) camss_delete(camss); } =20 +static const struct camss_resources msm8916_resources =3D { + .csiphy_res =3D csiphy_res_8x16, + .csid_res =3D csid_res_8x16, + .ispif_res =3D &ispif_res_8x16, + .vfe_res =3D vfe_res_8x16, +}; + +static const struct camss_resources msm8996_resources =3D { + .csiphy_res =3D csiphy_res_8x96, + .csid_res =3D csid_res_8x96, + .ispif_res =3D &ispif_res_8x96, + .vfe_res =3D vfe_res_8x96, +}; + +static const struct camss_resources sdm660_resources =3D { + .csiphy_res =3D csiphy_res_660, + .csid_res =3D csid_res_660, + .ispif_res =3D &ispif_res_660, + .vfe_res =3D vfe_res_660, +}; + +static const struct camss_resources sdm845_resources =3D { + .csiphy_res =3D csiphy_res_845, + .csid_res =3D csid_res_845, + .vfe_res =3D vfe_res_845, +}; + +static const struct camss_resources sm8250_resources =3D { + .csiphy_res =3D csiphy_res_8250, + .csid_res =3D csid_res_8250, + .vfe_res =3D vfe_res_8250, +}; + static const struct of_device_id camss_dt_match[] =3D { - { .compatible =3D "qcom,msm8916-camss" }, - { .compatible =3D "qcom,msm8996-camss" }, - { .compatible =3D "qcom,sdm660-camss" }, - { .compatible =3D "qcom,sdm845-camss" }, - { .compatible =3D "qcom,sm8250-camss" }, + { .compatible =3D "qcom,msm8916-camss", .data =3D &msm8916_resources }, + { .compatible =3D "qcom,msm8996-camss", .data =3D &msm8996_resources }, + { .compatible =3D "qcom,sdm660-camss", .data =3D &sdm660_resources }, + { .compatible =3D "qcom,sdm845-camss", .data =3D &sdm845_resources }, + { .compatible =3D "qcom,sm8250-camss", .data =3D &sm8250_resources }, { } }; =20 diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index e95211cdb1fd6..f632ee49ad83e 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -79,6 +79,13 @@ enum icc_count { ICC_SM8250_COUNT =3D 4, }; =20 +struct camss_resources { + const struct resources *csiphy_res; + const struct resources *csid_res; + const struct resources *ispif_res; + const struct resources *vfe_res; +}; + struct camss { enum camss_version version; struct v4l2_device v4l2_dev; @@ -99,6 +106,7 @@ struct camss { 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; }; =20 struct camss_camera_interface { --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 741AFEE49B5 for ; Wed, 23 Aug 2023 10:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbjHWKpJ (ORCPT ); Wed, 23 Aug 2023 06:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbjHWKo5 (ORCPT ); Wed, 23 Aug 2023 06:44:57 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D03D519A for ; Wed, 23 Aug 2023 03:44:54 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fee8af9cb9so34549265e9.1 for ; Wed, 23 Aug 2023 03:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787493; x=1693392293; 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=KIWSC2EXa4HC3O/Hi/O/D4z9uJ3T4+wrp3sKyTVS8eA=; b=wCYkjiMl12JkIIhXpD1ukArWwsuDfqjnN7xONtU0ClDyUfnpCeYvZ2VtS4IpMutdWI DVxZrGT1VIcuH7OF4s5oI0aS+IYslZZKTOnRH8XA3isMuiZ2yYRWKsWfaxzAYhufwRe1 AIRse4YxfM9YTcmCHyn32cJSaA/PnKtW3qhrAoIEO+0BRLgEgTjQM7Ve18oajWxaLQLD 4Im8lEJXHGFAA8BJ40juC1uzSDHRlq5TRS8cLbeLmkEEH8Grj9GFiPmDcm6OQrcrA78d Pm9fAbgHCFr8dfhO6CzjJuUM6TViUHQb5c+ABqPrQQJZ4HWkM9DxcU564UF/2+gKVfNf Dhpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787493; x=1693392293; 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=KIWSC2EXa4HC3O/Hi/O/D4z9uJ3T4+wrp3sKyTVS8eA=; b=ij2KneQrcAzLQhRlMdhETgBpRlNdU8XRWwo1bp2iFWsSOwKaDv7667kjUa4naQNy0+ QGQafCG1okv87uRoXyqXkeHmqwV9THHCF46CMQR55Rvz9Fu5JoK3LXoS18szEaYB9mpR la1a1wNb/lspU/tTVK9csxCGHR+cNXgIkDA0F/WpgvMOTZvRxzFeaMzmhhA4MZkIKj9/ 0RGg/B5fvXJhsi5XXtZWWK43eQzUs+vPIb8yvyzEGXuzW8AxDaKh8izogJpDp0dMLvlx 3XewaEoXNjY5H0R4CgGUnVsunim0p7k4a7Cz9nJC2zgm8Irww6BBdXE1szUEM9sHS8kl gkFA== X-Gm-Message-State: AOJu0Yyyai6VartaC4IgGghUvSe7chghPuwie1c86mAnCV7mzuW4DT0v LWFrKmcAxK0bSguJPTqNtz3PIQ== X-Google-Smtp-Source: AGHT+IEvB8PxZ0J0910A09wrsJb9MtH6J4s1XlznJTO7A9F2iD1Plu9djHIS0SR83V/CaFASyQJ4Wg== X-Received: by 2002:a05:600c:2901:b0:3fe:ef11:d79f with SMTP id i1-20020a05600c290100b003feef11d79fmr7491278wmd.36.1692787493280; Wed, 23 Aug 2023 03:44:53 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:52 -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 v3 03/15] media: qcom: camss: Pass icc bandwidth table as a platform parameter Date: Wed, 23 Aug 2023 11:44:32 +0100 Message-ID: <20230823104444.1954663-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Pass the bandwidth table as a platform parameter not if/else derived pointer to the static table. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- 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/plat= form/qcom/camss/camss.c index 82e679c8ca011..9a15f2253aa20 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 =3D 0; int i; =20 - if (camss->version =3D=3D CAMSS_8250) { - icc_res =3D &icc_res_sm8250[0]; - nbr_icc_paths =3D ICC_SM8250_COUNT; - } + icc_res =3D camss->res->icc_res; =20 - for (i =3D 0; i < nbr_icc_paths; i++) { + for (i =3D 0; i < camss->res->icc_path_num; i++) { camss->icc_path[i] =3D 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] =3D icc_res[i].icc_bw_tbl; } =20 return 0; @@ -1737,6 +1731,8 @@ static const struct camss_resources sm8250_resources = =3D { .csiphy_res =3D csiphy_res_8250, .csid_res =3D csid_res_8250, .vfe_res =3D vfe_res_8250, + .icc_res =3D icc_res_sm8250, + .icc_path_num =3D ARRAY_SIZE(icc_res_sm8250), }; =20 static const struct of_device_id camss_dt_match[] =3D { @@ -1753,14 +1749,10 @@ MODULE_DEVICE_TABLE(of, camss_dt_match); static int __maybe_unused camss_runtime_suspend(struct device *dev) { struct camss *camss =3D dev_get_drvdata(dev); - int nbr_icc_paths =3D 0; int i; int ret; =20 - if (camss->version =3D=3D CAMSS_8250) - nbr_icc_paths =3D ICC_SM8250_COUNT; - - for (i =3D 0; i < nbr_icc_paths; i++) { + for (i =3D 0; i < camss->res->icc_path_num; i++) { ret =3D icc_set_bw(camss->icc_path[i], 0, 0); if (ret) return ret; @@ -1772,17 +1764,14 @@ static int __maybe_unused camss_runtime_suspend(str= uct device *dev) static int __maybe_unused camss_runtime_resume(struct device *dev) { struct camss *camss =3D dev_get_drvdata(dev); - int nbr_icc_paths =3D 0; + const struct resources_icc *icc_res =3D camss->res->icc_res; int i; int ret; =20 - if (camss->version =3D=3D CAMSS_8250) - nbr_icc_paths =3D ICC_SM8250_COUNT; - - for (i =3D 0; i < nbr_icc_paths; i++) { + for (i =3D 0; i < camss->res->icc_path_num; i++) { ret =3D 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/plat= form/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; }; =20 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; }; =20 --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 1BB3FEE49B6 for ; Wed, 23 Aug 2023 10:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234066AbjHWKpN (ORCPT ); Wed, 23 Aug 2023 06:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233992AbjHWKpC (ORCPT ); Wed, 23 Aug 2023 06:45:02 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130F3CD5 for ; Wed, 23 Aug 2023 03:44:56 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe24dd8898so51539445e9.2 for ; Wed, 23 Aug 2023 03:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787494; x=1693392294; 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=lBWmlhalWFsNO67TkZzWkCo5vE7R/Zh6svfTml3ShZ0=; b=hWaKKwhcVSHLeoetD7Oan66QkdjIAQT2XCiDU6EmJKlrZfs76/fY+Ep5LaAJbQgGMu 58WIIRWiitMNp15iu3B1Gl5VDKD3doln6CTOZsqD3nqv92hAkBKg4fuMN+6YOCDBNGyw rHyTm8FNUft3OPi6ghE0kEGup2A/iX9Ek4EBHPJj0xL//5U3grCVGpJnoFm2EIIIuaX3 +0+1CE5C3YApHGpptq5Z1wTBfNtzxZwOUUzj7NVvAp6wzdBZ0cLQHfdrRAzxP1vTClfc hKP3LjyqRzFgLATt3xGk144G5GgK898P5dh6DVy71XGc9XSx6DsDQtRnDNWfeOuyOxKp rk9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787494; x=1693392294; 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=lBWmlhalWFsNO67TkZzWkCo5vE7R/Zh6svfTml3ShZ0=; b=ZqU2C62bEZS1TJEwQXiqCBHc9XWog3ZDCkts4XF54DJVVn4Jg2/laQA0/RNCC2IVLZ EKde7Jjosd5vp9N7rtlyPeR/N1eznSnV4VYXyowT8DW//4mReyhmTfMAxs31dSO+bhXn Vne6Sui9ptQqW8mpZ+sMoEHV+bVhXX+4JsbrKVTisCXQnSDwmTACHbUWiPqiL+kiK1wU pz6JJgCoXtIZTtAH4nRnSflRc6kwJbjunMzlsCO3k2Pv6qe5mgJ4TH5qpmM2h05HRHLs FfvEdS0CKAiYPtP77V5oceS9rg+mIWDDAoGig9BfiOdclIgsZWgXmieJUCKTkJs2UdnE oIWQ== X-Gm-Message-State: AOJu0YwLnc7SW3kszsDN4kqYnkUuNkV+a/X7wg+qyhxqE1k2qVhY7xHC yUzLIgGIZRToym6WHsz3VZrYWecB8NnJE0/oWzM= X-Google-Smtp-Source: AGHT+IHfthRNfVumYnBKUt/9JLG+7gXh4G0PwCcKtKPwtVNPDJveE0jS0XmBw+UqSmcXpCC8zvnG5A== X-Received: by 2002:a1c:790e:0:b0:3fc:21:2c43 with SMTP id l14-20020a1c790e000000b003fc00212c43mr9845911wme.13.1692787494518; Wed, 23 Aug 2023 03:44:54 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:53 -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 v3 04/15] media: qcom: camss: Pass remainder of variables as resources Date: Wed, 23 Aug 2023 11:44:33 +0100 Message-ID: <20230823104444.1954663-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The following variables are being assigned statically based on compatible strings in the probe path. * enum camss_version version; * int csiphy_num; * int csid_num; * int vfe_num; * int vfe_lite_num; * int vfe_total_num; Migrate those variables to resource parameters passed in on platform probe arguments. The one caveat is for VFE it has been necessary to intoduce a new variable vfe_total_num to capture the aggregate value of vfe_num + vfe_lite_num. All the rest of the changes are rote camss->variable to camss->res->variable with the parameter tables now populating the listed variables. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- .../media/platform/qcom/camss/camss-csid.c | 14 +-- .../qcom/camss/camss-csiphy-3ph-1-0.c | 8 +- .../media/platform/qcom/camss/camss-csiphy.c | 16 +-- .../media/platform/qcom/camss/camss-ispif.c | 28 ++--- .../media/platform/qcom/camss/camss-vfe-170.c | 4 +- .../media/platform/qcom/camss/camss-vfe-480.c | 4 +- drivers/media/platform/qcom/camss/camss-vfe.c | 26 ++-- .../media/platform/qcom/camss/camss-video.c | 10 +- drivers/media/platform/qcom/camss/camss.c | 119 +++++++++--------- drivers/media/platform/qcom/camss/camss.h | 11 +- 10 files changed, 117 insertions(+), 123 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index 9d7fb1adebb98..08991b070bd61 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -159,7 +159,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int o= n) struct camss *camss =3D csid->camss; struct device *dev =3D camss->dev; struct vfe_device *vfe =3D &camss->vfe[csid->id]; - u32 version =3D camss->version; + u32 version =3D camss->res->version; int ret =3D 0; =20 if (on) { @@ -576,13 +576,13 @@ int msm_csid_subdev_init(struct camss *camss, struct = csid_device *csid, csid->camss =3D camss; csid->id =3D id; =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { csid->ops =3D &csid_ops_4_1; - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { csid->ops =3D &csid_ops_4_7; - } else if (camss->version =3D=3D CAMSS_845 || - camss->version =3D=3D CAMSS_8250) { + } else if (camss->res->version =3D=3D CAMSS_845 || + camss->res->version =3D=3D CAMSS_8250) { csid->ops =3D &csid_ops_gen2; } else { return -EINVAL; @@ -591,7 +591,7 @@ int msm_csid_subdev_init(struct camss *camss, struct cs= id_device *csid, =20 /* Memory */ =20 - if (camss->version =3D=3D CAMSS_8250) { + if (camss->res->version =3D=3D CAMSS_8250) { /* for titan 480, CSID registers are inside the VFE region, * between the VFE "top" and "bus" registers. this requires * VFE to be initialized before CSID diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/dri= vers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index 4dba61b8d3f2a..f50e2235c37fc 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -402,7 +402,7 @@ static void csiphy_gen1_config_lanes(struct csiphy_devi= ce *csiphy, val =3D CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG; writel_relaxed(val, csiphy->base + CSIPHY_3PH_LNn_CFG1(l)); =20 - if (csiphy->camss->version =3D=3D CAMSS_660) + if (csiphy->camss->res->version =3D=3D CAMSS_660) val =3D CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS_660; else val =3D CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS; @@ -419,7 +419,7 @@ static void csiphy_gen2_config_lanes(struct csiphy_devi= ce *csiphy, int i, l, array_size; u32 val; =20 - switch (csiphy->camss->version) { + switch (csiphy->camss->res->version) { case CAMSS_845: r =3D &lane_regs_sdm845[0][0]; array_size =3D ARRAY_SIZE(lane_regs_sdm845[0]); @@ -468,8 +468,8 @@ static void csiphy_lanes_enable(struct csiphy_device *c= siphy, s64 link_freq, u8 lane_mask) { struct csiphy_lanes_cfg *c =3D &cfg->csi2->lane_cfg; - bool is_gen2 =3D (csiphy->camss->version =3D=3D CAMSS_845 || - csiphy->camss->version =3D=3D CAMSS_8250); + bool is_gen2 =3D (csiphy->camss->res->version =3D=3D CAMSS_845 || + csiphy->camss->res->version =3D=3D CAMSS_8250); u8 settle_cnt; u8 val; int i; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index c5ae9c61ee0b1..593aec5c97bc2 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -557,17 +557,17 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->id =3D id; csiphy->cfg.combo_mode =3D 0; =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { csiphy->ops =3D &csiphy_ops_2ph_1_0; csiphy->formats =3D csiphy_formats_8x16; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x16); - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_8x96; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x96); - } else if (camss->version =3D=3D CAMSS_845 || - camss->version =3D=3D CAMSS_8250) { + } else if (camss->res->version =3D=3D CAMSS_845 || + camss->res->version =3D=3D CAMSS_8250) { csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_sdm845; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_sdm845); @@ -581,8 +581,8 @@ int msm_csiphy_subdev_init(struct camss *camss, if (IS_ERR(csiphy->base)) return PTR_ERR(csiphy->base); =20 - if (camss->version =3D=3D CAMSS_8x16 || - camss->version =3D=3D CAMSS_8x96) { + if (camss->res->version =3D=3D CAMSS_8x16 || + camss->res->version =3D=3D CAMSS_8x96) { csiphy->base_clk_mux =3D devm_platform_ioremap_resource_byname(pdev, res->reg[1]); if (IS_ERR(csiphy->base_clk_mux)) @@ -664,7 +664,7 @@ int msm_csiphy_subdev_init(struct camss *camss, !strcmp(clock->name, "csiphy5_timer")) csiphy->rate_set[i] =3D true; =20 - if (camss->version =3D=3D CAMSS_660 && + if (camss->res->version =3D=3D CAMSS_660 && (!strcmp(clock->name, "csi0_phy") || !strcmp(clock->name, "csi1_phy") || !strcmp(clock->name, "csi2_phy"))) diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/medi= a/platform/qcom/camss/camss-ispif.c index 61765b874b9a2..0a58d2cf45007 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -270,7 +270,7 @@ static int ispif_vfe_reset(struct ispif_device *ispif, = u8 vfe_id) unsigned long time; u32 val; =20 - if (vfe_id > (camss->vfe_num - 1)) { + if (vfe_id > (camss->res->vfe_num - 1)) { dev_err(camss->dev, "Error: asked reset for invalid VFE%d\n", vfe_id); return -ENOENT; @@ -829,8 +829,8 @@ static int ispif_set_stream(struct v4l2_subdev *sd, int= enable) ispif_select_csid(ispif, intf, csid, vfe, 1); ispif_select_cid(ispif, intf, cid, vfe, 1); ispif_config_irq(ispif, intf, vfe, 1); - if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ispif_config_pack(ispif, line->fmt[MSM_ISPIF_PAD_SINK].code, intf, cid, vfe, 1); @@ -847,8 +847,8 @@ static int ispif_set_stream(struct v4l2_subdev *sd, int= enable) return ret; =20 mutex_lock(&ispif->config_lock); - if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ispif_config_pack(ispif, line->fmt[MSM_ISPIF_PAD_SINK].code, intf, cid, vfe, 0); @@ -1109,10 +1109,10 @@ int msm_ispif_subdev_init(struct camss *camss, ispif->camss =3D camss; =20 /* Number of ISPIF lines - same as number of CSID hardware modules */ - if (camss->version =3D=3D CAMSS_8x16) + if (camss->res->version =3D=3D CAMSS_8x16) ispif->line_num =3D 2; - else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ispif->line_num =3D 4; else return -EINVAL; @@ -1126,12 +1126,12 @@ int msm_ispif_subdev_init(struct camss *camss, ispif->line[i].ispif =3D ispif; ispif->line[i].id =3D i; =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { ispif->line[i].formats =3D ispif_formats_8x16; ispif->line[i].nformats =3D ARRAY_SIZE(ispif_formats_8x16); - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { ispif->line[i].formats =3D ispif_formats_8x96; ispif->line[i].nformats =3D ARRAY_SIZE(ispif_formats_8x96); @@ -1159,11 +1159,11 @@ int msm_ispif_subdev_init(struct camss *camss, ispif->irq =3D ret; snprintf(ispif->irq_name, sizeof(ispif->irq_name), "%s_%s", dev_name(dev), MSM_ISPIF_NAME); - if (camss->version =3D=3D CAMSS_8x16) + if (camss->res->version =3D=3D CAMSS_8x16) ret =3D devm_request_irq(dev, ispif->irq, ispif_isr_8x16, IRQF_TRIGGER_RISING, ispif->irq_name, ispif); - else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ret =3D devm_request_irq(dev, ispif->irq, ispif_isr_8x96, IRQF_TRIGGER_RISING, ispif->irq_name, ispif); else diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index ae9137633c301..9905bb06b3823 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -676,7 +676,7 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) { struct camss *camss =3D vfe->camss; =20 - if (vfe->id >=3D camss->vfe_num) + if (vfe->id >=3D camss->res->vfe_num) return; =20 device_link_del(camss->genpd_link[vfe->id]); @@ -691,7 +691,7 @@ static int vfe_pm_domain_on(struct vfe_device *vfe) struct camss *camss =3D vfe->camss; enum vfe_line_id id =3D vfe->id; =20 - if (id >=3D camss->vfe_num) + if (id >=3D camss->res->vfe_num) return 0; =20 camss->genpd_link[id] =3D device_link_add(camss->dev, camss->genpd[id], diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-480.c index a64d660abc538..80338efceb9e1 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -502,7 +502,7 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) { struct camss *camss =3D vfe->camss; =20 - if (vfe->id >=3D camss->vfe_num) + if (vfe->id >=3D camss->res->vfe_num) return; =20 device_link_del(camss->genpd_link[vfe->id]); @@ -517,7 +517,7 @@ static int vfe_pm_domain_on(struct vfe_device *vfe) struct camss *camss =3D vfe->camss; enum vfe_line_id id =3D vfe->id; =20 - if (id >=3D camss->vfe_num) + if (id >=3D camss->res->vfe_num) return 0; =20 camss->genpd_link[id] =3D device_link_add(camss->dev, camss->genpd[id], diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index b021f81cef123..526dd4ab343fe 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -170,7 +170,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 = sink_code, { struct vfe_device *vfe =3D to_vfe(line); =20 - if (vfe->camss->version =3D=3D CAMSS_8x16) + if (vfe->camss->res->version =3D=3D CAMSS_8x16) switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -218,10 +218,10 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u3= 2 sink_code, =20 return sink_code; } - else if (vfe->camss->version =3D=3D CAMSS_8x96 || - vfe->camss->version =3D=3D CAMSS_660 || - vfe->camss->version =3D=3D CAMSS_845 || - vfe->camss->version =3D=3D CAMSS_8250) + else if (vfe->camss->res->version =3D=3D CAMSS_8x96 || + vfe->camss->res->version =3D=3D CAMSS_660 || + vfe->camss->res->version =3D=3D CAMSS_845 || + vfe->camss->res->version =3D=3D CAMSS_8250) switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -1286,7 +1286,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, int i, j; int ret; =20 - switch (camss->version) { + switch (camss->res->version) { case CAMSS_8x16: vfe->ops =3D &vfe_ops_4_1; break; @@ -1392,7 +1392,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, init_completion(&l->output.sof); init_completion(&l->output.reg_update); =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x16; l->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1400,8 +1400,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, l->formats =3D formats_rdi_8x16; l->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x96; l->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1409,8 +1409,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, l->formats =3D formats_rdi_8x96; l->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (camss->version =3D=3D CAMSS_845 || - camss->version =3D=3D CAMSS_8250) { + } else if (camss->res->version =3D=3D CAMSS_845 || + camss->res->version =3D=3D CAMSS_8250) { l->formats =3D formats_rdi_845; l->nformats =3D ARRAY_SIZE(formats_rdi_845); } else { @@ -1542,8 +1542,8 @@ int msm_vfe_register_entities(struct vfe_device *vfe, } =20 video_out->ops =3D &vfe->video_ops; - if (vfe->camss->version =3D=3D CAMSS_845 || - vfe->camss->version =3D=3D CAMSS_8250) + if (vfe->camss->res->version =3D=3D CAMSS_845 || + vfe->camss->res->version =3D=3D CAMSS_8250) video_out->bpl_alignment =3D 16; else video_out->bpl_alignment =3D 8; diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/medi= a/platform/qcom/camss/camss-video.c index 1d686aef92eaf..46a89b5f6c171 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -1006,7 +1006,7 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, =20 mutex_init(&video->lock); =20 - if (video->camss->version =3D=3D CAMSS_8x16) { + if (video->camss->res->version =3D=3D CAMSS_8x16) { if (is_pix) { video->formats =3D formats_pix_8x16; video->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1014,8 +1014,8 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x16; video->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (video->camss->version =3D=3D CAMSS_8x96 || - video->camss->version =3D=3D CAMSS_660) { + } else if (video->camss->res->version =3D=3D CAMSS_8x96 || + video->camss->res->version =3D=3D CAMSS_660) { if (is_pix) { video->formats =3D formats_pix_8x96; video->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1023,8 +1023,8 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x96; video->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (video->camss->version =3D=3D CAMSS_845 || - video->camss->version =3D=3D CAMSS_8250) { + } else if (video->camss->res->version =3D=3D CAMSS_845 || + video->camss->res->version =3D=3D CAMSS_8250) { video->formats =3D formats_rdi_845; video->nformats =3D ARRAY_SIZE(formats_rdi_845); } else { diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 9a15f2253aa20..c8a2571e664fe 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1005,7 +1005,7 @@ int camss_pm_domain_on(struct camss *camss, int id) { int ret =3D 0; =20 - if (id < camss->vfe_num) { + if (id < camss->res->vfe_num) { struct vfe_device *vfe =3D &camss->vfe[id]; =20 ret =3D vfe->ops->pm_domain_on(vfe); @@ -1016,7 +1016,7 @@ int camss_pm_domain_on(struct camss *camss, int id) =20 void camss_pm_domain_off(struct camss *camss, int id) { - if (id < camss->vfe_num) { + if (id < camss->res->vfe_num) { struct vfe_device *vfe =3D &camss->vfe[id]; =20 vfe->ops->pm_domain_off(vfe); @@ -1125,7 +1125,7 @@ static int camss_init_subdevices(struct camss *camss) unsigned int i; int ret; =20 - for (i =3D 0; i < camss->csiphy_num; i++) { + for (i =3D 0; i < camss->res->csiphy_num; i++) { ret =3D msm_csiphy_subdev_init(camss, &camss->csiphy[i], &res->csiphy_res[i], i); if (ret < 0) { @@ -1137,7 +1137,7 @@ static int camss_init_subdevices(struct camss *camss) } =20 /* note: SM8250 requires VFE to be initialized before CSID */ - for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) { + for (i =3D 0; i < camss->res->vfe_total_num; i++) { ret =3D msm_vfe_subdev_init(camss, &camss->vfe[i], &res->vfe_res[i], i); if (ret < 0) { @@ -1147,7 +1147,7 @@ static int camss_init_subdevices(struct camss *camss) } } =20 - for (i =3D 0; i < camss->csid_num; i++) { + for (i =3D 0; i < camss->res->csid_num; i++) { ret =3D msm_csid_subdev_init(camss, &camss->csid[i], &res->csid_res[i], i); if (ret < 0) { @@ -1179,7 +1179,7 @@ static int camss_register_entities(struct camss *cams= s) int i, j, k; int ret; =20 - for (i =3D 0; i < camss->csiphy_num; i++) { + for (i =3D 0; i < camss->res->csiphy_num; i++) { ret =3D msm_csiphy_register_entity(&camss->csiphy[i], &camss->v4l2_dev); if (ret < 0) { @@ -1190,7 +1190,7 @@ static int camss_register_entities(struct camss *cams= s) } } =20 - for (i =3D 0; i < camss->csid_num; i++) { + for (i =3D 0; i < camss->res->csid_num; i++) { ret =3D msm_csid_register_entity(&camss->csid[i], &camss->v4l2_dev); if (ret < 0) { @@ -1209,7 +1209,7 @@ static int camss_register_entities(struct camss *cams= s) goto err_reg_ispif; } =20 - for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) { + for (i =3D 0; i < camss->res->vfe_total_num; i++) { ret =3D msm_vfe_register_entities(&camss->vfe[i], &camss->v4l2_dev); if (ret < 0) { @@ -1220,8 +1220,8 @@ static int camss_register_entities(struct camss *cams= s) } } =20 - for (i =3D 0; i < camss->csiphy_num; i++) { - for (j =3D 0; j < camss->csid_num; j++) { + for (i =3D 0; i < camss->res->csiphy_num; i++) { + for (j =3D 0; j < camss->res->csid_num; j++) { ret =3D media_create_pad_link( &camss->csiphy[i].subdev.entity, MSM_CSIPHY_PAD_SRC, @@ -1240,7 +1240,7 @@ static int camss_register_entities(struct camss *cams= s) } =20 if (camss->ispif) { - for (i =3D 0; i < camss->csid_num; i++) { + for (i =3D 0; i < camss->res->csid_num; i++) { for (j =3D 0; j < camss->ispif->line_num; j++) { ret =3D media_create_pad_link( &camss->csid[i].subdev.entity, @@ -1260,7 +1260,7 @@ static int camss_register_entities(struct camss *cams= s) } =20 for (i =3D 0; i < camss->ispif->line_num; i++) - for (k =3D 0; k < camss->vfe_num; k++) + for (k =3D 0; k < camss->res->vfe_num; k++) for (j =3D 0; j < camss->vfe[k].line_num; j++) { struct v4l2_subdev *ispif =3D &camss->ispif->line[i].subdev; struct v4l2_subdev *vfe =3D &camss->vfe[k].line[j].subdev; @@ -1280,8 +1280,8 @@ static int camss_register_entities(struct camss *cams= s) } } } else { - for (i =3D 0; i < camss->csid_num; i++) - for (k =3D 0; k < camss->vfe_num + camss->vfe_lite_num; k++) + for (i =3D 0; i < camss->res->csid_num; i++) + for (k =3D 0; k < camss->res->vfe_total_num; k++) for (j =3D 0; j < camss->vfe[k].line_num; j++) { struct v4l2_subdev *csid =3D &camss->csid[i].subdev; struct v4l2_subdev *vfe =3D &camss->vfe[k].line[j].subdev; @@ -1305,7 +1305,7 @@ static int camss_register_entities(struct camss *cams= s) return 0; =20 err_link: - i =3D camss->vfe_num + camss->vfe_lite_num; + i =3D camss->res->vfe_total_num; err_reg_vfe: for (i--; i >=3D 0; i--) msm_vfe_unregister_entities(&camss->vfe[i]); @@ -1313,12 +1313,12 @@ static int camss_register_entities(struct camss *ca= mss) err_reg_ispif: msm_ispif_unregister_entities(camss->ispif); =20 - i =3D camss->csid_num; + i =3D camss->res->csid_num; err_reg_csid: for (i--; i >=3D 0; i--) msm_csid_unregister_entity(&camss->csid[i]); =20 - i =3D camss->csiphy_num; + i =3D camss->res->csiphy_num; err_reg_csiphy: for (i--; i >=3D 0; i--) msm_csiphy_unregister_entity(&camss->csiphy[i]); @@ -1336,15 +1336,15 @@ static void camss_unregister_entities(struct camss = *camss) { unsigned int i; =20 - for (i =3D 0; i < camss->csiphy_num; i++) + for (i =3D 0; i < camss->res->csiphy_num; i++) msm_csiphy_unregister_entity(&camss->csiphy[i]); =20 - for (i =3D 0; i < camss->csid_num; i++) + for (i =3D 0; i < camss->res->csid_num; i++) msm_csid_unregister_entity(&camss->csid[i]); =20 msm_ispif_unregister_entities(camss->ispif); =20 - for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) + for (i =3D 0; i < camss->res->vfe_total_num; i++) msm_vfe_unregister_entities(&camss->vfe[i]); } =20 @@ -1463,7 +1463,7 @@ static int camss_configure_pd(struct camss *camss) } } =20 - if (i > camss->vfe_num) { + if (i > camss->res->vfe_num) { camss->genpd_link[i - 1] =3D device_link_add(camss->dev, camss->genpd[i = - 1], DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -1509,7 +1509,8 @@ static int camss_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; struct camss *camss; - int num_subdevs, ret; + int num_subdevs; + int ret; =20 camss =3D devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL); if (!camss) @@ -1523,59 +1524,24 @@ static int camss_probe(struct platform_device *pdev) camss->dev =3D dev; platform_set_drvdata(pdev, camss); =20 - if (of_device_is_compatible(dev->of_node, "qcom,msm8916-camss")) { - camss->version =3D CAMSS_8x16; - camss->csiphy_num =3D 2; - camss->csid_num =3D 2; - camss->vfe_num =3D 1; - } else if (of_device_is_compatible(dev->of_node, - "qcom,msm8996-camss")) { - camss->version =3D CAMSS_8x96; - camss->csiphy_num =3D 3; - camss->csid_num =3D 4; - camss->vfe_num =3D 2; - } else if (of_device_is_compatible(dev->of_node, - "qcom,sdm660-camss")) { - camss->version =3D CAMSS_660; - camss->csiphy_num =3D 3; - camss->csid_num =3D 4; - camss->vfe_num =3D 2; - } else if (of_device_is_compatible(dev->of_node, - "qcom,sdm845-camss")) { - camss->version =3D CAMSS_845; - camss->csiphy_num =3D 4; - camss->csid_num =3D 3; - camss->vfe_num =3D 2; - camss->vfe_lite_num =3D 1; - } else if (of_device_is_compatible(dev->of_node, - "qcom,sm8250-camss")) { - camss->version =3D CAMSS_8250; - camss->csiphy_num =3D 6; - camss->csid_num =3D 4; - camss->vfe_num =3D 2; - camss->vfe_lite_num =3D 2; - } else { - return -EINVAL; - } - - camss->csiphy =3D devm_kcalloc(dev, camss->csiphy_num, + camss->csiphy =3D devm_kcalloc(dev, camss->res->csiphy_num, sizeof(*camss->csiphy), GFP_KERNEL); if (!camss->csiphy) return -ENOMEM; =20 - camss->csid =3D devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid), + camss->csid =3D devm_kcalloc(dev, camss->res->csid_num, sizeof(*camss->cs= id), GFP_KERNEL); if (!camss->csid) return -ENOMEM; =20 - if (camss->version =3D=3D CAMSS_8x16 || - camss->version =3D=3D CAMSS_8x96) { + if (camss->res->version =3D=3D CAMSS_8x16 || + camss->res->version =3D=3D CAMSS_8x96) { camss->ispif =3D devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL); if (!camss->ispif) return -ENOMEM; } =20 - camss->vfe =3D devm_kcalloc(dev, camss->vfe_num + camss->vfe_lite_num, + camss->vfe =3D devm_kcalloc(dev, camss->res->vfe_total_num, sizeof(*camss->vfe), GFP_KERNEL); if (!camss->vfe) return -ENOMEM; @@ -1675,7 +1641,7 @@ void camss_delete(struct camss *camss) if (camss->genpd_num =3D=3D 1) return; =20 - if (camss->genpd_num > camss->vfe_num) + if (camss->genpd_num > camss->res->vfe_num) device_link_del(camss->genpd_link[camss->genpd_num - 1]); =20 for (i =3D 0; i < camss->genpd_num; i++) @@ -1701,38 +1667,65 @@ static void camss_remove(struct platform_device *pd= ev) } =20 static const struct camss_resources msm8916_resources =3D { + .version =3D CAMSS_8x16, .csiphy_res =3D csiphy_res_8x16, .csid_res =3D csid_res_8x16, .ispif_res =3D &ispif_res_8x16, .vfe_res =3D vfe_res_8x16, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_8x16), + .csid_num =3D ARRAY_SIZE(csid_res_8x16), + .vfe_num =3D ARRAY_SIZE(vfe_res_8x16), + .vfe_total_num =3D ARRAY_SIZE(vfe_res_8x16), }; =20 static const struct camss_resources msm8996_resources =3D { + .version =3D CAMSS_8x96, .csiphy_res =3D csiphy_res_8x96, .csid_res =3D csid_res_8x96, .ispif_res =3D &ispif_res_8x96, .vfe_res =3D vfe_res_8x96, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_8x96), + .csid_num =3D ARRAY_SIZE(csid_res_8x96), + .vfe_num =3D ARRAY_SIZE(vfe_res_8x96), + .vfe_total_num =3D ARRAY_SIZE(vfe_res_8x96), }; =20 static const struct camss_resources sdm660_resources =3D { + .version =3D CAMSS_660, .csiphy_res =3D csiphy_res_660, .csid_res =3D csid_res_660, .ispif_res =3D &ispif_res_660, .vfe_res =3D vfe_res_660, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_660), + .csid_num =3D ARRAY_SIZE(csid_res_660), + .vfe_num =3D ARRAY_SIZE(vfe_res_660), + .vfe_total_num =3D ARRAY_SIZE(vfe_res_660), }; =20 static const struct camss_resources sdm845_resources =3D { + .version =3D CAMSS_845, .csiphy_res =3D csiphy_res_845, .csid_res =3D csid_res_845, .vfe_res =3D vfe_res_845, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_845), + .csid_num =3D ARRAY_SIZE(csid_res_845), + .vfe_num =3D 2, + .vfe_lite_num =3D 1, + .vfe_total_num =3D 3, }; =20 static const struct camss_resources sm8250_resources =3D { + .version =3D CAMSS_8250, .csiphy_res =3D csiphy_res_8250, .csid_res =3D csid_res_8250, .vfe_res =3D vfe_res_8250, .icc_res =3D icc_res_sm8250, .icc_path_num =3D ARRAY_SIZE(icc_res_sm8250), + .csiphy_num =3D ARRAY_SIZE(csiphy_res_8250), + .csid_num =3D ARRAY_SIZE(csid_res_8250), + .vfe_num =3D 2, + .vfe_lite_num =3D 2, + .vfe_total_num =3D 4, }; =20 static const struct of_device_id camss_dt_match[] =3D { diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index 988c313b63551..dd8c58d349685 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -80,27 +80,28 @@ enum icc_count { }; =20 struct camss_resources { + enum camss_version version; const struct resources *csiphy_res; 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; + int csiphy_num; + int csid_num; + int vfe_num; + int vfe_lite_num; + int vfe_total_num; }; =20 struct camss { - enum camss_version version; struct v4l2_device v4l2_dev; struct v4l2_async_notifier notifier; struct media_device media_dev; struct device *dev; - int csiphy_num; struct csiphy_device *csiphy; - int csid_num; struct csid_device *csid; struct ispif_device *ispif; - int vfe_num; - int vfe_lite_num; struct vfe_device *vfe; atomic_t ref_count; int genpd_num; --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 A9620EE49B2 for ; Wed, 23 Aug 2023 10:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234057AbjHWKpV (ORCPT ); Wed, 23 Aug 2023 06:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233996AbjHWKpC (ORCPT ); Wed, 23 Aug 2023 06:45:02 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E8D8E50 for ; Wed, 23 Aug 2023 03:44:57 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-31ad9155414so4732712f8f.3 for ; Wed, 23 Aug 2023 03:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787496; x=1693392296; 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=V3EVM4NSh4sU0uIYCvXtqdOfYy3wiLidXcUOiCRG0qw=; b=h59sQOBsXwNJUZ9Canihv66exOSu6HqI8yy7h37hE1ly6XLg2Nj3murXw7x+3BeuvP 01ZKJxDgv1mLWoLyrsqgFHvUOvqwZaPWegohCB1gy12LvTMTHBPyfxdqZu1K2grQ+eW+ hC2+q7LflLOlIKuV8YSJ2auH+vVdiyFxWnDGXxMmdzpSN2ASJPvoXuqrdts00nLe1vMk DedN41WI6buB+dPK+YRvBMD3/vfgHxDwY0vxOWLHja6dLS9/LyfVcsZhyrO6X3dfCfCm 6XMPf40Jx3vCyPJxp320h1EN4gyNyGxCT2ESw7eA/SAHMgHXXDqTHsoYEkDFI8ByhH48 Hvng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787496; x=1693392296; 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=V3EVM4NSh4sU0uIYCvXtqdOfYy3wiLidXcUOiCRG0qw=; b=gqgG1e9cMd7/7qU+81RjFQfDQWBpH2wln44NnW+QkpdpE4Ibo3XF3OIPjtpEPF1DVl eqdjb6AJ4kjiN9gba72IlBneSuqIjDNl1S28cVkO86Ry9LaaObv1uXGfP3VWwAm7dyA9 2al96948jeaucHZVvyQ6xiQF+ewVFAfragfJfs8tS8/e+0VMDL38WxH8rQbiWZYAGYEP u7ZKQPX1GlEA29U2F6G/A9qHjCNolkGmTEDCdvkTSHt/4HptCB9D4nwlHT4lobI+PcGp UL4xFTIO+mubAvN6zkso/21RyKlDchvDrplpzr2RA8BWarzCgk+pkqLjfh6wKOi7L3DP l+6g== X-Gm-Message-State: AOJu0Yz/eOPaGALDc8aPKM6Mt6G5IZ7rnQ5gaHck69AYBWf24POnRBCa qyuR5+2jt9vdnUCW9m+9U74ePA== X-Google-Smtp-Source: AGHT+IEKyzbY5tiGk0x9wY+NW/nCfHACfkEFuDHkVk+Ms0tmU5QNI1Ubrn4wqYbRYfKgSR1CafbqzQ== X-Received: by 2002:adf:fd04:0:b0:319:76a3:1006 with SMTP id e4-20020adffd04000000b0031976a31006mr9343106wrr.40.1692787495903; Wed, 23 Aug 2023 03:44:55 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:55 -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 v3 05/15] media: qcom: camss: Pass line_num from compat resources Date: Wed, 23 Aug 2023 11:44:34 +0100 Message-ID: <20230823104444.1954663-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" line_num indicates the number of RDI - raw data interface channels which are associated with a given IFE/VFE - image/video front end. On several SoCs the RDI number is not static for each VFE - for example on sm8250 VFE Lite has four RDIs where regular VFE has three. Assigning line_num statically in the subdev_init() phase initialises each VFE to the lower number, meaning in practical terms that we are lobbing off one RDI on some VFEs. Interrupt handling uses static for (i =3D RDI0; i < RDI2; i++) {} in some of our VFE blocks but this can't work for situations where we have a mixture of VFE @ 3 RDI and VFE-lite @ 4 RDI blocks. First step to remediate is to pass line_num from a compat string controlled data-structure and do so on a per-VFE basis. Later patches will assign the correct number of RDI blocks per VFE. Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- .../media/platform/qcom/camss/camss-vfe-170.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-1.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-7.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-8.c | 2 -- .../media/platform/qcom/camss/camss-vfe-480.c | 1 - drivers/media/platform/qcom/camss/camss-vfe.c | 5 +++ drivers/media/platform/qcom/camss/camss.c | 36 ++++++++++++------- drivers/media/platform/qcom/camss/camss.h | 1 + 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index 9905bb06b3823..8aa921400ded0 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -756,8 +756,6 @@ static void vfe_subdev_init(struct device *dev, struct = vfe_device *vfe) { vfe->isr_ops =3D vfe_isr_ops_170; vfe->video_ops =3D vfe_video_ops_170; - - vfe->line_num =3D VFE_LINE_NUM_GEN2; } =20 const struct vfe_hw_ops vfe_ops_170 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-1.c index bc309f326f519..2911e4126e7ad 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c @@ -992,8 +992,6 @@ static void vfe_subdev_init(struct device *dev, struct = vfe_device *vfe) vfe->isr_ops =3D vfe_isr_ops_gen1; vfe->ops_gen1 =3D &vfe_ops_gen1_4_1; vfe->video_ops =3D vfe_video_ops_gen1; - - vfe->line_num =3D VFE_LINE_NUM_GEN1; } =20 const struct vfe_hw_ops vfe_ops_4_1 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-7.c index 8acd76c9746ba..b65ed0fef595e 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c @@ -1188,8 +1188,6 @@ static void vfe_subdev_init(struct device *dev, struc= t vfe_device *vfe) vfe->isr_ops =3D vfe_isr_ops_gen1; vfe->ops_gen1 =3D &vfe_ops_gen1_4_7; vfe->video_ops =3D vfe_video_ops_gen1; - - vfe->line_num =3D VFE_LINE_NUM_GEN1; } =20 const struct vfe_hw_ops vfe_ops_4_7 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-8.c index 3a0167ecf873a..7b3805177f037 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c @@ -1173,8 +1173,6 @@ static void vfe_subdev_init(struct device *dev, struc= t vfe_device *vfe) vfe->isr_ops =3D vfe_isr_ops_gen1; vfe->ops_gen1 =3D &vfe_ops_gen1_4_8; vfe->video_ops =3D vfe_video_ops_gen1; - - vfe->line_num =3D VFE_LINE_NUM_GEN1; } =20 const struct vfe_hw_ops vfe_ops_4_8 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-480.c index 80338efceb9e1..b1a07e846e25b 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -572,7 +572,6 @@ static const struct camss_video_ops vfe_video_ops_480 = =3D { static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) { vfe->video_ops =3D vfe_video_ops_480; - vfe->line_num =3D MAX_VFE_OUTPUT_LINES; } =20 const struct vfe_hw_ops vfe_ops_480 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 526dd4ab343fe..b789b3b2e4cfd 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1305,6 +1305,11 @@ int msm_vfe_subdev_init(struct camss *camss, struct = vfe_device *vfe, default: return -EINVAL; } + + if (!res->line_num) + return -EINVAL; + + vfe->line_num =3D res->line_num; vfe->ops->subdev_init(dev, vfe); =20 /* Memory */ diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index c8a2571e664fe..ce0d86e45fe48 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -123,7 +123,8 @@ static const struct resources vfe_res_8x16[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN1, } }; =20 @@ -263,7 +264,8 @@ static const struct resources vfe_res_8x96[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN1, }, =20 /* VFE1 */ @@ -281,7 +283,8 @@ static const struct resources vfe_res_8x96[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D VFE_LINE_NUM_GEN1, } }; =20 @@ -442,7 +445,8 @@ static const struct resources vfe_res_660[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN1, }, =20 /* VFE1 */ @@ -463,7 +467,8 @@ static const struct resources vfe_res_660[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D VFE_LINE_NUM_GEN1, } }; =20 @@ -621,7 +626,8 @@ static const struct resources vfe_res_845[] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN2, }, =20 /* VFE1 */ @@ -641,7 +647,8 @@ static const struct resources vfe_res_845[] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D VFE_LINE_NUM_GEN2, }, =20 /* VFE-lite */ @@ -660,7 +667,8 @@ static const struct resources vfe_res_845[] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "vfe_lite" }, - .interrupt =3D { "vfe_lite" } + .interrupt =3D { "vfe_lite" }, + .line_num =3D VFE_LINE_NUM_GEN2, } }; =20 @@ -787,7 +795,8 @@ static const struct resources vfe_res_8250[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D 4, }, /* VFE1 */ { @@ -805,7 +814,8 @@ static const struct resources vfe_res_8250[] =3D { { 0 }, { 0 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D 4, }, /* VFE2 (lite) */ { @@ -822,7 +832,8 @@ static const struct resources vfe_res_8250[] =3D { { 400000000, 480000000 }, { 0 } }, .reg =3D { "vfe_lite0" }, - .interrupt =3D { "vfe_lite0" } + .interrupt =3D { "vfe_lite0" }, + .line_num =3D 4, }, /* VFE3 (lite) */ { @@ -839,7 +850,8 @@ static const struct resources vfe_res_8250[] =3D { { 400000000, 480000000 }, { 0 } }, .reg =3D { "vfe_lite1" }, - .interrupt =3D { "vfe_lite1" } + .interrupt =3D { "vfe_lite1" }, + .line_num =3D 4, }, }; =20 diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index dd8c58d349685..101ce6e527931 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -48,6 +48,7 @@ struct resources { u32 clock_rate[CAMSS_RES_MAX][CAMSS_RES_MAX]; char *reg[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX]; + u8 line_num; }; =20 struct icc_bw_tbl { --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 5E5CDEE49B4 for ; Wed, 23 Aug 2023 10:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234069AbjHWKpR (ORCPT ); Wed, 23 Aug 2023 06:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234002AbjHWKpC (ORCPT ); Wed, 23 Aug 2023 06:45:02 -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 9C603E54 for ; Wed, 23 Aug 2023 03:44:58 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-31c6cd238e0so236523f8f.0 for ; Wed, 23 Aug 2023 03:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787497; x=1693392297; 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=uqMIPbw/+sU9M8KXenkrEeBNzKEqFkNbCna30dgzLCE=; b=HHuD0yRtb6li0CIt08gznOJSExeLkcRi9lF4E7+HpNgr1tPAA0ba1ZzSjkSl4a5d8d SvAu6Nzz5iOcBm3xRtQRf2amhqAGeLZFCkpWr8Tz71EZ4HaeVLgVNETCOOStJrFtK+WZ sTUkumfLQM5lbKZJ4f/VCqkgl2NvK86A5vc7jvnHUSi8vjZe6/Ygqeo6IMghUfSgiDtk dcLHaTG4C3fB37gYHlRKWw2OyiawsCtAIwQZW7+nDgIVuPeJPwR990xosoVZPI0g4m8T gvn0sRQETTIp1gjivGm9wj+Iw40YVRaDvFjwl3t3Fk2/WhCUatUjIoCw/lticfUgnUcY jKxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787497; x=1693392297; 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=uqMIPbw/+sU9M8KXenkrEeBNzKEqFkNbCna30dgzLCE=; b=TgSFYvJT8948q4VNjcCSPlRZoSWP9gWD8X6bswX/V02MFwmgOrsOUZwReOVz+FAMsE jOyi7VXbF+8KqaI6/NixxTghrfZe2WeUcKYApeshFwHttwFCVyO0OR3cQsWqr+Uf9kpG KjoF5SZlkJh7F9qtG4rU6Rs5gFCmktOuTDNOLzycUayS/pNljgTWWFFesJKa/sTOv5sr Z2Isu6kbfdpgX4yX8Qd3i7Sz+IJOa259rG4ohQcZPaQ7OgiMhrr9lDtlQpti/3xDDzwN +wAcheZbLv1Ict2VtgUoXt3GyzOYMtn1WcbagxPX/u6mz5LfJ02HcSnIGe70jftiEMLS canA== X-Gm-Message-State: AOJu0YxPEeWhMNCa+Kf7ttwA/0tOpHOvgd9AfiBuN83WDcW/X5J1hZum De/c8eFRDk0MYln8l4sMzBQvQw== X-Google-Smtp-Source: AGHT+IGvqIkHBEWAIKtUtnUjKtr6E0LhjgO+LHZmNx5lQWLUxDPZon0nnlq785htbPPFwvN3gUZQRw== X-Received: by 2002:adf:ec8a:0:b0:317:de66:259b with SMTP id z10-20020adfec8a000000b00317de66259bmr9560761wrn.15.1692787497210; Wed, 23 Aug 2023 03:44:57 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:56 -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 v3 06/15] media: qcom: camss: Assign the correct number of RDIs per VFE Date: Wed, 23 Aug 2023 11:44:35 +0100 Message-ID: <20230823104444.1954663-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Each Video Front End - VFE - has a variable number of Raw Data Interfaces - RDIs associated with it. The CAMSS code started from a naive implementation where a fixed define was used as a control in a for(){} loop iterating through RDIs. That model scales badly. An attempt was made with VFE_LINE_NUM_GEN2 and VFE_LINE_NUM_GEN1 to differentiate between SoCs but, the problem with that is "gen1" and "gen2" have no meaning in the silicon. There is no fixed constraint in the silicon between VFE and RDI, it is entirely up to the SoC designers how many VFEs are populated and how many RDIs to associate with each VFE. As an example sdm845 has VFE version 175 and sm8250 VFE version 480. sdm845 has 2 VFEs with 4 RDIs and 1 VFE Lite with 4 RDIs. sm8250 has 2 VFEs with 3 RDIs and 2 VFE Lite with 4 RDIs. Clearly then we need a more granular model to capture the necessary data. The defines have gone away to be replaced with per-SoC data but, we haven't populated the parameter data with the real values. Let's call those values out now msm8916: 1 x VFE 3 x RDI per VFE (not 4) msm8996: 2 x VFE 3 x RDI per VFE (not 4) sdm660: 2 x VFE 3 x RDI per VFE (not 4) sdm845: 2 x VFE 4 x RDI per VFE (not 3) 1 x VFE Lite 4 x RDI per VFE Lite (not 3) sm8250: 2 x VFE 3 x RDI per VFE (not 4) 2 x VFE Lite 4 x RDI per VFE This more complex and correct mapping was not possible prior to passing values via driver data. Now that we have that change in place we can correctly map VFEs to RDIs for each VFE. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index ce0d86e45fe48..c8b8ad176ee2b 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -124,7 +124,7 @@ static const struct resources vfe_res_8x16[] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, } }; =20 @@ -265,7 +265,7 @@ static const struct resources vfe_res_8x96[] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, }, =20 /* VFE1 */ @@ -284,7 +284,7 @@ static const struct resources vfe_res_8x96[] =3D { { 0 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, } }; =20 @@ -446,7 +446,7 @@ static const struct resources vfe_res_660[] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, }, =20 /* VFE1 */ @@ -468,7 +468,7 @@ static const struct resources vfe_res_660[] =3D { { 0 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, } }; =20 @@ -627,7 +627,7 @@ static const struct resources vfe_res_845[] =3D { { 384000000 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN2, + .line_num =3D 4, }, =20 /* VFE1 */ @@ -648,7 +648,7 @@ static const struct resources vfe_res_845[] =3D { { 384000000 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D VFE_LINE_NUM_GEN2, + .line_num =3D 4, }, =20 /* VFE-lite */ @@ -668,7 +668,7 @@ static const struct resources vfe_res_845[] =3D { { 384000000 } }, .reg =3D { "vfe_lite" }, .interrupt =3D { "vfe_lite" }, - .line_num =3D VFE_LINE_NUM_GEN2, + .line_num =3D 4, } }; =20 @@ -796,7 +796,7 @@ static const struct resources vfe_res_8250[] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D 4, + .line_num =3D 3, }, /* VFE1 */ { @@ -815,7 +815,7 @@ static const struct resources vfe_res_8250[] =3D { { 0 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D 4, + .line_num =3D 3, }, /* VFE2 (lite) */ { --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 A6640EE49A0 for ; Wed, 23 Aug 2023 10:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234089AbjHWKpZ (ORCPT ); Wed, 23 Aug 2023 06:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234012AbjHWKpC (ORCPT ); Wed, 23 Aug 2023 06:45:02 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD957E5F for ; Wed, 23 Aug 2023 03:44:59 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-317c3ac7339so4719208f8f.0 for ; Wed, 23 Aug 2023 03:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787498; x=1693392298; 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=7Fdh/fEq9xl23muJMDNyxcP6ElZOdNEZWpFYYwHgssM=; b=Rh+nBjG2m0uJ2Jp0JTsRdGbj3c9L7TM69DXAqpGBNSV6lJ4AYB4GhWXmhZnmMSUlL/ zC0vFYNZPEvpRr9btJM9zOUoUnUgX3RKJ9x6r8GOYmYnCcVSzHZdhsQSn7XlapIoEgyx eVfQXJCx5ZlFlWb/bTNgBQS/HBMuqSegQ3ngyQpwpiZ0hCiPEAYZTSFHVroNayuBaoDs ifnRj5QlScxAFPxRjOcaAPeByeUaW3o+XHlGkjikG1sukfG9oJswtFLewSRwx/5Uax84 xR5ZTs+mIfYD2zUi7CARVyUSPxNZPXactGsUrrsDa3x9SPOcVbC9vkoYSKX8Y9xI+S4X kRhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787498; x=1693392298; 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=7Fdh/fEq9xl23muJMDNyxcP6ElZOdNEZWpFYYwHgssM=; b=TwfjxPawoTfwih5nV8w5N9bdtrwrqsnUkSBDU15bTQCnUyEiQfnRyGo/Blo/ULAILm w8ykWxiBlb1f9HnPpEW/YgpV65XGoPzglnr/kFw8cig2yu1arq8IDS4DB1pzhF9wMm5p ll08i0ext187wwg2+VOpuARcVJ9+qJ2/Rez61CVHQVmjx+Bq2MtD9OUWiBEr/r/wsoaD b9iJNhQc2R42AebnQZs3v+NvsovUV+0jDc7xGSPUQ2PF6stqPLFOim9rIRZSevIUbVht KFFZ10LM/RmJMUndEZKIifY/Q1dPvZgWslN1ecz+/fHq0nH2THOUpUepBePrqgic05CG bDQg== X-Gm-Message-State: AOJu0YyK/bPi/0OuUizhoxmaTKK+5TY645slpKDWjtAmZyw2khrQ7+nK xu6VHK3jAKPGB/1YU2JIMcZgBA== X-Google-Smtp-Source: AGHT+IHnA0qSAUGqoGlPmAKj2P3G2fV1/TheB1TXkaqI8lTcgxDgY6R1/RRh7dVpjJKtDbVVSJaZNw== X-Received: by 2002:adf:f48e:0:b0:30e:3da5:46e5 with SMTP id l14-20020adff48e000000b0030e3da546e5mr9441003wro.59.1692787498303; Wed, 23 Aug 2023 03:44:58 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:57 -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 v3 07/15] media: qcom: camss: Capture VFE CSID dependency in a helper function Date: Wed, 23 Aug 2023 11:44:36 +0100 Message-ID: <20230823104444.1954663-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From sdm845 onwards we need to ensure the VFE is powered on prior to switching on the CSID. Alternatively we could model up the GDSCs and clocks the CSID needs without the VFE but, there's a real question of the legitimacy of such a use-case. For now drawing a line at sdm845 and switching on the associated VFEs is a perfectly valid thing to do. Rather than continually extend out this clause for at least two new SoCs with this same model - making the vfe_get/vfe_put path start to look like spaghetti we can encoded the dependency in a helper function. Use csid_depends_vfe() for this purpose. Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-csid.c | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index 08991b070bd61..fd04ed112b564 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -146,6 +146,22 @@ static int csid_set_clock_rates(struct csid_device *cs= id) return 0; } =20 +static bool csid_depends_vfe(u32 version) +{ + bool ret =3D false; + + switch (version) { + case CAMSS_845: + case CAMSS_8250: + ret =3D true; + break; + default: + break; + } + + return ret; +} + /* * csid_set_power - Power on/off CSID module * @sd: CSID V4L2 subdevice @@ -163,7 +179,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int o= n) int ret =3D 0; =20 if (on) { - if (version =3D=3D CAMSS_8250 || version =3D=3D CAMSS_845) { + if (csid_depends_vfe(version)) { ret =3D vfe_get(vfe); if (ret < 0) return ret; @@ -217,7 +233,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int o= n) regulator_bulk_disable(csid->num_supplies, csid->supplies); pm_runtime_put_sync(dev); - if (version =3D=3D CAMSS_8250 || version =3D=3D CAMSS_845) + if (csid_depends_vfe(version)) vfe_put(vfe); } =20 --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 4A020EE49A0 for ; Wed, 23 Aug 2023 10:45:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234108AbjHWKpc (ORCPT ); Wed, 23 Aug 2023 06:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbjHWKpH (ORCPT ); Wed, 23 Aug 2023 06:45:07 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 483BDE40 for ; Wed, 23 Aug 2023 03:45:01 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-317716a4622so4834288f8f.1 for ; Wed, 23 Aug 2023 03:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787499; x=1693392299; 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=8tKoNzN5CncFfvVbG92Xx/lZwuygM9C2OyND5O4Dtxs=; b=TEDzZknJjVS0LY0xouhqlbgCyV1UKWs/EWWyAFWrkQo0vKa7sa4PDDWojDUvih7PTC WCwDdhfgIMxLdtdOoeCtQQa4s64MoqkGOCdXhCUNJpRySuLI3w5Wnynq/6WIDEcV+gj6 u0Wdhwoxr05GutCoC3vtMDwiNcRQBs1b89PvNZgBBHJXmd0TZn381hP0FuWgfBMw+FiW n75JDmpf0jquh8N4TYjYHYo2fbVSUG9QUm3kyZo7hQIAx+cxScOxpZhKw9J7r9MtkKan 8oPmVfffCaQUvjDSuqi+xsXBHDB6j2gYbxElAbtshlWMdf4/hMkU1Uw39qbwzGaGUAJ+ Njng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787499; x=1693392299; 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=8tKoNzN5CncFfvVbG92Xx/lZwuygM9C2OyND5O4Dtxs=; b=LylX5Sgp5G+9Puu8eWPeRhILUN1ZroUvFFTzoi9Zw78FflocULkw4tdHsjsifr98rc DjKoGoGgf3EhQfmvZldkqKzf1WP5PrHeDWbOxluqekPh+qt39xzjwlgEri2NCWngbm4X 05pzzxIifUP0BCUeH1T23fskM+t7SxQoF6uz17+z+2ZHopdJsAfZCmmY7LtwKXTijSX/ k0KUH2eVSakhs/xrZAtAPFhkbiAl/V+yWauM3jNgKVbzBlypIi2LIjrxp21424YYXLKS iJOAope03PPFsGB9S5O5JHansvkr3infsiHqMayb6XXGFlgjB/n9LP3kiC6wa4XTtSSu LfQA== X-Gm-Message-State: AOJu0YwnnxqnrKhfouSn9VJnPqHaUcgMtzKJ3dDvBVI1Zj3k6BJmtarm vR5AoNeVD5UaGmHLCSM8tY4Vtw== X-Google-Smtp-Source: AGHT+IE9MGitIC2dnpdm810e19wbjxEv5dcPWWWpANyXIgkCuR2BxcWwTrMSmWMocY0T1GNB5cHUdQ== X-Received: by 2002:adf:cd0b:0:b0:31c:3013:9fa5 with SMTP id w11-20020adfcd0b000000b0031c30139fa5mr7830811wrm.59.1692787499519; Wed, 23 Aug 2023 03:44:59 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:44:58 -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 v3 08/15] media: qcom: camss: Untangle if/else spaghetti in camss Date: Wed, 23 Aug 2023 11:44:37 +0100 Message-ID: <20230823104444.1954663-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" I refuse to add another SoC to this convoluted if/else structure. By the time we added in a third SoC we ought to have transitioned these control flow strutures to switches. Adding in another Soc or two will make some of these if statements into five clause behemoths. Introduce switches in the obvious places to despaghetiify. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio --- .../media/platform/qcom/camss/camss-csid.c | 16 ++++--- .../media/platform/qcom/camss/camss-csiphy.c | 22 ++++++--- drivers/media/platform/qcom/camss/camss-vfe.c | 45 +++++++++++++------ .../media/platform/qcom/camss/camss-video.c | 16 ++++--- 4 files changed, 68 insertions(+), 31 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index fd04ed112b564..5dbbcda5232ac 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -592,15 +592,19 @@ int msm_csid_subdev_init(struct camss *camss, struct = csid_device *csid, csid->camss =3D camss; csid->id =3D id; =20 - if (camss->res->version =3D=3D CAMSS_8x16) { + switch (camss->res->version) { + case CAMSS_8x16: csid->ops =3D &csid_ops_4_1; - } else if (camss->res->version =3D=3D CAMSS_8x96 || - camss->res->version =3D=3D CAMSS_660) { + break; + case CAMSS_8x96: + case CAMSS_660: csid->ops =3D &csid_ops_4_7; - } else if (camss->res->version =3D=3D CAMSS_845 || - camss->res->version =3D=3D CAMSS_8250) { + break; + case CAMSS_845: + case CAMSS_8250: csid->ops =3D &csid_ops_gen2; - } else { + break; + default: return -EINVAL; } csid->ops->subdev_init(csid); diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 593aec5c97bc2..0e8c2a59ea241 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -557,21 +557,31 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->id =3D id; csiphy->cfg.combo_mode =3D 0; =20 - if (camss->res->version =3D=3D CAMSS_8x16) { + switch (camss->res->version) { + case CAMSS_8x16: + { csiphy->ops =3D &csiphy_ops_2ph_1_0; csiphy->formats =3D csiphy_formats_8x16; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x16); - } else if (camss->res->version =3D=3D CAMSS_8x96 || - camss->res->version =3D=3D CAMSS_660) { + break; + } + case CAMSS_8x96: + case CAMSS_660: + { csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_8x96; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x96); - } else if (camss->res->version =3D=3D CAMSS_845 || - camss->res->version =3D=3D CAMSS_8250) { + break; + } + case CAMSS_845: + case CAMSS_8250: + { csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_sdm845; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_sdm845); - } else { + break; + } + default: return -EINVAL; } =20 diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index b789b3b2e4cfd..8f48401e31cd3 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -170,7 +170,9 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 = sink_code, { struct vfe_device *vfe =3D to_vfe(line); =20 - if (vfe->camss->res->version =3D=3D CAMSS_8x16) + switch (vfe->camss->res->version) { + case CAMSS_8x16: + { switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -218,10 +220,13 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u3= 2 sink_code, =20 return sink_code; } - else if (vfe->camss->res->version =3D=3D CAMSS_8x96 || - vfe->camss->res->version =3D=3D CAMSS_660 || - vfe->camss->res->version =3D=3D CAMSS_845 || - vfe->camss->res->version =3D=3D CAMSS_8250) + break; + } + case CAMSS_8x96: + case CAMSS_660: + case CAMSS_845: + case CAMSS_8250: + { switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -281,8 +286,12 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32= sink_code, =20 return sink_code; } - else - return 0; + break; + } + default: + break; + } + return 0; } =20 int vfe_reset(struct vfe_device *vfe) @@ -1397,7 +1406,9 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, init_completion(&l->output.sof); init_completion(&l->output.reg_update); =20 - if (camss->res->version =3D=3D CAMSS_8x16) { + switch (camss->res->version) { + case CAMSS_8x16: + { if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x16; l->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1405,8 +1416,11 @@ int msm_vfe_subdev_init(struct camss *camss, struct = vfe_device *vfe, l->formats =3D formats_rdi_8x16; l->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (camss->res->version =3D=3D CAMSS_8x96 || - camss->res->version =3D=3D CAMSS_660) { + break; + } + case CAMSS_8x96: + case CAMSS_660: + { if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x96; l->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1414,11 +1428,16 @@ int msm_vfe_subdev_init(struct camss *camss, struct= vfe_device *vfe, l->formats =3D formats_rdi_8x96; l->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (camss->res->version =3D=3D CAMSS_845 || - camss->res->version =3D=3D CAMSS_8250) { + break; + } + case CAMSS_845: + case CAMSS_8250: + { l->formats =3D formats_rdi_845; l->nformats =3D ARRAY_SIZE(formats_rdi_845); - } else { + break; + } + default: return -EINVAL; } } diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/medi= a/platform/qcom/camss/camss-video.c index 46a89b5f6c171..e695724437ce1 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -1006,7 +1006,8 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, =20 mutex_init(&video->lock); =20 - if (video->camss->res->version =3D=3D CAMSS_8x16) { + switch (video->camss->res->version) { + case CAMSS_8x16: if (is_pix) { video->formats =3D formats_pix_8x16; video->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1014,8 +1015,9 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x16; video->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (video->camss->res->version =3D=3D CAMSS_8x96 || - video->camss->res->version =3D=3D CAMSS_660) { + break; + case CAMSS_8x96: + case CAMSS_660: if (is_pix) { video->formats =3D formats_pix_8x96; video->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1023,11 +1025,13 @@ int msm_video_register(struct camss_video *video, s= truct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x96; video->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (video->camss->res->version =3D=3D CAMSS_845 || - video->camss->res->version =3D=3D CAMSS_8250) { + break; + case CAMSS_845: + case CAMSS_8250: video->formats =3D formats_rdi_845; video->nformats =3D ARRAY_SIZE(formats_rdi_845); - } else { + break; + default: ret =3D -EINVAL; goto error_video_register; } --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 97A48EE49A0 for ; Wed, 23 Aug 2023 10:45:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234101AbjHWKp3 (ORCPT ); Wed, 23 Aug 2023 06:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbjHWKpH (ORCPT ); Wed, 23 Aug 2023 06:45:07 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB9BE71 for ; Wed, 23 Aug 2023 03:45:02 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31c4d5bd69cso2706580f8f.3 for ; Wed, 23 Aug 2023 03:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787501; x=1693392301; 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=CMd5xa502zq+zJtKRyAW8i5LwxGHRj3qKCAl3AH36Ls=; b=kRX+keFShYoh3ikMrf8cieD3HTIbEKNjElXdJfca5/STD+euldcxH9lQw+TGrRxUET 663qZveXENmbbe8vJjAgTfwx/sYchdjMcpSYv2uvPbeHu35inNNTglkSaUNWHf2ZL4QI V1+piWmnj8CCcrRA3spBcxae2v3j70cPp5W4I03E11KbYRq/B/2nis/jvNWtmXIIlCFI LXXg8lLQoYSm0cbaHiAn9H6oBhNmgPOo3Vc5VCiKWLFSU3qgSV914GQImUZybOiwQhv/ YV4jskSpJFlKZFU2I0Vcv2Kfsc9EndnEtR4lRhw35QGQGwGGZCTx2MOxa1zbuvl4R3ce 1UoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787501; x=1693392301; 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=CMd5xa502zq+zJtKRyAW8i5LwxGHRj3qKCAl3AH36Ls=; b=Wnm+iqBmaheF6CSgG74V6XrifddklCcX47k4ALJh47hWf+Js6aC7HpRdxjih0janpO q4DzW2RYJ7+E/TPcPz8EA8EOJVHX4/sq+HeuonFf5iFfqy/n8xFb/ocrrpSohh2ff+25 +B2wmaQRMVnzHZ22W3sg2N+f61DU/Olrio6bNHyHfMGKb3q46WWSDnBQcRhKhsUUFtCe MpLN5ptFcay6sHzVb52ZshagEI9lbvpXO74Htvb01TC973teqcgcPe7JE5D6YzhMNm8X Q1gy0LZkGHDV7TeeUipSURILPYlRIB1IMFxAEfFRT99+4OPVCBAmTwMKimV9Ore+soQ0 Lnfg== X-Gm-Message-State: AOJu0YxinmA5rgInm46k/ux378gvVZwTu24GeoGyjaPfxPaJqDNMVqkP vFGOhd08mEVJ1bgw2gEbpZsB1A== X-Google-Smtp-Source: AGHT+IGtFeJIM5mGqGxuAXbxR9IEjUJ9fiJWEwAXZ4bsSILfwimb94qbYymylV3hO3wxz5YYWRej1w== X-Received: by 2002:adf:dcce:0:b0:319:6b6c:dd01 with SMTP id x14-20020adfdcce000000b003196b6cdd01mr9885635wrm.17.1692787500902; Wed, 23 Aug 2023 03:45:00 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:00 -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 v3 09/15] media: qcom: camss: Improve error printout on icc_get fail Date: Wed, 23 Aug 2023 11:44:38 +0100 Message-ID: <20230823104444.1954663-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If icc_get() fails print the name of the failing path. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index c8b8ad176ee2b..72a0a9f304bb2 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1504,8 +1504,11 @@ static int camss_icc_get(struct camss *camss) for (i =3D 0; i < camss->res->icc_path_num; i++) { camss->icc_path[i] =3D devm_of_icc_get(camss->dev, icc_res[i].name); - if (IS_ERR(camss->icc_path[i])) + if (IS_ERR(camss->icc_path[i])) { + dev_err(camss->dev, "Unable to icc_get %s\n", + icc_res[i].name); return PTR_ERR(camss->icc_path[i]); + } } =20 return 0; --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 16371EE49A0 for ; Wed, 23 Aug 2023 10:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234115AbjHWKph (ORCPT ); Wed, 23 Aug 2023 06:45:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234053AbjHWKpJ (ORCPT ); Wed, 23 Aug 2023 06:45:09 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA168E7C for ; Wed, 23 Aug 2023 03:45:03 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31c479ede21so2771583f8f.2 for ; Wed, 23 Aug 2023 03:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787502; x=1693392302; 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=rHxvfmBq2wQcZEqJeTw0BxrGFmAlBN3kn0Ir0lpbaw4=; b=RK7fSEqchuMcLnME21sx1cAxKm1ohh4rOeH0kFTbeYZNLLOc0KqB2kE/OSFxWbVYlI WQ6FZyX/UIxy+szLwqxEuP7a+1lfwfoMpT8LXtRFBwtkb5rprWjdX+f4ZOf2h6dM1imB 5KkUanGpvDxKsV6PY+EM+bYuylgTH48zWM+yC0afo8XJUqRHMq1HWs8K0BzXHLJVVzwF B3Y5QvsiD/JXzmGYBTpBEvXKWAh/b8FPLx3sisw3JIVtJ8wKv/B1lBhskFc71M+HUWzX qBiVGJvx5m6GXcXvBU17GbfPZQb6YJMkMjLZq8XZiks9Vb1aRNSUrHdCFH2oORQsT214 hg1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787502; x=1693392302; 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=rHxvfmBq2wQcZEqJeTw0BxrGFmAlBN3kn0Ir0lpbaw4=; b=VK/QGoRL3LnDkEWSz3S9XfZOeLVmmBJQW+tVu61tie/+8dKJ9Y9abt7NjevTFbzYqd ZuDJ7lqJRa2S7JQjwiPtAB1iWtw2lHsiqJf/UWYuhp83GX7U0Bjbt6dlwwFOaBwJKFxg XMC7A4wYu+wgHqru4H9gu/Hd877Zg9nMzneZD5etPOsTnjSHWFFZFyQk0IiQlUANFGG1 ybMKtmMvmVbhuBUNjzWbNfTh9I7Aa6gB++Z5bvtBePe9Lyjrb1+Sd9L5QqfKBF3EnrsN uvzuY/DfKbYlUHIzHdApc93XTfcN8nhZb4c1ZGwloY2TkiyzOhJH4gOM6jMa8egSTtkn +vSg== X-Gm-Message-State: AOJu0YwmfvmawvncwFnBIWc9Q1c8hfARTQjT7/BPGGKHLeri+jAluHBA Bambbte3t0U39WMj8RU8933c1A== X-Google-Smtp-Source: AGHT+IFMOCh8NcCdKiEJDomH2o9MH+X6gGMRhmLARi6n1ID7VDWqrST5NLVd3DdYr49+F4PTrMtOiw== X-Received: by 2002:adf:dd90:0:b0:315:9e1b:4ea6 with SMTP id x16-20020adfdd90000000b003159e1b4ea6mr9105973wrl.58.1692787502156; Wed, 23 Aug 2023 03:45:02 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:01 -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 v3 10/15] media: qcom: camss: Allow clocks vfeN vfe_liteN or vfe_lite Date: Wed, 23 Aug 2023 11:44:39 +0100 Message-ID: <20230823104444.1954663-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The number of Video Front End - VFE or Image Front End - IFE supported with new SoCs can vary both for the full and lite cases. For example sdm845 has one vfe_lite and two vfe interfaces with the vfe clock called simply "vfe_lite" with no integer postfix. sc8280xp has four vfe and four vfe lite blocks. We need to support the following clock name formats - vfeN - vfe_liteN - vfe_lite with N being any reasonably sized integer. There are two sites in this code which need to do the same thing, constructing and matching strings with the pattern above, so encapsulate the logic in one function. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 8f48401e31cd3..73380e75dbb22 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -437,6 +437,20 @@ void vfe_isr_reset_ack(struct vfe_device *vfe) complete(&vfe->reset_complete); } =20 +static int vfe_match_clock_names(struct vfe_device *vfe, + struct camss_clock *clock) +{ + char vfe_name[CAMSS_RES_MAX]; + char vfe_lite_name[CAMSS_RES_MAX]; + + snprintf(vfe_name, sizeof(vfe_name), "vfe%d", vfe->id); + snprintf(vfe_lite_name, sizeof(vfe_lite_name), "vfe_lite%d", vfe->id); + + return (!strcmp(clock->name, vfe_name) || + !strcmp(clock->name, vfe_lite_name) || + !strcmp(clock->name, "vfe_lite")); +} + /* * vfe_set_clock_rates - Calculate and set clock rates on VFE module * @vfe: VFE device @@ -460,9 +474,7 @@ static int vfe_set_clock_rates(struct vfe_device *vfe) for (i =3D 0; i < vfe->nclocks; i++) { struct camss_clock *clock =3D &vfe->clock[i]; =20 - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate =3D 0; long rate; =20 @@ -543,9 +555,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) for (i =3D 0; i < vfe->nclocks; i++) { struct camss_clock *clock =3D &vfe->clock[i]; =20 - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate =3D 0; unsigned long rate; =20 --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 E30D4EE49B4 for ; Wed, 23 Aug 2023 10:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234030AbjHWKpl (ORCPT ); Wed, 23 Aug 2023 06:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234060AbjHWKpM (ORCPT ); Wed, 23 Aug 2023 06:45:12 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD5EF10CF for ; Wed, 23 Aug 2023 03:45:04 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-31781e15a0cso4831284f8f.3 for ; Wed, 23 Aug 2023 03:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787503; x=1693392303; 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=l9FgIR5BO1ZA/xwnNK7HzsY7163eVVAl221xkKgdSQ4=; b=mhAJonHk82O1JU38yvxq//f+PgwfunLi3MPyMMxfsOJEb0ZCqmh5XBUy/1UdB0f74l cHECz8xH1UvCOEDmrCPDR1+4j+6Dv8cGzofbVMulHAL/aDchojUGnS2wGv60ewN6ao/o D19WNIpawZ8kRgsVpnchBH60LMuZB1MW8kRiWMbZVtC6miQVYEOlbl5SCA5FwwXuSc+x U1c71nCjLDWMoq5qTHSih++bHWPpzAQPba22VtPTSwIBljwVmstxDXWcd2Unh+vGb33E Llag17Zk3cCGLA+LDB94GZw/3kbkEEs/wAEOMqnPYOpWhfGYPPNRK66r+hOPwso9/CmO uIpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787503; x=1693392303; 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=l9FgIR5BO1ZA/xwnNK7HzsY7163eVVAl221xkKgdSQ4=; b=AQiQFWu0IgJrj3A3ZosxxXeeNahDVwl5kCF2hH/85qoOvYmji2YEQuVN3wysslMxC/ hMhFF7HTVxawxduEuBPrBGe4axNYp3Ta0L4oP1xp2NwkEBRGMlyKZQB2CSZ75+Mdz8/8 ExygOA55yrPF/0oavhBsNrqF5F6IGBdxkCwH8BtBwO45nUDPOXwKs7HFxxur1Y+hdY66 bs2sNBNUELnDr+dnuyn/orXmRg4vmv/d/HVIEeIDtf4pC+pCx1gtpx7n6h2N4CEpPYGW BCjWMQC4Sv/NgeLOcA+0LgChN4IUD2v2kC5IG3tf6YaPJUiNU3UM1hQUU6bWhvKPCid1 3OYQ== X-Gm-Message-State: AOJu0Yy0ZuET+65CPo1ThP4D7PNkm4KqWxhTQdUJleHUBCkSfYhDivQj tgOrLG509PLnovPos/6mvPL+0Q== X-Google-Smtp-Source: AGHT+IG1+cvmYpNpk1eoo0KqVXeZN1HIsBfKTqiNgbwKTKafOvOkJR+Y/fxPgNluXdx8pZ5tnLXVHg== X-Received: by 2002:a5d:4fc7:0:b0:314:1b36:f440 with SMTP id h7-20020a5d4fc7000000b003141b36f440mr8428218wrw.70.1692787503323; Wed, 23 Aug 2023 03:45:03 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.45.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:02 -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 v3 11/15] media: qcom: camss: Functionally decompose CSIPHY clock lookups Date: Wed, 23 Aug 2023 11:44:40 +0100 Message-ID: <20230823104444.1954663-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The csiphyX_timer and csiX_phy values need not be hard-coded. We can functionally decompose the string matching inside of a loop. Static string values are brittle, difficult to extend and not required anyway since the camss->res->csiphy_num value informs us of the number of CSIPHYs and hence the set of potential clocks for a given CSIPHY. In simple terms if we have five CSIPHYs we can have no more and no less than five csiphy_timer clocks. Similarly csi_phy core clocks have a 1:1 relationship with the PHY they clock. Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-csiphy.c | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 0e8c2a59ea241..baf78c525fbfc 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -536,6 +536,15 @@ static int csiphy_init_formats(struct v4l2_subdev *sd, return csiphy_set_format(sd, fh ? fh->state : NULL, &format); } =20 +static bool csiphy_match_clock_name(const char *clock_name, const char *fo= rmat, + int index) +{ + char name[CAMSS_RES_MAX]; + + snprintf(name, sizeof(name), format, index); + return !strcmp(clock_name, name); +} + /* * msm_csiphy_subdev_init - Initialize CSIPHY device structure and resourc= es * @csiphy: CSIPHY device @@ -550,7 +559,7 @@ int msm_csiphy_subdev_init(struct camss *camss, { struct device *dev =3D camss->dev; struct platform_device *pdev =3D to_platform_device(dev); - int i, j; + int i, j, k; int ret; =20 csiphy->camss =3D camss; @@ -666,19 +675,19 @@ int msm_csiphy_subdev_init(struct camss *camss, for (j =3D 0; j < clock->nfreqs; j++) clock->freq[j] =3D res->clock_rate[i][j]; =20 - if (!strcmp(clock->name, "csiphy0_timer") || - !strcmp(clock->name, "csiphy1_timer") || - !strcmp(clock->name, "csiphy2_timer") || - !strcmp(clock->name, "csiphy3_timer") || - !strcmp(clock->name, "csiphy4_timer") || - !strcmp(clock->name, "csiphy5_timer")) - csiphy->rate_set[i] =3D true; - - if (camss->res->version =3D=3D CAMSS_660 && - (!strcmp(clock->name, "csi0_phy") || - !strcmp(clock->name, "csi1_phy") || - !strcmp(clock->name, "csi2_phy"))) - csiphy->rate_set[i] =3D true; + for (k =3D 0; k < camss->res->csiphy_num; k++) { + csiphy->rate_set[i] =3D csiphy_match_clock_name(clock->name, + "csiphy%d_timer", k); + if (csiphy->rate_set[i]) + break; + + if (camss->res->version =3D=3D CAMSS_660) { + csiphy->rate_set[i] =3D csiphy_match_clock_name(clock->name, + "csi%d_phy", k); + if (csiphy->rate_set[i]) + break; + } + } } =20 return 0; --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 35C70EE49B2 for ; Wed, 23 Aug 2023 10:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234009AbjHWKpo (ORCPT ); Wed, 23 Aug 2023 06:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234067AbjHWKpR (ORCPT ); Wed, 23 Aug 2023 06:45:17 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0604BE50 for ; Wed, 23 Aug 2023 03:45:06 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fe12baec61so53897085e9.2 for ; Wed, 23 Aug 2023 03:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787504; x=1693392304; 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=oe5JYcez2RRncc8Tqs2BLW5VAL0PX0lvSGbsu+cCr/s=; b=pHyMbyMXJpCL6G9/+HUquyQCMDm2uzfU0shAIf2bHTJKUSPbsJbYhlNyTNnUvx0aoO VjVdJl+0JQ960X8r6OHzyf4ZWF5TpOQHPCYlVzNJJcwBcBuWcraOzlMn+bmS+MWcxgOq 9pGYSxDH4mlXYYZMw8NzjhffOGB1TfcMMSsnw/w39Ne1TJ+68DN7aj52jolyjT7B8Nxr vEYXss5NzzHVPuhDBK6QoocAONS6c03XeFdUmWI6pD+5WDRmdDZv8LdxnzDdPvF74kYo JvOm2s9i6ejwas/Suvb7BJWpVSX9KdryVXC6fOMKfVW4l1v15LswbDS9ZFczOyPbmXg6 cEpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787504; x=1693392304; 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=oe5JYcez2RRncc8Tqs2BLW5VAL0PX0lvSGbsu+cCr/s=; b=KN+LGzLT4Cx4bXtnihtwNJm1G2pLnYZkBDcR0oaZnZxMrsjFsMwDNOL4Y+WvLRsHT6 BMa+3kaABNHql156wucDVkqeDn0uvqbQTChfMb2tYwXAwF/sEQ71iRkt11bpzBD4gTy5 5ys4fed0c+e4TnW9XpfPvPEQCPl2F2PNbtrIgo7EgM1gu4zurFEjlIhdQ4LpQyNIVayJ HmEwkPYVZnCNwfps6ChjCglznuB/1houmFNQxRZ64JkpSc7TLWW2jPs8562sgYzMqOsf u9L5EMjzsksZvixalqBhyRkJixSref/dgnv2+cB4wCi3ajmS5PC/PKm3eEkDgDgahaPL am3A== X-Gm-Message-State: AOJu0YyMBvvuSyW8EZ/eLqU9uuYmvB2NCdnnAyuBvRjYNrr7RuZIQOKD Ems/HEidHp6mkoh5JgdUZGjDnw== X-Google-Smtp-Source: AGHT+IGFkufNrsnDmQgxqXPw2avuPrLJEuQEiNe0i4H618jsl9lNYUq5I9/P++9GKiRrnOLHdpTsBQ== X-Received: by 2002:adf:ffcd:0:b0:319:7428:9ca0 with SMTP id x13-20020adfffcd000000b0031974289ca0mr7178505wrs.61.1692787504575; Wed, 23 Aug 2023 03:45:04 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:04 -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 v3 12/15] media: qcom: camss: Fix support for setting CSIPHY clock name csiphyX Date: Wed, 23 Aug 2023 11:44:41 +0100 Message-ID: <20230823104444.1954663-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Several of our upstream and soon-to-be upstream SoC CAMSS dtsi declare csiphyX as opposed to the older clock name csiX_phy. Right now the CAMSS code will fail to set the csiphyX clock even if we have declared it in our list of clocks. For sdm845 and sm8250 we appear to "get away" with this error, however on sc8280xp we don't. The right approach here is to set the clock when it is declared. If a SoC doesn't require or a SoC driver implementer doesn't think we need, then the clock ought to simply be omitted from the clock list. Include csiphyX in the set of permissible strings which will subsequently lead to the csiphyX clock being set during csiphy_set_clock_rates() phase. sdm845 and sm8250 will work with the code as-is so I've omitted this from a suggested Fixes list. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index baf78c525fbfc..d9c751f457703 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -687,6 +687,10 @@ int msm_csiphy_subdev_init(struct camss *camss, if (csiphy->rate_set[i]) break; } + + csiphy->rate_set[i] =3D csiphy_match_clock_name(clock->name, "csiphy%d"= , k); + if (csiphy->rate_set[i]) + break; } } =20 --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 0F434EE49B2 for ; Wed, 23 Aug 2023 10:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232021AbjHWKpx (ORCPT ); Wed, 23 Aug 2023 06:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234056AbjHWKpU (ORCPT ); Wed, 23 Aug 2023 06:45:20 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A73B10DD for ; Wed, 23 Aug 2023 03:45:07 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31427ddd3fbso4838450f8f.0 for ; Wed, 23 Aug 2023 03:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787505; x=1693392305; 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=TCd7GbPPAXe7wBQWBz5Iyr/diRlD1CNdqcFal/PKyLw=; b=H6uJQcVzryfjYSV6JMb3V1q9wO1vw54u/N7gmajjhKcL+QVvZk+JDoPdCID4huXbbb /jQw9ZuKB23Y92K08ejwK/u9isaH1da4f6lq/thdnSioSj9tVrNEKiKLUeYYeT8NJTrk BZ7KONeHT/gyBg/frz0JQ8KrBo4Wh5/pWbF0753smrJIpK4x86gHK7z0oiXj34e4WF4b HVTkf25A7JZt/0FaiKffvpRcIqR9dDAXvRTE8BDyXTqNwnQS6F8ESJ+0+c9nKvFF/wyH 9hKkA2BaTmE/8+yNEllRRoBwaVmtQIB3dDG/RoAGJPSbSWHQMiNcXXSkxxSlyPOp+PGi 1qdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787505; x=1693392305; 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=TCd7GbPPAXe7wBQWBz5Iyr/diRlD1CNdqcFal/PKyLw=; b=dJ4yEvCKUfTvVgj3qNZHNn/WpHee6Ze2jyu+sCCXtEeBkwzyTN9pKRTIc+jqZgrnuO bkPN49VxVgjRwUIEFnrjUsHg34k2MlII0LI2TajD/C6RAOM2c/EmKLFCp/EtILu3ITyk Tw8yKqnSzvrhQbkzWQW+lg1rFma9FJhsThbYIJl/PKaF9Zgf+8b0Sc5pKzpvTRzzGTUh glg44jCYhIOPgUoBPcSR1DyhPQunbJxbx7WYrMtlyibozx8F/P1V2e5V99ebp9qeHZ0Q eBNTA0EG3uWwT0bw0/Y1nXOxLQHsbgx480DVl14NU7xHazVziZicggWzj0ja6umrQYqe QDkQ== X-Gm-Message-State: AOJu0Yxk2FujYS2bWZAi/31uH5VcMaC68/EmH876tVbB3QNz3ttPU0t3 yjaGwy1vUPN7pqvu0SlC+NtS1A== X-Google-Smtp-Source: AGHT+IHFTgzCRaRfXXW9f0M92PiwFPDTi6wBLNXXA+cBYRX14+FSYG4I4TYBx7jMa0brq4Ir0itlvA== X-Received: by 2002:a5d:678d:0:b0:315:a17d:dbc6 with SMTP id v13-20020a5d678d000000b00315a17ddbc6mr9970701wru.14.1692787505788; Wed, 23 Aug 2023 03:45:05 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:05 -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 v3 13/15] media: qcom: camss: Support RDI3 for VFE 17x Date: Wed, 23 Aug 2023 11:44:42 +0100 Message-ID: <20230823104444.1954663-14-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Some VFEs have four RDIs apiece. Right now the ISR code has a hard-coded value which tops-out at RDI2 meaning only three RDIs can be utilised in practice. Extend out the various routines in camss-vfe-17x.c to support the higher RDI count. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss-vfe-170.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index 8aa921400ded0..c2487a8196db7 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -210,7 +210,8 @@ static void vfe_global_reset(struct vfe_device *vfe) GLOBAL_RESET_CMD_IDLE_CGC | GLOBAL_RESET_CMD_RDI0 | GLOBAL_RESET_CMD_RDI1 | - GLOBAL_RESET_CMD_RDI2; + GLOBAL_RESET_CMD_RDI2 | + GLOBAL_RESET_CMD_RDI3; =20 writel_relaxed(BIT(31), vfe->base + VFE_IRQ_MASK_0); =20 @@ -344,7 +345,7 @@ static void vfe_violation_read(struct vfe_device *vfe) static irqreturn_t vfe_isr(int irq, void *dev) { struct vfe_device *vfe =3D dev; - u32 status0, status1, vfe_bus_status[3]; + u32 status0, status1, vfe_bus_status[VFE_LINE_NUM_MAX]; int i, wm; =20 status0 =3D readl_relaxed(vfe->base + VFE_IRQ_STATUS_0); @@ -353,7 +354,7 @@ static irqreturn_t vfe_isr(int irq, void *dev) writel_relaxed(status0, vfe->base + VFE_IRQ_CLEAR_0); writel_relaxed(status1, vfe->base + VFE_IRQ_CLEAR_1); =20 - for (i =3D VFE_LINE_RDI0; i <=3D VFE_LINE_RDI2; i++) { + for (i =3D VFE_LINE_RDI0; i < vfe->line_num; i++) { vfe_bus_status[i] =3D readl_relaxed(vfe->base + VFE_BUS_IRQ_STATUS(i)); writel_relaxed(vfe_bus_status[i], vfe->base + VFE_BUS_IRQ_CLEAR(i)); } @@ -367,11 +368,11 @@ static irqreturn_t vfe_isr(int irq, void *dev) if (status0 & STATUS_0_RESET_ACK) vfe->isr_ops.reset_ack(vfe); =20 - for (i =3D VFE_LINE_RDI0; i <=3D VFE_LINE_RDI2; i++) + for (i =3D VFE_LINE_RDI0; i < vfe->line_num; i++) if (status0 & STATUS_0_RDI_REG_UPDATE(i)) vfe->isr_ops.reg_update(vfe, i); =20 - for (i =3D VFE_LINE_RDI0; i <=3D VFE_LINE_RDI2; i++) + for (i =3D VFE_LINE_RDI0; i < vfe->line_num; i++) if (status0 & STATUS_1_RDI_SOF(i)) vfe->isr_ops.sof(vfe, i); =20 --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 C02ABEE49A0 for ; Wed, 23 Aug 2023 10:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234060AbjHWKp5 (ORCPT ); Wed, 23 Aug 2023 06:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234053AbjHWKpi (ORCPT ); Wed, 23 Aug 2023 06:45:38 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3A110DE for ; Wed, 23 Aug 2023 03:45:08 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40037db2fe7so2382015e9.0 for ; Wed, 23 Aug 2023 03:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787507; x=1693392307; 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=XCsHx28OSfGIG+PvNDPUNK2MaUL6kouSWRdKAXaz/kg=; b=H2r5bhMm6ONKKK0NCsANReANW5qbk5jwUWuO/AkUutYicn4F4RtDjIWYgnCWL4sbnM 9A95zGcf5X27bazHpaANPIy8xXpMpD9+t+7mdnV3hJqi2sHVRBj52GiZi6O8EHltP3DO X2wpV2/yuewNNj9SF6gi5c/z2WewNtFHva7hhjBUNfWx3Jbsz3bW0Br5xHIqS6ttQO5z PAnLkEbKqpgHh7Re0l1JJgu255k4L2y962HVaPVkgG7qC14iI6100mBfi3eMtYdvXxC5 rxyGNrRFf6nbZwtTftzC0zvXpXq+w1OFoSSUCdm8Ikt3qn97zBv/k7OLkR6SDWUvOgt7 CtUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787507; x=1693392307; 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=XCsHx28OSfGIG+PvNDPUNK2MaUL6kouSWRdKAXaz/kg=; b=KMgixNVR13Jijmq5osUsCdpLymamjdGHTa/CLhtFHyZBWdIwwpDTHGpo2tE5zayDFU zTsw7+RCg7Vl17HtCGauk8iWm2TBQrW0tTJH6NUs9RgJP81hkHa1EXM5r6FcWcTpKRAg 8Suc913Jh8m6ezw9DZ75dwCGek15/r0KovA/PVKwFVMfORN2ljd58kECJ6BN10OrNyi+ 1V7O8MvI3F6epF+IpnZDrAEPbs2FkYuRGeJjytwqe1amSFX42Kercd1xO3IwvWdYeRe1 cw+G4HzGYmX7XEYZCV4TKTH2EDjn8I7svcc9LIiWwpQcEQunrPxCfufQ+en8/Aexj0MZ IwMg== X-Gm-Message-State: AOJu0YyOspRJLDGGu5w1k9zfuwpxuRXkxhWgOmNvifPQs8nYqSG3G500 svEguC59+qmw2egy9/GzO4i16A== X-Google-Smtp-Source: AGHT+IGVKSeQ9pWkxj/wfJ5G7eC3j8hb189Gfl4C+aJGuO8hAf/xOXoj4r1JD6nqQSjkTuoTbb7UYw== X-Received: by 2002:adf:e5c4:0:b0:317:eee2:6fba with SMTP id a4-20020adfe5c4000000b00317eee26fbamr10244304wrn.40.1692787507028; Wed, 23 Aug 2023 03:45:07 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.45.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:06 -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 v3 14/15] media: qcom: camss: Convert vfe_disable() from int to void Date: Wed, 23 Aug 2023 11:44:43 +0100 Message-ID: <20230823104444.1954663-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" No version of vfe_disable() currently returns nor has ever as near as I can discern ever returned a meaningful error code. Convert from the unused int return to void. Fixes: 633b388f85c5 ("media: camss: Refactor VFE HW version support") Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe-170.c | 5 ++--- drivers/media/platform/qcom/camss/camss-vfe-480.c | 5 ++--- drivers/media/platform/qcom/camss/camss-vfe-gen1.c | 5 ++--- drivers/media/platform/qcom/camss/camss-vfe-gen1.h | 3 +-- drivers/media/platform/qcom/camss/camss-vfe.c | 5 +---- drivers/media/platform/qcom/camss/camss-vfe.h | 2 +- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index c2487a8196db7..b6b425ac2e867 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -562,9 +562,8 @@ static int vfe_enable(struct vfe_line *line) * vfe_disable - Disable streaming on VFE line * @line: VFE line * - * Return 0 on success or a negative error code otherwise */ -static int vfe_disable(struct vfe_line *line) +static void vfe_disable(struct vfe_line *line) { struct vfe_device *vfe =3D to_vfe(line); =20 @@ -578,7 +577,7 @@ static int vfe_disable(struct vfe_line *line) =20 mutex_unlock(&vfe->stream_lock); =20 - return 0; + return; } =20 /* diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-480.c index b1a07e846e25b..be00a713163e1 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -397,9 +397,8 @@ static int vfe_enable(struct vfe_line *line) * vfe_disable - Disable streaming on VFE line * @line: VFE line * - * Return 0 on success or a negative error code otherwise */ -static int vfe_disable(struct vfe_line *line) +static void vfe_disable(struct vfe_line *line) { struct vfe_device *vfe =3D to_vfe(line); =20 @@ -413,7 +412,7 @@ static int vfe_disable(struct vfe_line *line) =20 mutex_unlock(&vfe->stream_lock); =20 - return 0; + return; } =20 /* diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen1.c b/drivers/m= edia/platform/qcom/camss/camss-vfe-gen1.c index 239d3d4ac6661..5e8319e565bbc 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-gen1.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen1.c @@ -95,9 +95,8 @@ static int vfe_disable_output(struct vfe_line *line) * vfe_gen1_disable - Disable streaming on VFE line * @line: VFE line * - * Return 0 on success or a negative error code otherwise */ -int vfe_gen1_disable(struct vfe_line *line) +void vfe_gen1_disable(struct vfe_line *line) { struct vfe_device *vfe =3D to_vfe(line); =20 @@ -114,7 +113,7 @@ int vfe_gen1_disable(struct vfe_line *line) =20 mutex_unlock(&vfe->stream_lock); =20 - return 0; + return; } =20 static void vfe_output_init_addrs(struct vfe_device *vfe, diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen1.h b/drivers/m= edia/platform/qcom/camss/camss-vfe-gen1.h index 6d5f9656562c8..b82137a2cb578 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-gen1.h +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen1.h @@ -82,9 +82,8 @@ static inline u8 vfe_calc_interp_reso(u16 input, u16 outp= ut) * vfe_gen1_disable - Disable streaming on VFE line * @line: VFE line * - * Return 0 on success or a negative error code otherwise */ -int vfe_gen1_disable(struct vfe_line *line); +void vfe_gen1_disable(struct vfe_line *line); =20 /* * vfe_gen1_enable - Enable VFE module diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 73380e75dbb22..d6c5628d51903 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -766,10 +766,7 @@ static int vfe_set_stream(struct v4l2_subdev *sd, int = enable) dev_err(vfe->camss->dev, "Failed to enable vfe outputs\n"); } else { - ret =3D vfe->ops->vfe_disable(line); - if (ret < 0) - dev_err(vfe->camss->dev, - "Failed to disable vfe outputs\n"); + vfe->ops->vfe_disable(line); } =20 return ret; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/= platform/qcom/camss/camss-vfe.h index cbc314c4e244b..b2f4192576364 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -112,7 +112,7 @@ struct vfe_hw_ops { void (*reg_update_clear)(struct vfe_device *vfe, enum vfe_line_id line_id); void (*subdev_init)(struct device *dev, struct vfe_device *vfe); - int (*vfe_disable)(struct vfe_line *line); + void (*vfe_disable)(struct vfe_line *line); int (*vfe_enable)(struct vfe_line *line); int (*vfe_halt)(struct vfe_device *vfe); void (*violation_read)(struct vfe_device *vfe); --=20 2.41.0 From nobody Wed Dec 17 05:57:14 2025 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 4EFF1EE49A0 for ; Wed, 23 Aug 2023 10:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234153AbjHWKqA (ORCPT ); Wed, 23 Aug 2023 06:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234128AbjHWKpi (ORCPT ); Wed, 23 Aug 2023 06:45:38 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEEFA10E0 for ; Wed, 23 Aug 2023 03:45:09 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-31ad779e6b3so4567400f8f.2 for ; Wed, 23 Aug 2023 03:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692787508; x=1693392308; 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=FIu4eWCkEOSVtI8FoLJRLwwONGivM5mrULXtY5Z5HVI=; b=iR1HQqxeBsupmS+Favm4zTSidm2aT6bx7ajaAl8rBuLII87IivTUcR2VWpznpsDE+R MCfdnWtCmOsEpUaFAl5mFZdQSr8nzotudFoQksQixrFdAXdx+r+oGFa8gWcd6vfaQqsH cVvlFANnHEouAyGGiZvq3xN0gruYNTynKcNGRwn4atmVlAZ8QnqQypDcdx2Qqc2Z0EWz RjY67jKMvacBJSfoIgHgxlCjphiFK106NYNXL14qgECQ67n5RjKd9cLiE7X+L30ngvis eil+bTCkEjRUoc1+IzIpjGuQFZp/chrfKSJ2Q6nrTaVUdpR94GxUzhjg/lx22O4He6hQ rQww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692787508; x=1693392308; 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=FIu4eWCkEOSVtI8FoLJRLwwONGivM5mrULXtY5Z5HVI=; b=kmnmuxRhIC0dOrUz8PO311TI5hrgabvdY8EAiuQFc+rbgUEhDCWUZ0fhWmp47+BDst FHYJyRymp+fZC1ilKQ71GzCuAeaL4ZV/gGV1gw7EOv90TwXXNkxtQWAShKXYEfGUnbpu mhgLDSTLqMnviQubv4SMJSh9DebpFbILp4NigPgygwMs9BZZG468rDag+ky9RI94JL01 kCEiTLjhuLIheSXNLJdUqeHurnQRq87u881io39fST9RJiigvYjcTFsgtz6yx7T3yaWK rRErbQnWhXkRzxmSezLAXhTrd4DiUwecCA/pSYseaQwlm8h0j4+IE3yHPThnUUjbJcTn QPuQ== X-Gm-Message-State: AOJu0YyjUVnnMlz4f5dJDaM3OmpypTdXr6wboYyBn/NKWBO7fU91VjFS 7O99kSERK3BNVi3QVyXkfrNLcg== X-Google-Smtp-Source: AGHT+IETgiaFMcrE1JfWFkGdddTyYkNG6PjtSRuCyiFhrM+u1c/VD06R+stwPw8nbB17oeoE3yvOFQ== X-Received: by 2002:a5d:6949:0:b0:319:7471:2965 with SMTP id r9-20020a5d6949000000b0031974712965mr9485144wrw.21.1692787508218; Wed, 23 Aug 2023 03:45:08 -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 n4-20020a5d4204000000b0031c5dda3aedsm6281213wrq.95.2023.08.23.03.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 03:45:07 -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 v3 15/15] media: qcom: camss: Comment CSID dt_id field Date: Wed, 23 Aug 2023 11:44:44 +0100 Message-ID: <20230823104444.1954663-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> References: <20230823104444.1954663-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Digging into the documentation we find that the DT_ID bitfield is used to map the six bit DT to a two bit ID code. This value is concatenated to the VC bitfield to create a CID value. DT_ID is the two least significant bits of CID and VC the most significant bits. Originally we set dt_id =3D vc * 4 in and then subsequently set dt_id =3D v= c. commit 3c4ed72a16bc ("media: camss: sm8250: Virtual channels for CSID") silently fixed the multiplication by four which would give a better value for the generated CID without mentioning what was being done or why. Next up I haplessly changed the value back to "dt_id =3D vc * 4" since there didn't appear to be any logic behind it. Hans asked what the change was for and I honestly couldn't remember the provenance of it, so I dug in. Link: https://lore.kernel.org/linux-arm-msm/edd4bf9b-0e1b-883c-1a4d-50f4102= c3924@xs4all.nl/ Add a comment so the next hapless programmer doesn't make this same mistake. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-gen2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/= media/platform/qcom/camss/camss-csid-gen2.c index 6ba2b10326444..cee50fc87e9de 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -352,6 +352,11 @@ static void __csid_configure_stream(struct csid_device= *csid, u8 enable, u8 vc) phy_sel =3D csid->phy.csiphy_id; =20 if (enable) { + /* + * A value caled 'CID' gets generated internal to CAMSS logic + * which is a concatenation of [vc:6 | dt_id:2] hence we reuse + * the least significant two bits of the VC to 'stuff' the CID value. + */ u8 dt_id =3D vc; =20 if (tg->enabled) { --=20 2.41.0