From: Tarang Raval <tarang.raval@siliconsignals.io>
To: sakari.ailus@linux.intel.com
Cc: mehdi.djait@linux.intel.com,
Tarang Raval <tarang.raval@siliconsignals.io>,
Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>,
Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 06/13] media: i2c: os05b10: Add test pattern options
Date: Fri, 6 Mar 2026 18:02:56 +0530 [thread overview]
Message-ID: <20260306123304.76722-7-tarang.raval@siliconsignals.io> (raw)
In-Reply-To: <20260306123304.76722-1-tarang.raval@siliconsignals.io>
Add V4L2_CID_TEST_PATTERN support with multiple sensor test-pattern modes
and program them via register 0x5080. Drop the fixed 0x5080 setting from the
common register sequence so the pattern is selected only through the control.
Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
---
drivers/media/i2c/os05b10.c | 55 +++++++++++++++++++++++++++++++++++--
1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c
index 009097a00eff..fbc191e1d505 100644
--- a/drivers/media/i2c/os05b10.c
+++ b/drivers/media/i2c/os05b10.c
@@ -103,6 +103,17 @@
#define OS05B10_REG_FORMAT2 CCI_REG8(0x3821)
#define OS05B10_HDR_ENABLE 0x04
+#define OS05B10_REG_PRE_ISP_20_0 CCI_REG8(0x5080)
+#define OS05B10_DISABLED 0x00
+#define OS05B10_COLOR_BAR_1 0x80
+#define OS05B10_COLOR_BAR_2 0x84
+#define OS05B10_COLOR_BAR_3 0x88
+#define OS05B10_COLOR_BAR_4 0x8c
+#define OS05B10_COLOR_SQUARE 0x82
+#define OS05B10_BW_SQUARE 0x92
+#define OS05B10_TRANSPARENT_EFFECT 0xa0
+#define OS05B10_ROLLING_BAR_EFFECT 0xc0
+
#define OS05B10_LINK_FREQ_600MHZ (600 * HZ_PER_MHZ)
static const struct v4l2_rect os05b10_native_area = {
@@ -396,7 +407,6 @@ static const struct cci_reg_sequence os05b10_common_regs[] = {
{ CCI_REG8(0x5004), 0x00 },
{ CCI_REG8(0x5005), 0x0e },
{ CCI_REG8(0x5036), 0x00 },
- { CCI_REG8(0x5080), 0x04 },
{ CCI_REG8(0x5082), 0x00 },
{ CCI_REG8(0x5180), 0x00 },
{ CCI_REG8(0x5181), 0x10 },
@@ -514,6 +524,30 @@ static const u32 os05b10_mbus_codes[] = {
MEDIA_BUS_FMT_SBGGR10_1X10,
};
+static const char * const os05b10_test_pattern_menu[] = {
+ "Disabled",
+ "colour bar type 1",
+ "colour bar type 2",
+ "colour bar type 3",
+ "colour bar type 4",
+ "color square",
+ "black-white square",
+ "transparent effect",
+ "rolling bar effect",
+};
+
+static const int os05b10_tp_val[] = {
+ OS05B10_DISABLED,
+ OS05B10_COLOR_BAR_1,
+ OS05B10_COLOR_BAR_2,
+ OS05B10_COLOR_BAR_3,
+ OS05B10_COLOR_BAR_4,
+ OS05B10_COLOR_SQUARE,
+ OS05B10_BW_SQUARE,
+ OS05B10_TRANSPARENT_EFFECT,
+ OS05B10_ROLLING_BAR_EFFECT,
+};
+
static inline struct os05b10 *to_os05b10(struct v4l2_subdev *sd)
{
return container_of_const(sd, struct os05b10, sd);
@@ -531,6 +565,15 @@ static u32 os05b10_get_format_code(struct os05b10 *os05b10)
return code;
}
+static int os05b10_update_test_pattern(struct os05b10 *os05b10, u32 pattern)
+{
+ if (pattern >= ARRAY_SIZE(os05b10_test_pattern_menu))
+ return -EINVAL;
+
+ return cci_write(os05b10->cci, OS05B10_REG_PRE_ISP_20_0,
+ os05b10_tp_val[pattern], NULL);
+}
+
static int os05b10_set_ctrl(struct v4l2_ctrl *ctrl)
{
struct os05b10 *os05b10 = container_of_const(ctrl->handler,
@@ -588,6 +631,9 @@ static int os05b10_set_ctrl(struct v4l2_ctrl *ctrl)
OS05B10_FLIP_ENABLE : OS05B10_FLIP_DISABLE,
NULL);
break;
+ case V4L2_CID_TEST_PATTERN:
+ ret = os05b10_update_test_pattern(os05b10, ctrl->val);
+ break;
default:
ret = -EINVAL;
break;
@@ -969,7 +1015,7 @@ static int os05b10_init_controls(struct os05b10 *os05b10)
int ret;
ctrl_hdlr = &os05b10->handler;
- v4l2_ctrl_handler_init(ctrl_hdlr, 11);
+ v4l2_ctrl_handler_init(ctrl_hdlr, 12);
pixel_rate = os05b10_pixel_rate(os05b10, mode);
v4l2_ctrl_new_std(ctrl_hdlr, &os05b10_ctrl_ops, V4L2_CID_PIXEL_RATE,
@@ -1025,6 +1071,11 @@ static int os05b10_init_controls(struct os05b10 *os05b10)
if (os05b10->vflip)
os05b10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
+ v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &os05b10_ctrl_ops,
+ V4L2_CID_TEST_PATTERN,
+ ARRAY_SIZE(os05b10_test_pattern_menu) - 1,
+ 0, 0, os05b10_test_pattern_menu);
+
if (ctrl_hdlr->error) {
ret = ctrl_hdlr->error;
dev_err(os05b10->dev, "control init failed (%d)\n", ret);
--
2.34.1
next prev parent reply other threads:[~2026-03-06 12:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 12:32 [PATCH 00/13] media: i2c: os05b10: Refactor driver and Add new features Tarang Raval
2026-03-06 12:32 ` [PATCH 01/13] media: i2c: os05b10: drop unused group-hold programming Tarang Raval
2026-03-06 12:32 ` [PATCH 02/13] media: i2c: os05b10: add register definitions and use them in init table Tarang Raval
2026-03-06 12:32 ` [PATCH 03/13] media: i2c: os05b10: split common and mode-specific init registers Tarang Raval
2026-03-06 12:32 ` [PATCH 04/13] media: i2c: os05b10: add V4L2 digital gain control Tarang Raval
2026-03-06 12:32 ` [PATCH 05/13] media: i2c: os05b10: Add H/V flip support Tarang Raval
2026-03-06 12:32 ` Tarang Raval [this message]
2026-03-06 12:32 ` [PATCH 07/13] media: i2c: os05b10: add 12-bit RAW mode support Tarang Raval
2026-03-06 12:32 ` [PATCH 08/13] media: i2c: os05b10: update pixel rate on 10/12-bit mode switch Tarang Raval
2026-03-06 12:32 ` [PATCH 09/13] media: i2c: os05b10: Add 1080p and 2x2 binning 720p modes Tarang Raval
2026-03-06 12:33 ` [PATCH 10/13] media: i2c: os05b10: keep vblank/exposure in sync on mode switch Tarang Raval
2026-03-06 13:35 ` Sakari Ailus
2026-03-07 5:28 ` Tarang Raval
2026-03-06 12:33 ` [PATCH 11/13] media: i2c: os05b10: Update active format before adjusting framing controls Tarang Raval
2026-03-06 13:36 ` Sakari Ailus
2026-03-07 5:22 ` Tarang Raval
2026-03-09 8:19 ` Tarang Raval
2026-03-24 16:31 ` Tarang Raval
2026-03-25 8:56 ` sakari.ailus
2026-03-25 9:05 ` Tarang Raval
2026-03-06 12:33 ` [PATCH 12/13] media: i2c: os05b10: Rename vmax variable in VBLANK control Tarang Raval
2026-03-06 12:33 ` [PATCH 13/13] media: i2c: os05b10: add 2-lane support Tarang Raval
2026-03-07 1:56 ` kernel test robot
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=20260306123304.76722-7-tarang.raval@siliconsignals.io \
--to=tarang.raval@siliconsignals.io \
--cc=elgin.perumbilly@siliconsignals.io \
--cc=himanshu.bhavani@siliconsignals.io \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@linux.intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox