From: Matthew Laux <matthew.laux@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@kernel.org>,
Mehdi Djait <mehdi.djait@bootlin.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
Matthew Laux <matthew.laux@gmail.com>
Subject: [PATCH v7 04/12] media: tw9900: add saturation, hue and sharpness controls
Date: Fri, 20 Nov 2026 21:55:15 -0600 [thread overview]
Message-ID: <20261121035523.26764-5-matthew.laux@gmail.com> (raw)
In-Reply-To: <20261121035523.26764-1-matthew.laux@gmail.com>
Add additional V4L2 controls for the tw9900 that modify the appropriate
registers for saturation, hue, and sharpness, sourced from the datasheet.
Signed-off-by: Matthew Laux <matthew.laux@gmail.com>
---
drivers/media/i2c/tw9900.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/tw9900.c b/drivers/media/i2c/tw9900.c
index df8c7b1f3450..42fc2afbbc77 100644
--- a/drivers/media/i2c/tw9900.c
+++ b/drivers/media/i2c/tw9900.c
@@ -41,6 +41,11 @@
#define TW9900_REG_CNTRL1 0x0C
#define TW9900_REG_BRIGHT_CTL 0x10
#define TW9900_REG_CONTRAST_CTL 0x11
+#define TW9900_REG_SHARPNESS 0x12
+#define TW9900_REG_SHARPNESS_MASK GENMASK(3, 0)
+#define TW9900_REG_SAT_U 0x13
+#define TW9900_REG_SAT_V 0x14
+#define TW9900_REG_HUE 0x15
#define TW9900_REG_VBI_CNTL 0x19
#define TW9900_REG_ANAL_CTL_II 0x1A
#define TW9900_REG_OUT_CTRL_II 0x1B
@@ -252,6 +257,26 @@ static int tw9900_s_ctrl(struct v4l2_ctrl *ctrl)
ret = tw9900_write_reg(tw9900->client, TW9900_REG_CONTRAST_CTL,
(u8)ctrl->val);
break;
+ case V4L2_CID_SATURATION:
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_SAT_U,
+ (u8)ctrl->val);
+ if (ret)
+ break;
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_SAT_V,
+ (u8)ctrl->val);
+ break;
+ case V4L2_CID_HUE:
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_HUE,
+ (u8)ctrl->val);
+ break;
+ case V4L2_CID_SHARPNESS:
+ ret = tw9900_read_reg(tw9900->client, TW9900_REG_SHARPNESS);
+ if (ret < 0)
+ break;
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_SHARPNESS,
+ (ret & ~TW9900_REG_SHARPNESS_MASK) |
+ ctrl->val);
+ break;
default:
ret = -EINVAL;
break;
@@ -701,7 +726,7 @@ static int tw9900_probe(struct i2c_client *client)
hdl = &tw9900->hdl;
- ret = v4l2_ctrl_handler_init(hdl, 2);
+ ret = v4l2_ctrl_handler_init(hdl, 5);
if (ret)
goto err_destory_mutex;
@@ -711,6 +736,12 @@ static int tw9900_probe(struct i2c_client *client)
-128, 127, 1, 0);
v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_CONTRAST,
0, 255, 1, 0x60);
+ v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_SATURATION,
+ 0, 255, 1, 0x80);
+ v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_HUE,
+ -128, 127, 1, 0);
+ v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_SHARPNESS,
+ 0, 15, 1, 1);
tw9900->subdev.ctrl_handler = hdl;
if (hdl->error) {
--
2.47.3
next prev parent reply other threads:[~2026-11-21 3:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 3:55 [PATCH v7 00/12] Add driver for StarTech USB3HDCAP capture device Matthew Laux
2026-11-21 3:55 ` [PATCH v7 01/12] media: tw9900: Disable regulator on runtime resume failure Matthew Laux
2026-11-21 3:55 ` [PATCH v7 02/12] media: tw9900: release the device when stopping the stream fails Matthew Laux
2026-11-21 3:55 ` [PATCH v7 03/12] media: tw9900: accept the TW9910 chip ID Matthew Laux
2026-11-21 3:55 ` Matthew Laux [this message]
2026-11-21 3:55 ` [PATCH v7 05/12] media: tw9900: program all mode registers in the PAL table Matthew Laux
2026-11-21 3:55 ` [PATCH v7 06/12] media: tw9900: power off the device on remove if still active Matthew Laux
2026-11-21 3:55 ` [PATCH v7 07/12] media: tw9900: power down analog blocks in runtime suspend Matthew Laux
2026-11-21 3:55 ` [PATCH v7 08/12] media: tw9900: use runtime PM autosuspend Matthew Laux
2026-11-21 3:55 ` [PATCH v7 09/12] media: tw9900: allow board-specific register tables via platform data Matthew Laux
2026-11-21 3:55 ` [PATCH v7 10/12] media: tw9900: add S-Video input and progressive source detection Matthew Laux
2026-11-25 14:38 ` Markus Elfring
2026-11-25 19:47 ` Matthew Laux
2026-11-21 3:55 ` [PATCH v7 11/12] media: Add subdevice driver for the Mstar MST3367 HDMI receiver Matthew Laux
2026-11-25 13:17 ` Hans Verkuil
2026-11-25 19:33 ` Matthew Laux
2026-11-21 3:55 ` [PATCH v7 12/12] media: add driver for StarTech USB3HDCAP Matthew Laux
2026-11-25 13:39 ` Hans Verkuil
2026-11-25 19:45 ` Matthew Laux
2026-11-25 13:41 ` [PATCH v7 00/12] Add driver for StarTech USB3HDCAP capture device Hans Verkuil
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=20261121035523.26764-5-matthew.laux@gmail.com \
--to=matthew.laux@gmail.com \
--cc=hverkuil@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@bootlin.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.