
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.