public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: fsl: add bitcount and timestamp controls
@ 2026-02-06  8:43 Shengjiu Wang
  2026-02-06  8:43 ` [PATCH 1/2] ASoC: fsl_sai: " Shengjiu Wang
  2026-02-06  8:43 ` [PATCH 2/2] ASoC: fsl_xcvr: " Shengjiu Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Shengjiu Wang @ 2026-02-06  8:43 UTC (permalink / raw)
  To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
	broonie, perex, tiwai, linux-sound, linuxppc-dev, linux-kernel

The SAI and XCVR have the timestamp counters and bit counters, which can
be used by software to track the progress of the transmitter and receiver.
They can also be used to calculate the relative frequency of the bit clock
against the bus interface clock.

Shengjiu Wang (2):
  ASoC: fsl_sai: add bitcount and timestamp controls
  ASoC: fsl_xcvr: add bitcount and timestamp controls

 sound/soc/fsl/fsl_sai.c  | 52 +++++++++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_xcvr.c | 56 ++++++++++++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_xcvr.h | 10 +++++++
 3 files changed, 118 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ASoC: fsl_sai: add bitcount and timestamp controls
  2026-02-06  8:43 [PATCH 0/2] ASoC: fsl: add bitcount and timestamp controls Shengjiu Wang
@ 2026-02-06  8:43 ` Shengjiu Wang
  2026-02-06 14:37   ` Mark Brown
  2026-02-06  8:43 ` [PATCH 2/2] ASoC: fsl_xcvr: " Shengjiu Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Shengjiu Wang @ 2026-02-06  8:43 UTC (permalink / raw)
  To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
	broonie, perex, tiwai, linux-sound, linuxppc-dev, linux-kernel

The transmitter and receiver implement separate timestamp counters and
bit counters. The bit counter increments at the end of each bit in a
frame whenever the transmitter or receiver is enabled. The bit counter
can be reset by software. The timestamp counter increments on the bus
interface clock whenever it is enabled. The current value of the
timestamp counter is latched whenever the bit counter increments.
Reading the bit counter register will cause the latched timestamp
value to be saved in the bit counter timestamp register. The timestamp
counter can be reset by software, this also resets the latched timestamp
value and the bit counter timestamp register.

The timestamp counter and bit counter can be used by software to track
the progress of the transmitter and receiver. It can also be used to
calculate the relative frequency of the bit clock against the bus
interface clock.

These bitcount and timestamp registers are volatile, and supported when
the module has timestamp features.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/fsl_sai.c | 52 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 148e09e58dfa..f07aa664d276 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -41,6 +41,38 @@ static const struct snd_pcm_hw_constraint_list fsl_sai_rate_constraints = {
 	.list = fsl_sai_rates,
 };
 
+static const char * const inc_mode[] = {
+	"On enabled and bitcount increment", "On enabled"
+};
+
+static const struct soc_enum tstmp_enum[] = {
+	SOC_ENUM_SINGLE(FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_TSINC),
+			ARRAY_SIZE(inc_mode), inc_mode),
+	SOC_ENUM_SINGLE(FSL_SAI_RTCTL, __bf_shf(FSL_SAI_xTCTL_TSINC),
+			ARRAY_SIZE(inc_mode), inc_mode),
+};
+
+static const struct snd_kcontrol_new fsl_sai_timestamp_ctrls[] = {
+	SOC_SINGLE("Transmit Timestamp Control Switch", FSL_SAI_TTCTL,
+		   __bf_shf(FSL_SAI_xTCTL_TSEN), 1, 0),
+	SOC_ENUM("Transmit Timestamp Increment", tstmp_enum[0]),
+	SOC_SINGLE("Transmit Timestamp Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RTSC), 1, 0),
+	SOC_SINGLE("Transmit Bit Counter Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RBC), 1, 0),
+	SOC_SINGLE_XR_SX("Transmit Timestamp Counter", FSL_SAI_TTCTN, 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Transmit Bit Counter", FSL_SAI_TBCTN, 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Transmit Latched Timestamp Counter", FSL_SAI_TTCAP,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE("Receive Timestamp Control Switch", FSL_SAI_RTCTL,
+		   __bf_shf(FSL_SAI_xTCTL_TSEN), 1, 0),
+	SOC_ENUM("Receive Timestamp Increment", tstmp_enum[1]),
+	SOC_SINGLE("Receive Timestamp Reset", FSL_SAI_RTCTL, __bf_shf(FSL_SAI_xTCTL_RTSC), 1, 0),
+	SOC_SINGLE("Receive Bit Counter Reset", FSL_SAI_RTCTL, __bf_shf(FSL_SAI_xTCTL_RBC), 1, 0),
+	SOC_SINGLE_XR_SX("Receive Timestamp Counter", FSL_SAI_RTCTN, 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Receive Bit Counter", FSL_SAI_RBCTN, 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Receive Latched Timestamp Counter", FSL_SAI_RTCAP,
+			 1, 32, 0, 0xffffffff, 0),
+};
+
 /**
  * fsl_sai_dir_is_synced - Check if stream is synced by the opposite stream
  *
@@ -1010,6 +1042,17 @@ static int fsl_sai_dai_resume(struct snd_soc_component *component)
 	return 0;
 }
 
+static int fsl_sai_component_probe(struct snd_soc_component *component)
+{
+	struct fsl_sai *sai = snd_soc_component_get_drvdata(component);
+
+	if (sai->verid.feature & FSL_SAI_VERID_TSTMP_EN)
+		snd_soc_add_component_controls(component, fsl_sai_timestamp_ctrls,
+					       ARRAY_SIZE(fsl_sai_timestamp_ctrls));
+
+	return 0;
+}
+
 static struct snd_soc_dai_driver fsl_sai_dai_template[] = {
 	{
 		.name = "sai-tx-rx",
@@ -1063,6 +1106,7 @@ static struct snd_soc_dai_driver fsl_sai_dai_template[] = {
 
 static const struct snd_soc_component_driver fsl_component = {
 	.name			= "fsl-sai",
+	.probe			= fsl_sai_component_probe,
 	.resume			= fsl_sai_dai_resume,
 	.legacy_dai_naming	= 1,
 };
@@ -1211,6 +1255,14 @@ static bool fsl_sai_volatile_reg(struct device *dev, unsigned int reg)
 	case FSL_SAI_RDR5:
 	case FSL_SAI_RDR6:
 	case FSL_SAI_RDR7:
+	case FSL_SAI_TTCTN:
+	case FSL_SAI_RTCTN:
+	case FSL_SAI_TTCTL:
+	case FSL_SAI_TBCTN:
+	case FSL_SAI_TTCAP:
+	case FSL_SAI_RTCTL:
+	case FSL_SAI_RBCTN:
+	case FSL_SAI_RTCAP:
 		return true;
 	default:
 		return false;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ASoC: fsl_xcvr: add bitcount and timestamp controls
  2026-02-06  8:43 [PATCH 0/2] ASoC: fsl: add bitcount and timestamp controls Shengjiu Wang
  2026-02-06  8:43 ` [PATCH 1/2] ASoC: fsl_sai: " Shengjiu Wang
@ 2026-02-06  8:43 ` Shengjiu Wang
  2026-02-06 16:19   ` kernel test robot
  1 sibling, 1 reply; 7+ messages in thread
From: Shengjiu Wang @ 2026-02-06  8:43 UTC (permalink / raw)
  To: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
	broonie, perex, tiwai, linux-sound, linuxppc-dev, linux-kernel

The transmitter and receiver implement separate timestamp counters and
bit counters. The bit counter increments at the end of each bit in a
frame whenever the transmitter or receiver is enabled. The bit counter
can be reset by software. The timestamp counter increments on the bus
interface clock whenever it is enabled. The current value of the
timestamp counter is latched whenever the bit counter increments.
Reading the bit counter register will cause the latched timestamp
value to be saved in the bit counter timestamp register. The timestamp
counter can be reset by software, this also resets the latched timestamp
value and the bit counter timestamp register.

The timestamp counter and bit counter can be used by software to track
the progress of the transmitter and receiver. It can also be used to
calculate the relative frequency of the bit clock against the bus
interface clock.

As there are three regmap handlers defined in this driver, explicitly
call the snd_soc_component_init_regmap() to init regmap handler for the
component.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/fsl_xcvr.c | 56 ++++++++++++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_xcvr.h | 10 +++++++
 2 files changed, 66 insertions(+)

diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index 5de93f458b56..d9e76ea9cf07 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -62,6 +62,50 @@ struct fsl_xcvr {
 	u32 spdif_constr_rates_list[SPDIF_NUM_RATES];
 };
 
+static const char * const inc_mode[] = {
+	"On enabled and bitcount increment", "On enabled"
+};
+
+static const struct soc_enum tstmp_enum[] = {
+	SOC_ENUM_SINGLE(FSL_XCVR_TX_DPTH_CNTR_CTRL, __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_TSINC),
+			ARRAY_SIZE(inc_mode), inc_mode),
+	SOC_ENUM_SINGLE(FSL_XCVR_RX_DPTH_CNTR_CTRL, __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_TSINC),
+			ARRAY_SIZE(inc_mode), inc_mode),
+};
+
+static const struct snd_kcontrol_new fsl_xcvr_timestamp_ctrls[] = {
+	SOC_SINGLE("Transmit Timestamp Control Switch", FSL_XCVR_TX_DPTH_CNTR_CTRL,
+		   __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_TSEN), 1, 0),
+	SOC_ENUM("Transmit Timestamp Increment", tstmp_enum[0]),
+	SOC_SINGLE("Transmit Timestamp Reset", FSL_XCVR_TX_DPTH_CNTR_CTRL,
+		   __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_RTSC), 1, 0),
+	SOC_SINGLE("Transmit Bit Counter Reset", FSL_XCVR_TX_DPTH_CNTR_CTRL,
+		   __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_RBC), 1, 0),
+	SOC_SINGLE_XR_SX("Transmit Timestamp Counter", FSL_XCVR_TX_DPTH_TSCR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Transmit Bit Counter", FSL_XCVR_TX_DPTH_BCR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Transmit Bit Count Timestamp", FSL_XCVR_TX_DPTH_BCTR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Transmit Latched Timestamp Counter", FSL_XCVR_TX_DPTH_BCRR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE("Receive Timestamp Control Switch", FSL_XCVR_RX_DPTH_CNTR_CTRL,
+		   __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_TSEN), 1, 0),
+	SOC_ENUM("Receive Timestamp Increment", tstmp_enum[1]),
+	SOC_SINGLE("Receive Timestamp Reset", FSL_XCVR_RX_DPTH_CNTR_CTRL,
+		   __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_RTSC), 1, 0),
+	SOC_SINGLE("Receive Bit Counter Reset", FSL_XCVR_RX_DPTH_CNTR_CTRL,
+		   __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_RBC), 1, 0),
+	SOC_SINGLE_XR_SX("Receive Timestamp Counter", FSL_XCVR_RX_DPTH_TSCR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Receive Bit Counter", FSL_XCVR_RX_DPTH_BCR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Receive Bit Count Timestamp", FSL_XCVR_RX_DPTH_BCTR,
+			 1, 32, 0, 0xffffffff, 0),
+	SOC_SINGLE_XR_SX("Receive Latched Timestamp Counter", FSL_XCVR_RX_DPTH_BCRR,
+			 1, 32, 0, 0xffffffff, 0),
+};
+
 static const struct fsl_xcvr_pll_conf {
 	u8 mfi;   /* min=0x18, max=0x38 */
 	u32 mfn;  /* signed int, 2's compl., min=0x3FFF0000, max=0x00010000 */
@@ -1073,8 +1117,20 @@ static struct snd_soc_dai_driver fsl_xcvr_dai = {
 	},
 };
 
