* [PATCH v2 1/9] media: v4l2-ctrls: add DV RX audio sampling rate and present controls
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 ` Hermes Wu via B4 Relay
2026-11-24 3:09 ` sashiko-bot
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
` (7 subsequent siblings)
8 siblings, 2 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
HDMI and DisplayPort receivers can report whether the source sends audio
and at which sampling rate. Drivers expose this today through
driver-specific controls (tc358743 and IT6625 each define their own pair),
so userspace has to know every driver to find it.
Add two standard read-only controls to the DV control class:
V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE, the sampling rate in Hz, 0 when no
audio is received or the rate is not known, and
V4L2_CID_DV_RX_AUDIO_PRESENT, whether audio is received. Drivers set
the range of the sampling rate control.
---
Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst | 10 ++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 5 +++++
include/uapi/linux/v4l2-controls.h | 2 ++
3 files changed, 17 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst
index 5918dde83efb324cd27cc4c771245cd2c38d0b0e..a9117912e9cb255a2ce452147858d927e9e3c27a 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst
@@ -158,3 +158,13 @@ enum v4l2_dv_it_content_type -
from a computer as opposed to content from a TV broadcast or an
analog source. See ``V4L2_CID_DV_TX_IT_CONTENT_TYPE`` for the
available content types.
+
+``V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE (integer)``
+ Reads the sampling rate, in Hz, of the audio that the receiver
+ receives from the source. It is 0 if no audio is received, or if the
+ receiver cannot determine the sampling rate. This read-only control
+ is applicable to HDMI and DisplayPort connectors.
+
+``V4L2_CID_DV_RX_AUDIO_PRESENT (boolean)``
+ Detects whether the receiver receives audio from the source. This
+ read-only control is applicable to HDMI and DisplayPort connectors.
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index e062f2088490470c42d6c579ff7675be454a29b0..579b2d297cc8246dddb4e8d4ab74aed1e6084744 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -1180,6 +1180,8 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_DV_RX_POWER_PRESENT: return "Power Present";
case V4L2_CID_DV_RX_RGB_RANGE: return "Rx RGB Quantization Range";
case V4L2_CID_DV_RX_IT_CONTENT_TYPE: return "Rx IT Content Type";
+ case V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE: return "Rx Audio Sampling Rate";
+ case V4L2_CID_DV_RX_AUDIO_PRESENT: return "Rx Audio Present";
case V4L2_CID_FM_RX_CLASS: return "FM Radio Receiver Controls";
case V4L2_CID_TUNE_DEEMPHASIS: return "De-Emphasis";
@@ -1317,6 +1319,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_RDS_RX_TRAFFIC_ANNOUNCEMENT:
case V4L2_CID_RDS_RX_TRAFFIC_PROGRAM:
case V4L2_CID_RDS_RX_MUSIC_SPEECH:
+ case V4L2_CID_DV_RX_AUDIO_PRESENT:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
@@ -1682,6 +1685,8 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_DV_TX_EDID_PRESENT:
case V4L2_CID_DV_RX_POWER_PRESENT:
case V4L2_CID_DV_RX_IT_CONTENT_TYPE:
+ case V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE:
+ case V4L2_CID_DV_RX_AUDIO_PRESENT:
case V4L2_CID_RDS_RX_PTY:
case V4L2_CID_RDS_RX_PS_NAME:
case V4L2_CID_RDS_RX_RADIO_TEXT:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index d17e41d51d2ec1ccb9e8ceb3ccc89ebc4381a4cd..52124b7acdeab787978029aa49ea75d0ad4cc534 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1301,6 +1301,8 @@ enum v4l2_dv_it_content_type {
#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)
#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101)
#define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102)
+#define V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE (V4L2_CID_DV_CLASS_BASE + 103)
+#define V4L2_CID_DV_RX_AUDIO_PRESENT (V4L2_CID_DV_CLASS_BASE + 104)
#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1)
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 1/9] media: v4l2-ctrls: add DV RX audio sampling rate and present controls
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 3:09 ` sashiko-bot
2026-11-24 4:02 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:09 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: v4l2-ctrls: missing Signed-off-by trailer in commit
message
--
commit 4122cfd3e97b7a24c90f98c01731dc4ca9f4a197
Author: Hermes Wu <Hermes.wu@ite.com.tw>
> media: v4l2-ctrls: add DV RX audio sampling rate and present controls
>
> HDMI and DisplayPort receivers can report whether the source sends audio
> and at which sampling rate. Drivers expose this today through
> driver-specific controls (tc358743 and IT6625 each define their own pair),
> so userspace has to know every driver to find it.
>
> Add two standard read-only controls to the DV control class:
> V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE, the sampling rate in Hz, 0 when no
> audio is received or the rate is not known, and
> V4L2_CID_DV_RX_AUDIO_PRESENT, whether audio is received. Drivers set
> the range of the sampling rate control.
[Severity: High]
The commit message is missing a Signed-off-by: trailer from the patch
author, which is required by the Developer's Certificate of Origin before
the patch can be applied.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=1
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH v2 1/9] media: v4l2-ctrls: add DV RX audio sampling rate and present controls
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 3:09 ` sashiko-bot
@ 2026-11-24 4:02 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: Hermes.Wu @ 2026-11-24 4:02 UTC (permalink / raw)
To: Hermes.Wu, mchehab, robh, krzk+dt, conor+dt, hverkuil+cisco,
hverkuil
Cc: linux-media, devicetree, linux-kernel, broonie, lgirdwood,
linux-sound, linux-api
The Signed-off-by is missing from this patch, sorry about that:
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
The next version will carry it in the patch itself.
Best regards,
Hermes
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 2/9] media: v4l2-ctrls: add the DV RX audio type control
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 3:04 ` Hermes Wu via B4 Relay
2026-11-24 3:09 ` sashiko-bot
2026-11-24 4:03 ` Hermes.Wu
2026-11-24 3:04 ` [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls Hermes Wu via B4 Relay
` (6 subsequent siblings)
8 siblings, 2 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
An HDMI or DisplayPort receiver can pass on linear PCM, compressed audio
in IEC 61937 format, high bit rate (HBR) compressed audio, or one bit
(DSD) audio. Userspace capturing that audio needs to know which kind it
is, for example to decide whether the samples can be played as PCM or
must be passed through to a decoder.
Add a standard read-only menu control, V4L2_CID_DV_RX_AUDIO_TYPE, to the
DV control class with these four values. It describes how the audio is
carried, not the codec: the codec of compressed audio is identified by
the IEC 61937 data.
---
.../userspace-api/media/v4l/ext-ctrls-dv.rst | 25 ++++++++++++++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 12 +++++++++++
include/uapi/linux/v4l2-controls.h | 7 ++++++
3 files changed, 44 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst
index a9117912e9cb255a2ce452147858d927e9e3c27a..feddf5dbe18665855f5ef362260e6439606bfc6b 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-dv.rst
@@ -168,3 +168,28 @@ enum v4l2_dv_it_content_type -
``V4L2_CID_DV_RX_AUDIO_PRESENT (boolean)``
Detects whether the receiver receives audio from the source. This
read-only control is applicable to HDMI and DisplayPort connectors.
+
+``V4L2_CID_DV_RX_AUDIO_TYPE``
+ (enum)
+
+enum v4l2_dv_rx_audio_type -
+ Reads how the source sends the audio that the receiver receives. It
+ describes the kind of audio stream, not the codec of compressed
+ audio. The value is only meaningful while
+ ``V4L2_CID_DV_RX_AUDIO_PRESENT`` is set. This read-only control is
+ applicable to HDMI and DisplayPort connectors. Possible values are:
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - ``V4L2_DV_RX_AUDIO_TYPE_LPCM``
+ - Linear PCM audio.
+ * - ``V4L2_DV_RX_AUDIO_TYPE_IEC61937``
+ - Compressed audio carried as IEC 61937 data, for example AC-3 or
+ DTS. The codec is identified by the IEC 61937 data itself.
+ * - ``V4L2_DV_RX_AUDIO_TYPE_HBR``
+ - High bit rate compressed audio, carried as IEC 61937 data in HDMI
+ High Bit Rate audio packets.
+ * - ``V4L2_DV_RX_AUDIO_TYPE_ONE_BIT``
+ - One bit audio (DSD).
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 579b2d297cc8246dddb4e8d4ab74aed1e6084744..05e8e781d964c488f3f8ce941c10b8474609e86f 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -491,6 +491,13 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"No IT Content",
NULL,
};
+ static const char * const dv_rx_audio_type[] = {
+ "LPCM",
+ "IEC 61937",
+ "High Bit Rate",
+ "One Bit",
+ NULL,
+ };
static const char * const detect_md_mode[] = {
"Disabled",
"Global",
@@ -722,6 +729,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
case V4L2_CID_DV_TX_IT_CONTENT_TYPE:
case V4L2_CID_DV_RX_IT_CONTENT_TYPE:
return dv_it_content_type;
+ case V4L2_CID_DV_RX_AUDIO_TYPE:
+ return dv_rx_audio_type;
case V4L2_CID_DETECT_MD_MODE:
return detect_md_mode;
case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
@@ -1182,6 +1191,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_DV_RX_IT_CONTENT_TYPE: return "Rx IT Content Type";
case V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE: return "Rx Audio Sampling Rate";
case V4L2_CID_DV_RX_AUDIO_PRESENT: return "Rx Audio Present";
+ case V4L2_CID_DV_RX_AUDIO_TYPE: return "Rx Audio Type";
case V4L2_CID_FM_RX_CLASS: return "FM Radio Receiver Controls";
case V4L2_CID_TUNE_DEEMPHASIS: return "De-Emphasis";
@@ -1407,6 +1417,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_DV_TX_IT_CONTENT_TYPE:
case V4L2_CID_DV_RX_RGB_RANGE:
case V4L2_CID_DV_RX_IT_CONTENT_TYPE:
+ case V4L2_CID_DV_RX_AUDIO_TYPE:
case V4L2_CID_TEST_PATTERN:
case V4L2_CID_DEINTERLACING_MODE:
case V4L2_CID_TUNE_DEEMPHASIS:
@@ -1687,6 +1698,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
case V4L2_CID_DV_RX_IT_CONTENT_TYPE:
case V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE:
case V4L2_CID_DV_RX_AUDIO_PRESENT:
+ case V4L2_CID_DV_RX_AUDIO_TYPE:
case V4L2_CID_RDS_RX_PTY:
case V4L2_CID_RDS_RX_PS_NAME:
case V4L2_CID_RDS_RX_RADIO_TEXT:
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 52124b7acdeab787978029aa49ea75d0ad4cc534..942a1df3057e3e49c9111f6a27ec1883d964bf64 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1303,6 +1303,13 @@ enum v4l2_dv_it_content_type {
#define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102)
#define V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE (V4L2_CID_DV_CLASS_BASE + 103)
#define V4L2_CID_DV_RX_AUDIO_PRESENT (V4L2_CID_DV_CLASS_BASE + 104)
+#define V4L2_CID_DV_RX_AUDIO_TYPE (V4L2_CID_DV_CLASS_BASE + 105)
+enum v4l2_dv_rx_audio_type {
+ V4L2_DV_RX_AUDIO_TYPE_LPCM = 0,
+ V4L2_DV_RX_AUDIO_TYPE_IEC61937 = 1,
+ V4L2_DV_RX_AUDIO_TYPE_HBR = 2,
+ V4L2_DV_RX_AUDIO_TYPE_ONE_BIT = 3,
+};
#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1)
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 2/9] media: v4l2-ctrls: add the DV RX audio type control
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 3:09 ` sashiko-bot
2026-11-24 4:03 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:09 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: v4l2-ctrls: missing Signed-off-by trailer in commit
message
--
commit fb359067feb3d2fad1ab958d4474696294bed179
Author: Hermes Wu <Hermes.wu@ite.com.tw>
> media: v4l2-ctrls: add the DV RX audio type control
>
> An HDMI or DisplayPort receiver can pass on linear PCM, compressed audio
> in IEC 61937 format, high bit rate (HBR) compressed audio, or one bit
> (DSD) audio. Userspace capturing that audio needs to know which kind it
> is, for example to decide whether the samples can be played as PCM or
> must be passed through to a decoder.
>
> Add a standard read-only menu control, V4L2_CID_DV_RX_AUDIO_TYPE, to the
> DV control class with these four values. It describes how the audio is
> carried, not the codec: the codec of compressed audio is identified by
> the IEC 61937 data.
[Severity: High]
This commit message is missing a Signed-off-by: trailer from the author.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=2
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH v2 2/9] media: v4l2-ctrls: add the DV RX audio type control
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 3:09 ` sashiko-bot
@ 2026-11-24 4:03 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: Hermes.Wu @ 2026-11-24 4:03 UTC (permalink / raw)
To: Hermes.Wu, mchehab, robh, krzk+dt, conor+dt, hverkuil+cisco,
hverkuil
Cc: linux-media, devicetree, linux-kernel, broonie, lgirdwood,
linux-sound, linux-api
The Signed-off-by is missing from this patch, sorry about that:
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
The next version will carry it in the patch itself.
Best regards,
Hermes
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls
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 3:04 ` [PATCH v2 2/9] media: v4l2-ctrls: add the DV RX audio type control Hermes Wu via B4 Relay
@ 2026-11-24 3:04 ` Hermes Wu via B4 Relay
2026-11-24 3:14 ` sashiko-bot
2026-11-24 4:04 ` 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
` (5 subsequent siblings)
8 siblings, 2 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
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
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls
2026-11-24 3:04 ` [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls Hermes Wu via B4 Relay
@ 2026-11-24 3:14 ` sashiko-bot
2026-11-24 4:04 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:14 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: i2c: tc358743: missing Signed-off-by trailer in commit
message
--
commit 2fcb6f1ab2ea0f1607fb0f6011772556e8ede268
Author: Hermes Wu <Hermes.wu@ite.com.tw>
> media: i2c: tc358743: also report the standard audio controls
>
> 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.
[Severity: High]
This commit is missing a Signed-off-by: trailer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=3
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls
2026-11-24 3:04 ` [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls Hermes Wu via B4 Relay
2026-11-24 3:14 ` sashiko-bot
@ 2026-11-24 4:04 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: Hermes.Wu @ 2026-11-24 4:04 UTC (permalink / raw)
To: Hermes.Wu, mchehab, robh, krzk+dt, conor+dt, hverkuil+cisco,
hverkuil
Cc: linux-media, devicetree, linux-kernel, broonie, lgirdwood,
linux-sound, linux-api
The Signed-off-by is missing from this patch, sorry about that:
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
The next version will carry it in the patch itself.
Best regards,
Hermes
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 4/9] dt-bindings: media: ite,it6625: add audio DAI properties
2026-11-24 3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
` (2 preceding siblings ...)
2026-11-24 3:04 ` [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls Hermes Wu via B4 Relay
@ 2026-11-24 3:04 ` 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
` (4 subsequent siblings)
8 siblings, 0 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu, Krzysztof Kozlowski
From: Hermes Wu <Hermes.wu@ite.com.tw>
IT6625 and IT6626 decode the HDMI audio stream and output it on an I2S
interface, driving the bit and frame clocks themselves. The bridge has up
to eight I2S data pins.
Add '#sound-dai-cells' so the bridge can be referenced as an audio codec
DAI, and 'ite,i2s-data-lanes' to describe which data pins are connected
to the audio receiver, in HDMI channel-pair order. Without the property
only SD0 is connected.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
.../devicetree/bindings/media/i2c/ite,it6625.yaml | 23 +++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml b/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml
index b766f075dedd4668446856aceb854b24726a1266..d00a3d607e8a7893118bd25fa93136656b31703e 100644
--- a/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml
@@ -43,6 +43,23 @@ properties:
ovdd-supply:
description: I/O supply voltage
+ '#sound-dai-cells':
+ const: 0
+
+ ite,i2s-data-lanes:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 1
+ maxItems: 8
+ uniqueItems: true
+ items:
+ enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
+ description:
+ I2S audio data pins (SD0 - SD7) that are connected to the audio
+ receiver, in HDMI channel-pair order. The first entry is the pin
+ carrying HDMI channels 1 and 2, the second the pin carrying channels 3
+ and 4, and so on. The bridge drives the I2S bit and frame clocks. If
+ the property is absent, only SD0 is connected.
+
ports:
$ref: /schemas/graph.yaml#/properties/ports
properties:
@@ -111,6 +128,7 @@ required:
- ovdd-supply
allOf:
+ - $ref: /schemas/sound/dai-common.yaml#
- if:
properties:
compatible:
@@ -131,7 +149,7 @@ allOf:
required:
- bus-type
-additionalProperties: false
+unevaluatedProperties: false
examples:
- |
@@ -153,6 +171,9 @@ examples:
vdd33-supply = <&vdd33_reg>;
ovdd-supply = <&ovdd_reg>;
+ #sound-dai-cells = <0>;
+ ite,i2s-data-lanes = <0 1 2 3>;
+
ports {
#address-cells = <1>;
#size-cells = <0>;
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 5/9] media: i2c: it6625: decode audio status fields with FIELD_GET()
2026-11-24 3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
` (3 preceding siblings ...)
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 ` 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
` (3 subsequent siblings)
8 siblings, 0 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
The sampling-rate control compares the whole HDMI_AUDIO_INFO1 byte
against the AUD_FS code table, although AUD_FS occupies only bits
[5:0]. Any set upper bit makes every rate read back as 0.
Describe the audio registers with GENMASK() fields and decode them with
FIELD_GET(). Collect the audio status in one helper that runs under
it6625_lock: it reads RX_STATUS once, for both the video-stable and the
audio-present bits, and reads the read-only stream description in
0x6B-0x6E as a single 4-byte transfer only while audio is present. Both
audio controls are then fed from that one sample.
Drop the 0x6E alignment/delay/polarity/shift defines; they were unused,
and the audio output framing is fixed by the firmware.
Apart from masking AUD_FS, the controls behave as before: the rate
reads 0 when there is no stable signal, no audio, an unknown code or a
read error, and the present control follows the audio-present bit.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/media/i2c/it6625.c | 206 +++++++++++++++++++++++++++++----------------
1 file changed, 132 insertions(+), 74 deletions(-)
diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
index af6995dee8de2d820c593f4924adc6f7e031e61c..6ff5a5574b379c217138500887a041563158845a 100644
--- a/drivers/media/i2c/it6625.c
+++ b/drivers/media/i2c/it6625.c
@@ -83,25 +83,34 @@ MODULE_PARM_DESC(debug, "debug level (0-3)");
#define REG_HDMI_VIDEO_INFO 0x6A
#define B_COLOR_MODE BIT(0)
#define B_COLOR_DEPTH BIT(4)
+/*
+ * 0x6B-0x6E describe the decoded HDMI audio stream that the firmware passes
+ * through to the audio output. They are read-only and only meaningful while
+ * REG_RX_STATUS reports audio present.
+ */
#define REG_HDMI_AUDIO_INFO1 0x6B
-#define B_AUD_FS BIT(0)
+#define M_AUD_FS GENMASK(5, 0)
#define REG_HDMI_AUDIO_INFO2 0x6C
-#define B_AUD_CH BIT(0)
-#define B_AUD_WL BIT(4)
+#define M_AUD_CH GENMASK(3, 0)
+#define M_AUD_WL GENMASK(7, 4)
#define REG_HDMI_AUDIO_INFO3 0x6D
-#define B_AUD_TYPE BIT(0)
+#define M_AUD_TYPE GENMASK(1, 0)
+#define AUD_TYPE_LPCM 0
#define B_AUD_MS BIT(2)
#define B_AUD_3D BIT(3)
#define REG_AUDIO_FMT 0x6E
-#define B_I2S_WL BIT(0)
-#define B_I2S_ALN BIT(2)
-#define B_I2S_DLY BIT(3)
-#define B_I2S_LR BIT(4)
-#define B_I2S_SFT BIT(5)
-#define B_AUD_OUT_IF BIT(6)
+#define M_I2S_WL GENMASK(1, 0)
+#define I2S_WL_16BIT 0
+#define I2S_WL_18BIT 1
+#define I2S_WL_20BIT 2
+#define I2S_WL_24BIT 3
+#define M_AUD_OUT_IF GENMASK(7, 6)
+#define AUD_OUT_IF_I2S 0
+
+#define AUDIO_INFO_LEN 4
#define REG_IF_LATCH_HB 0x6F
#define REG_IF_DATA 0x70
@@ -254,6 +263,28 @@ enum it6625_chip_type {
IT6626_CHIP = 1,
};
+/* decoded 0x6B-0x6E: the HDMI audio stream passed through to the output */
+struct it6625_audio_stream {
+ u8 fs_code;
+ u8 channels;
+ u8 type;
+ bool multi_stream;
+ bool is_3d;
+ u8 i2s_wl;
+ u8 out_if;
+};
+
+struct it6625_audio_info {
+ /* false if any status read failed */
+ bool read_ok;
+ /* REG_RX_STATUS */
+ bool vid_stable;
+ bool present;
+ bool avmute;
+ /* only refreshed while present */
+ struct it6625_audio_stream stream;
+};
+
struct it6625 {
struct device *dev;
struct i2c_client *i2c_client;
@@ -592,61 +623,94 @@ static inline bool no_signal(struct it6625 *it6625)
return val < 0 ? true : !(val & B_RX_STABLE);
}
-static inline bool audio_present(struct it6625 *it6625)
+static const struct it6625_audio_rate {
+ u8 fs_code;
+ u32 rate;
+} it6625_audio_rates[] = {
+ { AUD32K, 32000 },
+ { AUD44K, 44100 },
+ { AUD48K, 48000 },
+ { AUD64K, 64000 },
+ { AUD88K, 88200 },
+ { AUD96K, 96000 },
+
+ { AUD128K, 128000 },
+ { AUD176K, 176400 },
+ { AUD192K, 192000 },
+ { AUD256K, 256000 },
+ { AUD352K, 352800 },
+ { AUD384K, 384000 },
+
+ { AUD512K, 512000 },
+ { AUD705K, 705600 },
+ { AUD768K, 768000 },
+ { AUD1024K, 1024000 },
+ { AUD1411K, 1411200 },
+ { AUD1536K, 1536000 },
+};
+
+/* returns 0 for an unknown sampling-frequency code */
+static u32 it6625_audio_fs_to_rate(u8 fs_code)
+{
+ for (unsigned int i = 0; i < ARRAY_SIZE(it6625_audio_rates); i++) {
+ if (it6625_audio_rates[i].fs_code == fs_code)
+ return it6625_audio_rates[i].rate;
+ }
+
+ return 0;
+}
+
+/*
+ * Sample the audio status. REG_RX_STATUS is always read; the stream
+ * description in 0x6B-0x6E is only read while audio is present, otherwise
+ * info->stream is left untouched. read_ok is false if any read failed.
+ */
+static void it6625_read_audio_info(struct it6625 *it6625,
+ struct it6625_audio_info *info)
{
+ u8 buf[AUDIO_INFO_LEN];
int val;
- val = it6625_read_byte(it6625, REG_RX_STATUS);
- return val < 0 ? false : val & B_RX_AUD_ON;
-}
-
-static int get_audio_sampling_rate(struct it6625 *it6625)
-{
- static const struct fs_id_map {
- u8 fs_id;
- u32 freq;
- } s_fsid_map[] = {
- { AUD32K, 32000 },
- { AUD44K, 44100 },
- { AUD48K, 48000 },
- { AUD64K, 64000 },
- { AUD88K, 88200 },
- { AUD96K, 96000 },
-
- { AUD128K, 128000 },
- { AUD176K, 176400 },
- { AUD192K, 192000 },
- { AUD256K, 256000 },
- { AUD352K, 352800 },
- { AUD384K, 384000 },
-
- { AUD512K, 512000 },
- { AUD705K, 705600 },
- { AUD768K, 768000 },
- { AUD1024K, 1024000 },
- { AUD1411K, 1411200 },
- { AUD1536K, 1536000 },
- };
- int fs_id;
- int i, freq = 0;
+ lockdep_assert_held(&it6625->it6625_lock);
- if (no_signal(it6625) || !audio_present(it6625))
- return 0;
+ val = it6625_read_byte(it6625, REG_RX_STATUS);
+ if (val < 0) {
+ info->read_ok = false;
+ info->vid_stable = false;
+ info->present = false;
+ info->avmute = false;
+ return;
+ }
- guard(mutex)(&it6625->it6625_lock);
+ info->read_ok = true;
+ info->vid_stable = val & B_RX_STABLE;
+ info->present = val & B_RX_AUD_ON;
+ info->avmute = val & B_RX_AVMUTE;
- fs_id = it6625_read_byte(it6625, REG_HDMI_AUDIO_INFO1);
- if (fs_id < 0)
- return 0;
+ if (!info->present)
+ return;
- for (i = 0; i < ARRAY_SIZE(s_fsid_map); i++) {
- if (s_fsid_map[i].fs_id == fs_id) {
- freq = s_fsid_map[i].freq;
- break;
- }
+ if (it6625_read_bytes(it6625, REG_HDMI_AUDIO_INFO1, buf, sizeof(buf))) {
+ info->read_ok = false;
+ return;
}
- return freq;
+ info->stream.fs_code = FIELD_GET(M_AUD_FS, buf[0]);
+ info->stream.channels = FIELD_GET(M_AUD_CH, buf[1]);
+ info->stream.type = FIELD_GET(M_AUD_TYPE, buf[2]);
+ info->stream.multi_stream = buf[2] & B_AUD_MS;
+ info->stream.is_3d = buf[2] & B_AUD_3D;
+ info->stream.i2s_wl = FIELD_GET(M_I2S_WL, buf[3]);
+ info->stream.out_if = FIELD_GET(M_AUD_OUT_IF, buf[3]);
+}
+
+/* sampling rate for the V4L2 control: 0 means unavailable */
+static u32 it6625_audio_info_rate(const struct it6625_audio_info *info)
+{
+ if (!info->read_ok || !info->vid_stable || !info->present)
+ return 0;
+
+ return it6625_audio_fs_to_rate(info->stream.fs_code);
}
static u64 it6625_get_pclk(struct it6625 *it6625)
@@ -905,20 +969,21 @@ static int it6625_s_ctrl_detect_hdmi_5v(struct v4l2_subdev *sd)
hdmi_5v_power_present(it6625));
}
-static int it6625_s_ctrl_audio_sampling_rate(struct v4l2_subdev *sd)
+static int it6625_s_ctrl_audio(struct v4l2_subdev *sd)
{
struct it6625 *it6625 = sd_to_6625(sd);
+ struct it6625_audio_info info = {};
+ int ret;
- return v4l2_ctrl_s_ctrl(it6625->ctrl_audio_sampling_rate,
- get_audio_sampling_rate(it6625));
-}
+ scoped_guard(mutex, &it6625->it6625_lock)
+ it6625_read_audio_info(it6625, &info);
-static int it6625_s_ctrl_audio_present(struct v4l2_subdev *sd)
-{
- struct it6625 *it6625 = sd_to_6625(sd);
+ ret = v4l2_ctrl_s_ctrl(it6625->ctrl_audio_sampling_rate,
+ it6625_audio_info_rate(&info));
+ if (ret)
+ return ret;
- return v4l2_ctrl_s_ctrl(it6625->ctrl_audio_present,
- audio_present(it6625));
+ return v4l2_ctrl_s_ctrl(it6625->ctrl_audio_present, info.present);
}
static int it6625_v4l2_sd_ctrl_update(struct v4l2_subdev *sd)
@@ -929,11 +994,7 @@ static int it6625_v4l2_sd_ctrl_update(struct v4l2_subdev *sd)
if (ret)
return ret;
- ret = it6625_s_ctrl_audio_sampling_rate(sd);
- if (ret)
- return ret;
-
- return it6625_s_ctrl_audio_present(sd);
+ return it6625_s_ctrl_audio(sd);
}
static int it6625_enable_stream_locked(struct it6625 *it6625, bool enable)
@@ -1184,10 +1245,7 @@ static void it6625_irq_format_change(struct it6625 *it6625)
static void it6625_irq_hdmi_audio_change(struct it6625 *it6625)
{
- struct v4l2_subdev *sd = &it6625->sd;
-
- it6625_s_ctrl_audio_sampling_rate(sd);
- it6625_s_ctrl_audio_present(sd);
+ it6625_s_ctrl_audio(&it6625->sd);
}
static void it6625_get_timings(struct it6625 *it6625,
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 6/9] media: i2c: it6625: add I2S audio capture DAI
2026-11-24 3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
` (4 preceding siblings ...)
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 ` Hermes Wu via B4 Relay
2026-11-24 3:18 ` sashiko-bot
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
` (2 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
IT6625 and IT6626 decode the HDMI audio stream and pass it through to an
I2S output. The bridge drives the bit and frame clocks and uses standard
I2S framing with 16, 20 or 24 valid bits in 32-bit slots. None of this
is host-configurable: 0x6B-0x6E only report the stream being output.
Register an ASoC component with one capture DAI when the device node has
'#sound-dai-cells'. The DAI accepts only what the bridge currently
outputs: single-stream, non-3D LPCM at 32 kHz to 192 kHz, S32_LE with the
valid bits reported through msbits, and 2 channels per connected I2S
data pin (from 'ite,i2s-data-lanes'), up to 8 channels. startup pins
these values, and hw_params, prepare and the start and resume triggers
check them again against the latest observed status.
The I2S clocks are not guaranteed to keep running at a constant rate
when audio is lost, muted or changes format. Any observed change of the
audio status, and any status read failure, therefore stops a running
capture with an XRUN. A paused stream whose audio changed is still
released, and then stopped with an XRUN: refusing the release would
leave it paused, where a blocking read waits indefinitely. Changes are
observed on the audio-change, video-change, 5V and AV-mute events, and
every 200 ms while a capture stream is open, to catch changes that raise
no event.
The V4L2 audio controls are updated from the same status sample. The
bridge can report audio before the video signal is stable or the
sampling-frequency code is valid, and may raise no further event once
they are. After an event that leaves audio present without a valid rate,
the status is therefore checked again every 200 ms, up to 15 times, also
when no capture stream is open.
The component is registered without devm and unregistered first in
remove. Unregistering waits for open capture streams to be closed, so no
DAI callback can run while the rest of the driver is torn down. Unbind
therefore blocks while a capture stream is held open.
The driver still builds without ASoC: the audio code is compiled out
when SND_SOC is disabled.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/media/i2c/Kconfig | 1 +
drivers/media/i2c/it6625.c | 613 +++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 599 insertions(+), 15 deletions(-)
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 9e42b380e3f20ee9f41123d265cb9b0506324ed0..d28b0dc1cf0ec7ea3ff2840cbcf1c0ced81863dc 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -1393,6 +1393,7 @@ config VIDEO_IT6625
tristate "IT6625 HDMI to MIPI CSI bridge"
depends on VIDEO_DEV && I2C
depends on OF
+ depends on SND_SOC || !SND_SOC
select CEC_CORE
select HDMI
select MEDIA_CONTROLLER
diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
index 6ff5a5574b379c217138500887a041563158845a..4a6ab00f04013b874e9af13f26e88f90fcbc3989 100644
--- a/drivers/media/i2c/it6625.c
+++ b/drivers/media/i2c/it6625.c
@@ -30,6 +30,9 @@
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
#include <uapi/linux/it6625.h>
static int debug;
@@ -112,6 +115,15 @@ MODULE_PARM_DESC(debug, "debug level (0-3)");
#define AUDIO_INFO_LEN 4
+/* I2S capture DAI */
+#define IT6625_AUDIO_MAX_LANES 8
+#define IT6625_AUDIO_MAX_CHANNELS 8
+#define IT6625_AUDIO_MAX_RATE 192000
+/* status re-check period while a capture stream is open */
+#define IT6625_AUDIO_REFRESH_MS 200
+/* re-checks after an event that left present audio without a valid rate */
+#define IT6625_AUDIO_SETTLE_POLLS 15
+
#define REG_IF_LATCH_HB 0x6F
#define REG_IF_DATA 0x70
#define REG_EMP_DATA 0xA0
@@ -348,6 +360,35 @@ struct it6625 {
int if_snapshot_err;
/* set just before complete(), to disambiguate timeout vs. capture */
bool if_snapshot_done;
+
+ /*
+ * ASoC capture DAI state. audio is written with both it6625_lock and
+ * audio_lock held, so either one is enough to read it. Everything
+ * else below is protected by audio_lock, which is taken with
+ * spin_lock_irqsave() because .trigger runs in atomic context. It is
+ * never held across I2C, V4L2 control, ALSA core or work-sync calls.
+ */
+ spinlock_t audio_lock;
+ /* last published audio status sample */
+ struct it6625_audio_info audio;
+ /* bumped on any observed audio status change and on read failures */
+ u32 audio_gen;
+ /* the open capture stream, or NULL */
+ struct snd_pcm_substream *audio_substream;
+ /* audio_gen and stream accepted by the open capture stream */
+ u32 audio_accepted_gen;
+ struct it6625_audio_stream audio_accepted;
+ bool audio_running;
+ /* stream shutdown in progress: queue no new work */
+ bool audio_block;
+ /* refresh work runs left to follow a rate that is still settling */
+ unsigned int audio_settle_polls;
+ /* component registered by probe, unregistered first in remove */
+ bool audio_registered;
+ /* number of connected I2S data pins, from ite,i2s-data-lanes */
+ u8 audio_lanes;
+ struct work_struct audio_xrun_work;
+ struct delayed_work audio_refresh_work;
};
/*
@@ -969,21 +1010,132 @@ static int it6625_s_ctrl_detect_hdmi_5v(struct v4l2_subdev *sd)
hdmi_5v_power_present(it6625));
}
+static bool it6625_audio_stream_equal(const struct it6625_audio_stream *a,
+ const struct it6625_audio_stream *b)
+{
+ return a->fs_code == b->fs_code &&
+ a->channels == b->channels &&
+ a->type == b->type &&
+ a->multi_stream == b->multi_stream &&
+ a->is_3d == b->is_3d &&
+ a->i2s_wl == b->i2s_wl &&
+ a->out_if == b->out_if;
+}
+
+/*
+ * Any change of the status bits or of the stream description, and every
+ * read failure, invalidates an accepted capture stream: the I2S clocks are
+ * not guaranteed to keep running at one rate across such a change.
+ */
+static bool it6625_audio_changed(const struct it6625_audio_info *old,
+ const struct it6625_audio_info *new)
+{
+ return !new->read_ok ||
+ new->read_ok != old->read_ok ||
+ new->vid_stable != old->vid_stable ||
+ new->present != old->present ||
+ new->avmute != old->avmute ||
+ !it6625_audio_stream_equal(&new->stream, &old->stream);
+}
+
+/*
+ * Sample the audio status and publish it. The read and the publication
+ * both happen under it6625_lock, so concurrent refreshes cannot publish
+ * out of order.
+ */
+static void it6625_audio_refresh(struct it6625 *it6625)
+{
+ struct it6625_audio_info info;
+ unsigned long flags;
+
+ guard(mutex)(&it6625->it6625_lock);
+
+ /* keep the last stream description if audio is absent */
+ info = it6625->audio;
+ it6625_read_audio_info(it6625, &info);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ if (it6625_audio_changed(&it6625->audio, &info)) {
+ it6625->audio_gen++;
+ if (it6625->audio_substream && it6625->audio_running &&
+ !it6625->audio_block)
+ queue_work(system_wq, &it6625->audio_xrun_work);
+ }
+ it6625->audio = info;
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+}
+
+/*
+ * Selecting the published sample and writing both controls happen under
+ * the control handler lock, so a stale sample never overwrites a newer one.
+ */
+static int it6625_audio_update_ctrls(struct it6625 *it6625)
+{
+ struct it6625_audio_info info;
+ unsigned long flags;
+ int ret;
+
+ v4l2_ctrl_lock(it6625->ctrl_audio_present);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ info = it6625->audio;
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ ret = __v4l2_ctrl_s_ctrl(it6625->ctrl_audio_sampling_rate,
+ it6625_audio_info_rate(&info));
+ if (!ret)
+ ret = __v4l2_ctrl_s_ctrl(it6625->ctrl_audio_present,
+ info.present);
+
+ v4l2_ctrl_unlock(it6625->ctrl_audio_present);
+
+ return ret;
+}
+
static int it6625_s_ctrl_audio(struct v4l2_subdev *sd)
{
struct it6625 *it6625 = sd_to_6625(sd);
- struct it6625_audio_info info = {};
+
+ it6625_audio_refresh(it6625);
+
+ return it6625_audio_update_ctrls(it6625);
+}
+
+/* audio is present but its rate is not valid yet. Caller holds audio_lock. */
+static bool it6625_audio_settling(struct it6625 *it6625)
+{
+ lockdep_assert_held(&it6625->audio_lock);
+
+ return it6625->audio.read_ok && it6625->audio.present &&
+ !it6625_audio_info_rate(&it6625->audio);
+}
+
+/*
+ * Update the audio controls on a status event. The chip can report audio
+ * present before the video is stable or the sampling-frequency code is
+ * valid, and may raise no further interrupt once they settle, so keep
+ * re-checking for a while in that case.
+ */
+static int it6625_audio_event(struct it6625 *it6625)
+{
+ unsigned long flags;
int ret;
- scoped_guard(mutex, &it6625->it6625_lock)
- it6625_read_audio_info(it6625, &info);
+ ret = it6625_s_ctrl_audio(&it6625->sd);
- ret = v4l2_ctrl_s_ctrl(it6625->ctrl_audio_sampling_rate,
- it6625_audio_info_rate(&info));
- if (ret)
- return ret;
+ /*
+ * Load the budget and queue the work in one section, so the work
+ * can't be queued again after it has used up the budget.
+ */
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ if (it6625_audio_settling(it6625)) {
+ it6625->audio_settle_polls = IT6625_AUDIO_SETTLE_POLLS;
+ schedule_delayed_work(&it6625->audio_refresh_work,
+ msecs_to_jiffies(IT6625_AUDIO_REFRESH_MS));
+ }
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
- return v4l2_ctrl_s_ctrl(it6625->ctrl_audio_present, info.present);
+ return ret;
}
static int it6625_v4l2_sd_ctrl_update(struct v4l2_subdev *sd)
@@ -994,7 +1146,7 @@ static int it6625_v4l2_sd_ctrl_update(struct v4l2_subdev *sd)
if (ret)
return ret;
- return it6625_s_ctrl_audio(sd);
+ return it6625_audio_event(sd_to_6625(sd));
}
static int it6625_enable_stream_locked(struct it6625 *it6625, bool enable)
@@ -1227,6 +1379,9 @@ static void it6625_irq_format_change(struct it6625 *it6625)
};
int ret;
+ /* the audio rate is only valid while the video is stable */
+ it6625_audio_event(it6625);
+
if (no_signal(it6625)) {
if (sd->devnode)
v4l2_subdev_notify_event(sd, &it6625_ev_fmt);
@@ -1245,7 +1400,7 @@ static void it6625_irq_format_change(struct it6625 *it6625)
static void it6625_irq_hdmi_audio_change(struct it6625 *it6625)
{
- it6625_s_ctrl_audio(&it6625->sd);
+ it6625_audio_event(it6625);
}
static void it6625_get_timings(struct it6625 *it6625,
@@ -1318,11 +1473,13 @@ static void it6625_irq_avmute_change(struct it6625 *it6625)
u8 avmute;
val = it6625_read_byte(it6625, REG_RX_STATUS);
- if (val < 0)
- return;
+ if (val >= 0) {
+ avmute = (val & B_RX_AVMUTE) ? 1 : 0;
+ v4l2_info(sd, "AVMute change to %d", avmute);
+ }
- avmute = (val & B_RX_AVMUTE) ? 1 : 0;
- v4l2_info(sd, "AVMute change to %d", avmute);
+ /* AV mute makes the audio unusable for capture */
+ it6625_audio_event(it6625);
}
static void it6625_dispatch_int_status1(struct it6625 *it6625, int int_sts1)
@@ -2008,6 +2165,373 @@ static int it6625_v4l2_init_controls(struct v4l2_subdev *sd)
return 0;
}
+/*
+ * I2S capture DAI. The firmware decodes the HDMI audio stream and passes it
+ * through to the I2S output, which it drives as bit and frame clock
+ * provider: standard I2S framing, 16/20/24-bit data in 32-bit slots. None of
+ * this is configurable, so the DAI only accepts streams matching the
+ * currently observed audio and stops a running capture when that changes.
+ */
+
+/* valid bits per 32-bit slot, 0 if unsupported */
+static unsigned int it6625_audio_wl_bits(u8 i2s_wl)
+{
+ switch (i2s_wl) {
+ case I2S_WL_16BIT:
+ return 16;
+ case I2S_WL_20BIT:
+ return 20;
+ case I2S_WL_24BIT:
+ return 24;
+ default:
+ return 0;
+ }
+}
+
+static unsigned int it6625_audio_max_channels(const struct it6625 *it6625)
+{
+ return min(2U * it6625->audio_lanes, IT6625_AUDIO_MAX_CHANNELS);
+}
+
+/* can this audio status be captured? Pure check, callable in atomic context. */
+static int it6625_audio_check(const struct it6625 *it6625,
+ const struct it6625_audio_info *info)
+{
+ const struct it6625_audio_stream *s = &info->stream;
+ u32 rate = it6625_audio_fs_to_rate(s->fs_code);
+
+ if (!info->read_ok || !info->vid_stable || !info->present ||
+ info->avmute)
+ return -ENODEV;
+
+ if (s->out_if != AUD_OUT_IF_I2S || s->type != AUD_TYPE_LPCM ||
+ s->multi_stream || s->is_3d)
+ return -ENODEV;
+
+ if (!rate || rate > IT6625_AUDIO_MAX_RATE)
+ return -ENODEV;
+
+ if (s->channels < 2 || s->channels % 2 ||
+ s->channels > it6625_audio_max_channels(it6625))
+ return -ENODEV;
+
+ if (!it6625_audio_wl_bits(s->i2s_wl))
+ return -ENODEV;
+
+ return 0;
+}
+
+/* is the accepted stream still current? Caller holds audio_lock. */
+static int it6625_audio_validate_locked(struct it6625 *it6625)
+{
+ lockdep_assert_held(&it6625->audio_lock);
+
+ if (it6625->audio_gen != it6625->audio_accepted_gen)
+ return -EPIPE;
+
+ return it6625_audio_check(it6625, &it6625->audio);
+}
+
+static void it6625_audio_xrun_work(struct work_struct *work)
+{
+ struct it6625 *it6625 = container_of(work, struct it6625,
+ audio_xrun_work);
+ struct snd_pcm_substream *substream = NULL;
+ unsigned long flags;
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ if (!it6625->audio_block)
+ substream = it6625->audio_substream;
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ /* .shutdown drains this work before the substream goes away */
+ if (IS_ENABLED(CONFIG_SND_SOC) && substream)
+ snd_pcm_stop_xrun(substream);
+}
+
+/*
+ * Catch persistent audio changes that raise no interrupt while a capture
+ * stream is open, and follow a rate that is still settling after an event
+ * for at most IT6625_AUDIO_SETTLE_POLLS runs.
+ */
+static void it6625_audio_refresh_work(struct work_struct *work)
+{
+ struct it6625 *it6625 = container_of(to_delayed_work(work),
+ struct it6625, audio_refresh_work);
+ unsigned long flags;
+ bool rearm;
+
+ it6625_s_ctrl_audio(&it6625->sd);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ /* every run uses up one re-check of a settle budget */
+ if (it6625->audio_settle_polls)
+ it6625->audio_settle_polls--;
+ rearm = (it6625->audio_substream && !it6625->audio_block) ||
+ (it6625->audio_settle_polls && it6625_audio_settling(it6625));
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ if (rearm)
+ schedule_delayed_work(&it6625->audio_refresh_work,
+ msecs_to_jiffies(IT6625_AUDIO_REFRESH_MS));
+}
+
+static struct it6625 *dai_to_6625(struct snd_soc_dai *dai)
+{
+ /* the I2C client data is the V4L2 subdev */
+ return sd_to_6625(snd_soc_dai_get_drvdata(dai));
+}
+
+static int it6625_dai_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct it6625 *it6625 = dai_to_6625(dai);
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct it6625_audio_info info;
+ unsigned long flags;
+ u32 gen;
+ int ret;
+
+ it6625_s_ctrl_audio(&it6625->sd);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ if (it6625->audio_substream || it6625->audio_block)
+ ret = -EBUSY;
+ else
+ ret = it6625_audio_check(it6625, &it6625->audio);
+ info = it6625->audio;
+ gen = it6625->audio_gen;
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+ if (ret)
+ return ret;
+
+ ret = snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_RATE,
+ it6625_audio_fs_to_rate(info.stream.fs_code));
+ if (ret < 0)
+ return ret;
+
+ ret = snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_CHANNELS,
+ info.stream.channels);
+ if (ret < 0)
+ return ret;
+
+ ret = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT,
+ SNDRV_PCM_FMTBIT_S32_LE);
+ if (ret < 0)
+ return ret;
+
+ ret = snd_pcm_hw_constraint_msbits(runtime, 0, 32,
+ it6625_audio_wl_bits(info.stream.i2s_wl));
+ if (ret < 0)
+ return ret;
+
+ /* recheck: the status may have changed while installing constraints */
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ if (it6625->audio_substream || it6625->audio_block)
+ ret = -EBUSY;
+ else if (it6625->audio_gen != gen)
+ ret = -EPIPE;
+ else
+ ret = it6625_audio_check(it6625, &it6625->audio);
+ if (!ret) {
+ it6625->audio_substream = substream;
+ it6625->audio_accepted = info.stream;
+ it6625->audio_accepted_gen = gen;
+ it6625->audio_running = false;
+ }
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+ if (ret)
+ return ret;
+
+ schedule_delayed_work(&it6625->audio_refresh_work,
+ msecs_to_jiffies(IT6625_AUDIO_REFRESH_MS));
+
+ return 0;
+}
+
+/* also called on rollback after a successful .startup */
+static void it6625_dai_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct it6625 *it6625 = dai_to_6625(dai);
+ unsigned long flags;
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ it6625->audio_block = true;
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ cancel_delayed_work_sync(&it6625->audio_refresh_work);
+ cancel_work_sync(&it6625->audio_xrun_work);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ it6625->audio_substream = NULL;
+ it6625->audio_running = false;
+ it6625->audio_block = false;
+ /* the cancel above also stopped a rate that is still settling */
+ if (it6625->audio_settle_polls && it6625_audio_settling(it6625))
+ schedule_delayed_work(&it6625->audio_refresh_work,
+ msecs_to_jiffies(IT6625_AUDIO_REFRESH_MS));
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+}
+
+static int it6625_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
+{
+ if ((fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) != SND_SOC_DAIFMT_CBP_CFP ||
+ (fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_I2S ||
+ (fmt & SND_SOC_DAIFMT_INV_MASK) != SND_SOC_DAIFMT_NB_NF)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int it6625_dai_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct it6625 *it6625 = dai_to_6625(dai);
+ const struct it6625_audio_stream *s;
+ unsigned long flags;
+ int ret;
+
+ it6625_s_ctrl_audio(&it6625->sd);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ ret = it6625_audio_validate_locked(it6625);
+ s = &it6625->audio_accepted;
+ if (!ret &&
+ (params_rate(params) != it6625_audio_fs_to_rate(s->fs_code) ||
+ params_channels(params) != s->channels ||
+ params_format(params) != SNDRV_PCM_FORMAT_S32_LE))
+ ret = -EINVAL;
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ return ret;
+}
+
+static int it6625_dai_prepare(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct it6625 *it6625 = dai_to_6625(dai);
+ unsigned long flags;
+ int ret;
+
+ it6625_s_ctrl_audio(&it6625->sd);
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ ret = it6625_audio_validate_locked(it6625);
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ return ret;
+}
+
+/*
+ * Atomic: only the published status is consulted. A loss that no refresh
+ * has observed yet is handled by the refresh that observes it.
+ */
+static int it6625_dai_trigger(struct snd_pcm_substream *substream, int cmd,
+ struct snd_soc_dai *dai)
+{
+ struct it6625 *it6625 = dai_to_6625(dai);
+ unsigned long flags;
+ int ret = 0;
+
+ spin_lock_irqsave(&it6625->audio_lock, flags);
+ switch (cmd) {
+ case SNDRV_PCM_TRIGGER_START:
+ case SNDRV_PCM_TRIGGER_RESUME:
+ ret = it6625_audio_validate_locked(it6625);
+ if (!ret)
+ it6625->audio_running = true;
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ /*
+ * A refused release would leave the stream paused, and a
+ * blocking read on a paused stream never returns. If the
+ * stream became stale while paused, release it and stop it
+ * with an XRUN instead.
+ */
+ it6625->audio_running = true;
+ if (it6625_audio_validate_locked(it6625) &&
+ it6625->audio_substream && !it6625->audio_block)
+ queue_work(system_wq, &it6625->audio_xrun_work);
+ break;
+ case SNDRV_PCM_TRIGGER_STOP:
+ case SNDRV_PCM_TRIGGER_SUSPEND:
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ it6625->audio_running = false;
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ spin_unlock_irqrestore(&it6625->audio_lock, flags);
+
+ return ret;
+}
+
+static const struct snd_soc_dai_ops it6625_dai_ops = {
+ .startup = it6625_dai_startup,
+ .shutdown = it6625_dai_shutdown,
+ .set_fmt = it6625_dai_set_fmt,
+ .hw_params = it6625_dai_hw_params,
+ .prepare = it6625_dai_prepare,
+ .trigger = it6625_dai_trigger,
+};
+
+static struct snd_soc_dai_driver it6625_dai = {
+ .name = "it6625-i2s",
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 2,
+ .channels_max = IT6625_AUDIO_MAX_CHANNELS,
+ .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
+ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 |
+ SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
+ SNDRV_PCM_RATE_128000 | SNDRV_PCM_RATE_176400 |
+ SNDRV_PCM_RATE_192000,
+ .formats = SNDRV_PCM_FMTBIT_S32_LE,
+ },
+ .ops = &it6625_dai_ops,
+};
+
+static const struct snd_soc_component_driver it6625_component = {
+ .name = "it6625",
+ .endianness = 1,
+};
+
+/*
+ * Registered without devm so that remove can unregister it first: that
+ * waits until every open capture stream is closed, so no DAI callback
+ * runs once the driver starts tearing down.
+ */
+static int it6625_audio_register(struct it6625 *it6625)
+{
+ int err;
+
+ if (!IS_ENABLED(CONFIG_SND_SOC) ||
+ !of_property_present(it6625->dev->of_node, "#sound-dai-cells"))
+ return 0;
+
+ err = snd_soc_register_component(it6625->dev, &it6625_component,
+ &it6625_dai, 1);
+ if (err)
+ return dev_err_probe(it6625->dev, err,
+ "failed to register audio DAI");
+
+ it6625->audio_registered = true;
+
+ return 0;
+}
+
+static void it6625_audio_unregister(struct it6625 *it6625)
+{
+ if (IS_ENABLED(CONFIG_SND_SOC) && it6625->audio_registered)
+ snd_soc_unregister_component(it6625->dev);
+
+ disable_delayed_work_sync(&it6625->audio_refresh_work);
+ disable_work_sync(&it6625->audio_xrun_work);
+}
+
static void it6625_regdump_print(struct seq_file *s, const u8 *reg_buf)
{
seq_puts(s, " 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F\n");
@@ -2274,9 +2798,49 @@ static int it6625_parse_endpoint(struct it6625 *it6625)
return ret;
}
+static int it6625_parse_audio(struct it6625 *it6625)
+{
+ struct device *dev = it6625->dev;
+ struct device_node *np = dev->of_node;
+ u32 lanes[IT6625_AUDIO_MAX_LANES];
+ int count, ret;
+
+ it6625->audio_lanes = 1;
+
+ if (!of_property_present(np, "ite,i2s-data-lanes"))
+ return 0;
+
+ count = of_property_count_u32_elems(np, "ite,i2s-data-lanes");
+ if (count < 1 || count > IT6625_AUDIO_MAX_LANES)
+ return dev_err_probe(dev, -EINVAL,
+ "ite,i2s-data-lanes needs 1 to %u entries",
+ IT6625_AUDIO_MAX_LANES);
+
+ ret = of_property_read_u32_array(np, "ite,i2s-data-lanes", lanes, count);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to read ite,i2s-data-lanes");
+
+ /* channel-pair to data-pin mapping is not supported yet */
+ for (unsigned int i = 0; i < count; i++) {
+ if (lanes[i] != i)
+ return dev_err_probe(dev, -EINVAL,
+ "ite,i2s-data-lanes must be <0 1 ... n-1>");
+ }
+
+ it6625->audio_lanes = count;
+
+ return 0;
+}
+
static int it6625_parse_dt(struct it6625 *it6625)
{
- return it6625_parse_endpoint(it6625);
+ int ret;
+
+ ret = it6625_parse_endpoint(it6625);
+ if (ret)
+ return ret;
+
+ return it6625_parse_audio(it6625);
}
static int it6625_check_device(struct it6625 *it6625)
@@ -2350,6 +2914,9 @@ static int it6625_probe(struct i2c_client *client)
init_completion(&it6625->if_latched);
INIT_DELAYED_WORK(&it6625->hpd_delayed_work, it6625_hpd_delayed_work);
INIT_WORK(&it6625->polling_work, it6625_polling_work);
+ spin_lock_init(&it6625->audio_lock);
+ INIT_WORK(&it6625->audio_xrun_work, it6625_audio_xrun_work);
+ INIT_DELAYED_WORK(&it6625->audio_refresh_work, it6625_audio_refresh_work);
if (client->irq) {
err = devm_request_threaded_irq(&client->dev, client->irq,
@@ -2434,6 +3001,13 @@ static int it6625_probe(struct i2c_client *client)
goto err_clean_debugfs;
}
+ /* may bind a waiting sound card, so everything must be set up */
+ err = it6625_audio_register(it6625);
+ if (err) {
+ v4l2_async_unregister_subdev(sd);
+ goto err_clean_debugfs;
+ }
+
if (client->irq)
enable_irq(client->irq);
else
@@ -2442,6 +3016,12 @@ static int it6625_probe(struct i2c_client *client)
return 0;
err_clean_debugfs:
+ /*
+ * Events dispatched by the probe control update or a debugfs reader
+ * may have queued it. Disable rather than cancel it: a reader still
+ * running until the debugfs removal below must not queue it again.
+ */
+ disable_delayed_work_sync(&it6625->audio_refresh_work);
v4l2_debugfs_if_free(it6625->infoframes);
debugfs_remove_recursive(it6625->debugfs_dir);
cec_unregister_adapter(it6625->cec_adap);
@@ -2469,6 +3049,9 @@ static void it6625_remove(struct i2c_client *client)
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct it6625 *it6625 = sd_to_6625(sd);
+ /* first: waits for open capture streams to close */
+ it6625_audio_unregister(it6625);
+
v4l2_debugfs_if_free(it6625->infoframes);
if (client->irq)
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 6/9] media: i2c: it6625: add I2S audio capture DAI
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:18 ` sashiko-bot
0 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:18 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: i2c: it6625: work teardown after subdev cleanup in
it6625_probe()
--
commit 853245ce8c11b8ab4cad5a6167d0cdd74d9412b2
Author: Hermes Wu <Hermes.wu@ite.com.tw>
media: i2c: it6625: add I2S audio capture DAI
This commit registers an ASoC component with an I2S capture DAI for the
IT6625/IT6626 HDMI bridge when #sound-dai-cells is present in device tree,
and updates audio controls and capture state on status changes and
periodic refreshes.
> diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
> index 6ff5a5574b379..4a6ab00f04013 100644
> --- a/drivers/media/i2c/it6625.c
> +++ b/drivers/media/i2c/it6625.c
[ ... ]
> @@ -2434,6 +3001,13 @@ static int it6625_probe(struct i2c_client *client)
> goto err_clean_debugfs;
> }
>
> + /* may bind a waiting sound card, so everything must be set up */
> + err = it6625_audio_register(it6625);
> + if (err) {
> + v4l2_async_unregister_subdev(sd);
> + goto err_clean_debugfs;
> + }
> +
> if (client->irq)
> enable_irq(client->irq);
> else
> @@ -2442,6 +3016,12 @@ static int it6625_probe(struct i2c_client *client)
> return 0;
>
> err_clean_debugfs:
> + /*
> + * Events dispatched by the probe control update or a debugfs reader
> + * may have queued it. Disable rather than cancel it: a reader still
> + * running until the debugfs removal below must not queue it again.
> + */
> + disable_delayed_work_sync(&it6625->audio_refresh_work);
> v4l2_debugfs_if_free(it6625->infoframes);
> debugfs_remove_recursive(it6625->debugfs_dir);
> cec_unregister_adapter(it6625->cec_adap);
[Severity: Medium]
Can polling_work or hpd_delayed_work run after it6625->cec_adap and
it6625->hdl are torn down when it6625_audio_register() fails?
Before this patch, v4l2_async_register_subdev() was the last fallible step
in it6625_probe(), so no subdev callback could have queued polling_work or
hpd_delayed_work on the probe error path. With it6625_audio_register()
placed after v4l2_async_register_subdev(), a bound bridge can invoke
subdev callbacks such as it6625_isr() (which schedules polling_work) or
it6625_s_edid() (which schedules hpd_delayed_work) before
v4l2_async_unregister_subdev() runs:
CPU0 CPU1 (kworker)
it6625_probe()
v4l2_async_register_subdev(sd)
/* subdev callback: it6625_isr() */
schedule_work(&it6625->polling_work)
it6625_audio_register() -> fails
v4l2_async_unregister_subdev(sd)
goto err_clean_debugfs
cec_unregister_adapter(it6625->cec_adap)
v4l2_subdev_cleanup(sd)
v4l2_ctrl_handler_free(&it6625->hdl)
it6625_polling_work()
...
it6625_v4l2_sd_ctrl_update()
<-- use-after-free on controls
cancel_work_sync(&it6625->polling_work)
Canceling polling_work and hpd_delayed_work after
v4l2_async_unregister_subdev() (or at err_clean_debugfs, matching the
teardown order in it6625_remove()) would drain them before the CEC adapter
and V4L2 controls are freed.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=6
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 7/9] media: i2c: it6625: capture compressed and HBR audio, not just LPCM
2026-11-24 3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
` (5 preceding siblings ...)
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 ` Hermes Wu via B4 Relay
2026-11-24 3:11 ` sashiko-bot
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 3:04 ` [PATCH v2 9/9] media: uapi: it6625: remove the driver-specific audio controls Hermes Wu via B4 Relay
8 siblings, 1 reply; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
The capture DAI accepts only LPCM. The bridge also outputs compressed
IEC 61937 streams (AC-3, DTS, ...) and high bit rate (HBR) streams
(Dolby TrueHD/MAT, DTS-HD Master Audio) on the same I2S interface, but
these are rejected.
Add it6625_audio_xport(), which derives the I2S frame rate and slot
count from the stream's coding type and sampling rate. LPCM is
unchanged. A compressed stream is carried in 2 slots at its own
sampling rate, except at the HBR rates of 768 kHz and 705.6 kHz, where
one IEC 61937 stream is spread over 8 slots on 4 data lines at a quarter
of that rate. The bridge firmware also reports the HBR coding type for
some compressed streams at ordinary rates, such as 48 kHz DTS, so the
sampling rate, not the coding type, selects the layout. A compressed
stream at 768 kHz or 705.6 kHz is rejected when fewer than 4 data lines
are connected.
Use the derived rate and channel count in the eligibility check, the
startup constraints and the hw_params comparison. DSD is still
rejected. The driver does not parse the compressed data: userspace
receives the IEC 61937 words as they are.
Report the stream's type through the standard V4L2_CID_DV_RX_AUDIO_TYPE
control, so that userspace can tell LPCM, compressed, HBR and one-bit
streams apart without parsing the audio InfoFrame.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/media/i2c/it6625.c | 109 ++++++++++++++++++++++++++++++++++++++-------
1 file changed, 93 insertions(+), 16 deletions(-)
diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
index 4a6ab00f04013b874e9af13f26e88f90fcbc3989..72ca1d4ecdc932609f1a38129bfa1e188a024ddf 100644
--- a/drivers/media/i2c/it6625.c
+++ b/drivers/media/i2c/it6625.c
@@ -101,6 +101,9 @@ MODULE_PARM_DESC(debug, "debug level (0-3)");
#define REG_HDMI_AUDIO_INFO3 0x6D
#define M_AUD_TYPE GENMASK(1, 0)
#define AUD_TYPE_LPCM 0
+#define AUD_TYPE_NLPCM 1
+#define AUD_TYPE_HBR 2
+#define AUD_TYPE_DSD 3
#define B_AUD_MS BIT(2)
#define B_AUD_3D BIT(3)
@@ -119,6 +122,9 @@ MODULE_PARM_DESC(debug, "debug level (0-3)");
#define IT6625_AUDIO_MAX_LANES 8
#define IT6625_AUDIO_MAX_CHANNELS 8
#define IT6625_AUDIO_MAX_RATE 192000
+/* HBR: one IEC 61937 stream spread over 4 lanes (8 slots) per frame */
+#define IT6625_AUDIO_HBR_LANES 4
+#define IT6625_AUDIO_HBR_CHANNELS 8
/* status re-check period while a capture stream is open */
#define IT6625_AUDIO_REFRESH_MS 200
/* re-checks after an event that left present audio without a valid rate */
@@ -327,6 +333,7 @@ struct it6625 {
struct v4l2_ctrl *ctrl_5v_detect;
struct v4l2_ctrl *ctrl_audio_sampling_rate;
struct v4l2_ctrl *ctrl_audio_present;
+ struct v4l2_ctrl *ctrl_audio_type;
struct v4l2_ctrl *ctrl_link_freq;
struct delayed_work hpd_delayed_work;
@@ -1065,6 +1072,14 @@ static void it6625_audio_refresh(struct it6625 *it6625)
spin_unlock_irqrestore(&it6625->audio_lock, flags);
}
+/* AUD_TYPE (2 bits) to V4L2_CID_DV_RX_AUDIO_TYPE */
+static const u8 it6625_audio_type_to_v4l2[] = {
+ [AUD_TYPE_LPCM] = V4L2_DV_RX_AUDIO_TYPE_LPCM,
+ [AUD_TYPE_NLPCM] = V4L2_DV_RX_AUDIO_TYPE_IEC61937,
+ [AUD_TYPE_HBR] = V4L2_DV_RX_AUDIO_TYPE_HBR,
+ [AUD_TYPE_DSD] = V4L2_DV_RX_AUDIO_TYPE_ONE_BIT,
+};
+
/*
* Selecting the published sample and writing both controls happen under
* the control handler lock, so a stale sample never overwrites a newer one.
@@ -1086,6 +1101,9 @@ static int it6625_audio_update_ctrls(struct it6625 *it6625)
if (!ret)
ret = __v4l2_ctrl_s_ctrl(it6625->ctrl_audio_present,
info.present);
+ if (!ret)
+ ret = __v4l2_ctrl_s_ctrl(it6625->ctrl_audio_type,
+ it6625_audio_type_to_v4l2[info.stream.type]);
v4l2_ctrl_unlock(it6625->ctrl_audio_present);
@@ -2138,7 +2156,7 @@ static int it6625_v4l2_init_controls(struct v4l2_subdev *sd)
bool cphy_3trio = it6625->bus_type == V4L2_MBUS_CSI2_CPHY &&
it6625->csi_lanes == 3;
- v4l2_ctrl_handler_init(hdl, 4);
+ v4l2_ctrl_handler_init(hdl, 5);
it6625->ctrl_5v_detect =
v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_DV_RX_POWER_PRESENT,
@@ -2150,6 +2168,10 @@ static int it6625_v4l2_init_controls(struct v4l2_subdev *sd)
NULL);
it6625->ctrl_audio_present =
v4l2_ctrl_new_custom(hdl, &it6625_ctrl_audio_present, NULL);
+ it6625->ctrl_audio_type =
+ v4l2_ctrl_new_std_menu(hdl, NULL, V4L2_CID_DV_RX_AUDIO_TYPE,
+ V4L2_DV_RX_AUDIO_TYPE_ONE_BIT, 0,
+ V4L2_DV_RX_AUDIO_TYPE_LPCM);
it6625->ctrl_link_freq =
v4l2_ctrl_new_int_menu(hdl, NULL, V4L2_CID_LINK_FREQ, 0, 0,
cphy_3trio ? it6626_cphy_3trio_link_freq :
@@ -2193,26 +2215,74 @@ static unsigned int it6625_audio_max_channels(const struct it6625 *it6625)
return min(2U * it6625->audio_lanes, IT6625_AUDIO_MAX_CHANNELS);
}
+/*
+ * I2S frame rate and slot count that carry this stream. Pure, callable in
+ * atomic context; returns -ENODEV for a stream the I2S output can't carry.
+ *
+ * LPCM goes out as is. A compressed IEC 61937 stream at up to 192 kHz
+ * takes 2 slots at its own sampling rate, whatever channel count the
+ * source signals. An HBR stream (AUD_FS 768 or 705.6 kHz) is one IEC 61937
+ * stream at 4x the frame rate spread over 4 lanes: 8 slots at a quarter of
+ * that rate.
+ *
+ * The firmware doesn't keep AUD_TYPE to its documented meaning: it reports
+ * HBR for a plain 48 kHz DTS stream too. So the rate, not NLPCM vs. HBR,
+ * selects the layout of a compressed stream.
+ */
+static int it6625_audio_xport(const struct it6625 *it6625,
+ const struct it6625_audio_stream *s,
+ u32 *rate, unsigned int *channels)
+{
+ u32 fs = it6625_audio_fs_to_rate(s->fs_code);
+
+ if (!fs)
+ return -ENODEV;
+
+ switch (s->type) {
+ case AUD_TYPE_LPCM:
+ *rate = fs;
+ *channels = s->channels;
+ break;
+ case AUD_TYPE_NLPCM:
+ case AUD_TYPE_HBR:
+ if (fs == 768000 || fs == 705600) {
+ *rate = fs / IT6625_AUDIO_HBR_LANES;
+ *channels = IT6625_AUDIO_HBR_CHANNELS;
+ } else {
+ *rate = fs;
+ *channels = 2;
+ }
+ break;
+ default:
+ return -ENODEV;
+ }
+
+ if (*rate > IT6625_AUDIO_MAX_RATE)
+ return -ENODEV;
+
+ if (*channels < 2 || *channels % 2 ||
+ *channels > it6625_audio_max_channels(it6625))
+ return -ENODEV;
+
+ return 0;
+}
+
/* can this audio status be captured? Pure check, callable in atomic context. */
static int it6625_audio_check(const struct it6625 *it6625,
const struct it6625_audio_info *info)
{
const struct it6625_audio_stream *s = &info->stream;
- u32 rate = it6625_audio_fs_to_rate(s->fs_code);
+ unsigned int channels;
+ u32 rate;
if (!info->read_ok || !info->vid_stable || !info->present ||
info->avmute)
return -ENODEV;
- if (s->out_if != AUD_OUT_IF_I2S || s->type != AUD_TYPE_LPCM ||
- s->multi_stream || s->is_3d)
- return -ENODEV;
-
- if (!rate || rate > IT6625_AUDIO_MAX_RATE)
+ if (s->out_if != AUD_OUT_IF_I2S || s->multi_stream || s->is_3d)
return -ENODEV;
- if (s->channels < 2 || s->channels % 2 ||
- s->channels > it6625_audio_max_channels(it6625))
+ if (it6625_audio_xport(it6625, s, &rate, &channels))
return -ENODEV;
if (!it6625_audio_wl_bits(s->i2s_wl))
@@ -2288,8 +2358,9 @@ static int it6625_dai_startup(struct snd_pcm_substream *substream,
struct it6625 *it6625 = dai_to_6625(dai);
struct snd_pcm_runtime *runtime = substream->runtime;
struct it6625_audio_info info;
+ unsigned int channels;
unsigned long flags;
- u32 gen;
+ u32 gen, rate;
int ret;
it6625_s_ctrl_audio(&it6625->sd);
@@ -2305,13 +2376,16 @@ static int it6625_dai_startup(struct snd_pcm_substream *substream,
if (ret)
return ret;
+ /* the check above passed, so this can't fail */
+ it6625_audio_xport(it6625, &info.stream, &rate, &channels);
+
ret = snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_RATE,
- it6625_audio_fs_to_rate(info.stream.fs_code));
+ rate);
if (ret < 0)
return ret;
ret = snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_CHANNELS,
- info.stream.channels);
+ channels);
if (ret < 0)
return ret;
@@ -2389,18 +2463,21 @@ static int it6625_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct it6625 *it6625 = dai_to_6625(dai);
- const struct it6625_audio_stream *s;
+ unsigned int channels;
unsigned long flags;
+ u32 rate;
int ret;
it6625_s_ctrl_audio(&it6625->sd);
spin_lock_irqsave(&it6625->audio_lock, flags);
ret = it6625_audio_validate_locked(it6625);
- s = &it6625->audio_accepted;
+ if (!ret)
+ ret = it6625_audio_xport(it6625, &it6625->audio_accepted,
+ &rate, &channels);
if (!ret &&
- (params_rate(params) != it6625_audio_fs_to_rate(s->fs_code) ||
- params_channels(params) != s->channels ||
+ (params_rate(params) != rate ||
+ params_channels(params) != channels ||
params_format(params) != SNDRV_PCM_FORMAT_S32_LE))
ret = -EINVAL;
spin_unlock_irqrestore(&it6625->audio_lock, flags);
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 7/9] media: i2c: it6625: capture compressed and HBR audio, not just LPCM
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:11 ` sashiko-bot
0 siblings, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:11 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: i2c: it6625: raw AUD_TYPE reported in
it6625_audio_update_ctrls()
--
commit 2ad342a8f95e2e510b1b156099c86836ba734db4
Author: Hermes Wu <Hermes.wu@ite.com.tw>
media: i2c: it6625: capture compressed and HBR audio, not just LPCM
This commit extends the IT6625/IT6626 I2S capture DAI to support compressed
IEC 61937 and HBR audio streams and exposes the stream coding type through
the V4L2_CID_DV_RX_AUDIO_TYPE control.
> diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
> index 4a6ab00f04013..72ca1d4ecdc93 100644
> --- a/drivers/media/i2c/it6625.c
> +++ b/drivers/media/i2c/it6625.c
[ ... ]
> @@ -1086,6 +1101,9 @@ static int it6625_audio_update_ctrls(struct it6625 *it6625)
> if (!ret)
> ret = __v4l2_ctrl_s_ctrl(it6625->ctrl_audio_present,
> info.present);
> + if (!ret)
> + ret = __v4l2_ctrl_s_ctrl(it6625->ctrl_audio_type,
> + it6625_audio_type_to_v4l2[info.stream.type]);
[Severity: Medium]
Should it6625_audio_update_ctrls() also check the sampling rate before
reporting V4L2_DV_RX_AUDIO_TYPE_HBR?
As noted in it6625_audio_xport(), the bridge firmware reports AUD_TYPE_HBR
for ordinary compressed streams such as 48 kHz DTS. Mapping
info.stream.type directly through it6625_audio_type_to_v4l2[] reports
V4L2_DV_RX_AUDIO_TYPE_HBR instead of V4L2_DV_RX_AUDIO_TYPE_IEC61937 for
those non-HBR streams.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=7
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 8/9] media: i2c: it6625: use the standard audio rate and present controls
2026-11-24 3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
` (6 preceding siblings ...)
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 ` Hermes Wu via B4 Relay
2026-11-24 3:15 ` sashiko-bot
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
8 siblings, 2 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
The driver reports the HDMI audio sampling rate and whether audio is
present through the driver-specific controls
V4L2_CID_IT6625_AUDIO_SAMPLING_RATE and V4L2_CID_IT6625_AUDIO_PRESENT.
There are now standard controls for both.
Report V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE and
V4L2_CID_DV_RX_AUDIO_PRESENT instead, with the same range and the same
values. The driver-specific control IDs are no longer used.
---
drivers/media/i2c/it6625.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)
diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
index 72ca1d4ecdc932609f1a38129bfa1e188a024ddf..e4487e8111b94b2fa9f599e37ecd2b8a11425862 100644
--- a/drivers/media/i2c/it6625.c
+++ b/drivers/media/i2c/it6625.c
@@ -2127,28 +2127,6 @@ static const struct v4l2_subdev_internal_ops it6625_internal_ops = {
.init_state = it6625_init_state,
};
-static const struct v4l2_ctrl_config it6625_ctrl_audio_sampling_rate = {
- .id = V4L2_CID_IT6625_AUDIO_SAMPLING_RATE,
- .name = "Audio Sampling Rate",
- .type = V4L2_CTRL_TYPE_INTEGER,
- .min = 0,
- .max = 1536000,
- .step = 1,
- .def = 0,
- .flags = V4L2_CTRL_FLAG_READ_ONLY,
-};
-
-static const struct v4l2_ctrl_config it6625_ctrl_audio_present = {
- .id = V4L2_CID_IT6625_AUDIO_PRESENT,
- .name = "Audio Present",
- .type = V4L2_CTRL_TYPE_BOOLEAN,
- .min = 0,
- .max = 1,
- .step = 1,
- .def = 0,
- .flags = V4L2_CTRL_FLAG_READ_ONLY,
-};
-
static int it6625_v4l2_init_controls(struct v4l2_subdev *sd)
{
struct it6625 *it6625 = sd_to_6625(sd);
@@ -2163,11 +2141,11 @@ static int it6625_v4l2_init_controls(struct v4l2_subdev *sd)
0, 1, 0, 0);
it6625->ctrl_audio_sampling_rate =
- v4l2_ctrl_new_custom(hdl,
- &it6625_ctrl_audio_sampling_rate,
- NULL);
+ v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE,
+ 0, 1536000, 1, 0);
it6625->ctrl_audio_present =
- v4l2_ctrl_new_custom(hdl, &it6625_ctrl_audio_present, NULL);
+ v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_DV_RX_AUDIO_PRESENT,
+ 0, 1, 1, 0);
it6625->ctrl_audio_type =
v4l2_ctrl_new_std_menu(hdl, NULL, V4L2_CID_DV_RX_AUDIO_TYPE,
V4L2_DV_RX_AUDIO_TYPE_ONE_BIT, 0,
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 8/9] media: i2c: it6625: use the standard audio rate and present controls
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 3:15 ` sashiko-bot
2026-11-24 4:04 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:15 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: i2c: it6625: missing Signed-off-by trailer in commit
message
--
commit df45ad662e0b631be85cdfcc0e3f26a74fc6f35e
Author: Hermes Wu <Hermes.wu@ite.com.tw>
> media: i2c: it6625: use the standard audio rate and present controls
>
> The driver reports the HDMI audio sampling rate and whether audio is
> present through the driver-specific controls
> V4L2_CID_IT6625_AUDIO_SAMPLING_RATE and V4L2_CID_IT6625_AUDIO_PRESENT.
> There are now standard controls for both.
>
> Report V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE and
> V4L2_CID_DV_RX_AUDIO_PRESENT instead, with the same range and the same
> values. The driver-specific control IDs are no longer used.
[Severity: High]
The commit message is missing a Signed-off-by trailer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=8
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH v2 8/9] media: i2c: it6625: use the standard audio rate and present controls
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 3:15 ` sashiko-bot
@ 2026-11-24 4:04 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: Hermes.Wu @ 2026-11-24 4:04 UTC (permalink / raw)
To: Hermes.Wu, mchehab, robh, krzk+dt, conor+dt, hverkuil+cisco,
hverkuil
Cc: linux-media, devicetree, linux-kernel, broonie, lgirdwood,
linux-sound, linux-api
The Signed-off-by is missing from this patch, sorry about that:
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
The next version will carry it in the patch itself.
Best regards,
Hermes
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 9/9] media: uapi: it6625: remove the driver-specific audio controls
2026-11-24 3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
` (7 preceding siblings ...)
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 3:04 ` Hermes Wu via B4 Relay
2026-11-24 3:11 ` sashiko-bot
2026-11-24 4:04 ` Hermes.Wu
8 siblings, 2 replies; 22+ messages in thread
From: Hermes Wu via B4 Relay @ 2026-11-24 3:04 UTC (permalink / raw)
To: Hermes Wu, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Hans Verkuil, Hans Verkuil
Cc: linux-media, devicetree, linux-kernel, Mark Brown, Liam Girdwood,
linux-sound, linux-api, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
V4L2_CID_IT6625_AUDIO_SAMPLING_RATE and V4L2_CID_IT6625_AUDIO_PRESENT
have been replaced by the standard V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE
and V4L2_CID_DV_RX_AUDIO_PRESENT controls, and the driver no longer uses
them. They were added together with the driver and are not part of any
released kernel yet.
Remove the uAPI header and the V4L2_CID_USER_IT6625_BASE reservation.
---
MAINTAINERS | 1 -
drivers/media/i2c/it6625.c | 1 -
include/uapi/linux/it6625.h | 25 -------------------------
include/uapi/linux/v4l2-controls.h | 6 ------
4 files changed, 33 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index f4456f4589a1b86b140ab578d149884d46a3320a..a7a315f0e80585be26fe2b52a62c19e469cb5703 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14271,7 +14271,6 @@ S: Maintained
T: git git://linuxtv.org/media.git
F: Documentation/devicetree/bindings/media/i2c/ite,it6625.yaml
F: drivers/media/i2c/it6625.c
-F: include/uapi/linux/it6625.h
IVTV VIDEO4LINUX DRIVER
M: Andy Walls <awalls@md.metrocast.net>
diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
index e4487e8111b94b2fa9f599e37ecd2b8a11425862..64c1cec26edfcb0e0105e00e1b7ba5960252aae7 100644
--- a/drivers/media/i2c/it6625.c
+++ b/drivers/media/i2c/it6625.c
@@ -33,7 +33,6 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
-#include <uapi/linux/it6625.h>
static int debug;
module_param(debug, int, 0644);
diff --git a/include/uapi/linux/it6625.h b/include/uapi/linux/it6625.h
deleted file mode 100644
index a895658aaf6a80d3fb624cdece33c5135161c72d..0000000000000000000000000000000000000000
--- a/include/uapi/linux/it6625.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
-/*
- * Controls header for IT6625/IT6626 driver
- */
-
-#ifndef _UAPI_LINUX_IT6625_H
-#define _UAPI_LINUX_IT6625_H
-
-#include <linux/v4l2-controls.h>
-
-/*
- * Currently detected HDMI audio sampling rate, in Hz. Read-only.
- * 0 means the rate is unavailable/unknown: no audio is currently
- * present on the input, the hardware reported a sample-rate id this
- * driver doesn't recognize, or the status read itself failed. Never a
- * literal 0 Hz sample rate.
- */
-#define V4L2_CID_IT6625_AUDIO_SAMPLING_RATE (V4L2_CID_USER_IT6625_BASE + 0)
-
-/*
- * Whether HDMI audio is currently present on the input. Read-only.
- */
-#define V4L2_CID_IT6625_AUDIO_PRESENT (V4L2_CID_USER_IT6625_BASE + 1)
-
-#endif /* _UAPI_LINUX_IT6625_H */
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 942a1df3057e3e49c9111f6a27ec1883d964bf64..a2d4ea909e01f9b705d30b680ef382f5fcd39714 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -249,12 +249,6 @@ enum v4l2_colorfx {
*/
#define V4L2_CID_USER_DCMIPP_BASE (V4L2_CID_USER_BASE + 0x1240)
-/*
- * The base for IT6625/IT6626 driver controls.
- * We reserve 16 controls for this driver.
- */
-#define V4L2_CID_USER_IT6625_BASE (V4L2_CID_USER_BASE + 0x1250)
-
/* MPEG-class control IDs */
/* The MPEG controls are applicable to all codec controls
* and the 'MPEG' part of the define is historical */
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 9/9] media: uapi: it6625: remove the driver-specific audio controls
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 3:11 ` sashiko-bot
2026-11-24 4:04 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: sashiko-bot @ 2026-11-24 3:11 UTC (permalink / raw)
To: Hermes Wu; +Cc: devicetree, linux-sound, robh, conor+dt, media-ci
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: uapi: it6625: missing Signed-off-by trailer in commit
message
--
commit bffb6bb92c0f2a8d28eb18c2023b0a2bf9862359
Author: Hermes Wu <Hermes.wu@ite.com.tw>
> media: uapi: it6625: remove the driver-specific audio controls
>
> V4L2_CID_IT6625_AUDIO_SAMPLING_RATE and V4L2_CID_IT6625_AUDIO_PRESENT
> have been replaced by the standard V4L2_CID_DV_RX_AUDIO_SAMPLING_RATE
> and V4L2_CID_DV_RX_AUDIO_PRESENT controls, and the driver no longer uses
> them. They were added together with the driver and are not part of any
> released kernel yet.
>
> Remove the uAPI header and the V4L2_CID_USER_IT6625_BASE reservation.
[Severity: High]
The commit message is missing a Signed-off-by trailer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=9
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH v2 9/9] media: uapi: it6625: remove the driver-specific audio controls
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 3:11 ` sashiko-bot
@ 2026-11-24 4:04 ` Hermes.Wu
1 sibling, 0 replies; 22+ messages in thread
From: Hermes.Wu @ 2026-11-24 4:04 UTC (permalink / raw)
To: Hermes.Wu, mchehab, robh, krzk+dt, conor+dt, hverkuil+cisco,
hverkuil
Cc: linux-media, devicetree, linux-kernel, broonie, lgirdwood,
linux-sound, linux-api
The Signed-off-by is missing from this patch, sorry about that:
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
The next version will carry it in the patch itself.
Best regards,
Hermes
^ permalink raw reply [flat|nested] 22+ messages in thread