From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Vikram Sharma <quic_vikramsa@quicinc.com>,
Robert Foss <rfoss@kernel.org>, Todor Tomov <todor.too@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Kapatrala Syed <akapatra@quicinc.com>,
Hariram Purushothaman <hariramp@quicinc.com>,
cros-qcom-dts-watchers@chromium.org,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Loic Poulain <loic.poulain@linaro.org>,
Andi Shyti <andi.shyti@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org,
Suresh Vankadara <quic_svankada@quicinc.com>,
Trishansh Bhardwaj <quic_tbhardwa@quicinc.com>
Subject: Re: [PATCH 6/6] media: qcom: camss: support for camss driver for sc7280
Date: Sat, 29 Jun 2024 12:45:28 +0100 [thread overview]
Message-ID: <bb2eb6ea-a209-4986-8415-ce14904dbda1@linaro.org> (raw)
In-Reply-To: <20240629-camss_first_post_linux_next-v1-6-bc798edabc3a@quicinc.com>
On 28/06/2024 19:32, Vikram Sharma wrote:
> From: Suresh Vankadara <quic_svankada@quicinc.com>
>
> This change adds support for camss driver for sc7280 soc.
>
> Signed-off-by: Suresh Vankadara <quic_svankada@quicinc.com>
> Signed-off-by: Trishansh Bhardwaj <quic_tbhardwa@quicinc.com>
> Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
> ---
> drivers/media/platform/qcom/camss/camss-csid.c | 16 +-
> .../platform/qcom/camss/camss-csiphy-3ph-1-0.c | 2 +
> drivers/media/platform/qcom/camss/camss-vfe.c | 2 +
> drivers/media/platform/qcom/camss/camss.c | 340 +++++++++++++++++++++
> drivers/media/platform/qcom/camss/camss.h | 2 +
> 5 files changed, 359 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index 858db5d4ca75..2c622233da6f 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -28,6 +28,7 @@
> /* offset of CSID registers in VFE region for VFE 480 */
> #define VFE_480_CSID_OFFSET 0x1200
> #define VFE_480_LITE_CSID_OFFSET 0x200
> +#define VFE_165_CSID_OFFSET 0x4000
>
> #define MSM_CSID_NAME "msm_csid"
>
> @@ -1028,8 +1029,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
> csid->res->hw_ops->subdev_init(csid);
>
> /* Memory */
> -
> - if (camss->res->version == CAMSS_8250) {
> + switch (camss->res->version) {
> + case 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
> @@ -1040,10 +1041,19 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
> else
> csid->base = csid->res->parent_dev_ops->get_base_address(camss, id)
> + VFE_480_CSID_OFFSET;
> - } else {
> + break;
> + case CAMSS_7280:
> + /* for titan 165, CSID registers are inside the VFE region,
> + * between the VFE "top" and "bus" registers. this requires
> + * VFE to be initialized before CSID
> + */
> + csid->base = camss->vfe[id].base + VFE_165_CSID_OFFSET;
Right but you can just define "csid" registers in your yaml and dts per
standard definitions.
Looking at what we did for 8250 here there's absolutely no good reason
to have C code derive offsets like this which can be described in dts.
I'll send a patch to that effect - along with named power-domains for 8250.
Please just define your CSID registers in the yaml/dts - there's no need
to add executable code to the driver to find an offset.
> + break;
> + default:
> csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
> if (IS_ERR(csid->base))
> return PTR_ERR(csid->base);
> + break;
> }
>
> /* Interrupt */
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index df7e93a5a4f6..c7e507420732 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
> @@ -510,6 +510,7 @@ static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy,
> array_size = ARRAY_SIZE(lane_regs_sdm845[0]);
> break;
> case CAMSS_8250:
> + case CAMSS_7280:
> r = &lane_regs_sm8250[0][0];
> array_size = ARRAY_SIZE(lane_regs_sm8250[0]);
> break;
> @@ -560,6 +561,7 @@ static bool csiphy_is_gen2(u32 version)
> case CAMSS_845:
> case CAMSS_8250:
> case CAMSS_8280XP:
> + case CAMSS_7280:
Sort alphanumerically please.
> + /* CSIPHY0 */
> + {
> + .regulators = {},
> + .clock = { "csiphy0", "csiphy0_timer", "csiphy0_timer_src"},
> + .clock_rate = { { 300000000 },
> + { 300000000 },
> + { 300000000 }},
I'll reiterate, I don't believe the _src clocks are required.
> +
> +static const struct resources_icc icc_res_sc7280[] = {
> + {
> + .name = "cam_ahb",
> + .icc_bw_tbl.avg = 38400,
> + .icc_bw_tbl.peak = 76800,
> + },
> + {
> + .name = "cam_hf_0",
> + .icc_bw_tbl.avg = 2097152,
> + .icc_bw_tbl.peak = 2097152,
> + },
> +};
Good to see this.
> +
> /*
> * camss_add_clock_margin - Add margin to clock frequency rate
> * @rate: Clock frequency rate
> @@ -1824,6 +2099,57 @@ static int camss_init_subdevices(struct camss *camss)
> return 0;
> }
>
> +/*
> + * camss_link_entities_v2 - Register subdev nodes and create links
> + * @camss: CAMSS device
> + *
> + * Return 0 on success or a negative error code on failure
> + */
> +static int camss_link_entities_v2(struct camss *camss)
> +{
> + int i, j;
> + int ret;
> +
> + for (i = 0; i < camss->res->csiphy_num; i++) {
> + for (j = 0; j < camss->res->csid_num; j++) {
> + ret = media_create_pad_link(&camss->csiphy[i].subdev.entity,
> + MSM_CSIPHY_PAD_SRC,
> + &camss->csid[j].subdev.entity,
> + MSM_CSID_PAD_SINK,
> + 0);
> + if (ret < 0) {
> + dev_err(camss->dev,
> + "Failed to link %s->%s entities: %d\n",
> + camss->csiphy[i].subdev.entity.name,
> + camss->csid[j].subdev.entity.name,
> + ret);
> + return ret;
> + }
> + }
> + }
> +
> + for (i = 0; i < camss->res->csid_num; i++)
> + for (j = 0; j < camss->vfe[i].res->line_num; j++) {
> + struct v4l2_subdev *csid = &camss->csid[i].subdev;
> + struct v4l2_subdev *vfe = &camss->vfe[i].line[j].subdev;
> +
> + ret = media_create_pad_link(&csid->entity,
> + MSM_CSID_PAD_FIRST_SRC + j,
> + &vfe->entity,
> + MSM_VFE_PAD_SINK,
> + 0);
> + if (ret < 0) {
> + dev_err(camss->dev,
> + "Failed to link %s->%s entities: %d\n",
> + csid->entity.name,
> + vfe->entity.name,
> + ret);
> + return ret;
> + }
> + }
> + return 0;
> +}
So I see what you're doing here and agree but, I think it should be made
into its own standalone patch.
We can break up the link_entities function into something for ispif the
v1 and something for everybody else @ v2, not just 7280.
Either way such a change deserves its own standalone patch.
> +
> /*
> * camss_link_entities - Register subdev nodes and create links
> * @camss: CAMSS device
> @@ -2440,12 +2766,26 @@ static const struct camss_resources sc8280xp_resources = {
> .link_entities = camss_link_entities
> };
>
> +static const struct camss_resources sc7280_resources = {
> + .version = CAMSS_7280,
> + .csiphy_res = csiphy_res_7280,
> + .csid_res = csid_res_7280,
> + .vfe_res = vfe_res_7280,
> + .icc_res = icc_res_sc7280,
> + .icc_path_num = ARRAY_SIZE(icc_res_sc7280),
> + .csiphy_num = ARRAY_SIZE(csiphy_res_7280),
> + .csid_num = ARRAY_SIZE(csid_res_7280),
> + .vfe_num = 3,
> + .link_entities = camss_link_entities_v2
> +};
> +
> static const struct of_device_id camss_dt_match[] = {
> { .compatible = "qcom,msm8916-camss", .data = &msm8916_resources },
> { .compatible = "qcom,msm8996-camss", .data = &msm8996_resources },
> { .compatible = "qcom,sdm660-camss", .data = &sdm660_resources },
> { .compatible = "qcom,sdm845-camss", .data = &sdm845_resources },
> { .compatible = "qcom,sm8250-camss", .data = &sm8250_resources },
> + { .compatible = "qcom,sc7280-camss", .data = &sc7280_resources },
> { .compatible = "qcom,sc8280xp-camss", .data = &sc8280xp_resources },
Its just occured to me, this list ought to be sorted alpanumerically too.
I'd be obliged if you could add a patch to this series to sort this list
prior to adding in your new string - in the appropriate order.
> { }
> };
> diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
> index 73c47c07fc30..29dbf93ce9c5 100644
> --- a/drivers/media/platform/qcom/camss/camss.h
> +++ b/drivers/media/platform/qcom/camss/camss.h
> @@ -79,11 +79,13 @@ enum camss_version {
> CAMSS_845,
> CAMSS_8250,
> CAMSS_8280XP,
> + CAMSS_7280,
> };
>
> enum icc_count {
> ICC_DEFAULT_COUNT = 0,
> ICC_SM8250_COUNT = 4,
> + ICC_SM7280_COUNT = 4,
> };
Do you even use the SM7280 specific enum ? I didn't see it, SoC name is
SC7280 anyway.
I think you can drop that.
---
bod
next prev parent reply other threads:[~2024-06-29 11:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 18:32 [PATCH 0/6] media: qcom: camss: Add sc7280 support Vikram Sharma
2024-06-28 18:32 ` [PATCH 1/6] media: dt-bindings: media: camss: Add qcom,sc7280-camss binding Vikram Sharma
2024-06-29 10:57 ` Bryan O'Donoghue
2024-07-01 8:58 ` Krzysztof Kozlowski
2024-06-28 18:32 ` [PATCH 2/6] arm64: dts: qcom: sc7280: Add support for camss Vikram Sharma
2024-06-29 11:53 ` Bryan O'Donoghue
2024-06-28 18:32 ` [PATCH 3/6] arm64: dts: qcom: sc7280: Add IMX577 camera sensor Vikram Sharma
2024-06-29 11:07 ` Bryan O'Donoghue
2024-06-29 13:10 ` Konrad Dybcio
2024-07-01 8:59 ` Krzysztof Kozlowski
2024-07-01 18:38 ` Dmitry Baryshkov
2024-06-28 18:32 ` [PATCH 4/6] arm64: dts: qcom: qcs6490-rb3gen2: Enable " Vikram Sharma
2024-06-29 11:22 ` Bryan O'Donoghue
2024-07-01 9:00 ` Krzysztof Kozlowski
2024-06-28 18:32 ` [PATCH 5/6] i2c: Enable IMX577 camera sensor for qcm6490 Vikram Sharma
2024-06-29 8:22 ` Luca Weiss
2024-07-01 9:01 ` Krzysztof Kozlowski
2024-07-01 9:01 ` Krzysztof Kozlowski
2024-06-28 18:32 ` [PATCH 6/6] media: qcom: camss: support for camss driver for sc7280 Vikram Sharma
2024-06-29 11:45 ` Bryan O'Donoghue [this message]
2024-07-01 19:22 ` Marion & Christophe JAILLET
2024-07-04 15:01 ` [PATCH 0/6] media: qcom: camss: Add sc7280 support Luca Weiss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb2eb6ea-a209-4986-8415-ce14904dbda1@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=akapatra@quicinc.com \
--cc=andersson@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=conor+dt@kernel.org \
--cc=cros-qcom-dts-watchers@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=hariramp@quicinc.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mchehab@kernel.org \
--cc=quic_svankada@quicinc.com \
--cc=quic_tbhardwa@quicinc.com \
--cc=quic_vikramsa@quicinc.com \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=todor.too@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox