CHROMIUM: Remove "DP Hotplug" in mach-exynos.
[cascardo/linux.git] / arch / arm / mach-exynos / mach-exynos5-dt.c
index 470e21b..0d12546 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
+#include <mach/bitfix-snow.h>
 #include <mach/map.h>
 #include <mach/ppmu.h>
 #include <mach/dev.h>
@@ -144,20 +145,25 @@ static struct s3c_fb_pd_win smdk5250_fb_win2 = {
 };
 #endif
 
-static struct fb_videomode snow_fb_window[] = {
-       {
-               .left_margin    = 72,
-               .right_margin   = 72,
-               .upper_margin   = 27,
-               .lower_margin   = 26,
+/*
+ * - 70250000. / ((1366 + 40 + 40 + 32) * (768 + 10 + 10 + 5))
+ * - 59.93751141159025
+ * - 70500000. / ((1366 + 40 + 40 + 32) * (768 + 10 + 10 + 5))
+ * - 60.150812163944664
+ * - 70500000. / ((1366 + 40 + 40 + 32) * (768 + 10 + 12 + 6))
+ *   59.92411312312578
+ */
+static struct fb_videomode snow_fb_window = {
+               .left_margin    = 40,
+               .right_margin   = 40,
+               .upper_margin   = 10,
+               .lower_margin   = 12,
                .hsync_len      = 32,
-               .vsync_len      = 5,
+               .vsync_len      = 6,
                .xres           = 1366,
                .yres           = 768,
-       }, {
-               .xres           = -1,
-               .yres           = -1,
-       },
+               .refresh        = 60,
+               .pixclock       = 70500000,
 };
 
 static void exynos_fimd_gpio_setup_24bpp(void)
@@ -217,31 +223,18 @@ static struct exynos_drm_hdmi_pdata drm_hdmi_pdata = {
 
 #ifdef CONFIG_DRM_EXYNOS_FIMD
 static struct exynos_drm_fimd_pdata smdk5250_lcd1_pdata = {
-       .panel[0].timing   = {
-               .xres           = 1280,
-               .yres           = 800,
-               .hsync_len      = 4,
-               .left_margin    = 0x4,
-               .right_margin   = 0x4,
-               .vsync_len      = 4,
-               .upper_margin   = 4,
-               .lower_margin   = 4,
-               .refresh        = 60,
-       },
-       .panel[1].timing   = {
-               .xres           = 1280,
-               .yres           = 720,
-               .hsync_len      = 4,
-               .left_margin    = 0x4,
-               .right_margin   = 0x4,
-               .vsync_len      = 4,
-               .upper_margin   = 4,
-               .lower_margin   = 4,
-               .refresh        = 60,
-       },
-       .panel[2].timing   = {
-               .xres           = -1,
-               .yres           = -1,
+       .panel = {
+               .timing   = {
+                       .xres           = 1280,
+                       .yres           = 800,
+                       .hsync_len      = 4,
+                       .left_margin    = 0x4,
+                       .right_margin   = 0x4,
+                       .vsync_len      = 4,
+                       .upper_margin   = 4,
+                       .lower_margin   = 4,
+                       .refresh        = 60,
+               },
        },
        .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
        .vidcon1        = VIDCON1_INV_VCLK,
@@ -553,6 +546,7 @@ static struct dwc3_exynos_data smdk5250_xhci_pdata = {
        .phy_init = s5p_usb_phy_init,
        .phy_exit = s5p_usb_phy_exit,
        .phyclk_switch = exynos5_dwc_phyclk_switch,
+       .use_ext_clk = s5p_usb_phy_use_ext_clk,
 };
 
 struct exynos_gpio_cfg {
@@ -566,7 +560,7 @@ static const char *rclksrc[] = {
        [1] = "i2sclk",
 };
 
-static struct video_info smdk5250_dp_config = {
+static struct video_info ptn3460_dp_config = {
        .name                   = "eDP-LVDS NXP PTN3460",
 
        .h_sync_polarity        = 0,
@@ -582,11 +576,29 @@ static struct video_info smdk5250_dp_config = {
        .lane_count             = LANE_COUNT2,
 };
 
+static struct video_info ps8622_dp_config = {
+       .name                   = "eDP-LVDS Parade PS8622",
+
+       .h_sync_polarity        = 0,
+       .v_sync_polarity        = 0,
+       .interlaced             = 0,
+
+       .color_space            = COLOR_RGB,
+       .dynamic_range          = VESA,
+       .ycbcr_coeff            = COLOR_YCBCR601,
+       .color_depth            = COLOR_8,
+
+       .link_rate              = LINK_RATE_2_70GBPS,
+       .lane_count             = LANE_COUNT1,
+};
+
 static struct exynos_dp_platdata smdk5250_dp_data = {
-       .video_info     = &smdk5250_dp_config,
-       .training_type  = SW_LINK_TRAINING,
-       .phy_init       = s5p_dp_phy_init,
-       .phy_exit       = s5p_dp_phy_exit,
+       .video_info             = &ptn3460_dp_config,
+       .training_type          = SW_LINK_TRAINING,
+       .hpd_gpio               = -ENODEV,
+       .force_connected        = true,
+       .phy_init               = s5p_dp_phy_init,
+       .phy_exit               = s5p_dp_phy_exit,
 };
 
 #define S5P_PMU_DEBUG                          S5P_PMUREG(0x0A00)
@@ -683,6 +695,7 @@ static bool enable_mwi87xx(void)
 static void exynos_wifi_bt_set_power(u32 slot_id, u32 volt)
 {
        if (volt == 0 || (!of_machine_is_compatible("google,snow") &&
+                         !of_machine_is_compatible("google,spring") &&
                          !of_machine_is_compatible("google,daisy")))
                return;
        if (!enable_mwi87xx())
@@ -926,13 +939,16 @@ static struct platform_device *smdk5250_devices[] __initdata = {
 #ifdef CONFIG_DRM_EXYNOS_HDMI
        &exynos_drm_hdmi_device,
 #endif
+#ifdef CONFIG_BUSFREQ_OPP
+       &exynos5_busfreq,
+#endif
+};
+
+static struct platform_device *thermistor_devices[] __initdata = {
        &s3c_device_adc_ntc_thermistor0,
        &s3c_device_adc_ntc_thermistor1,
        &s3c_device_adc_ntc_thermistor2,
        &s3c_device_adc_ntc_thermistor3,
-#ifdef CONFIG_BUSFREQ_OPP
-       &exynos5_busfreq,
-#endif
 };
 
 static struct regulator_consumer_supply dummy_supplies[] = {
@@ -994,6 +1010,7 @@ static void __init exynos5_reserve(void)
        init_consistent_dma_size(SZ_64M);
 
        exynos5_ramoops_reserve();
+       bitfix_reserve();
 }
 
 static void s5p_tv_setup(void)
@@ -1015,7 +1032,6 @@ static void exynos5_i2c_setup(void)
 static void __init exynos5250_dt_machine_init(void)
 {
        struct device_node *srom_np, *np;
-       int i;
 
        regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
 
@@ -1034,14 +1050,26 @@ static void __init exynos5250_dt_machine_init(void)
        }
 
        /*
-        * Request lcd_bl_en GPIO for smdk5250_bl_notify().
-        * TODO: Fix this so we are not at risk of requesting the GPIO
-        * multiple times, this should be done with device tree, and
-        * likely integrated into the plat-samsung/dev-backlight.c init.
+        * Set the backlight on LCD_PWM pin only for boards not using the
+        * Parade eDP bridge which has an internal PWN for the backlight.
         */
-       gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH, "lcd_bl_en");
+       if (!of_find_compatible_node(NULL, NULL, "parade,ps8622")) {
+               if (of_machine_is_compatible("google,snow")) {
+                       smdk5250_bl_data.max_brightness = 2800;
+                       smdk5250_bl_data.dft_brightness = 2800;
+               }
 
-       samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
+               /*
+                * Request lcd_bl_en GPIO for smdk5250_bl_notify().
+                * TODO: Fix this so we are not at risk of requesting the GPIO
+                * multiple times, this should be done with device tree, and
+                * likely integrated into the plat-samsung/dev-backlight.c init.
+                */
+               gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH,
+                                "lcd_bl_en");
+
+               samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
+       }
 
        /*
         * HACK ALERT! TODO: FIXME!
@@ -1053,12 +1081,8 @@ static void __init exynos5250_dt_machine_init(void)
 
        if (of_machine_is_compatible("google,daisy")) {
 #ifdef CONFIG_DRM_EXYNOS_FIMD
-               smdk5250_lcd1_pdata.panel[0].timing.xres = 1366;
-               smdk5250_lcd1_pdata.panel[0].timing.yres = 768;
-               smdk5250_lcd1_pdata.panel[1].timing.xres = 1280;
-               smdk5250_lcd1_pdata.panel[1].timing.yres = 720;
-               smdk5250_lcd1_pdata.panel[2].timing.xres = -1;
-               smdk5250_lcd1_pdata.panel[2].timing.yres = -1;
+               smdk5250_lcd1_pdata.panel.timing.xres = 1366;
+               smdk5250_lcd1_pdata.panel.timing.yres = 768;
                smdk5250_lcd1_pdata.panel_type = MIPI_LCD;
 #else
                smdk5250_fb_win0.win_mode.xres = 1366;
@@ -1078,17 +1102,31 @@ static void __init exynos5250_dt_machine_init(void)
 #endif
                dsim_lcd_info.lcd_size.width = 1366;
                dsim_lcd_info.lcd_size.height = 768;
-       } else if (of_machine_is_compatible("google,snow")) {
+       } else if ((of_machine_is_compatible("google,snow")) ||
+                  (of_machine_is_compatible("google,spring"))) {
 #ifdef CONFIG_DRM_EXYNOS_FIMD
-               for (i = 0;i < ARRAY_SIZE(snow_fb_window);i++)
-                       smdk5250_lcd1_pdata.panel[i].timing = snow_fb_window[i];
+               smdk5250_lcd1_pdata.panel.timing = snow_fb_window;
 
                smdk5250_lcd1_pdata.panel_type = DP_LCD;
-               smdk5250_lcd1_pdata.clock_rate = 76400000;
                smdk5250_lcd1_pdata.vidcon1 = 0;
+               smdk5250_lcd1_pdata.clock_rate =
+                       smdk5250_lcd1_pdata.panel.timing.pixclock;
 #endif
        }
 
+       /* put the DP output configuration matching the eDP-LVDS bridge */
+       if (of_find_compatible_node(NULL, NULL, "nxp,ptn3460")) {
+               smdk5250_dp_data.video_info = &ptn3460_dp_config;
+       } else {
+               struct device_node *node =
+                       of_find_compatible_node(NULL, NULL, "parade,ps8622");
+               if (node) {
+                       smdk5250_dp_data.video_info = &ps8622_dp_config;
+                       smdk5250_dp_data.hpd_gpio =
+                               of_get_named_gpio(node, "hpd-gpio", 0);
+               }
+       }
+
        if (gpio_request_one(EXYNOS5_GPX2(6), GPIOF_OUT_INIT_HIGH,
                "HOST_VBUS_CONTROL")) {
                printk(KERN_ERR "failed to request gpio_host_vbus\n");
@@ -1140,13 +1178,19 @@ static void __init exynos5250_dt_machine_init(void)
 #endif
        s5p_tv_setup();
 
-       /* Enable power to ADC */
-       __raw_writel(0x1, S5P_ADC_PHY_CONTROL);
+       np = of_find_compatible_node(NULL, NULL, "samsung,exynos5-adc");
+       if (np && of_device_is_available(np)) {
+               /* Enable power to ADC */
+               __raw_writel(0x1, S5P_ADC_PHY_CONTROL);
 
-       s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor0);
-       s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor1);
-       s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor2);
-       s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor3);
+               s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor0);
+               s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor1);
+               s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor2);
+               s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor3);
+
+               platform_add_devices(thermistor_devices,
+                                    ARRAY_SIZE(thermistor_devices));
+       }
 
 #ifdef CONFIG_BUSFREQ_OPP
        dev_add(&busfreq, &exynos5_busfreq.dev);