+static int fsl_xcvr_component_probe(struct snd_soc_component *component)
+{
+	struct fsl_xcvr *xcvr = snd_soc_component_get_drvdata(component);
+
+	snd_soc_component_init_regmap(component, xcvr->regmap);
+
+	return 0;
+}
+
 static const struct snd_soc_component_driver fsl_xcvr_comp = {
 	.name			= "fsl-xcvr-dai",
+	.probe			= fsl_xcvr_component_probe,
+	.controls		= fsl_xcvr_timestamp_ctrls,
+	.num_controls		= ARRAY_SIZE(fsl_xcvr_timestamp_ctrls),
 	.legacy_dai_naming	= 1,
 };
 
diff --git a/sound/soc/fsl/fsl_xcvr.h b/sound/soc/fsl/fsl_xcvr.h
index dade3945cc0c..1c3636567763 100644
--- a/sound/soc/fsl/fsl_xcvr.h
+++ b/sound/soc/fsl/fsl_xcvr.h
@@ -233,6 +233,16 @@
 #define FSL_XCVR_TX_DPTH_CTRL_CLK_RATIO		BIT(29)
 #define FSL_XCVR_TX_DPTH_CTRL_TM_NO_PRE_BME	GENMASK(31, 30)
 
+#define FSL_XCVR_RX_DPTH_CNTR_CTRL_TSEN		BIT(0)
+#define FSL_XCVR_RX_DPTH_CNTR_CTRL_TSINC	BIT(1)
+#define FSL_XCVR_RX_DPTH_CNTR_CTRL_RBC		BIT(8)
+#define FSL_XCVR_RX_DPTH_CNTR_CTRL_RTSC		BIT(9)
+
+#define FSL_XCVR_TX_DPTH_CNTR_CTRL_TSEN		BIT(0)
+#define FSL_XCVR_TX_DPTH_CNTR_CTRL_TSINC	BIT(1)
+#define FSL_XCVR_TX_DPTH_CNTR_CTRL_RBC		BIT(8)
+#define FSL_XCVR_TX_DPTH_CNTR_CTRL_RTSC		BIT(9)
+
 #define FSL_XCVR_PHY_AI_CTRL_AI_RESETN		BIT(15)
 #define FSL_XCVR_PHY_AI_CTRL_AI_RWB		BIT(31)
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ASoC: fsl_sai: add bitcount and timestamp controls
  2026-02-06  8:43 ` [PATCH 1/2] ASoC: fsl_sai: " Shengjiu Wang
@ 2026-02-06 14:37   ` Mark Brown
  2026-02-09  3:16     ` Shengjiu Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2026-02-06 14:37 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
	perex, tiwai, linux-sound, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

On Fri, Feb 06, 2026 at 04:43:33PM +0800, Shengjiu Wang wrote:

> +	SOC_ENUM("Transmit Timestamp Increment", tstmp_enum[0]),

Don't have arrays of enums with magic indexes into them - this is just
error prone and hard to follow.  The normal thing is to declare a
separtae variable for each enum, or if you *must* use an array use
named constants at both ends to index into it (but that's not
meaningfully different to just having multiple variables...).

> +	SOC_SINGLE("Transmit Timestamp Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RTSC), 1, 0),
> +	SOC_SINGLE("Transmit Bit Counter Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RBC), 1, 0),

__bf_shf()?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] ASoC: fsl_xcvr: add bitcount and timestamp controls
  2026-02-06  8:43 ` [PATCH 2/2] ASoC: fsl_xcvr: " Shengjiu Wang
