setup-fimc.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2011 Samsung Electronics Co., Ltd.
  3. *
  4. * Exynos4 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. #include <linux/gpio.h>
  11. #include <plat/gpio-cfg.h>
  12. #include <plat/camport.h>
  13. int exynos4_fimc_setup_gpio(enum s5p_camport_id id)
  14. {
  15. u32 gpio8, gpio5;
  16. u32 sfn;
  17. int ret;
  18. switch (id) {
  19. case S5P_CAMPORT_A:
  20. gpio8 = EXYNOS4_GPJ0(0); /* PCLK, VSYNC, HREF, DATA[0:4] */
  21. gpio5 = EXYNOS4_GPJ1(0); /* DATA[5:7], CLKOUT, FIELD */
  22. sfn = S3C_GPIO_SFN(2);
  23. break;
  24. case S5P_CAMPORT_B:
  25. gpio8 = EXYNOS4_GPE0(0); /* DATA[0:7] */
  26. gpio5 = EXYNOS4_GPE1(0); /* PCLK, VSYNC, HREF, CLKOUT, FIELD */
  27. sfn = S3C_GPIO_SFN(3);
  28. break;
  29. default:
  30. WARN(1, "Wrong camport id: %d\n", id);
  31. return -EINVAL;
  32. }
  33. ret = s3c_gpio_cfgall_range(gpio8, 8, sfn, S3C_GPIO_PULL_UP);
  34. if (ret)
  35. return ret;
  36. return s3c_gpio_cfgall_range(gpio5, 5, sfn, S3C_GPIO_PULL_UP);
  37. }