]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ARM: SAMSUNG: make local setup-camif in mach-s3c24xx
authorKukjin Kim <kgene@kernel.org>
Wed, 29 Jul 2015 16:48:17 +0000 (01:48 +0900)
committerKukjin Kim <kgene@kernel.org>
Wed, 29 Jul 2015 16:48:44 +0000 (01:48 +0900)
This patch moves setup-camif from plat-samsung into mach-s3c24xx
because it can be used only for s3c24xx no other platforms.

Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
arch/arm/mach-s3c24xx/Kconfig
arch/arm/mach-s3c24xx/Makefile
arch/arm/mach-s3c24xx/setup-camif.c [new file with mode: 0644]
arch/arm/plat-samsung/Kconfig
arch/arm/plat-samsung/Makefile
arch/arm/plat-samsung/setup-camif.c [deleted file]

index 23bec3a85b22bb2e2231804d8c164839f5e46818..ef68ecb273964f7c237078752b555d326aa08056 100644 (file)
@@ -124,6 +124,11 @@ config S3C24XX_PLL
          This also means that the PLL tables for the selected CPU(s) will
          be built which may increase the size of the kernel image.
 
+config S3C_SETUP_CAMIF
+       bool
+       help
+         Compile in common setup code for S3C CAMIF devices
+
 # cpu frequency items common between s3c2410 and s3c2440/s3c2442
 
 config S3C2410_IOTIMING
index 05920c8a5764737b845883030be776b6b1d9c122..8ac2f58a3480db0886562c73e0af0958dbb6644e 100644 (file)
@@ -99,3 +99,4 @@ obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO)        += setup-sdhci-gpio.o
 obj-$(CONFIG_S3C2443_SETUP_SPI)                += setup-spi.o
 obj-$(CONFIG_ARCH_S3C24XX)             += setup-i2c.o
 obj-$(CONFIG_S3C24XX_SETUP_TS)         += setup-ts.o
+obj-$(CONFIG_S3C_SETUP_CAMIF)          += setup-camif.o
diff --git a/arch/arm/mach-s3c24xx/setup-camif.c b/arch/arm/mach-s3c24xx/setup-camif.c
new file mode 100644 (file)
index 0000000..72d8edb
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
+ *
+ * Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+#include <plat/gpio-cfg.h>
+#include <mach/gpio-samsung.h>
+
+/* Number of camera port pins, without FIELD */
+#define S3C_CAMIF_NUM_GPIOS    13
+
+/* Default camera port configuration helpers. */
+
+static void camif_get_gpios(int *gpio_start, int *gpio_reset)
+{
+#ifdef CONFIG_ARCH_S3C24XX
+       *gpio_start = S3C2410_GPJ(0);
+       *gpio_reset = S3C2410_GPJ(12);
+#else
+       /* s3c64xx */
+       *gpio_start = S3C64XX_GPF(0);
+       *gpio_reset = S3C64XX_GPF(3);
+#endif
+}
+
+int s3c_camif_gpio_get(void)
+{
+       int gpio_start, gpio_reset;
+       int ret, i;
+
+       camif_get_gpios(&gpio_start, &gpio_reset);
+
+       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
+               int gpio = gpio_start + i;
+
+               if (gpio == gpio_reset)
+                       continue;
+
+               ret = gpio_request(gpio, "camif");
+               if (!ret)
+                       ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
+               if (ret) {
+                       pr_err("failed to configure GPIO %d\n", gpio);
+                       for (--i; i >= 0; i--)
+                               gpio_free(gpio--);
+                       return ret;
+               }
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+
+       return 0;
+}
+
+void s3c_camif_gpio_put(void)
+{
+       int i, gpio_start, gpio_reset;
+
+       camif_get_gpios(&gpio_start, &gpio_reset);
+
+       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
+               int gpio = gpio_start + i;
+               if (gpio != gpio_reset)
+                       gpio_free(gpio);
+       }
+}
index cb8e3d655d1ab362ea6123ea60d909fb08fec1c5..f115c8156758823ebaf726bf56c6747f1c713e07 100644 (file)
@@ -231,18 +231,12 @@ config S3C24XX_PWM
          Support for exporting the PWM timer blocks via the pwm device
          system
 
-config S3C_SETUP_CAMIF
-       bool
-       help
-         Compile in common setup code for S3C CAMIF devices
-
 config SAMSUNG_PM_GPIO
        bool
        default y if GPIO_SAMSUNG && PM
        help
          Include legacy GPIO power management code for platforms not using
          pinctrl-samsung driver.
-
 endif
 
 config S5P_DEV_MFC
index 1a29ab1f446d3438efcff4affc8bdf9faffbab1d..c48a2ccb1c620933e6e0e6118bfa1e9c3ee0ca9b 100644 (file)
@@ -24,8 +24,6 @@ obj-$(CONFIG_S5P_DEV_MFC)     += s5p-dev-mfc.o
 
 obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)    += dev-backlight.o
 
-obj-$(CONFIG_S3C_SETUP_CAMIF)  += setup-camif.o
-
 # PM support
 
 obj-$(CONFIG_PM_SLEEP)         += pm-common.o
diff --git a/arch/arm/plat-samsung/setup-camif.c b/arch/arm/plat-samsung/setup-camif.c
deleted file mode 100644 (file)
index 72d8edb..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
- *
- * Helper functions for S3C24XX/S3C64XX SoC series CAMIF driver
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/gpio.h>
-#include <plat/gpio-cfg.h>
-#include <mach/gpio-samsung.h>
-
-/* Number of camera port pins, without FIELD */
-#define S3C_CAMIF_NUM_GPIOS    13
-
-/* Default camera port configuration helpers. */
-
-static void camif_get_gpios(int *gpio_start, int *gpio_reset)
-{
-#ifdef CONFIG_ARCH_S3C24XX
-       *gpio_start = S3C2410_GPJ(0);
-       *gpio_reset = S3C2410_GPJ(12);
-#else
-       /* s3c64xx */
-       *gpio_start = S3C64XX_GPF(0);
-       *gpio_reset = S3C64XX_GPF(3);
-#endif
-}
-
-int s3c_camif_gpio_get(void)
-{
-       int gpio_start, gpio_reset;
-       int ret, i;
-
-       camif_get_gpios(&gpio_start, &gpio_reset);
-
-       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
-               int gpio = gpio_start + i;
-
-               if (gpio == gpio_reset)
-                       continue;
-
-               ret = gpio_request(gpio, "camif");
-               if (!ret)
-                       ret = s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
-               if (ret) {
-                       pr_err("failed to configure GPIO %d\n", gpio);
-                       for (--i; i >= 0; i--)
-                               gpio_free(gpio--);
-                       return ret;
-               }
-               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
-       }
-
-       return 0;
-}
-
-void s3c_camif_gpio_put(void)
-{
-       int i, gpio_start, gpio_reset;
-
-       camif_get_gpios(&gpio_start, &gpio_reset);
-
-       for (i = 0; i < S3C_CAMIF_NUM_GPIOS; i++) {
-               int gpio = gpio_start + i;
-               if (gpio != gpio_reset)
-                       gpio_free(gpio);
-       }
-}