From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Depeng Shao <quic_depengs@quicinc.com>,
rfoss@kernel.org, todor.too@gmail.com, mchehab@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org
Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@quicinc.com, Yongsheng Li <quic_yon@quicinc.com>
Subject: Re: [PATCH 12/13] media: qcom: camss: Add CSID Gen3 support for sm8550
Date: Thu, 15 Aug 2024 17:10:06 +0100 [thread overview]
Message-ID: <be0b5f96-2863-4b10-b003-6829dfb04b95@linaro.org> (raw)
In-Reply-To: <ff261ab4-b59d-48a1-9ede-3c691842d913@quicinc.com>
On 15/08/2024 16:14, Depeng Shao wrote:
> Hi Bryan,
>
>
>>> ---
>>> drivers/media/platform/qcom/camss/Makefile | 1 +
>>> .../platform/qcom/camss/camss-csid-gen3.c | 339 ++++++++++++++++++
>>> .../platform/qcom/camss/camss-csid-gen3.h | 26 ++
>>
>>
>> So this "gen2" and "gen3" stuff would make sense if we had a number of
>> SoCs based on gen2 and gen3 which were controlled from the upper-level
>> gen2.c and gen3.c.
>>
>> What you're submitting here is csid-780 so the file should be named
>> csid-780.
>>
>> When we add 680 or 880 then it makes sense to try to encapsulate a
>> class of generation into one file - potentially.
>>
>> I'd guess that was the intent behind gen2.c.
>>
>> TL;DR please name your file csid-xxx.c
>
> Sure, I will use csid-780.c
>
>>> +
>>> + writel(val, csid->base + CSID_CSI2_RX_CFG0);
>>> +
>>> + val = 1 << CSI2_RX_CFG1_ECC_CORRECTION_EN;
>>> + if (vc > 3)
>>> + val |= 1 << CSI2_RX_CFG1_VC_MODE;
>>
>> So again these are needless bit-shifts.
>>
>> #define CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN BIT(0)
>>
>> val = CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN;
>>
>
> You posted same comments in v3 series, I also replied it.
> https://lore.kernel.org/all/eeaf4f4e-5200-4b13-b38f-3f3385fc2a2b@quicinc.com/
>
> Some of register bits which just need to be configured to 0 or 1, then
> can use BIT(X), but some register bits need to configure a specific
> value, e.g., CSID_RDI_CFG0 bits[22:26] need to configure a vc vaule,
> bits[16:21] need to configure a dt value, then we can't use BIT(x) to
> handle this.
Yes please use macros() to bury any _necessary_ bit shifts to populate a
_bit_field_ away but as an example CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN
is not a bit-field.
>
>
>>> case MSM_CSID_PAD_SRC:
>>> - if (csid->testgen_mode->cur.val == 0) {
>>> + if (!csid->testgen_mode || csid->testgen_mode->cur.val == 0) {
>>
>> See my comments on adding new guards to core functionality.
>>
>> Is this sm8550 specific or generic ?
>>
>
> It is sm8550 specific, since we don't have testgen mode in sm8550 csid,
> so need to add some guards, the guards are added for similar reason.
Hmm, I see in my tree I just assigned testgen_mode to some dummy data.
You're right, retain this, when we enable testgen as a standalone entity
outside of CSID we can address this again.
>
>>> /* Test generator is disabled, */
>>> /* keep pad formats in sync */
>>> u32 code = fmt->code;
>>> @@ -1042,6 +1042,7 @@ static int csid_init_formats(struct v4l2_subdev
>>> *sd, struct v4l2_subdev_fh *fh)
>>> static int csid_set_test_pattern(struct csid_device *csid, s32 value)
>>> {
>>> struct csid_testgen_config *tg = &csid->testgen;
>>> + const struct csid_hw_ops *hw_ops = csid->res->hw_ops;
>>> /* If CSID is linked to CSIPHY, do not allow to enable test
>>> generator */
>>> if (value && media_pad_remote_pad_first(&csid-
>>> >pads[MSM_CSID_PAD_SINK]))
>>> @@ -1049,7 +1050,10 @@ static int csid_set_test_pattern(struct
>>> csid_device *csid, s32 value)
>>> tg->enabled = !!value;
>>> - return csid->res->hw_ops->configure_testgen_pattern(csid, value);
>>> + if (hw_ops->configure_testgen_pattern)
>>> + return -EOPNOTSUPP;
>>> + else
>>> + return hw_ops->configure_testgen_pattern(csid, value);
>>
>> If you just add a dummy configure_testgen_pattern we can get rid of
>> this branching stuff.
>>
>
> Do you mean add dummy function in csid-780/gen3.c? How about the other
> ops in vfe_ops_780, add dummy function or use NULL? We need to guards if
> we set it as NULL.
See above, you're right what you have is fine.
>
> static int csid_configure_testgen_pattern(struct csid_device *csid, s32
> val)
> {
> return 0;
> }
>
>>> }
>>> /*
>>> @@ -1121,6 +1125,19 @@ int msm_csid_subdev_init(struct camss *camss,
>>> struct csid_device *csid,
>>> csid->base = devm_platform_ioremap_resource_byname(pdev,
>>> res->reg[0]);
>>> if (IS_ERR(csid->base))
>>> return PTR_ERR(csid->base);
>>> +
>>> + /* CSID "top" is a new function in new version HW,
>>> + * CSID can connect to VFE & SFE(Sensor Front End).
>>> + * this connection is controlled by CSID "top" registers.
>>> + * There is only one CSID "top" region for all CSIDs.
>>> + */
>>> + if (!csid_is_lite(csid) && res->reg[1] && !camss-
>>> >csid_top_base) {
>>> + camss->csid_top_base =
>>> + devm_platform_ioremap_resource_byname(pdev, res-
>>> >reg[1]);
>>
>> That's a complex clause.
>>
>> Let me send you a patch to do it a different way.
>>
>
> I was also thinking to addd it in camss level, then I thought it is in
> csid block, so I moved it to csid, but it is also fine to add it in
> camss. Can I add your patch into this series? Just like the csiphy patches.
static const struct resources_wrapper csid_wrapper_res_sm8550 = {
.reg = "csid_wrapper",
};
Yes go ahead, all you should need to do then is add
"&csid_wrapper_res_sm8550" to your resources.
static const struct camss_resources sm8550_resources = {
.version = CAMSS_SM8550,
.pd_name = "top",
.csiphy_res = csiphy_res_sm8550,
.csid_res = csid_res_sm8550,
.ispif_res = NULL,
.vfe_res = vfe_res_sm8550,
.csid_wrapper_res = &csid_wrapper_res_sm8550,
...
};
---
bod
next prev parent reply other threads:[~2024-08-15 16:10 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 14:41 [PATCH v4 00/13] media: qcom: camss: Add sm8550 support Depeng Shao
2024-08-12 14:41 ` [PATCH 01/13] media: qcom: camss: csiphy-3ph: Fix trivial indentation fault in defines Depeng Shao
2024-08-12 14:41 ` [PATCH 02/13] media: qcom: camss: csiphy-3ph: Remove redundant PHY init sequence control loop Depeng Shao
2024-08-12 14:41 ` [PATCH 03/13] media: qcom: camss: csiphy-3ph: Rename struct Depeng Shao
2024-08-12 14:41 ` [PATCH 04/13] media: qcom: camss: csiphy: Add an init callback to CSI PHY devices Depeng Shao
2024-08-19 0:17 ` Vladimir Zapolskiy
2024-09-04 14:20 ` Depeng Shao
2024-09-04 14:51 ` Bryan O'Donoghue
2024-08-12 14:41 ` [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to data field inside csiphy struct Depeng Shao
2024-08-19 0:01 ` Vladimir Zapolskiy
2024-08-28 14:11 ` Depeng Shao
2024-08-12 14:41 ` [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to find common control regs Depeng Shao
2024-08-18 23:59 ` Vladimir Zapolskiy
2024-08-12 14:41 ` [PATCH 07/13] dt-bindings: media: camss: Add qcom,sm8550-camss binding Depeng Shao
2024-08-16 7:01 ` Krzysztof Kozlowski
2024-08-16 7:45 ` Depeng Shao
2024-09-30 7:17 ` Krzysztof Kozlowski
2024-09-05 15:20 ` Vladimir Zapolskiy
2024-09-05 15:54 ` Depeng Shao
2024-09-06 15:56 ` Vladimir Zapolskiy
2024-09-25 15:13 ` Depeng Shao
2024-09-30 7:16 ` Krzysztof Kozlowski
2024-09-30 8:46 ` Vladimir Zapolskiy
2024-09-30 8:55 ` Bryan O'Donoghue
2024-09-30 9:15 ` Vladimir Zapolskiy
2024-09-30 7:26 ` Krzysztof Kozlowski
2024-09-30 8:32 ` Vladimir Zapolskiy
2024-09-30 9:03 ` Bryan O'Donoghue
2024-09-12 8:22 ` Vladimir Zapolskiy
2024-09-12 11:41 ` Bryan O'Donoghue
2024-09-12 12:44 ` Vladimir Zapolskiy
2024-09-12 15:11 ` Bryan O'Donoghue
2024-09-12 20:57 ` Vladimir Zapolskiy
2024-09-12 22:41 ` Bryan O'Donoghue
2024-09-13 5:06 ` Vladimir Zapolskiy
2024-09-17 22:40 ` Bryan O'Donoghue
2024-09-17 23:16 ` Vladimir Zapolskiy
2024-09-25 15:40 ` Depeng Shao
2024-09-30 9:26 ` Depeng Shao
2024-10-08 13:50 ` Vladimir Zapolskiy
2024-10-08 14:06 ` Bryan O'Donoghue
2024-10-08 15:47 ` Depeng Shao
2024-09-30 10:21 ` Bryan O'Donoghue
2024-09-13 4:17 ` Dmitry Baryshkov
2024-09-12 13:48 ` Neil Armstrong
2024-08-12 14:41 ` [PATCH 08/13] media: qcom: camss: csid: Move common code into csid core Depeng Shao
2024-08-14 23:53 ` Bryan O'Donoghue
2024-08-24 12:50 ` Vladimir Zapolskiy
2024-08-12 14:41 ` [PATCH 09/13] media: qcom: camss: vfe: Move common code into vfe core Depeng Shao
2024-08-15 0:09 ` Bryan O'Donoghue
2024-08-16 13:07 ` Depeng Shao
2024-08-24 13:06 ` Vladimir Zapolskiy
2024-08-28 0:07 ` Bryan O'Donoghue
2024-09-02 13:11 ` Depeng Shao
2024-08-12 14:41 ` [PATCH 10/13] media: qcom: camss: Add sm8550 compatible Depeng Shao
2024-08-13 12:57 ` Bryan O'Donoghue
2024-08-12 14:41 ` [PATCH 11/13] media: qcom: camss: csiphy-3ph: Add Gen2 v2.1.2 two-phase MIPI CSI-2 DPHY support Depeng Shao
2024-08-12 14:41 ` [PATCH 12/13] media: qcom: camss: Add CSID Gen3 support for sm8550 Depeng Shao
2024-08-14 16:08 ` Bryan O'Donoghue
2024-08-15 15:14 ` Depeng Shao
2024-08-15 16:10 ` Bryan O'Donoghue [this message]
2024-08-16 11:34 ` Bryan O'Donoghue
2024-08-16 13:11 ` Depeng Shao
2024-08-16 14:21 ` Bryan O'Donoghue
2024-08-19 13:23 ` Depeng Shao
2024-08-16 14:45 ` Bryan O'Donoghue
2024-08-19 13:18 ` Depeng Shao
2024-08-16 14:49 ` Bryan O'Donoghue
2024-08-24 13:19 ` Vladimir Zapolskiy
2024-09-30 9:23 ` Vladimir Zapolskiy
2024-09-30 9:38 ` Depeng Shao
2024-08-12 14:41 ` [PATCH 13/13] media: qcom: camss: Add support for VFE hardware version Titan 780 Depeng Shao
2024-08-14 11:13 ` Vladimir Zapolskiy
2024-08-14 13:10 ` Depeng Shao
2024-08-14 23:20 ` Vladimir Zapolskiy
2024-08-15 14:42 ` Depeng Shao
2024-08-15 14:57 ` Vladimir Zapolskiy
2024-08-15 15:43 ` Depeng Shao
2024-08-15 21:31 ` Vladimir Zapolskiy
2024-08-16 12:42 ` Depeng Shao
2024-08-20 14:01 ` Vladimir Zapolskiy
2024-08-14 16:23 ` Bryan O'Donoghue
2024-08-15 13:33 ` Depeng Shao
2024-08-15 16:16 ` Bryan O'Donoghue
2024-08-15 0:16 ` Bryan O'Donoghue
2024-08-15 14:24 ` Depeng Shao
2024-08-15 0:25 ` Bryan O'Donoghue
2024-08-15 14:21 ` Depeng Shao
2024-08-15 16:17 ` Bryan O'Donoghue
2024-09-29 1:28 ` Depeng Shao
2024-09-29 23:57 ` Bryan O'Donoghue
2024-09-30 5:37 ` Depeng Shao
2024-08-19 11:05 ` Bryan O'Donoghue
2024-08-19 13:07 ` Depeng Shao
2024-08-21 11:11 ` Vladimir Zapolskiy
2024-08-24 13:31 ` Vladimir Zapolskiy
2024-08-27 13:16 ` Bryan O'Donoghue
2024-08-13 12:35 ` [PATCH v4 00/13] media: qcom: camss: Add sm8550 support Bryan O'Donoghue
2024-08-13 12:42 ` Depeng Shao
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=be0b5f96-2863-4b10-b003-6829dfb04b95@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@quicinc.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=quic_depengs@quicinc.com \
--cc=quic_yon@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;
as well as URLs for NNTP newsgroup(s).