tlv320aic3x: Failed to init class D
Hello,
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 transfers.
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"?
regards, Marc
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.
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
On Tue, Nov 28, 2023 at 04:47:27PM +0100, Marc Kleine-Budde wrote:
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();
That's not going to work well, patches always bypass the cache since they are often ordering dependent and if we understood what they were doing we should be writing them in normal code rather than just spamming in numbers. There was some edge case usage I can't remember right now (IIRC with partial cache sync) which meant that we didn't want to just assume that there'd be a full cache sync as the first action after leaving cache only mode.
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.
Cache sync will reapply the patch, that's the _register() bit of the function name.
participants (2)
-
Marc Kleine-Budde
-
Mark Brown