diff options
author | Bo Yan <byan@nvidia.com> | 2012-12-07 19:06:31 -0800 |
---|---|---|
committer | Mandar Padmawar <mpadmawar@nvidia.com> | 2013-02-18 22:27:51 -0800 |
commit | 8713f8e1b46c046487fb65bb1fc1c7b645d2f08f (patch) | |
tree | af2106b04fd37706d46d924078ca28abefacbf81 /drivers/misc/a2220.c | |
parent | b37127d1c36d643bbc46c29dbcea518fb32ea807 (diff) |
audio: a2220: Fix the wrong GPIO for reset
gpio number for reset is not specified in platform data, in fact, its
value is 0 after kzalloc. Requesting gpio for this number is bad
because the pin for GPIO 0 is used for other purposes. The original
hack is to use a magic number 118 for reset GPIO, this still needs to
be fixed. Meanwhile, to unblock the work which requires GPIO 0,
do not request GPIO 0 in this module.
Change-Id: Ibe1c38e948603fcd1d9de1164d5f69b0804757d2
Signed-off-by: Bo Yan <byan@nvidia.com>
Reviewed-on: http://git-master/r/169562
(cherry picked from commit 2cf6fa583d1eb1f993cd1b7b5fe9cab8fcc55fb3)
Reviewed-on: http://git-master/r/201516
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Dara Ramesh <dramesh@nvidia.com>
Reviewed-by: Vijay Mali <vmali@nvidia.com>
Diffstat (limited to 'drivers/misc/a2220.c')
-rw-r--r-- | drivers/misc/a2220.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/misc/a2220.c b/drivers/misc/a2220.c index cf36c8f27463..a3e9fbceba7c 100644 --- a/drivers/misc/a2220.c +++ b/drivers/misc/a2220.c @@ -2,6 +2,8 @@ * * Copyright (C) 2009 HTC Corporation. * + * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. @@ -201,7 +203,10 @@ static ssize_t a2220_hw_reset(struct a2220img *img) while (retry--) { /* Reset A2220 chip */ - gpio_set_value(pdata->gpio_a2220_reset, 0); + if (pdata->gpio_a2220_reset) + gpio_set_value(pdata->gpio_a2220_reset, 0); + else + gpio_set_value(VP_RESET, 1); /* Enable A2220 clock */ if (control_a2220_clk) @@ -209,7 +214,10 @@ static ssize_t a2220_hw_reset(struct a2220img *img) mdelay(1); /* Take out of reset */ - gpio_set_value(pdata->gpio_a2220_reset, 1); + if (pdata->gpio_a2220_reset) + gpio_set_value(pdata->gpio_a2220_reset, 1); + else + gpio_set_value(VP_RESET, 0); msleep(50); /* Delay before send I2C command */ @@ -1255,18 +1263,20 @@ static int a2220_probe(struct i2c_client *client, } } - rc = gpio_request(pdata->gpio_a2220_reset, "a2220"); - if (rc < 0) { - printk(KERN_ERR "%s: gpio request reset pin failed\n", + if (pdata->gpio_a2220_reset) { + rc = gpio_request(pdata->gpio_a2220_reset, "a2220"); + if (rc < 0) { + printk(KERN_ERR "%s: gpio request reset pin failed\n", __func__); - goto err_free_gpio; - } + goto err_free_gpio; + } - rc = gpio_direction_output(pdata->gpio_a2220_reset, 1); - if (rc < 0) { - printk(KERN_ERR "%s: request reset gpio direction failed\n", + rc = gpio_direction_output(pdata->gpio_a2220_reset, 1); + if (rc < 0) { + printk(KERN_ERR "%s: request reset gpio direction failed\n", __func__); - goto err_free_gpio_all; + goto err_free_gpio_all; + } } if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { @@ -1299,7 +1309,8 @@ static int a2220_probe(struct i2c_client *client, #endif } - gpio_set_value(pdata->gpio_a2220_reset, 1); + if (pdata->gpio_a2220_reset) + gpio_set_value(pdata->gpio_a2220_reset, 1); if (pdata->gpio_a2220_audience_chip_sel) gpio_set_value(pdata->gpio_a2220_audience_chip_sel, 1); @@ -1316,7 +1327,8 @@ static int a2220_probe(struct i2c_client *client, return 0; err_free_gpio_all: - gpio_free(pdata->gpio_a2220_reset); + if (pdata->gpio_a2220_reset) + gpio_free(pdata->gpio_a2220_reset); err_free_gpio: if (pdata->gpio_a2220_wakeup) { #ifdef CONFIG_USA_MODEL_SGH_T989 |