Message ID | 20250309181600.1322701-3-jan.dakinevich@salutedevices.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | ASoC: meson: g12a-toacodec: add support for A1 SoC | expand |
Hi Jan, kernel test robot noticed the following build warnings: [auto build test WARNING on broonie-sound/for-next] [also build test WARNING on linus/master v6.14-rc5 next-20250307] [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/Jan-Dakinevich/ASoC-meson-codec-glue-add-support-for-capture-stream/20250310-022013 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20250309181600.1322701-3-jan.dakinevich%40salutedevices.com patch subject: [PATCH v2 2/4] ASoC: meson: g12a-toacodec: drop the definition of bits config: i386-buildonly-randconfig-005-20250310 (https://download.01.org/0day-ci/archive/20250310/202503100909.xnqNYW9u-lkp@intel.com/config) compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250310/202503100909.xnqNYW9u-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/202503100909.xnqNYW9u-lkp@intel.com/ All warnings (new ones prefixed by >>): >> sound/soc/meson/g12a-toacodec.c:83:11: warning: result of comparison of constant 18446744073709551615 with expression of type 'typeof (_Generic((mclk_sel), char: (unsigned char)0, unsigned char: (unsigned char)0, signed char: (unsigned char)0, unsigned short: (unsigned short)0, short: (unsigned short)0, unsigned int: (unsigned int)0, int: (unsigned int)0, unsigned long: (unsigned long)0, long: (unsigned long)0, unsigned long long: (unsigned long long)0, long long: (unsigned long long)0, default: (mclk_sel)))' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare] 83 | FIELD_PREP(mclk_sel, mux)); | ^~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:115:3: note: expanded from macro 'FIELD_PREP' 115 | __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:72:53: note: expanded from macro '__BF_FIELD_CHECK' 72 | BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ 73 | __bf_cast_unsigned(_reg, ~0ull), \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | _pfx "type of reg too small for mask"); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ include/linux/compiler_types.h:542:22: note: expanded from macro 'compiletime_assert' 542 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler_types.h:530:23: note: expanded from macro '_compiletime_assert' 530 | __compiletime_assert(condition, msg, prefix, suffix) | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler_types.h:522:9: note: expanded from macro '__compiletime_assert' 522 | if (!(condition)) \ | ^~~~~~~~~ 1 warning generated. vim +83 sound/soc/meson/g12a-toacodec.c 42 43 static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol, 44 struct snd_ctl_elem_value *ucontrol) 45 { 46 struct snd_soc_component *component = 47 snd_soc_dapm_kcontrol_component(kcontrol); 48 struct g12a_toacodec *priv = snd_soc_component_get_drvdata(component); 49 struct snd_soc_dapm_context *dapm = 50 snd_soc_dapm_kcontrol_dapm(kcontrol); 51 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 52 unsigned int mclk_sel = GENMASK(2, 0); 53 unsigned int mux, reg; 54 55 if (ucontrol->value.enumerated.item[0] >= e->items) 56 return -EINVAL; 57 58 mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); 59 regmap_field_read(priv->field_dat_sel, ®); 60 61 if (mux == reg) 62 return 0; 63 64 /* Force disconnect of the mux while updating */ 65 snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL); 66 67 regmap_field_write(priv->field_dat_sel, mux); 68 regmap_field_write(priv->field_lrclk_sel, mux); 69 regmap_field_write(priv->field_bclk_sel, mux); 70 71 /* 72 * FIXME: 73 * On this soc, the glue gets the MCLK directly from the clock 74 * controller instead of going the through the TDM interface. 75 * 76 * Here we assume interface A uses clock A, etc ... While it is 77 * true for now, it could be different. Instead the glue should 78 * find out the clock used by the interface and select the same 79 * source. For that, we will need regmap backed clock mux which 80 * is a work in progress 81 */ 82 snd_soc_component_update_bits(component, e->reg, mclk_sel, > 83 FIELD_PREP(mclk_sel, mux)); 84 85 snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); 86 87 return 1; 88 } 89
diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c index 531bb8707a3e..03bde8d8d192 100644 --- a/sound/soc/meson/g12a-toacodec.c +++ b/sound/soc/meson/g12a-toacodec.c @@ -20,26 +20,6 @@ #define G12A_TOACODEC_DRV_NAME "g12a-toacodec" #define TOACODEC_CTRL0 0x0 -#define CTRL0_ENABLE_SHIFT 31 -#define CTRL0_DAT_SEL_SM1_MSB 19 -#define CTRL0_DAT_SEL_SM1_LSB 18 -#define CTRL0_DAT_SEL_MSB 15 -#define CTRL0_DAT_SEL_LSB 14 -#define CTRL0_LANE_SEL_SM1 16 -#define CTRL0_LANE_SEL 12 -#define CTRL0_LRCLK_SEL_SM1_MSB 14 -#define CTRL0_LRCLK_SEL_SM1_LSB 12 -#define CTRL0_LRCLK_SEL_MSB 9 -#define CTRL0_LRCLK_SEL_LSB 8 -#define CTRL0_LRCLK_INV_SM1 BIT(10) -#define CTRL0_BLK_CAP_INV_SM1 BIT(9) -#define CTRL0_BLK_CAP_INV BIT(7) -#define CTRL0_BCLK_O_INV_SM1 BIT(8) -#define CTRL0_BCLK_O_INV BIT(6) -#define CTRL0_BCLK_SEL_SM1_MSB 6 -#define CTRL0_BCLK_SEL_MSB 5 -#define CTRL0_BCLK_SEL_LSB 4 -#define CTRL0_MCLK_SEL GENMASK(2, 0) #define TOACODEC_OUT_CHMAX 2 @@ -69,6 +49,7 @@ static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol, struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + unsigned int mclk_sel = GENMASK(2, 0); unsigned int mux, reg; if (ucontrol->value.enumerated.item[0] >= e->items) @@ -98,21 +79,18 @@ static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol, * source. For that, we will need regmap backed clock mux which * is a work in progress */ - snd_soc_component_update_bits(component, e->reg, - CTRL0_MCLK_SEL, - FIELD_PREP(CTRL0_MCLK_SEL, mux)); + snd_soc_component_update_bits(component, e->reg, mclk_sel, + FIELD_PREP(mclk_sel, mux)); snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); return 1; } -static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0, - CTRL0_DAT_SEL_LSB, +static SOC_ENUM_SINGLE_DECL(g12a_toacodec_mux_enum, TOACODEC_CTRL0, 14, g12a_toacodec_mux_texts); -static SOC_ENUM_SINGLE_DECL(sm1_toacodec_mux_enum, TOACODEC_CTRL0, - CTRL0_DAT_SEL_SM1_LSB, +static SOC_ENUM_SINGLE_DECL(sm1_toacodec_mux_enum, TOACODEC_CTRL0, 18, g12a_toacodec_mux_texts); static const struct snd_kcontrol_new g12a_toacodec_mux = @@ -126,8 +104,7 @@ static const struct snd_kcontrol_new sm1_toacodec_mux = g12a_toacodec_mux_put_enum); static const struct snd_kcontrol_new g12a_toacodec_out_enable = - SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0, - CTRL0_ENABLE_SHIFT, 1, 0); + SOC_DAPM_SINGLE_AUTODISABLE("Switch", TOACODEC_CTRL0, 31, 1, 0); static const struct snd_soc_dapm_widget g12a_toacodec_widgets[] = { SND_SOC_DAPM_MUX("SRC", SND_SOC_NOPM, 0, 0, @@ -209,15 +186,13 @@ static struct snd_soc_dai_driver g12a_toacodec_dai_drv[] = { static int g12a_toacodec_component_probe(struct snd_soc_component *c) { /* Initialize the static clock parameters */ - return snd_soc_component_write(c, TOACODEC_CTRL0, - CTRL0_BLK_CAP_INV); + return snd_soc_component_write(c, TOACODEC_CTRL0, BIT(7)); } static int sm1_toacodec_component_probe(struct snd_soc_component *c) { /* Initialize the static clock parameters */ - return snd_soc_component_write(c, TOACODEC_CTRL0, - CTRL0_BLK_CAP_INV_SM1); + return snd_soc_component_write(c, TOACODEC_CTRL0, BIT(9)); } static const struct snd_soc_dapm_route g12a_toacodec_routes[] = { @@ -229,11 +204,11 @@ static const struct snd_soc_dapm_route g12a_toacodec_routes[] = { }; static const struct snd_kcontrol_new g12a_toacodec_controls[] = { - SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL, 3, 0), + SOC_SINGLE("Lane Select", TOACODEC_CTRL0, 12, 3, 0), }; static const struct snd_kcontrol_new sm1_toacodec_controls[] = { - SOC_SINGLE("Lane Select", TOACODEC_CTRL0, CTRL0_LANE_SEL_SM1, 3, 0), + SOC_SINGLE("Lane Select", TOACODEC_CTRL0, 16, 3, 0), }; static const struct snd_soc_component_driver g12a_toacodec_component_drv = {
There are many of defines, but several of them are unused, other are used once. It would easier to read if these values would occure in the place of their usage. Signed-off-by: Jan Dakinevich <jan.dakinevich@salutedevices.com> --- Also, there was an another attempt to rework bits' definition: https://lore.kernel.org/all/20240325235311.411920-1-jan.dakinevich@salutedevices.com/ --- sound/soc/meson/g12a-toacodec.c | 45 ++++++++------------------------- 1 file changed, 10 insertions(+), 35 deletions(-)