mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hermes Wu via B4 Relay <devnull+Hermes.wu.ite.com.tw@kernel.org>
To: Hermes Wu <Hermes.Wu@ite.com.tw>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Hans Verkuil <hverkuil+cisco@kernel.org>,
	 Hans Verkuil <hverkuil@kernel.org>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	linux-sound@vger.kernel.org,  linux-api@vger.kernel.org,
	Hermes Wu <Hermes.wu@ite.com.tw>
Subject: [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls
Date: Tue, 24 Nov 2026 11:04:40 +0800	[thread overview]
Message-ID: <20261124-upstream-it6625-alsa-i2s-v2-3-a154685f6989@ite.com.tw> (raw)
In-Reply-To: <20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw>

From: Hermes Wu <Hermes.wu@ite.com.tw>

The driver reports the HDMI audio sampling rate and whether audio is
present through its custom controls TC358743_CID_AUDIO_SAMPLING_RATE and
TC358743_CID_AUDIO_PRESENT. There are now standard controls for both:
V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE and V4L2_CID_DV_RX_AUDIO_PRESENT.

Add the standard controls and set them together with the custom ones,
from the same values. The custom controls are kept, since userspace may
already use them.
---
 drivers/media/i2c/tc358743.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index d9cd0563d50b62e90387397210e80a8b10f0988f..873fc22d030a3cc87c79e35eb57579eba902432f 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -95,6 +95,8 @@ struct tc358743_state {
 	struct v4l2_ctrl *detect_tx_5v_ctrl;
 	struct v4l2_ctrl *audio_sampling_rate_ctrl;
 	struct v4l2_ctrl *audio_present_ctrl;
+	struct v4l2_ctrl *audio_sampling_rate_std_ctrl;
+	struct v4l2_ctrl *audio_present_std_ctrl;
 
 	struct delayed_work delayed_work_enable_hotplug;
 
@@ -589,17 +591,27 @@ static int tc358743_s_ctrl_detect_tx_5v(struct v4l2_subdev *sd)
 static int tc358743_s_ctrl_audio_sampling_rate(struct v4l2_subdev *sd)
 {
 	struct tc358743_state *state = to_state(sd);
+	int rate = get_audio_sampling_rate(sd);
+	int ret;
 
-	return v4l2_ctrl_s_ctrl(state->audio_sampling_rate_ctrl,
-			get_audio_sampling_rate(sd));
+	ret = v4l2_ctrl_s_ctrl(state->audio_sampling_rate_ctrl, rate);
+	if (ret)
+		return ret;
+
+	return v4l2_ctrl_s_ctrl(state->audio_sampling_rate_std_ctrl, rate);
 }
 
 static int tc358743_s_ctrl_audio_present(struct v4l2_subdev *sd)
 {
 	struct tc358743_state *state = to_state(sd);
+	bool present = audio_present(sd);
+	int ret;
 
-	return v4l2_ctrl_s_ctrl(state->audio_present_ctrl,
-			audio_present(sd));
+	ret = v4l2_ctrl_s_ctrl(state->audio_present_ctrl, present);
+	if (ret)
+		return ret;
+
+	return v4l2_ctrl_s_ctrl(state->audio_present_std_ctrl, present);
 }
 
 static int tc358743_update_controls(struct v4l2_subdev *sd)
@@ -2217,11 +2229,20 @@ static int tc358743_probe(struct i2c_client *client)
 	}
 
 	/* control handlers */
-	v4l2_ctrl_handler_init(&state->hdl, 3);
+	v4l2_ctrl_handler_init(&state->hdl, 5);
 
 	state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(&state->hdl, NULL,
 			V4L2_CID_DV_RX_POWER_PRESENT, 0, 1, 0, 0);
 
+	state->audio_sampling_rate_std_ctrl =
+		v4l2_ctrl_new_std(&state->hdl, NULL,
+				  V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE,
+				  0, 768000, 1, 0);
+
+	state->audio_present_std_ctrl =
+		v4l2_ctrl_new_std(&state->hdl, NULL,
+				  V4L2_CID_DV_RX_AUDIO_PRESENT, 0, 1, 1, 0);
+
 	/* custom controls */
 	state->audio_sampling_rate_ctrl = v4l2_ctrl_new_custom(&state->hdl,
 			&tc358743_ctrl_audio_sampling_rate, NULL);

-- 
2.34.1



  parent reply	other threads:[~2026-11-24  3:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 1/9] media: v4l2-ctrls: add DV RX audio sampling rate and present controls Hermes Wu via B4 Relay
2026-11-24  4:02   ` Hermes.Wu
2026-11-24  3:04 ` [PATCH v2 2/9] media: v4l2-ctrls: add the DV RX audio type control Hermes Wu via B4 Relay
2026-11-24  4:03   ` Hermes.Wu
2026-11-24  3:04 ` Hermes Wu via B4 Relay [this message]
2026-11-24  4:04   ` [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls Hermes.Wu
2026-11-24  3:04 ` [PATCH v2 4/9] dt-bindings: media: ite,it6625: add audio DAI properties Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 5/9] media: i2c: it6625: decode audio status fields with FIELD_GET() Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 6/9] media: i2c: it6625: add I2S audio capture DAI Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 7/9] media: i2c: it6625: capture compressed and HBR audio, not just LPCM Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 8/9] media: i2c: it6625: use the standard audio rate and present controls Hermes Wu via B4 Relay
2026-11-24  4:04   ` Hermes.Wu
2026-11-24  3:04 ` [PATCH v2 9/9] media: uapi: it6625: remove the driver-specific audio controls Hermes Wu via B4 Relay
2026-11-24  4:04   ` Hermes.Wu

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=20261124-upstream-it6625-alsa-i2s-v2-3-a154685f6989@ite.com.tw \
    --to=devnull+hermes.wu.ite.com.tw@kernel.org \
    --cc=Hermes.Wu@ite.com.tw \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.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®