@ 2026-02-06 16:19   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-02-06 16:19 UTC (permalink / raw)
  To: Shengjiu Wang, shengjiu.wang, Xiubo.Lee, festevam, nicoleotsuka,
	lgirdwood, broonie, perex, tiwai, linux-sound, linuxppc-dev,
	linux-kernel
  Cc: llvm, oe-kbuild-all

Hi Shengjiu,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.19-rc8 next-20260205]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shengjiu-Wang/ASoC-fsl_sai-add-bitcount-and-timestamp-controls/20260206-164423
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20260206084334.483404-3-shengjiu.wang%40nxp.com
patch subject: [PATCH 2/2] ASoC: fsl_xcvr: add bitcount and timestamp controls
config: hexagon-randconfig-002-20260206 (https://download.01.org/0day-ci/archive/20260207/202602070032.CtJMTCOn-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260207/202602070032.CtJMTCOn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602070032.CtJMTCOn-lkp@intel.com/

All errors (new ones prefixed by >>):

>> sound/soc/fsl/fsl_xcvr.c:70:46: error: call to undeclared function '__bf_shf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      70 |         SOC_ENUM_SINGLE(FSL_XCVR_TX_DPTH_CNTR_CTRL, __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_TSINC),
         |                                                     ^
>> sound/soc/fsl/fsl_xcvr.c:70:46: error: initializer element is not a compile-time constant
      70 |         SOC_ENUM_SINGLE(FSL_XCVR_TX_DPTH_CNTR_CTRL, __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_TSINC),
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      71 |                         ARRAY_SIZE(inc_mode), inc_mode),
         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/sound/soc.h:215:24: note: expanded from macro 'SOC_ENUM_SINGLE'
     215 |         SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
         |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/sound/soc.h:211:27: note: expanded from macro 'SOC_ENUM_DOUBLE'
     211 | {       .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
         |                                 ^~~~~~~~
   sound/soc/fsl/fsl_xcvr.c:78:6: error: initializer element is not a compile-time constant
      78 |                    __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_TSEN), 1, 0),
         |                    ^
   sound/soc/fsl/fsl_xcvr.c:81:6: error: initializer element is not a compile-time constant
      81 |                    __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_RTSC), 1, 0),
         |                    ^
   sound/soc/fsl/fsl_xcvr.c:83:6: error: initializer element is not a compile-time constant
      83 |                    __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_RBC), 1, 0),
         |                    ^
   sound/soc/fsl/fsl_xcvr.c:93:6: error: initializer element is not a compile-time constant
      93 |                    __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_TSEN), 1, 0),
         |                    ^
   sound/soc/fsl/fsl_xcvr.c:96:6: error: initializer element is not a compile-time constant
      96 |                    __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_RTSC), 1, 0),
         |                    ^
   sound/soc/fsl/fsl_xcvr.c:98:6: error: initializer element is not a compile-time constant
      98 |                    __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_RBC), 1, 0),
         |                    ^
>> sound/soc/fsl/fsl_xcvr.c:1133:19: error: invalid application of 'sizeof' to an incomplete type 'const struct snd_kcontrol_new[]'
    1133 |         .num_controls           = ARRAY_SIZE(fsl_xcvr_timestamp_ctrls),
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                ^~~~~
   9 errors generated.


