Hey all,
We have a custom built hw, based on am335x and from time to time we need to rmmod/modprobe the ASoC machine driver. Depending on the hw, the first call to regmap_update_bits(..) in cs4271_codec_probe(..) fails with -EREMOTEIO.
The error is originated in:
drivers/i2c/busses/i2c-omap.c
and happens if no i2c package acknowledge is received by the host.
I think this is a timing issue and on some devices, the codec is just not ready yet, for communication.
What is the right way to fix that? My attempt would be something like this:
const int retries = 5;
while (retries) { ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, CS4271_MODE2_PDN | CS4271_MODE2_CPEN, CS4271_MODE2_PDN | CS4271_MODE2_CPEN);
if (ret == -EREMOTEIO) { retries--; udelay(1); continue;
} else if (ret) return ret;
break; }
But I might also just add a proper delay before the first call to regmap_update_bits(..)
So what is the proper way to handle this?
Thanks Pascal