
Thanks, Broonie. New question from one of my customers. Looking forward to your comments. Thanks.
-----Original Message----- From: Mark Brown broonie@kernel.org Sent: Friday, April 18, 2025 11:53 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: Re: [EXTERNAL] Re: [PATCH v1] ASoC: tas2781: Add "Acoustic Tuning" kcontrol for acoustic application
On Fri, Apr 18, 2025 at 10:18:59AM +0000, Ding, Shenghao wrote:
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)?
Right, the combination within the driver rather than combining things at the subsystem level is causing you trouble here. It's sufficiently non standard that you probably do need to open code something here, but the broad point that we shouldn't have this unrestricted write feature available in production kernels remains - something similar to what regmap is doing for example.
May I create a debugfs node in the driver for "Acoustic tuning"?