mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gianluca Boiano <morf3089@gmail.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	 Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	 Loic Poulain <loic.poulain@oss.qualcomm.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Hans Verkuil <hverkuil@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org,
	 David Heidelberg <david@ixit.cz>,
	Gianluca Boiano <morf3089@gmail.com>
Subject: [PATCH 2/5] media: qcom: camss: Look up link frequency from the sub-device on the CSI-2 link
Date: Mon, 23 Nov 2026 21:33:54 +0100	[thread overview]
Message-ID: <20261123-b4-ccs-imx376-v1-2-2b26850a6f11@gmail.com> (raw)
In-Reply-To: <20261123-b4-ccs-imx376-v1-0-2b26850a6f11@gmail.com>

camss_find_sensor_pad() returns the pad of the first sub-device found
upstream of the CSIPHY that has the MEDIA_ENT_F_CAM_SENSOR function. This
is the pixel array for a sensor that consists of several sub-devices, such
as a MIPI CCS one, and the link frequency and the pixel rate are then
looked up from the controls of the pixel array.

The pixel array does not have a link frequency control, and the pixel rate
it has is the rate at which pixels are read out from the array, not the
one on the CSI-2 bus. The link frequency used for the CSIPHY clock and
the settle count and the pixel clock used for the VFE clock rate are then
derived from the wrong rate. On Sony IMX376 that is 800 MHz instead of
400 MHz at a 500 MHz link frequency, and the kernel warns:

  v4l2_get_link_freq_ctrl: Link frequency estimated using pixel rate:
  result might be inaccurate

The controls describing the CSI-2 bus (V4L2_CID_LINK_FREQ and the CSI-2
V4L2_CID_PIXEL_RATE) are those of the sub-device that transmits on the
bus, i.e. the one that CAMSS has bound. Return the pad of that sub-device
instead, as the other CSI-2 receiver drivers do.

For a sensor consisting of a single sub-device the result is the same.

Signed-off-by: Gianluca Boiano <morf3089@gmail.com>
---
 drivers/media/platform/qcom/camss/camss.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index c54185c93a8a..cf86bf04dfe7 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -4513,6 +4513,10 @@ void camss_disable_clocks(int nclocks, struct camss_clock *clock)
  * camss_find_sensor_pad - Find the media pad via which the sensor is linked
  * @entity: Media entity to start searching from
  *
+ * The sensor pad is the source pad of the sub-device bound to CAMSS, i.e. the
+ * one that transmits on the CSI-2 bus. For a sensor made of several sub-devices
+ * this is not necessarily the pad of the pixel array.
+ *
  * Return a pointer to sensor media pad or NULL if not found
  */
 struct media_pad *camss_find_sensor_pad(struct media_entity *entity)
@@ -4530,7 +4534,7 @@ struct media_pad *camss_find_sensor_pad(struct media_entity *entity)
 
 		entity = pad->entity;
 
-		if (entity->function == MEDIA_ENT_F_CAM_SENSOR)
+		if (v4l2_get_subdev_hostdata(media_entity_to_v4l2_subdev(entity)))
 			return pad;
 	}
 }

-- 
2.56.1


  parent reply	other threads:[~2026-11-23 20:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 20:33 [PATCH 0/5] media: qcom: camss, ccs: Sony IMX376 on SDM660 using the MIPI CCS driver Gianluca Boiano
2026-11-23 20:33 ` [PATCH 1/5] media: qcom: camss: Don't stream sub-devices upstream of the sensor Gianluca Boiano
2026-11-23 20:33 ` Gianluca Boiano [this message]
2026-11-23 20:33 ` [PATCH 3/5] media: ccs: Store the format set on a sink pad Gianluca Boiano
2026-11-23 20:33 ` [PATCH 4/5] media: ccs: Make the source pad format follow the crop rectangle Gianluca Boiano
2026-11-23 20:33 ` [PATCH 5/5] media: ccs: Apply rule-based manufacturer register blocks at stream start Gianluca Boiano

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=20261123-b4-ccs-imx376-v1-2-2b26850a6f11@gmail.com \
    --to=morf3089@gmail.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=david@ixit.cz \
    --cc=hverkuil@kernel.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=phone-devel@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --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®