vim +/__bf_shf +70 sound/soc/fsl/fsl_xcvr.c

    68	
    69	static const struct soc_enum tstmp_enum[] = {
  > 70		SOC_ENUM_SINGLE(FSL_XCVR_TX_DPTH_CNTR_CTRL, __bf_shf(FSL_XCVR_TX_DPTH_CNTR_CTRL_TSINC),
    71				ARRAY_SIZE(inc_mode), inc_mode),
    72		SOC_ENUM_SINGLE(FSL_XCVR_RX_DPTH_CNTR_CTRL, __bf_shf(FSL_XCVR_RX_DPTH_CNTR_CTRL_TSINC),
    73				ARRAY_SIZE(inc_mode), inc_mode),
    74	};
    75	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ASoC: fsl_sai: add bitcount and timestamp controls
  2026-02-06 14:37   ` Mark Brown
@ 2026-02-09  3:16     ` Shengjiu Wang
  2026-02-10  3:09       ` Shengjiu Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Shengjiu Wang @ 2026-02-09  3:16 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
	perex, tiwai, linux-sound, linuxppc-dev, linux-kernel

On Fri, Feb 6, 2026 at 10:37 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Feb 06, 2026 at 04:43:33PM +0800, Shengjiu Wang wrote:
>
> > +     SOC_ENUM("Transmit Timestamp Increment", tstmp_enum[0]),
>
> Don't have arrays of enums with magic indexes into them - this is just
> error prone and hard to follow.  The normal thing is to declare a
> separtae variable for each enum, or if you *must* use an array use
> named constants at both ends to index into it (but that's not
> meaningfully different to just having multiple variables...).

Thanks for the comments.  I will update it.

>
> > +     SOC_SINGLE("Transmit Timestamp Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RTSC), 1, 0),
> > +     SOC_SINGLE("Transmit Bit Counter Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RBC), 1, 0),
>
> __bf_shf()?

Can we use the __bf_shf() to get the shift of the mask?

best regards
Shengjiu Wang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] ASoC: fsl_sai: add bitcount and timestamp controls
  2026-02-09  3:16     ` Shengjiu Wang
@ 2026-02-10  3:09       ` Shengjiu Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Shengjiu Wang @ 2026-02-10  3:09 UTC (permalink / raw)
  To: Mark Brown
  Cc: Shengjiu Wang, Xiubo.Lee, festevam, nicoleotsuka, lgirdwood,
	perex, tiwai, linux-sound, linuxppc-dev, linux-kernel

Hi Mark

On Mon, Feb 9, 2026 at 11:16 AM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
>
> On Fri, Feb 6, 2026 at 10:37 PM Mark Brown <broonie@kernel.org> wrote:
> >
> > On Fri, Feb 06, 2026 at 04:43:33PM +0800, Shengjiu Wang wrote:
> >
> > > +     SOC_ENUM("Transmit Timestamp Increment", tstmp_enum[0]),
> >
> > Don't have arrays of enums with magic indexes into them - this is just
> > error prone and hard to follow.  The normal thing is to declare a
> > separtae variable for each enum, or if you *must* use an array use
> > named constants at both ends to index into it (but that's not
> > meaningfully different to just having multiple variables...).
>
> Thanks for the comments.  I will update it.
>
> >
> > > +     SOC_SINGLE("Transmit Timestamp Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RTSC), 1, 0),
> > > +     SOC_SINGLE("Transmit Bit Counter Reset", FSL_SAI_TTCTL, __bf_shf(FSL_SAI_xTCTL_RBC), 1, 0),
> >
> > __bf_shf()?
>
> Can we use the __bf_shf() to get the shift of the mask?

Shall I use the definition FSL_SAI_xTCTL_RBC_SHIFT to replace
__bf_shf(FSL_SAI_xTCTL_RBC)?

Best regards
Shengjiu Wang

>
> best regards
> Shengjiu Wang

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-02-10  3:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06  8:43 [PATCH 0/2] ASoC: fsl: add bitcount and timestamp controls Shengjiu Wang
2026-02-06  8:43 ` [PATCH 1/2] ASoC: fsl_sai: " Shengjiu Wang
2026-02-06 14:37   ` Mark Brown
2026-02-09  3:16     ` Shengjiu Wang
2026-02-10  3:09       ` Shengjiu Wang
2026-02-06  8:43 ` [PATCH 2/2] ASoC: fsl_xcvr: " Shengjiu Wang
2026-02-06 16:19   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox