From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Wenmeng Liu <quic_wenmliu@quicinc.com>,
Robert Foss <rfoss@kernel.org>, Todor Tomov <todor.too@gmail.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 1/3] media: qcom: camss: Add support for TPG common
Date: Thu, 17 Jul 2025 14:43:57 +0200 [thread overview]
Message-ID: <449ac3c3-1f6a-4e69-899d-c4e4577714a4@oss.qualcomm.com> (raw)
In-Reply-To: <20250717-lemans_tpg-v2-1-a2538659349c@quicinc.com>
On 7/17/25 5:20 AM, Wenmeng Liu wrote:
> Add support for TPG common, unlike CSID TPG, this TPG can
> be seen as a combination of CSIPHY and sensor.
>
> Signed-off-by: Wenmeng Liu <quic_wenmliu@quicinc.com>
> ---
[...]
> +++ b/drivers/media/platform/qcom/camss/camss-tpg.c
> @@ -0,0 +1,737 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * camss-tpg.c
I think the filename is redundant, especially since it may change in
the future
[...]
> +const struct tpg_format_info *tpg_get_fmt_entry(const struct tpg_format_info *formats,
> + unsigned int nformats,
> + u32 code)
> +{
> + unsigned int i;
https://staticthinking.wordpress.com/2022/06/01/unsigned-int-i-is-stupid/
> +
> + for (i = 0; i < nformats; i++)
> + if (code == formats[i].code)
> + return &formats[i];
> +
> + WARN(1, "Unknown format\n");
> +
> + return &formats[0];
Err.. that doesn't seem right, neither WARN (which usually signifies
some sort of a critical condition or hw failure), nor returning a format
different to the one the user requested
We should probably return some kind of -EOPNOTSUPP
> +}
> +
> +/*
> + * tpg_set_clock_rates - Calculate and set clock rates on tpg module
> + * @tpg: tpg device
> + */
> +static int tpg_set_clock_rates(struct tpg_device *tpg)
> +{
> + struct device *dev = tpg->camss->dev;
> + int i, j;
> + int ret;
> +
> + for (i = 0; i < tpg->nclocks; i++) {
> + struct camss_clock *clock = &tpg->clock[i];
> + u64 min_rate = 0;
> + long round_rate;
> +
> + camss_add_clock_margin(&min_rate);
> +
> + for (j = 0; j < clock->nfreqs; j++)
> + if (min_rate < clock->freq[j])
> + break;
> +
> + if (j == clock->nfreqs) {
> + dev_err(dev,
> + "clock is too high for TPG\n");
I really insist you don't have to break this line
It would probably be useful to print the rates (the one that's too
high and the maximum)
> + return -EINVAL;
> + }
> +
> + /* if clock is not available */
> + /* set highest possible tpg clock rate */
> + if (min_rate == 0)
> + j = clock->nfreqs - 1;
Well, you never assign anything nonzero to min_rate..
[...]
> +static void tpg_try_format(struct tpg_device *tpg,
> + struct v4l2_subdev_state *sd_state,
> + unsigned int pad,
> + struct v4l2_mbus_framefmt *fmt,
> + enum v4l2_subdev_format_whence which)
> +{
> + unsigned int i;
> +
> + switch (pad) {
> + case MSM_TPG_PAD_SINK:
> + /* Test generator is enabled, set format on source */
> + /* pad to allow test generator usage */
This is a very strange way to write multiline comments
[...]
> + /* Memory */
> + tpg->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
> + if (IS_ERR(tpg->base))
> + return PTR_ERR(tpg->base);
> +
> + /* Interrupt */
> + ret = platform_get_irq_byname(pdev, res->interrupt[0]);
> + if (ret < 0)
> + return ret;
The comments are unnecessary
Konrad
next prev parent reply other threads:[~2025-07-17 12:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 3:20 [PATCH v2 0/3] media: qcom: camss: Add sa8775p camss TPG support Wenmeng Liu
2025-07-17 3:20 ` [PATCH v2 1/3] media: qcom: camss: Add support for TPG common Wenmeng Liu
2025-07-17 12:42 ` Bryan O'Donoghue
2025-08-15 8:52 ` Wenmeng Liu
2025-08-15 12:12 ` Bryan O'Donoghue
2025-07-17 12:43 ` Konrad Dybcio [this message]
2025-07-17 3:20 ` [PATCH v2 2/3] media: qcom: camss: Add link " Wenmeng Liu
2025-07-17 12:52 ` Konrad Dybcio
2025-07-17 12:56 ` Bryan O'Donoghue
2025-07-17 3:20 ` [PATCH v2 3/3] media: qcom: camss: tpg: Add TPG support for SA8775P Wenmeng Liu
2025-07-17 12:54 ` Konrad Dybcio
2025-07-17 12:59 ` Bryan O'Donoghue
2025-07-17 12:34 ` [PATCH v2 0/3] media: qcom: camss: Add sa8775p camss TPG support Konrad Dybcio
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=449ac3c3-1f6a-4e69-899d-c4e4577714a4@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=bryan.odonoghue@linaro.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_wenmliu@quicinc.com \
--cc=rfoss@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
all inboxes | Powered by JetHome®