Message ID | 1372168801-4221-3-git-send-email-fabio.estevam@freescale.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Jun 25, 2013 at 11:00:01AM -0300, Fabio Estevam wrote: > In case of I2C error, let's defer the probe. > > On mx28, for example, the first read of the codec revision register fails > because there is no codec clock provided at this point. The codec clock will be > enabled later in the mxs-saif driver, so return -EPROBE_DEFER in case of I2C > read error, so that the codec driver can do another attempt at a later stage > when the codec clock is available. This doesn't seem to match up with the code: > ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, ®); > - if (ret) > + if (ret) { > + ret = -EPROBE_DEFER; /* If I2C read failed, try again later */ > goto disable_clk; > > + } Looking at the label we jump to here it seems like the clock really should be enabled at the point where the register read is attempted...
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d441559..a2dce4a 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1536,9 +1536,12 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, /* read chip information */ ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, ®); - if (ret) + if (ret) { + ret = -EPROBE_DEFER; /* If I2C read failed, try again later */ goto disable_clk; + } + if (((reg & SGTL5000_PARTID_MASK) >> SGTL5000_PARTID_SHIFT) != SGTL5000_PARTID_PART_ID) { dev_err(&client->dev,
In case of I2C error, let's defer the probe. On mx28, for example, the first read of the codec revision register fails because there is no codec clock provided at this point. The codec clock will be enabled later in the mxs-saif driver, so return -EPROBE_DEFER in case of I2C read error, so that the codec driver can do another attempt at a later stage when the codec clock is available. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- sound/soc/codecs/sgtl5000.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)