diff options
author | Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | 2012-11-22 00:29:18 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2012-11-27 18:03:27 -0500 |
commit | e51d5486a9940e22aa5034bc26cf10ea63ca0b7c (patch) | |
tree | d1f6a5aa9ca7305e8d1fe32036eb631e1a2e681e /arch | |
parent | f4a75d2eb7b1e2206094b901be09adb31ba63681 (diff) |
ARM: SAMSUNG: Add s3c24xx/s3c64xx CAMIF GPIO setup helpers
This patch adds default helper functions for the camera port
pin configuration. Whenever pinctrl support for s3c24xx/s3c64xx
SoCs is available these code should be removed and proper pinctrl
API should be used in the CAMIF driver.
Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-s3c24xx/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/plat-samsung/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-samsung/setup-camif.c | 70 |
4 files changed, 77 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 2b6cb5f29c2d..01f70c977676 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
@@ -405,6 +405,7 @@ config MACH_MINI2440 | |||
405 | select NEW_LEDS | 405 | select NEW_LEDS |
406 | select S3C_DEV_NAND | 406 | select S3C_DEV_NAND |
407 | select S3C_DEV_USB_HOST | 407 | select S3C_DEV_USB_HOST |
408 | select S3C_SETUP_CAMIF | ||
408 | help | 409 | help |
409 | Say Y here to select support for the MINI2440. Is a 10cm x 10cm board | 410 | Say Y here to select support for the MINI2440. Is a 10cm x 10cm board |
410 | available via various sources. It can come with a 3.5" or 7" touch LCD. | 411 | available via various sources. It can come with a 3.5" or 7" touch LCD. |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 59401e1cc530..95360e679f4e 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -414,6 +414,11 @@ config S5P_SETUP_MIPIPHY | |||
414 | help | 414 | help |
415 | Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices | 415 | Compile in common setup code for MIPI-CSIS and MIPI-DSIM devices |
416 | 416 | ||
417 | config S3C_SETUP_CAMIF | ||
418 | bool | ||
419 | help | ||
420 | Compile in common setup code for S3C CAMIF devices | ||
421 | |||
417 | # DMA | 422 | # DMA |
418 | 423 | ||
419 | config S3C_DMA | 424 | config S3C_DMA |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 9e40e8d00740..3a7c64d1814a 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o | |||
41 | 41 | ||
42 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o | 42 | obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o |
43 | 43 | ||
44 | obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o | ||
44 | obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o | 45 | obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o |
45 | 46 | ||
46 | # DMA support | 47 | # DMA support |
diff --git a/arch/arm/plat-samsung/setup-camif.c b/arch/arm/plat-samsung/setup-camif.c new file mode 100644 index 000000000000..e01bf760af2c --- /dev/null +++ b/arch/arm/plat-samsung/setup-camif.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
3 | * | ||
4 | * Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver | ||
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 | |||
14 | /* Number of camera port pins, without FIELD */ | ||
15 | #define S3C_CAMIF_NUM_GPIOS 13 | ||
16 | |||
17 | /* Default camera port configuration helpers. */ | ||
18 | |||
19 | static void camif_get_gpios(int *gpio_start, int *gpio_reset) | ||
20 | { | ||
21 | #ifdef CONFIG_ARCH_S3C24XX | ||
22 | *gpio_start = S3C2410_GPJ(0); | ||
23 | *gpio_reset = S3C2410_GPJ(12); | ||
24 | #else | ||
25 | /* s3c64xx */ | ||
26 | *gpio_start = S3C64XX_GPF(0); | ||
27 | *gpio_reset = S3C64XX_GPF(3); | ||
28 | #endif | ||
29 | } | ||
30 | |||
31 | int s3c_camif_gpio_get(void) | ||
32 | { | ||
33 | int gpio_start, gpio_reset; | ||
34 | int ret, i; | ||
35 | |||
36 | camif_get_gpios(&gpio_start, &gpio_reset); | ||
37 | |||
38 | for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) { | ||
39 | int gpio = gpio_start + i; | ||
40 | |||
41 | if (gpio == gpio_reset) | ||
42 | continue; | ||
43 | |||
44 | ret = gpio_request(gpio, "camif"); | ||
45 | if (!ret) | ||
46 | ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
47 | if (ret) { | ||
48 | pr_err("failed to configure GPIO %d\n", gpio); | ||
49 | for (--i; i >= 0; i--) | ||
50 | gpio_free(gpio--); | ||
51 | return ret; | ||
52 | } | ||
53 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
54 | } | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | void s3c_camif_gpio_put(void) | ||
60 | { | ||
61 | int i, gpio_start, gpio_reset; | ||
62 | |||
63 | camif_get_gpios(&gpio_start, &gpio_reset); | ||
64 | |||
65 | for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) { | ||
66 | int gpio = gpio_start + i; | ||
67 | if (gpio != gpio_reset) | ||
68 | gpio_free(gpio); | ||
69 | } | ||
70 | } | ||