mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 3/6] media: qcom: camss: csid-340: Report the hardware SOF timestamp
Date: Tue, 24 Nov 2026 12:35:56 +0000	[thread overview]
Message-ID: <57fed113-9f79-41d3-96d8-725be5e58918@linaro.org> (raw)
In-Reply-To: <08b9a714-278b-4e1c-81c8-59a60dba5916@linaro.org>

On 24/11/2026 12:28, Bryan O'Donoghue wrote:
> On 24/11/2026 12:20, Loic Poulain wrote:
>>> On 23/11/2026 17:16, Loic Poulain wrote:
>>>> +static u64 __csid_sof_timestamp(struct csid_device *csid, enum 
>>>> csid_iface iface)
>>>> +{
>>>> +     u32 lo, hi;
>>>> +
>>>> +     /*
>>>> +      * The pair is latched on SOF rather than counting, so it can 
>>>> be read
>>>> +      * one word at a time without tearing.
>>>> +      */
>>>> +     lo = readl_relaxed(csid->base + CSID_TIMESTAMP_CURR0_SOF(iface));
>>>> +     hi = readl_relaxed(csid->base + CSID_TIMESTAMP_CURR1_SOF(iface));
>>>> +
>>>> +     return csid_timestamp_to_monotonic(csid, ((u64)hi << 32) | lo);
>>>> +}
>>>> +
>>>>    static irqreturn_t csid_isr(int irq, void *dev)
>>>>    {
>>>>        struct csid_device *csid = dev;
>>>> @@ -207,7 +234,7 @@ static irqreturn_t csid_isr(int irq, void *dev)
>>>>                iface_val |= status;
>>>>
>>>>                if (status & CSID_IFACE_IRQ_INFO_INPUT_SOF)
>>>> -                     csid_sof_event(csid, i, 0);
>>>> +                     csid_sof_event(csid, i, 
>>>> __csid_sof_timestamp(csid, iface));
>>>>        }
>>> I think a callback in csid_sof_event() might be cleaner or some other
>>> way to not have to replicate all of __csid_sof_timestamp() for each CSI
>>> decoder.
>> I added it as a parameter because it is provided in much the same way
>> as the sequence number, given that the timestamp is directly related
>> to and coupled with it. So it is not clearly obvious why the sequence
>> number should be passed as a parameter while the timestamp should not.
> 
> But pretty much every hardware implementation will have to do the above 
> function. I'm asking for more functional decomposition.
> 
> You could pass the hi/lo for example and make the sof_timestamp() 
> function common - called once from inside of csid_sof_event()
> 
> ---
> bod

Anyway yeah csid_sof_event() increments the seq_no itself so you could 
just have a ts = csid->get_sof_ts(csid, ...); and functionally decompose 
without passing hi/lo down the callstack too.

Either option really.

---
bod

  reply	other threads:[~2026-11-24 12:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:16 [PATCH 0/6] media: qcom: camss: " Loic Poulain
2026-11-23 17:16 ` [PATCH 1/6] media: v4l2-event: Allow drivers to provide the event timestamp Loic Poulain
2026-11-23 17:16 ` [PATCH 2/6] media: qcom: camss: csid: Pass the SOF time to csid_sof_event() Loic Poulain
2026-11-24  9:56   ` Bryan O'Donoghue
2026-11-23 17:16 ` [PATCH 3/6] media: qcom: camss: csid-340: Report the hardware SOF timestamp Loic Poulain
2026-11-24  9:57   ` Bryan O'Donoghue
2026-11-24 12:20     ` Loic Poulain
2026-11-24 12:28       ` Bryan O'Donoghue
2026-11-24 12:35         ` Bryan O'Donoghue [this message]
2026-11-23 17:16 ` [PATCH 4/6] media: camss: Define timestamp registers for csid-gen2 Loic Poulain
2026-11-23 17:16 ` [PATCH 5/6] media: camss: csid-gen2: Report the hardware SOF timestamp Loic Poulain
2026-11-23 17:16 ` [PATCH 6/6] media: qcom: camss: Timestamp buffers at start of frame Loic Poulain
2026-11-24  9:59 ` [PATCH 0/6] media: qcom: camss: Report the hardware SOF timestamp Bryan O'Donoghue
2026-11-24 10:21   ` Loic Poulain
2026-11-24 10:24     ` Loic Poulain
2026-11-24 11:47     ` 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=57fed113-9f79-41d3-96d8-725be5e58918@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mchehab@kernel.org \
    --cc=vladimir.zapolskiy@linaro.org \
    /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

all inboxes | Powered by JetHome®