Merge git://git.kernel.org/pub/scm/linux/kernel/git/nico/orion into fixes
[pandora-kernel.git] / arch / arm / mach-s5pv210 / setup-fimc.c
1 /*
2  * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3  *
4  * S5PV210 camera interface GPIO configuration.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #include <linux/gpio.h>
12 #include <plat/gpio-cfg.h>
13 #include <plat/camport.h>
14
15 int s5pv210_fimc_setup_gpio(enum s5p_camport_id id)
16 {
17         u32 gpio8, gpio5;
18         int ret;
19
20         switch (id) {
21         case S5P_CAMPORT_A:
22                 gpio8 = S5PV210_GPE0(0);
23                 gpio5 = S5PV210_GPE1(0);
24                 break;
25
26         case S5P_CAMPORT_B:
27                 gpio8 = S5PV210_GPJ0(0);
28                 gpio5 = S5PV210_GPJ1(0);
29                 break;
30
31         default:
32                 WARN(1, "Wrong camport id: %d\n", id);
33                 return -EINVAL;
34         }
35
36         ret = s3c_gpio_cfgall_range(gpio8, 8, S3C_GPIO_SFN(2),
37                                     S3C_GPIO_PULL_UP);
38         if (ret)
39                 return ret;
40
41         return s3c_gpio_cfgall_range(gpio5, 5, S3C_GPIO_SFN(2),
42                                      S3C_GPIO_PULL_UP);
43 }