diff options
author | Bharat Nihalani <bnihalani@nvidia.com> | 2010-12-15 17:56:15 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:46:07 -0800 |
commit | f06ba73dec4757a6716fd2db42b501033a2854b9 (patch) | |
tree | 6a9f10e8246d2ba3d850b97c23e45ba74e7b58b4 /arch/arm | |
parent | 0932c8ae2d5b8e809d3cba0dedd85ce261347de8 (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.
Original-Change-Id: Ia17e33bb68267358b4966f732778a80ba229f364
Reviewed-on: http://git-master/r/13337
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Rebase-Id: Rb4ed70e987600349b1deb70aad562bdfb84acf34
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-sensors.c | 39 |
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 df013b8b297c..6a37b7ab4a2b 100644 --- a/arch/arm/mach-tegra/board-ventana-sensors.c +++ b/arch/arm/mach-tegra/board-ventana-sensors.c @@ -188,34 +188,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); |