ASoC: dt-bindings: Add cmx655 codec
Subsystems (3)
PATCH v3 1/2 ASoC: dt-bindings: Add cmx655 codec
---
V2 -> V3: fixed dt_binding_check + yamllint warnings V1 -> V2: removed the txt file, fixed review remarks
--- .../bindings/sound/cml,cmx655d.yaml | 78 +++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + 2 files changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/cml,cmx655d.yaml
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +78 -0
@@ -0,0 +1,78 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/cml,cmx655d.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: CML Micro CMX655D codec + +maintainers: + - Richard Walton <[email protected]> + - Nikola Jelic <[email protected]> + +description: + The CMX655D is an ultra-low power voice codec. + +allOf: + - $ref: dai-common.yaml# + +properties: + compatible: + enum: + - cml,cmx655d + + reg: + description: Local bus address + maxItems: 1 + + "#sound-dai-cells": + description: The first cell indicating the audio interface + const: 0 + + reset-gpios: + description: GPIO used for codec reset, negative logic + maxItems: 1 + + interrupts: + description: Interrupt for the CMX655D IRQ line + maxItems: 1 + + interrupt-names: + description: Interrupt name for the CMX655D IRQ line + maxItems: 1 + + cml,classd-oc-reset-attempts: + description: Maximum number of times to reset CMX655 class-D + following a overcurrent event. + >10000 = disable limit. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + maximum: 10001 + default: 5 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/gpio/gpio.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + audio-codec@54 { + compatible = "cml,cmx655d"; + #sound-dai-cells = <0>; + reg = <0x54>; + reset-gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio>; + interrupts = <25 IRQ_TYPE_EDGE_RISING>; + cml,classd-oc-reset-attempts = <5>; + }; + + }; +...
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -308,6 +308,8 @@ patternProperties: description: Carl Cloos Schweisstechnik GmbH. "^cloudengines,.*": description: Cloud Engines, Inc. + "^cml,.*": + description: CML Micro, Ltd. "^cnm,.*": description: Chips&Media, Inc. "^cnxt,.*":
Signature · 1 line
2.47.2
PATCH v3 2/2 ASoC: codecs: cmx655: Add CML's CMX655D codec
---
V2 -> V3: Review remarks
V1 -> V2: Review remarks, code style + various other fixes
--- sound/soc/codecs/Kconfig | 16 + sound/soc/codecs/Makefile | 6 + sound/soc/codecs/cmx655-i2c.c | 60 ++ sound/soc/codecs/cmx655-spi.c | 60 ++ sound/soc/codecs/cmx655.c | 1051 +++++++++++++++++++++++++++++++++ sound/soc/codecs/cmx655.h | 154 +++++ 6 files changed, 1347 insertions(+) create mode 100644 sound/soc/codecs/cmx655-i2c.c create mode 100644 sound/soc/codecs/cmx655-spi.c create mode 100644 sound/soc/codecs/cmx655.c create mode 100644 sound/soc/codecs/cmx655.h
sound/soc/codecs/Kconfig +16 -0
@@ -63,6 +63,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_BT_SCO imply SND_SOC_BD28623 imply SND_SOC_CHV3_CODEC + imply SND_SOC_CMX655 imply SND_SOC_CQ0093VC imply SND_SOC_CROS_EC_CODEC imply SND_SOC_CS35L32
@@ -747,6 +748,21 @@ config SND_SOC_CPCAP tristate "Motorola CPCAP codec" depends on MFD_CPCAP || COMPILE_TEST +config SND_SOC_CMX655D + tristate + +config SND_SOC_CMX655D_I2C + tristate "CMX655D codec (I2C)" + depends on I2C + select SND_SOC_CMX655D + select REGMAP_I2C + +config SND_SOC_CMX655D_SPI + tristate "CMX655D codec (SPI)" + depends on SPI + select SND_SOC_CMX655D + select REGMAP_SPI + config SND_SOC_CQ0093VC tristate
sound/soc/codecs/Makefile +6 -0
@@ -58,6 +58,9 @@ snd-soc-aw88399-y := aw88399.o snd-soc-bd28623-y := bd28623.o snd-soc-bt-sco-y := bt-sco.o snd-soc-chv3-codec-y := chv3-codec.o +snd-soc-cmx655-y := cmx655.o +snd-soc-cmx655-i2c-y := cmx655-i2c.o +snd-soc-cmx655-spi-y := cmx655-spi.o snd-soc-cpcap-y := cpcap.o snd-soc-cq93vc-y := cq93vc.o snd-soc-cros-ec-codec-y := cros_ec_codec.o
@@ -475,6 +478,9 @@ obj-$(CONFIG_SND_SOC_AW88399) += snd-soc-aw88399.o obj-$(CONFIG_SND_SOC_BD28623) += snd-soc-bd28623.o obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o obj-$(CONFIG_SND_SOC_CHV3_CODEC) += snd-soc-chv3-codec.o +obj-$(CONFIG_SND_SOC_CMX655D) += snd-soc-cmx655.o +obj-$(CONFIG_SND_SOC_CMX655D_I2C) += snd-soc-cmx655-i2c.o +obj-$(CONFIG_SND_SOC_CMX655D_SPI) += snd-soc-cmx655-spi.o obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o obj-$(CONFIG_SND_SOC_CPCAP) += snd-soc-cpcap.o obj-$(CONFIG_SND_SOC_CROS_EC_CODEC) += snd-soc-cros-ec-codec.o
sound/soc/codecs/cmx655-i2c.c new file +60 -0
60 lines not on this page · raw message
sound/soc/codecs/cmx655-spi.c new file +60 -0
60 lines not on this page · raw message
sound/soc/codecs/cmx655.c new file +1051 -0
1,051 lines not on this page · raw message
sound/soc/codecs/cmx655.h new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
2.47.2
kernel test robot
build botRe: [PATCH v3 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec
kernel test robot noticed the following build warnings:
Hi Nikola,
kernel test robot noticed the following build warnings:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on robh/for-next tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.14-rc1 next-20250207] [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/Nikola-Jelic/ASoC-codecs-cmx655-Add-CML-s-CMX655D-codec/20250208-001527 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20250207161412.6281-2-nikola.jelic83%40gmail.com patch subject: [PATCH v3 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec reproduce: (https://download.01.org/0day-ci/archive/20250208/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
versioncheck warnings: (new ones prefixed by >>)
INFO PATH=/opt/cross/rustc-1.78.0-bindgen-0.65.1/cargo/bin:/opt/cross/clang-19/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/timeout -k 100 3h /usr/bin/make KCFLAGS= -Wtautological-compare -Wno-error=return-type -Wreturn-type -Wcast-function-type -funsigned-char -Wundef -fstrict-flex-arrays=3 -Wformat-overflow -Wformat-truncation -Wenum-conversion W=1 --keep-going LLVM=1 -j32 ARCH=x86_64 versioncheck find ./* \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o \
-name '*.[hcS]' -type f -print | sort \
| xargs perl -w ./scripts/checkversion.pl
./samples/bpf/spintest.bpf.c: 8 linux/version.h not needed.
>> ./sound/soc/codecs/cmx655-i2c.c: 3 linux/version.h not needed. >> ./sound/soc/codecs/cmx655-spi.c: 3 linux/version.h not needed. >> ./sound/soc/codecs/cmx655.c: 3 linux/version.h not needed.
./tools/lib/bpf/bpf_helpers.h: 424: need linux/version.h ./tools/testing/selftests/bpf/progs/dev_cgroup.c: 9 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/netcnt_prog.c: 3 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_map_lock.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_send_signal_kern.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_spin_lock.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_tcp_estats.c: 37 linux/version.h not needed. ./tools/testing/selftests/wireguard/qemu/init.c: 27 linux/version.h not needed.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v3 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec
In reply to Nikola Jelickernel test robot noticed the following build warnings:
Hi Nikola,
kernel test robot noticed the following build warnings:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on robh/for-next tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.14-rc1 next-20250207] [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/Nikola-Jelic/ASoC-codecs-cmx655-Add-CML-s-CMX655D-codec/20250208-001527 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20250207161412.6281-2-nikola.jelic83%40gmail.com patch subject: [PATCH v3 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250209/[email protected]/config) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250209/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from sound/soc/codecs/cmx655.c:10:
In file included from include/sound/soc.h:26:
In file included from include/sound/ac97_codec.h:17:
In file included from include/sound/pcm.h:15:
In file included from include/linux/mm.h:2224:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/codecs/cmx655.c:194:50: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
194 | *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
195 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/cmx655.c:194:50: note: use '|' for a bitwise operation
194 | *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^~
| |
>> sound/soc/codecs/cmx655.c:194:19: warning: converting the result of '<<' to a boolean always evaluates to false [-Wtautological-constant-compare]
194 | *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
>> sound/soc/codecs/cmx655.c:195:11: warning: converting the result of '<<' to a boolean; did you mean '(3 << (0)) != 0'? [-Wint-in-bool-context]
195 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ^
sound/soc/codecs/cmx655.c:199:50: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
199 | *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
200 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/cmx655.c:199:50: note: use '|' for a bitwise operation
199 | *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^~
| |
sound/soc/codecs/cmx655.c:199:19: warning: converting the result of '<<' to a boolean always evaluates to false [-Wtautological-constant-compare]
199 | *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
sound/soc/codecs/cmx655.c:200:11: warning: converting the result of '<<' to a boolean; did you mean '(3 << (0)) != 0'? [-Wint-in-bool-context]
200 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ^
sound/soc/codecs/cmx655.c:204:51: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
204 | *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
205 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/cmx655.c:204:51: note: use '|' for a bitwise operation
204 | *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^~
| |
sound/soc/codecs/cmx655.c:204:20: warning: converting the result of '<<' to a boolean; did you mean '(12 << (4)) != 0'? [-Wint-in-bool-context]
204 | *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
sound/soc/codecs/cmx655.c:205:11: warning: converting the result of '<<' to a boolean; did you mean '(3 << (0)) != 0'? [-Wint-in-bool-context]
205 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ^
sound/soc/codecs/cmx655.c:209:51: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
209 | *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
210 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/cmx655.c:209:51: note: use '|' for a bitwise operation
209 | *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^~
| |
sound/soc/codecs/cmx655.c:209:20: warning: converting the result of '<<' to a boolean; did you mean '(12 << (4)) != 0'? [-Wint-in-bool-context]
209 | *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
| ^
sound/soc/codecs/cmx655.c:210:11: warning: converting the result of '<<' to a boolean; did you mean '(3 << (0)) != 0'? [-Wint-in-bool-context]
210 | (3 << CMX655_PLLCTRL_CPI_SHIFT);
| ^
sound/soc/codecs/cmx655.c:859:16: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
859 | if ((reg_val && CMX655_VF_DCBLOCK) > 0) {
| ^ ~~~~~~~~~~~~~~~~~
sound/soc/codecs/cmx655.c:859:16: note: use '&' for a bitwise operation
859 | if ((reg_val && CMX655_VF_DCBLOCK) > 0) {
| ^~
| &
sound/soc/codecs/cmx655.c:859:16: note: remove constant to silence this warning
859 | if ((reg_val && CMX655_VF_DCBLOCK) > 0) {
| ^~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/cmx655.c:859:19: warning: converting the result of '<<' to a boolean; did you mean '(1 << (2)) != 0'? [-Wint-in-bool-context]
859 | if ((reg_val && CMX655_VF_DCBLOCK) > 0) {
| ^
sound/soc/codecs/cmx655.h:70:46: note: expanded from macro 'CMX655_VF_DCBLOCK'
70 | #define CMX655_VF_DCBLOCK (0x1 << CMX655_VF_DCBLOCK_SHIFT)
| ^17 warnings generated.
vim +194 sound/soc/codecs/cmx655.c
149
150 /**
151 * cmx655_get_sys_clk_config(): Get the clock configuration.
152 * @clk_id: Clock source setting as defined in cmx655.h
153 * @primary_mode: Non-zero if the CMX655 is the DAI primary
154 * @sr_setting: Setting for sample rate 0 to 3
155 * @clk_src: pointer for storing clock source (PLLREF, PLLSEL and
156 * CLKSEL bits)
157 * @rdiv: pointer for storing PLL's RDIV value (13 bits)
158 * @ndiv: pointer for storing PLL's NDIV value (13 bits)
159 * @pll_ctrl: pointer for storing PLLCTRL register value (8 bits)
160 *
161 * Get the clock setup for the system clock based on clock Id, DAI primary mode
162 * and sample rate.
163 *
164 * Return: 0 for success, negative value otherwise
165 */
166 static int cmx655_get_sys_clk_config(int clk_id,
167 int primary_mode,
168 int sr_setting,
169 int *clk_src,
170 int *rdiv, int *ndiv, int *pll_ctrl)
171 {
172 if (clk_id == CMX655_SYSCLK_AUTO) {
173 if (primary_mode != 0)
174 clk_id = CMX655_SYSCLK_RCLK;
175 else
176 clk_id = CMX655_SYSCLK_LRCLK;
177 }
178 *rdiv = 0;
179 *ndiv = 0;
180 *pll_ctrl = 0;
181 switch (clk_id) {
182 case CMX655_SYSCLK_RCLK:
183 *clk_src = CMX655_CLKCTRL_CLRSRC_RCLK;
184 break;
185 case CMX655_SYSCLK_LPO:
186 *clk_src = CMX655_CLKCTRL_CLRSRC_LPO;
187 break;
188 case CMX655_SYSCLK_LRCLK:
189 *clk_src = CMX655_CLKCTRL_CLRSRC_LRCLK;
190 *rdiv = 1;
191 switch (sr_setting) {
192 case CMX655_CLKCTRL_SR_8K:
193 *ndiv = 3072;
> 194 *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
> 195 (3 << CMX655_PLLCTRL_CPI_SHIFT); 196 break;
197 case CMX655_CLKCTRL_SR_16K:
198 *ndiv = 1536;
199 *pll_ctrl = (0 << CMX655_PLLCTRL_LFILT_SHIFT) ||
200 (3 << CMX655_PLLCTRL_CPI_SHIFT);
201 break;
202 case CMX655_CLKCTRL_SR_32K:
203 *ndiv = 768;
204 *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
205 (3 << CMX655_PLLCTRL_CPI_SHIFT);
206 break;
207 case CMX655_CLKCTRL_SR_48K:
208 *ndiv = 512;
209 *pll_ctrl = (12 << CMX655_PLLCTRL_LFILT_SHIFT) ||
210 (3 << CMX655_PLLCTRL_CPI_SHIFT);
211 break;
212 default:
213 return -EINVAL;
214 }
215 break;
216 default:
217 return -EINVAL;
218 }
219 return 0;
220 };
221
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki