
Hi Brownie. Thanks for your comments, my question is inline.
-----Original Message----- From: Mark Brown broonie@kernel.org Sent: Thursday, April 17, 2025 8:32 PM To: Ding, Shenghao shenghao-ding@ti.com Cc: andriy.shevchenko@linux.intel.com; tiwai@suse.de; 13916275206@139.com; 13564923607@139.com; alsa-devel@alsa- project.org; Xu, Baojun baojun.xu@ti.com Subject: [EXTERNAL] Re: [PATCH v1] ASoC: tas2781: Add "Acoustic Tuning" kcontrol for acoustic application
On Thu, Apr 17, 2025 at 06:47:53PM +0800, Shenghao Ding wrote:
"Acoustic Tuning" kcontrol is a bridge to the acoustic tuning application tool which can tune the chips' acoustic effect.
- reg = TASDEVICE_REG(src[3], src[4], src[5]);
- guard(mutex)(&priv->codec_lock);
- if (src[1] == 'w') {
if (len > 1)
ret = tasdevice_dev_bulk_write(priv, chn, reg,
&src[6], len);
else
ret = tasdevice_dev_write(priv, chn, reg, src[6]);
So, this is basically just unrestricted register I/O to the device. That's not a great interface - it just lets userspace do anything, including conflicting with things that the driver is managing itself. Usually a coefficient interface would just expose a specific set of registers with the coefficient data as a control.
I know other CODEC vendors use the regmap debugfs interface for this, if you change the kernel to define REGMAP_ALLOW_WRITE_DEBUGFS then you can do both writes and reads for the tuning. The tuning tool then produces a file with just the coefficients which is loaded at runtime, with anything that's normal routing or whatever being configured via the control API.
REGMAP_ALLOW_WRITE_DEBUGFS is a good option for the Acoustic Tool. But in the case of multiple pieces of tas2781, our devicetree for such case is an aggregated one: audio-codec@38 { compatible = "ti,tas2781"; reg = <0x38>, /* dev0 for Audio slot 0 */ <0x3a>, /* dev1 for Audio slot 1 */ <0x39>, /* dev2 for Audio slot 2 */ <0x3b>; /* dev3 for Audio slot 3 */
#sound-dai-cells = <0>; reset-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; interrupt-parent = <&gpio1>; interrupts = <15>; }; There creates only one device node for 0x38 device in debug/regmap. How to switch the i2c address to other devices(such as dev1, dev2 or dev3)?