From: Depeng Shao <quic_depengs@quicinc.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>, <rfoss@kernel.org>,
<todor.too@gmail.com>, <mchehab@kernel.org>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>
Cc: <quic_eberman@quicinc.com>, <linux-media@vger.kernel.org>,
<linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <kernel@quicinc.com>
Subject: Re: [PATCH 11/13] media: qcom: camss: Add notify interface in camss driver
Date: Thu, 11 Jul 2024 19:54:07 +0800 [thread overview]
Message-ID: <0e5f029b-ee63-4e44-a75e-877fbae042b3@quicinc.com> (raw)
In-Reply-To: <236cfe43-8321-4168-8630-fb9528f581bd@linaro.org>
Hi Bryan,
On 7/10/2024 7:54 PM, Bryan O'Donoghue wrote:
> On 09/07/2024 17:06, Depeng Shao wrote:
>> The main v4l2 process logic in camss vfe subdev driver, so the vfe driver
>> handles the buf done irq and register update configuration. But the buf
>> done irq and register update configuration have been moved CSID HW in
>> Titan 780 and other new platform, so vfe driver needs to call into CSID
>> driver to configure the register update. And CSID driver also needs to
>> call into vfe driver to notify of the buf done irq.
>>
>> Adding this notify interface in camss structure to do the subdevs cross
>> /*
>> * csid_isr - CSID module interrupt service routine
>> * @irq: Interrupt line
>> @@ -341,6 +353,14 @@ static irqreturn_t csid_isr(int irq, void *dev)
>> if (csid->phy.en_vc & BIT(i)) {
>> val = readl_relaxed(csid->base +
>> CSID_CSI2_RDIN_IRQ_STATUS(i));
>> writel_relaxed(val, csid->base +
>> CSID_CSI2_RDIN_IRQ_CLEAR(i));
>> +
>> + if (buf_done_val & BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET +
>> i)) {
>> + /* For Titan 780, Buf Done IRQ® has been moved to
>> CSID from VFE.
>> + * Once CSID received Buf Done, need notify this
>> event to VFE.
>> + * Trigger VFE to handle Buf Done process.
>> + */
>> + csid->camss->notify(&csid->subdev,
>> CAMSS_MSG_BUF_DONE, (void *)&i);
>
> Instead of a generic notify function with an enum passed to a switch
> lets just have a dedicated function for each functional callback.
>
> csid->camss->reg_update_cmd();
> csid->camss->reg_clear_cmd();
>
> We can get rid of a switch and an additional enum that way, plus
> redundant "event not supported" error checking.
>
Sure, will update the code based on suggestion.
>> + }
>> }
>> val = 1 << IRQ_CMD_CLEAR;
>> @@ -434,6 +454,23 @@ static void csid_subdev_init(struct csid_device
>> *csid)
>> csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2;
>> }
>> +static void csid_subdev_process_msg(struct csid_device *csid,
>> unsigned int msg_type, void *arg)
>> +{
>> + int msg_data = *(int *)arg;
>> +
>> + switch (msg_type) {
>> + case CAMSS_MSG_RUP:
>> + csid_reg_update(csid, msg_data);
>> + break;
>> + case CAMSS_MSG_RUP_CLEAR:
>> + csid_reg_update_clear(csid, msg_data);
>> + break;
>> + default:
>> + dev_err(csid->camss->dev, "NOT Supported EVT Type\n");
>> + break;
>> + }
>> +}
>> +
>> const struct csid_hw_ops csid_ops_gen3 = {
>> .configure_stream = csid_configure_stream,
>> .configure_testgen_pattern = csid_configure_testgen_pattern,
>> @@ -442,4 +479,5 @@ const struct csid_hw_ops csid_ops_gen3 = {
>> .reset = csid_reset,
>> .src_pad_code = csid_src_pad_code,
>> .subdev_init = csid_subdev_init,
>> + .process_msg = csid_subdev_process_msg,
>> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h
>> b/drivers/media/platform/qcom/camss/camss-vfe.h
>> index 10e2cc3c0b83..a8b09ce9941b 100644
>> --- a/drivers/media/platform/qcom/camss/camss-vfe.h
>> +++ b/drivers/media/platform/qcom/camss/camss-vfe.h
>> @@ -115,6 +115,7 @@ struct vfe_hw_ops {
>> int (*vfe_halt)(struct vfe_device *vfe);
>> void (*violation_read)(struct vfe_device *vfe);
>> void (*vfe_wm_stop)(struct vfe_device *vfe, u8 wm);
>> + void (*process_msg)(struct vfe_device *vfe, unsigned int
>> msg_type, void *arg);
>> };
>> struct vfe_isr_ops {
>> diff --git a/drivers/media/platform/qcom/camss/camss.c
>> b/drivers/media/platform/qcom/camss/camss.c
>> index 1f1f44f6fbb2..abeb0918e47d 100644
>> --- a/drivers/media/platform/qcom/camss/camss.c
>> +++ b/drivers/media/platform/qcom/camss/camss.c
>> @@ -2202,6 +2202,52 @@ static void camss_genpd_cleanup(struct camss
>> *camss)
>> dev_pm_domain_detach(camss->genpd, true);
>> }
>> +static void camss_notify_msg(struct v4l2_subdev *sd,
>> + unsigned int msg_type, void *arg)
>> +{
>> + struct v4l2_device *v4l2_dev = sd->v4l2_dev;
>> + struct camss *camss = to_camss(v4l2_dev);
>> + struct vfe_device *vfe;
>> + struct vfe_line *vfe_line;
>> + struct csid_device *csid;
>> + int evt_data = *(int *)arg;
>> +
>> + switch (msg_type) {
>> + case CAMSS_MSG_BUF_DONE:
>> + csid = v4l2_get_subdevdata(sd);
>> + vfe = &(camss->vfe[csid->id]);
>> + if (vfe->res->hw_ops->process_msg)
>> + vfe->res->hw_ops->process_msg(vfe,
>> + CAMSS_MSG_BUF_DONE, (void *)&evt_data);
>> + break;
>> +
>> + case CAMSS_MSG_RUP:
>> + vfe_line = v4l2_get_subdevdata(sd);
>> + vfe = to_vfe(vfe_line);
>> + csid = &(camss->csid[vfe->id]);
>> +
>> + if (csid->res->hw_ops->process_msg)
>> + csid->res->hw_ops->process_msg(csid,
>> + CAMSS_MSG_RUP, (void *)&evt_data);
>> + break;
>> +
>> + case CAMSS_MSG_RUP_CLEAR:
>> + vfe_line = v4l2_get_subdevdata(sd);
>> + vfe = to_vfe(vfe_line);
>> + csid = &(camss->csid[vfe->id]);
>> +
>> + if (csid->res->hw_ops->process_msg)
>> + csid->res->hw_ops->process_msg(csid,
>> + CAMSS_MSG_RUP_CLEAR, (void *)&evt_data);
>> +
>> + break;
>> +
>> + default:
>> + dev_err(camss->dev, "Not supported evt type\n");
>> + break;
>> + }
>> +}
>
> Instead of having a central swiss army knife notify() callback these
> should be CSID or VFE specific callbacks vfe->buf_done() csid->msg_rup()
> etc.
>
I will try to add the callback in CSID and VFE driver.
Thanks,
Depeng
next prev parent reply other threads:[~2024-07-11 11:54 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 16:06 [PATCH V3 00/13] media: qcom: camss: Add sm8550 support Depeng Shao
2024-07-09 16:06 ` [PATCH 01/13] media: qcom: camss: csiphy-3ph: Fix trivial indentation fault in defines Depeng Shao
2024-07-31 23:16 ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 02/13] media: qcom: camss: csiphy-3ph: Remove redundant PHY init sequence control loop Depeng Shao
2024-07-31 23:27 ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 03/13] media: qcom: camss: csiphy-3ph: Rename struct Depeng Shao
2024-07-31 23:28 ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 04/13] media: qcom: camss: csiphy: Add an init callback to CSI PHY devices Depeng Shao
2024-07-31 23:43 ` Vladimir Zapolskiy
2024-08-01 8:16 ` Bryan O'Donoghue
2024-08-04 21:26 ` Vladimir Zapolskiy
2024-08-07 13:08 ` Depeng Shao
2024-08-07 14:04 ` Bryan O'Donoghue
2024-08-07 15:03 ` Depeng Shao
2024-08-07 15:37 ` Bryan O'Donoghue
2024-08-08 14:02 ` Depeng Shao
2024-08-12 11:32 ` Bryan O'Donoghue
2024-08-12 12:20 ` Depeng Shao
2024-07-09 16:06 ` [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to data field inside csiphy struct Depeng Shao
2024-07-31 23:55 ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to find common control regs Depeng Shao
2024-07-09 16:06 ` [PATCH 07/13] dt-bindings: media: camss: Add qcom,sm8550-camss binding Depeng Shao
2024-07-09 20:21 ` Rob Herring (Arm)
2024-07-10 9:37 ` Bryan O'Donoghue
2024-07-10 10:59 ` Depeng Shao
2024-07-10 11:07 ` Krzysztof Kozlowski
2024-07-11 10:43 ` Depeng Shao
2024-08-01 0:05 ` Vladimir Zapolskiy
2024-08-01 2:02 ` Depeng Shao
2024-07-09 16:06 ` [PATCH 08/13] media: qcom: camss: csiphy-3ph: Add Gen2 v1.2 two-phase MIPI CSI-2 DPHY init Depeng Shao
2024-07-10 11:09 ` Krzysztof Kozlowski
2024-07-10 13:14 ` Depeng Shao
2024-07-10 11:13 ` Bryan O'Donoghue
2024-07-10 13:33 ` Depeng Shao
2024-07-09 16:06 ` [PATCH 09/13] media: qcom: camss: Add CSID Gen3 support for SM8550 Depeng Shao
2024-07-10 11:20 ` Krzysztof Kozlowski
2024-07-11 11:08 ` Depeng Shao
2024-07-11 11:12 ` Krzysztof Kozlowski
2024-07-11 11:41 ` Depeng Shao
2024-07-11 12:00 ` Bryan O'Donoghue
2024-07-11 12:14 ` Depeng Shao
2024-07-11 12:17 ` Krzysztof Kozlowski
2024-07-31 15:26 ` Depeng Shao
2024-07-31 16:12 ` Bryan O'Donoghue
2024-08-01 1:53 ` Depeng Shao
2024-08-01 10:59 ` Bryan O'Donoghue
2024-08-01 11:14 ` Bryan O'Donoghue
2024-08-01 13:49 ` Depeng Shao
2024-07-10 11:28 ` Bryan O'Donoghue
2024-07-11 15:33 ` Depeng Shao
2024-08-07 15:10 ` Depeng Shao
2024-07-09 16:06 ` [PATCH 10/13] media: qcom: camss: Add support for VFE hardware version Titan 780 Depeng Shao
2024-07-10 11:22 ` Krzysztof Kozlowski
2024-07-10 11:47 ` Bryan O'Donoghue
2024-07-11 13:29 ` Depeng Shao
2024-07-09 16:06 ` [PATCH 11/13] media: qcom: camss: Add notify interface in camss driver Depeng Shao
2024-07-10 11:54 ` Bryan O'Donoghue
2024-07-11 11:54 ` Depeng Shao [this message]
2024-07-09 16:06 ` [PATCH 12/13] media: qcom: camss: Add sm8550 support Depeng Shao
2024-07-10 12:02 ` Bryan O'Donoghue
2024-07-11 14:36 ` Depeng Shao
2024-07-09 16:06 ` [PATCH 13/13] media: qcom: camss: Add sm8550 resources Depeng Shao
2024-07-10 11:08 ` [PATCH V3 00/13] media: qcom: camss: Add sm8550 support Krzysztof Kozlowski
2024-07-10 11:27 ` Depeng Shao
2024-07-10 12:30 ` Krzysztof Kozlowski
2024-07-11 11:14 ` Depeng Shao
2024-08-24 17:05 ` Bryan O'Donoghue
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=0e5f029b-ee63-4e44-a75e-877fbae042b3@quicinc.com \
--to=quic_depengs@quicinc.com \
--cc=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_eberman@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