diff options
author | Ramalingam C <ramalingamc@nvidia.com> | 2012-02-01 19:26:09 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-02-03 05:53:52 -0800 |
commit | ff11080bde456a889e1a2b536a87bad65e6bee7c (patch) | |
tree | b5098083bf960f7cb81c21f3aab05666eca668f8 | |
parent | 51f40227d9f41491af52467515c51cacc77fdef8 (diff) |
arm: tegra: ventana: probing for bq20z75 chip
In the probe function of the bq20z75 driver, check for the presence of the
bq20z75. If there is no response from device, terminate the driver
initialization.
Bug 932030
Change-Id: I6608eaea6b6b37b18d3f77f40d58c1f8e9b05b3c
Signed-off-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-on: http://git-master/r/78750
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
-rw-r--r-- | drivers/power/bq20z75.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c index 7f9dfbf61cde..32e5a8c5c3df 100644 --- a/drivers/power/bq20z75.c +++ b/drivers/power/bq20z75.c @@ -648,6 +648,17 @@ static int __devinit bq20z75_probe(struct i2c_client *client, i2c_set_clientdata(client, bq20z75_device); + /* Probing for the presence of the bq20z75 */ + rc = bq20z75_read_word_data(client, + bq20z75_data[REG_SERIAL_NUMBER].addr); + + if (rc < 0) { + dev_err(&client->dev, + "%s: bq20z75 is not responding\n", __func__); + rc = -ENODEV; + goto exit_mem_free; + } + if (!bq20z75_device->gpio_detect) goto skip_gpio; @@ -687,7 +698,6 @@ static int __devinit bq20z75_probe(struct i2c_client *client, bq20z75_device->irq = irq; skip_gpio: - rc = power_supply_register(&client->dev, &bq20z75_device->power_supply); if (rc) { dev_err(&client->dev, @@ -710,6 +720,7 @@ exit_psupply: if (bq20z75_device->gpio_detect) gpio_free(pdata->battery_detect); +exit_mem_free: kfree(bq20z75_device); return rc; |