From 1e2e1af03b1ca26b1659fa45a49a039946a0d14f Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Wed, 26 Oct 2016 23:19:21 +0200 Subject: apalis-tk1: integrate optional edp support Integrate optional eDP support (e.g. uncomment define of APALIS_TK1_EDP as found in the platform data header file. Tested using a prototype Apalis TK1 mezzanine connecting to a Samsung LTN156FL02-L01 panel featuring a 4K aka UHD resolution of 3840 by 2160. Signed-off-by: Marcel Ziswiler Acked-by: Dominik Sliwa --- .../tegra124-platforms/tegra124-apalis-pmic.dtsi | 6 +- arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/board-apalis-tk1-panel.c | 97 +++++++++++++++++++++- arch/arm/mach-tegra/board-apalis-tk1.h | 2 + arch/arm/mach-tegra/panel-a-edp-1080p-14-0.c | 25 ++++++ 5 files changed, 128 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi b/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi index 745f63b0f7d0..46bd097fc47e 100644 --- a/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi +++ b/arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-pmic.dtsi @@ -416,13 +416,17 @@ as3722_ldo4: ldo4 { regulator-name = "AVDD_LVDS0_PLL"; regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-init-microvolt = <1800000>; consumers { c1 { regulator-consumer-supply = "avdd_lvds0_pll"; }; c2 { + regulator-consumer-supply = "avdd_3v3_dp"; + }; + c3 { regulator-consumer-supply = "avdd_lcd"; }; }; diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 80dfa9f53e43..d3092be73044 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -150,6 +150,7 @@ obj-${CONFIG_MACH_APALIS_TK1} += board-apalis-tk1-sensors.o obj-${CONFIG_MACH_APALIS_TK1} += board-apalis-tk1-panel.o obj-${CONFIG_MACH_APALIS_TK1} += board-apalis-tk1-memory.o obj-${CONFIG_MACH_APALIS_TK1} += board-apalis-tk1-power.o +obj-${CONFIG_MACH_APALIS_TK1} += panel-a-edp-1080p-14-0.o obj-${CONFIG_MACH_APALIS_TK1} += panel-c-lvds-1366-14.o ifeq ($(CONFIG_MACH_APALIS_TK1),y) obj-${CONFIG_SYSEDP_FRAMEWORK} += board-apalis-tk1-sysedp.o diff --git a/arch/arm/mach-tegra/board-apalis-tk1-panel.c b/arch/arm/mach-tegra/board-apalis-tk1-panel.c index 7e95326d75a8..71701ff44f1e 100644 --- a/arch/arm/mach-tegra/board-apalis-tk1-panel.c +++ b/arch/arm/mach-tegra/board-apalis-tk1-panel.c @@ -203,6 +203,7 @@ static struct resource apalis_tk1_disp2_resources[] = { #ifndef CONFIG_TEGRA_HDMI_PRIMARY static struct tegra_dc_sd_settings sd_settings; +#ifndef APALIS_TK1_EDP static struct tegra_dc_mode apalis_tk1_lvds_panel_modes[] = { { .pclk = 27000000, @@ -237,8 +238,13 @@ static struct tegra_dc_out_pin lvds_out_pins[] = { .pol = TEGRA_DC_OUT_PIN_POL_HIGH, }, }; +#endif /* !APALIS_TK1_EDP */ static struct tegra_dc_out apalis_tk1_disp1_out = { +#ifdef APALIS_TK1_EDP + .type = TEGRA_DC_OUT_DSI, + .sd_settings = &sd_settings, +#else /* APALIS_TK1_EDP */ .align = TEGRA_DC_ALIGN_MSB, .order = TEGRA_DC_ORDER_RED_BLUE, .flags = TEGRA_DC_OUT_CONTINUOUS_MODE, @@ -247,6 +253,7 @@ static struct tegra_dc_out apalis_tk1_disp1_out = { .n_modes = ARRAY_SIZE(apalis_tk1_lvds_panel_modes), .out_pins = lvds_out_pins, .n_out_pins = ARRAY_SIZE(lvds_out_pins), +#endif /* APALIS_TK1_EDP */ }; #endif @@ -540,17 +547,102 @@ static struct platform_device apalis_tk1_nvmap_device = { }, }; +#ifdef APALIS_TK1_EDP +static struct tegra_dc_dp_lt_settings apalis_tk1_edp_lt_data[] = { + { + .drive_current = { + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + }, + .lane_preemphasis = { + PRE_EMPHASIS_L0, + PRE_EMPHASIS_L0, + PRE_EMPHASIS_L0, + PRE_EMPHASIS_L0, + }, + .post_cursor = { + POST_CURSOR2_L0, + POST_CURSOR2_L0, + POST_CURSOR2_L0, + POST_CURSOR2_L0, + }, + .tx_pu = 0, + .load_adj = 0x3, + }, + { + .drive_current = { + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + }, + .lane_preemphasis = { + PRE_EMPHASIS_L0, + PRE_EMPHASIS_L0, + PRE_EMPHASIS_L0, + PRE_EMPHASIS_L0, + }, + .post_cursor = { + POST_CURSOR2_L0, + POST_CURSOR2_L0, + POST_CURSOR2_L0, + POST_CURSOR2_L0, + }, + .tx_pu = 0, + .load_adj = 0x4, + }, + { + .drive_current = { + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + DRIVE_CURRENT_L0, + }, + .lane_preemphasis = { + PRE_EMPHASIS_L1, + PRE_EMPHASIS_L1, + PRE_EMPHASIS_L1, + PRE_EMPHASIS_L1, + }, + .post_cursor = { + POST_CURSOR2_L0, + POST_CURSOR2_L0, + POST_CURSOR2_L0, + POST_CURSOR2_L0, + }, + .tx_pu = 0, + .load_adj = 0x6, + }, +}; + +static struct tegra_dp_out dp_settings = { + /* Panel can override this with its own LT data */ + .lt_settings = apalis_tk1_edp_lt_data, + .n_lt_settings = ARRAY_SIZE(apalis_tk1_edp_lt_data), + .tx_pu_disable = true, +}; +#endif /* APALIS_TK1_EDP */ + #ifndef CONFIG_TEGRA_HDMI_PRIMARY /* can be called multiple times */ static struct tegra_panel *apalis_tk1_panel_configure(void) { struct tegra_panel *panel = NULL; - panel = &lvds_c_1366_14; - apalis_tk1_disp1_out.type = TEGRA_DC_OUT_LVDS; apalis_tk1_disp1_device.resource = apalis_tk1_disp1_edp_resources; apalis_tk1_disp1_device.num_resources = ARRAY_SIZE(apalis_tk1_disp1_edp_resources); +#ifdef APALIS_TK1_EDP + apalis_tk1_disp1_out.dp_out = &dp_settings; + apalis_tk1_disp1_out.type = TEGRA_DC_OUT_DP; + panel = &edp_a_1080p_14_0; +#else /* APALIS_TK1_EDP */ + apalis_tk1_disp1_out.type = TEGRA_DC_OUT_LVDS; + panel = &lvds_c_1366_14; +#endif /* APALIS_TK1_EDP */ +// apalis_tk1_disp1_out.rotation = 180; return panel; } @@ -766,6 +858,7 @@ int __init apalis_tk1_display_init(void) clk_put(disp1_clk); return PTR_ERR(disp1_clk); } + #ifndef CONFIG_TEGRA_HDMI_PRIMARY panel = apalis_tk1_panel_configure(); diff --git a/arch/arm/mach-tegra/board-apalis-tk1.h b/arch/arm/mach-tegra/board-apalis-tk1.h index a7074a110561..a3561d0f87d3 100644 --- a/arch/arm/mach-tegra/board-apalis-tk1.h +++ b/arch/arm/mach-tegra/board-apalis-tk1.h @@ -24,6 +24,8 @@ #include #include "gpio-names.h" +//#define APALIS_TK1_EDP + /* GPIO */ #define APALIS_GPIO1 TEGRA_GPIO_PFF2 diff --git a/arch/arm/mach-tegra/panel-a-edp-1080p-14-0.c b/arch/arm/mach-tegra/panel-a-edp-1080p-14-0.c index e530d68401d5..2a647eabf261 100644 --- a/arch/arm/mach-tegra/panel-a-edp-1080p-14-0.c +++ b/arch/arm/mach-tegra/panel-a-edp-1080p-14-0.c @@ -33,7 +33,11 @@ #define DC_CTRL_MODE TEGRA_DC_OUT_CONTINUOUS_MODE +#ifdef CONFIG_MACH_APALIS_TK1 +#define EDP_PANEL_BL_PWM TEGRA_GPIO_PU6 +#else #define EDP_PANEL_BL_PWM TEGRA_GPIO_PH1 +#endif static bool reg_requested; static bool gpio_requested; @@ -168,6 +172,16 @@ static int laguna_edp_regulator_get(struct device *dev) goto fail; } +#ifdef CONFIG_MACH_APALIS_TK1 + avdd_3v3_dp = regulator_get(dev, "avdd_3v3_dp"); + if (IS_ERR_OR_NULL(avdd_3v3_dp)) { + pr_err("avdd_3v3_dp regulator get failed\n"); + err = PTR_ERR(avdd_3v3_dp); + avdd_3v3_dp = NULL; + goto fail; + } +#endif /* CONFIG_MACH_APALIS_TK1 */ + reg_requested = true; return 0; fail: @@ -272,6 +286,13 @@ static int edp_a_1080p_14_0_enable(struct device *dev) pr_err("avdd_3v3_dp regulator enable failed\n"); goto fail; } +#ifdef CONFIG_MACH_APALIS_TK1 + err = regulator_set_voltage(avdd_3v3_dp, 3300000, 3300000); + if (err < 0) { + pr_err("avdd_3v3_dp regulator_set_voltage to 3.3V failed\n"); + goto fail; + } +#endif /* CONFIG_MACH_APALIS_TK1 */ } msleep(20); @@ -380,7 +401,11 @@ static int edp_a_1080p_14_0_check_fb(struct device *dev, struct fb_info *info) } static struct platform_pwm_backlight_data edp_a_1080p_14_0_bl_data = { +#ifdef CONFIG_MACH_APALIS_TK1 + .pwm_id = 3, +#else .pwm_id = 1, +#endif .max_brightness = 255, .dft_brightness = 224, .pwm_period_ns = 1000000, -- cgit v1.2.3