aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos4/mach-universal_c210.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2011-09-26 18:18:55 -0400
committerKukjin Kim <kgene.kim@samsung.com>2011-10-04 05:58:57 -0400
commit0513218222d15e4c3aad20747d21d4007b1c6a95 (patch)
tree7e5852e2b48c19d20919cf12968354c53614c996 /arch/arm/mach-exynos4/mach-universal_c210.c
parent39aefabbc8b3fbe2e339b97c8dac73a895077661 (diff)
ARM: S5PV210: Add support for M-5MOLS image sensor on UNIVERSAL_C210
Add voltage regulator definitions for M-5MOLS camera, platform data definition for the sensor and MIPI-CSI receiver drivers. Add CAM power domain dependencies for FIMC and CSIS devices. Define required I2C0 bus timings. Setup camera port A GPIO. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos4/mach-universal_c210.c')
-rw-r--r--arch/arm/mach-exynos4/mach-universal_c210.c206
1 files changed, 198 insertions, 8 deletions
diff --git a/arch/arm/mach-exynos4/mach-universal_c210.c b/arch/arm/mach-exynos4/mach-universal_c210.c
index 315c50328067..18cf5c7cf56d 100644
--- a/arch/arm/mach-exynos4/mach-universal_c210.c
+++ b/arch/arm/mach-exynos4/mach-universal_c210.c
@@ -37,9 +37,16 @@
37#include <plat/sdhci.h> 37#include <plat/sdhci.h>
38#include <plat/pd.h> 38#include <plat/pd.h>
39#include <plat/regs-fb-v4.h> 39#include <plat/regs-fb-v4.h>
40#include <plat/fimc-core.h>
41#include <plat/camport.h>
42#include <plat/mipi_csis.h>
40 43
41#include <mach/map.h> 44#include <mach/map.h>
42 45
46#include <media/v4l2-mediabus.h>
47#include <media/s5p_fimc.h>
48#include <media/m5mols.h>
49
43/* Following are default values for UCON, ULCON and UFCON UART registers */ 50/* Following are default values for UCON, ULCON and UFCON UART registers */
44#define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 51#define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
45 S3C2410_UCON_RXILEVEL | \ 52 S3C2410_UCON_RXILEVEL | \
@@ -192,6 +199,7 @@ static struct regulator_init_data lp3974_ldo2_data = {
192static struct regulator_consumer_supply lp3974_ldo3_consumer[] = { 199static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
193 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), 200 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
194 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), 201 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
202 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
195}; 203};
196 204
197static struct regulator_init_data lp3974_ldo3_data = { 205static struct regulator_init_data lp3974_ldo3_data = {
@@ -254,6 +262,10 @@ static struct regulator_init_data lp3974_ldo6_data = {
254 }, 262 },
255}; 263};
256 264
265static struct regulator_consumer_supply lp3974_ldo7_consumer[] = {
266 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"),
267};
268
257static struct regulator_init_data lp3974_ldo7_data = { 269static struct regulator_init_data lp3974_ldo7_data = {
258 .constraints = { 270 .constraints = {
259 .name = "VLCD+VMIPI_1.8V", 271 .name = "VLCD+VMIPI_1.8V",
@@ -265,6 +277,8 @@ static struct regulator_init_data lp3974_ldo7_data = {
265 .disabled = 1, 277 .disabled = 1,
266 }, 278 },
267 }, 279 },
280 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer),
281 .consumer_supplies = lp3974_ldo7_consumer,
268}; 282};
269 283
270static struct regulator_consumer_supply lp3974_ldo8_consumer[] = { 284static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
@@ -313,6 +327,9 @@ static struct regulator_init_data lp3974_ldo10_data = {
313 }, 327 },
314}; 328};
315 329
330static struct regulator_consumer_supply lp3974_ldo11_consumer =
331 REGULATOR_SUPPLY("dig_28", "0-001f");
332
316static struct regulator_init_data lp3974_ldo11_data = { 333static struct regulator_init_data lp3974_ldo11_data = {
317 .constraints = { 334 .constraints = {
318 .name = "CAM_AF_3.3V", 335 .name = "CAM_AF_3.3V",
@@ -324,6 +341,8 @@ static struct regulator_init_data lp3974_ldo11_data = {
324 .disabled = 1, 341 .disabled = 1,
325 }, 342 },
326 }, 343 },
344 .num_consumer_supplies = 1,
345 .consumer_supplies = &lp3974_ldo11_consumer,
327}; 346};
328 347
329static struct regulator_init_data lp3974_ldo12_data = { 348static struct regulator_init_data lp3974_ldo12_data = {
@@ -352,6 +371,9 @@ static struct regulator_init_data lp3974_ldo13_data = {
352 }, 371 },
353}; 372};
354 373
374static struct regulator_consumer_supply lp3974_ldo14_consumer =
375 REGULATOR_SUPPLY("dig_18", "0-001f");
376
355static struct regulator_init_data lp3974_ldo14_data = { 377static struct regulator_init_data lp3974_ldo14_data = {
356 .constraints = { 378 .constraints = {
357 .name = "CAM_I_HOST_1.8V", 379 .name = "CAM_I_HOST_1.8V",
@@ -363,8 +385,14 @@ static struct regulator_init_data lp3974_ldo14_data = {
363 .disabled = 1, 385 .disabled = 1,
364 }, 386 },
365 }, 387 },
388 .num_consumer_supplies = 1,
389 .consumer_supplies = &lp3974_ldo14_consumer,
366}; 390};
367 391
392
393static struct regulator_consumer_supply lp3974_ldo15_consumer =
394 REGULATOR_SUPPLY("dig_12", "0-001f");
395
368static struct regulator_init_data lp3974_ldo15_data = { 396static struct regulator_init_data lp3974_ldo15_data = {
369 .constraints = { 397 .constraints = {
370 .name = "CAM_S_DIG+FM33_CORE_1.2V", 398 .name = "CAM_S_DIG+FM33_CORE_1.2V",
@@ -376,6 +404,12 @@ static struct regulator_init_data lp3974_ldo15_data = {
376 .disabled = 1, 404 .disabled = 1,
377 }, 405 },
378 }, 406 },
407 .num_consumer_supplies = 1,
408 .consumer_supplies = &lp3974_ldo15_consumer,
409};
410
411static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
412 REGULATOR_SUPPLY("a_sensor", "0-001f"),
379}; 413};
380 414
381static struct regulator_init_data lp3974_ldo16_data = { 415static struct regulator_init_data lp3974_ldo16_data = {
@@ -389,6 +423,8 @@ static struct regulator_init_data lp3974_ldo16_data = {
389 .disabled = 1, 423 .disabled = 1,
390 }, 424 },
391 }, 425 },
426 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer),
427 .consumer_supplies = lp3974_ldo16_consumer,
392}; 428};
393 429
394static struct regulator_init_data lp3974_ldo17_data = { 430static struct regulator_init_data lp3974_ldo17_data = {
@@ -499,6 +535,15 @@ static struct max8998_platform_data universal_lp3974_pdata = {
499 .wakeup = true, 535 .wakeup = true,
500}; 536};
501 537
538
539enum fixed_regulator_id {
540 FIXED_REG_ID_MMC0,
541 FIXED_REG_ID_HDMI_5V,
542 FIXED_REG_ID_CAM_S_IF,
543 FIXED_REG_ID_CAM_I_CORE,
544 FIXED_REG_ID_CAM_VT_DIO,
545};
546
502static struct regulator_consumer_supply hdmi_fixed_consumer = 547static struct regulator_consumer_supply hdmi_fixed_consumer =
503 REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi"); 548 REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi");
504 549
@@ -521,7 +566,7 @@ static struct fixed_voltage_config hdmi_fixed_voltage_config = {
521 566
522static struct platform_device hdmi_fixed_voltage = { 567static struct platform_device hdmi_fixed_voltage = {
523 .name = "reg-fixed-voltage", 568 .name = "reg-fixed-voltage",
524 .id = 6, 569 .id = FIXED_REG_ID_HDMI_5V,
525 .dev = { 570 .dev = {
526 .platform_data = &hdmi_fixed_voltage_config, 571 .platform_data = &hdmi_fixed_voltage_config,
527 }, 572 },
@@ -628,6 +673,11 @@ static void __init universal_touchkey_init(void)
628 gpio_direction_output(gpio, 1); 673 gpio_direction_output(gpio, 1);
629} 674}
630 675
676static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
677 .frequency = 300 * 1000,
678 .sda_delay = 200,
679};
680
631/* GPIO KEYS */ 681/* GPIO KEYS */
632static struct gpio_keys_button universal_gpio_keys_tables[] = { 682static struct gpio_keys_button universal_gpio_keys_tables[] = {
633 { 683 {
@@ -713,7 +763,7 @@ static struct fixed_voltage_config mmc0_fixed_voltage_config = {
713 763
714static struct platform_device mmc0_fixed_voltage = { 764static struct platform_device mmc0_fixed_voltage = {
715 .name = "reg-fixed-voltage", 765 .name = "reg-fixed-voltage",
716 .id = 0, 766 .id = FIXED_REG_ID_MMC0,
717 .dev = { 767 .dev = {
718 .platform_data = &mmc0_fixed_voltage_config, 768 .platform_data = &mmc0_fixed_voltage_config,
719 }, 769 },
@@ -747,11 +797,6 @@ static void __init universal_sdhci_init(void)
747 s3c_sdhci3_set_platdata(&universal_hsmmc3_data); 797 s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
748} 798}
749 799
750/* I2C0 */
751static struct i2c_board_info i2c0_devs[] __initdata = {
752 /* Camera, To be updated */
753};
754
755/* I2C1 */ 800/* I2C1 */
756static struct i2c_board_info i2c1_devs[] __initdata = { 801static struct i2c_board_info i2c1_devs[] __initdata = {
757 /* Gyro, To be updated */ 802 /* Gyro, To be updated */
@@ -783,8 +828,139 @@ static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
783 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 828 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
784}; 829};
785 830
831static struct regulator_consumer_supply cam_i_core_supply =
832 REGULATOR_SUPPLY("core", "0-001f");
833
834static struct regulator_init_data cam_i_core_reg_init_data = {
835 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
836 .num_consumer_supplies = 1,
837 .consumer_supplies = &cam_i_core_supply,
838};
839
840static struct fixed_voltage_config cam_i_core_fixed_voltage_cfg = {
841 .supply_name = "CAM_I_CORE_1.2V",
842 .microvolts = 1200000,
843 .gpio = EXYNOS4_GPE2(2), /* CAM_8M_CORE_EN */
844 .enable_high = 1,
845 .init_data = &cam_i_core_reg_init_data,
846};
847
848static struct platform_device cam_i_core_fixed_reg_dev = {
849 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_I_CORE,
850 .dev = { .platform_data = &cam_i_core_fixed_voltage_cfg },
851};
852
853static struct regulator_consumer_supply cam_s_if_supply =
854 REGULATOR_SUPPLY("d_sensor", "0-001f");
855
856static struct regulator_init_data cam_s_if_reg_init_data = {
857 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
858 .num_consumer_supplies = 1,
859 .consumer_supplies = &cam_s_if_supply,
860};
861
862static struct fixed_voltage_config cam_s_if_fixed_voltage_cfg = {
863 .supply_name = "CAM_S_IF_1.8V",
864 .microvolts = 1800000,
865 .gpio = EXYNOS4_GPE3(0), /* CAM_PWR_EN1 */
866 .enable_high = 1,
867 .init_data = &cam_s_if_reg_init_data,
868};
869
870static struct platform_device cam_s_if_fixed_reg_dev = {
871 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_S_IF,
872 .dev = { .platform_data = &cam_s_if_fixed_voltage_cfg },
873};
874
875static struct s5p_platform_mipi_csis mipi_csis_platdata = {
876 .clk_rate = 166000000UL,
877 .lanes = 2,
878 .alignment = 32,
879 .hs_settle = 12,
880 .phy_enable = s5p_csis_phy_enable,
881};
882
883#define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3)
884#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */
885#define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5)
886
887static int m5mols_set_power(struct device *dev, int on)
888{
889 gpio_set_value(GPIO_CAM_LEVEL_EN(1), !on);
890 gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
891 return 0;
892}
893
894static struct m5mols_platform_data m5mols_platdata = {
895 .gpio_reset = GPIO_CAM_MEGA_nRST,
896 .reset_polarity = 0,
897 .set_power = m5mols_set_power,
898};
899
900static struct i2c_board_info m5mols_board_info = {
901 I2C_BOARD_INFO("M5MOLS", 0x1F),
902 .platform_data = &m5mols_platdata,
903};
904
905static struct s5p_fimc_isp_info universal_camera_sensors[] = {
906 {
907 .mux_id = 0,
908 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
909 V4L2_MBUS_VSYNC_ACTIVE_LOW,
910 .bus_type = FIMC_MIPI_CSI2,
911 .board_info = &m5mols_board_info,
912 .i2c_bus_num = 0,
913 .clk_frequency = 21600000UL,
914 .csi_data_align = 32,
915 },
916};
917
918static struct s5p_platform_fimc fimc_md_platdata = {
919 .isp_info = universal_camera_sensors,
920 .num_clients = ARRAY_SIZE(universal_camera_sensors),
921};
922
923struct platform_device s5p_device_fimc_md = {
924 .name = "s5p-fimc-md",
925 .id = -1,
926};
927
928static struct gpio universal_camera_gpios[] = {
929 { GPIO_CAM_LEVEL_EN(1), GPIOF_OUT_INIT_HIGH, "CAM_LVL_EN1" },
930 { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" },
931 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
932 { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
933};
934
935static void universal_camera_init(void)
936{
937 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
938 &s5p_device_mipi_csis0);
939 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
940 &s5p_device_fimc_md);
941
942 if (gpio_request_array(universal_camera_gpios,
943 ARRAY_SIZE(universal_camera_gpios))) {
944 pr_err("%s: GPIO request failed\n", __func__);
945 return;
946 }
947
948 if (!s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xf)))
949 m5mols_board_info.irq = gpio_to_irq(GPIO_CAM_8M_ISP_INT);
950 else
951 pr_err("Failed to configure 8M_ISP_INT GPIO\n");
952
953 /* Free GPIOs controlled directly by the sensor drivers. */
954 gpio_free(GPIO_CAM_MEGA_nRST);
955 gpio_free(GPIO_CAM_8M_ISP_INT);
956
957 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A))
958 pr_err("Camera port A setup failed\n");
959}
960
786static struct platform_device *universal_devices[] __initdata = { 961static struct platform_device *universal_devices[] __initdata = {
787 /* Samsung Platform Devices */ 962 /* Samsung Platform Devices */
963 &s5p_device_mipi_csis0,
788 &s5p_device_fimc0, 964 &s5p_device_fimc0,
789 &s5p_device_fimc1, 965 &s5p_device_fimc1,
790 &s5p_device_fimc2, 966 &s5p_device_fimc2,
@@ -793,6 +969,7 @@ static struct platform_device *universal_devices[] __initdata = {
793 &s3c_device_hsmmc0, 969 &s3c_device_hsmmc0,
794 &s3c_device_hsmmc2, 970 &s3c_device_hsmmc2,
795 &s3c_device_hsmmc3, 971 &s3c_device_hsmmc3,
972 &s3c_device_i2c0,
796 &s3c_device_i2c3, 973 &s3c_device_i2c3,
797 &s3c_device_i2c5, 974 &s3c_device_i2c5,
798 &s5p_device_i2c_hdmiphy, 975 &s5p_device_i2c_hdmiphy,
@@ -812,6 +989,10 @@ static struct platform_device *universal_devices[] __initdata = {
812 &s5p_device_mfc_r, 989 &s5p_device_mfc_r,
813 &exynos4_device_pd[PD_MFC], 990 &exynos4_device_pd[PD_MFC],
814 &exynos4_device_pd[PD_LCD0], 991 &exynos4_device_pd[PD_LCD0],
992 &exynos4_device_pd[PD_CAM],
993 &cam_i_core_fixed_reg_dev,
994 &cam_s_if_fixed_reg_dev,
995 &s5p_device_fimc_md,
815}; 996};
816 997
817static void __init universal_map_io(void) 998static void __init universal_map_io(void)
@@ -845,7 +1026,7 @@ static void __init universal_machine_init(void)
845 universal_sdhci_init(); 1026 universal_sdhci_init();
846 s5p_tv_setup(); 1027 s5p_tv_setup();
847 1028
848 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); 1029 s3c_i2c0_set_platdata(&universal_i2c0_platdata);
849 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); 1030 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
850 1031
851 universal_tsp_init(); 1032 universal_tsp_init();
@@ -862,10 +1043,19 @@ static void __init universal_machine_init(void)
862 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs, 1043 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
863 ARRAY_SIZE(i2c_gpio12_devs)); 1044 ARRAY_SIZE(i2c_gpio12_devs));
864 1045
1046 universal_camera_init();
1047
865 /* Last */ 1048 /* Last */
866 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices)); 1049 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
1050
867 s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev; 1051 s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
868 s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev; 1052 s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
1053
1054 s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1055 s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1056 s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1057 s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1058 s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
869} 1059}
870 1060
871MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") 1061MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")