During the tpa6130a2_i2c_write, you read the data->power_state, that may change it's state meanwhile (preempted). Thus, I suggest you using the mutex to cover all i2c writes. (and all tpa read <-> write cycles, so that things are consistent?)
A call to tpa6130a2_power() -> preemted over somewhere here, you may have i2c accesses to a chip that's not powered up?
Well it is very unlikely that something like this could ever happen since the tpa6130a2_channel_enable and the tpa6130a2_power is called when DAPM is enabling/disabling the path. I think in a middle of enable or disable there should not be any opposite operation running in DAPM...
But better to be safe: I can add the mutex_lock, unlock pair.
I'll wait for more comments and address this one as well.
-- Péter
Right, sorry I read the patch too fast =) So I guess it's ok like it was. However, I'll put sleep(n)'s in the problematic places and verify it's 100% ok one of these weeks.
- Eero