On 28.11.2023 15:06:43, Mark Brown wrote:
On Tue, Nov 28, 2023 at 11:55:25AM +0100, Marc Kleine-Budde wrote:
we are using an I2C connected ti,tlv320aic3007. During probe, regmap_register_patch() returns -6, which leads to the error message: "tlv320aic3x 2-0018: Failed to init class D: -6". I think this is because the codec is still in reset and does not respond to the I2C
How to get rid of the error message? Power on the codec, just to write the register sequence or don't print the error message on "-6"?
Yes, power on the CODEC - if you're applying a patch the expectation is that it should actually be applied to the device, otherwise things might get confused later.
I think you're right in general, but as far as I understand the driver takes care of this.
In probe() it wants to write to the regcache only, and then calls regmap_register_patch(). During probe the chip is unpowered and in reset:
| aic3x_probe() | regcache_cache_only(true); | regmap_register_patch();
In aic3x_set_power() the sequence is, power on device, get out of reset, regcache_cache_only(false) and then regcache_sync():
| aic3x_set_power() | regulator_bulk_enable(); | gpiod_set_value(aic3x->gpio_reset, 0); | regcache_cache_only(false); | regcache_sync();
If I only power on the codec in probe() for the regmap_register_patch(), I'll shut it down after the regmap_register_patch() anyways. So the register values are lost in any case.
regards, Marc