From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Jai Luthra <jai.luthra@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Alexander Shiyan <eagle.alexander923@gmail.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: [PATCH v5 05/16] media: sony-starvis2: Rework 2 lane support for higher link freqs
Date: Mon, 19 Oct 2026 15:28:12 +0100 [thread overview]
Message-ID: <20261019-media-starvis2-v5-5-eef935347ce9@raspberrypi.com> (raw)
In-Reply-To: <20261019-media-starvis2-v5-0-eef935347ce9@raspberrypi.com>
With some Starvis 2 sensors, the link frequency on 2 lanes is sufficient
to achieve a lower line time than the 4 lane value divided by 2, as
the 4 lane value hits the minimum that the pixel array can handle.
That can't easily be handled with the way the values are currently stored.
Storing the 2 lane hmax alongside the pixel array's minimum allows the
4 lane support to divide the value by 2, and then clip to the pixel
array value as a minimum.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/sony-starvis2.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index eb7662c43989..b0b1716a86e2 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -176,15 +176,15 @@ static const u64 link_freqs[] = {
[STARVIS2_LINK_FREQ_1188MHZ] = 1188000000,
};
-static const u16 imx678_min_hmax_4lane[] = {
- [STARVIS2_LINK_FREQ_297MHZ] = 1584,
- [STARVIS2_LINK_FREQ_360MHZ] = 1320,
- [STARVIS2_LINK_FREQ_445MHZ] = 1100,
- [STARVIS2_LINK_FREQ_594MHZ] = 792,
- [STARVIS2_LINK_FREQ_720MHZ] = 660,
- [STARVIS2_LINK_FREQ_891MHZ] = 550,
- [STARVIS2_LINK_FREQ_1039MHZ] = 550,
- [STARVIS2_LINK_FREQ_1188MHZ] = 550,
+static const u16 imx678_min_hmax_2lane[] = {
+ [STARVIS2_LINK_FREQ_297MHZ] = 3168,
+ [STARVIS2_LINK_FREQ_360MHZ] = 2640,
+ [STARVIS2_LINK_FREQ_445MHZ] = 2200,
+ [STARVIS2_LINK_FREQ_594MHZ] = 1584,
+ [STARVIS2_LINK_FREQ_720MHZ] = 1320,
+ [STARVIS2_LINK_FREQ_891MHZ] = 1100,
+ [STARVIS2_LINK_FREQ_1039MHZ] = 1100,
+ [STARVIS2_LINK_FREQ_1188MHZ] = 1100,
};
struct starvis2_inck_cfg {
@@ -631,7 +631,8 @@ struct starvis2_variant {
const struct cci_reg_sequence *common_regs;
unsigned int num_common_regs;
unsigned int vmax_default;
- const u16 *hmax_min;
+ const u16 *hmax_min_link_freq;
+ u16 hmax_min_pixel_array;
};
static const struct starvis2_variant imx678_variant_def = {
@@ -656,7 +657,8 @@ static const struct starvis2_variant imx678_variant_def = {
.common_regs = imx678_common_regs,
.num_common_regs = ARRAY_SIZE(imx678_common_regs),
.vmax_default = 2250,
- .hmax_min = imx678_min_hmax_4lane,
+ .hmax_min_link_freq = imx678_min_hmax_2lane,
+ .hmax_min_pixel_array = 550,
};
struct starvis2_model_info {
@@ -1204,11 +1206,8 @@ static const struct v4l2_subdev_internal_ops starvis2_internal_ops = {
static int starvis2_init_controls(struct starvis2 *starvis2)
{
struct v4l2_ctrl_handler *ctrl_hdlr;
- const u32 hmax_4lane =
- starvis2->variant->hmax_min[__fls(starvis2->link_freq_bitmap)];
- const u32 lane_scale =
- starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
+ const struct starvis2_variant *variant = starvis2->variant;
struct v4l2_fwnode_device_properties props;
struct v4l2_ctrl *link_freq;
s32 hblank, max_hblank, vblank, max_vblank;
@@ -1225,7 +1224,10 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
return ret;
starvis2->vmax = starvis2->variant->vmax_default;
- hmax = hmax_4lane * lane_scale;
+
+ hmax = variant->hmax_min_link_freq[__fls(starvis2->link_freq_bitmap)];
+ if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+ hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
/* PIXEL_RATE is fixed and read-only */
v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
--
2.34.1
next prev parent reply other threads:[~2026-10-19 14:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 14:28 [PATCH v5 00/16] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 01/16] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 02/16] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 03/16] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 04/16] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
2026-10-19 14:28 ` Dave Stevenson [this message]
2026-10-19 14:28 ` [PATCH v5 06/16] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 07/16] media: sony-starvis2: Correct the exposure range Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 08/16] media: sony-starvis2: Put module into standby after identify Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 09/16] media: sony-starvis2: Use pm_runtime_autosuspend Dave Stevenson
2026-10-19 16:07 ` sashiko-bot
2026-10-19 14:28 ` [PATCH v5 10/16] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 11/16] media: sony-starvis2: Add support for IMX662 Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 12/16] media: sony-starvis2: Add support for IMX675 Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 13/16] media: sony-starvis2: Add support for IMX832 Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 14/16] media: sony-starvis2: Only update bits for window mode Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 15/16] media: sony-starvis2: Parameterise exposure min and step Dave Stevenson
2026-10-19 14:28 ` [PATCH v5 16/16] media: sony-starvis2: Add support for IMX585 Dave Stevenson
2026-10-19 16:23 ` sashiko-bot
2026-10-20 10:21 ` [PATCH v5 00/16] Update imx678 to act as a common Sony Starvis 2 driver Sakari Ailus
2026-10-22 10:56 ` [PATCH 1/2] dt-bindings: media: i2c: imx678: Add IMX676 (Starvis 2) Jai Luthra
2026-10-22 10:56 ` [PATCH 2/2] media: sony-starvis2: Add support for IMX676 Jai Luthra
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=20261019-media-starvis2-v5-5-eef935347ce9@raspberrypi.com \
--to=dave.stevenson@raspberrypi.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=eagle.alexander923@gmail.com \
--cc=jai.luthra@ideasonboard.com \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.