summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-ventana-sensors.c
diff options
context:
space:
mode:
authorBharat Nihalani <bnihalani@nvidia.com>2010-12-15 17:56:15 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2012-03-23 21:08:50 -0700
commita974680ede1f6b80a8a4803ff4996e336365fad4 (patch)
tree79d70942544168cea0ac170153104cd96dd27bde /arch/arm/mach-tegra/board-ventana-sensors.c
parentb064318946977ef32b93993206a76b0be92b56b2 (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/mach-tegra/board-ventana-sensors.c')
-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 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);