summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorBharat Nihalani <bnihalani@nvidia.com>2010-12-15 17:56:15 +0530
committerBharat Nihalani <bnihalani@nvidia.com>2010-12-15 04:40:42 -0800
commitf7a9b97454b957e1a650b16f8119142253ee7135 (patch)
treeb27eef245cf3b8364e670a50a4f1035d53286853 /arch/arm
parent9de15d0ada57d118cff7c95f0c7a8d69bfa03c40 (diff)
[ARM] tegra: camera init: Have error checks to fail gracefully
Introduce error checks to detect gpio_request error if camera is not connected to Ventana board. Change-Id: Ia17e33bb68267358b4966f732778a80ba229f364 Reviewed-on: http://git-master/r/13337 Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-tegra/board-ventana-sensors.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/arch/arm/mach-tegra/board-ventana-sensors.c b/arch/arm/mach-tegra/board-ventana-sensors.c
index fd16b81b0bbe..75b982e75153 100644
--- a/arch/arm/mach-tegra/board-ventana-sensors.c
+++ b/arch/arm/mach-tegra/board-ventana-sensors.c
@@ -246,34 +246,59 @@ int __init ventana_sensors_init(void)
#define TCA6416_GPIO7 TEGRA_NR_GPIOS + 4 + 7
#define TCA6416_GPIO15 TEGRA_NR_GPIOS + 4 + 15
-int __init ventana_sensors_late_init()
+int __init ventana_sensors_late_init(void)
{
+ int ret;
if (!machine_is_ventana()) return 0;
i2c_new_device(i2c_get_adapter(3), ventana_i2c3_board_info_tca6416);
- gpio_request(TPS6586X_GPIO2, "tps6586x_gpio2");
+ ret = gpio_request(TPS6586X_GPIO2, "tps6586x_gpio2");
+ if (ret < 0) {
+ pr_err("%s failed at line %d with error %d\n", __func__, __LINE__, ret);
+ return ret;
+ }
gpio_direction_output(TPS6586X_GPIO2, 1);
gpio_export(TPS6586X_GPIO2, false);
- gpio_request(TCA6416_GPIO4, "tca6416_gpio4");
+ ret = gpio_request(TCA6416_GPIO4, "tca6416_gpio4");
+ if (ret < 0) {
+ pr_err("%s failed at line %d with error %d\n", __func__, __LINE__, ret);
+ return ret;
+ }
gpio_direction_output(TCA6416_GPIO4, 0);
gpio_export(TCA6416_GPIO4, false);
- gpio_request(TCA6416_GPIO5, "tca6416_gpio5");
+ ret = gpio_request(TCA6416_GPIO5, "tca6416_gpio5");
+ if (ret < 0) {
+ pr_err("%s failed at line %d with error %d\n", __func__, __LINE__, ret);
+ return ret;
+ }
gpio_direction_output(TCA6416_GPIO5, 1);
gpio_export(TCA6416_GPIO5, false);
- gpio_request(TCA6416_GPIO6, "tca6416_gpio6");
+ ret = gpio_request(TCA6416_GPIO6, "tca6416_gpio6");
+ if (ret < 0) {
+ pr_err("%s failed at line %d with error %d\n", __func__, __LINE__, ret);
+ return ret;
+ }
gpio_direction_output(TCA6416_GPIO6, 0);
gpio_export(TCA6416_GPIO6, false);
- gpio_request(TCA6416_GPIO7, "tca6416_gpio7");
+ ret = gpio_request(TCA6416_GPIO7, "tca6416_gpio7");
+ if (ret < 0) {
+ pr_err("%s failed at line %d with error %d\n", __func__, __LINE__, ret);
+ return ret;
+ }
gpio_direction_output(TCA6416_GPIO7, 1);
gpio_export(TCA6416_GPIO7, false);
- gpio_request(TCA6416_GPIO15, "tca6416_gpio15");
+ ret = gpio_request(TCA6416_GPIO15, "tca6416_gpio15");
+ if (ret < 0) {
+ pr_err("%s failed at line %d with error %d\n", __func__, __LINE__, ret);
+ return ret;
+ }
gpio_direction_output(TCA6416_GPIO15, 1);
gpio_export(TCA6416_GPIO15, false);