diff options
Diffstat (limited to 'arch/arm/mach-tegra/board-enterprise-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-panel.c | 130 |
1 files changed, 99 insertions, 31 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c index 837635bf0731..c27201171e4b 100644 --- a/arch/arm/mach-tegra/board-enterprise-panel.c +++ b/arch/arm/mach-tegra/board-enterprise-panel.c @@ -1,7 +1,7 @@ /* * arch/arm/mach-tegra/board-enterprise-panel.c * - * Copyright (c) 2011-2012, NVIDIA Corporation. + * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -169,6 +169,16 @@ static int enterprise_backlight_notify(struct device *unused, int brightness) static int enterprise_disp1_check_fb(struct device *dev, struct fb_info *info); +static struct platform_pwm_backlight_data external_pwm_disp1_backlight_data = { + .pwm_id = 3, + .max_brightness = 255, + .dft_brightness = 224, + .pwm_period_ns = 1000000, + .notify = enterprise_backlight_notify, + /* Only toggle backlight on fb blank notifications for disp1 */ + .check_fb = enterprise_disp1_check_fb, +}; + #if IS_EXTERNAL_PWM static struct platform_pwm_backlight_data enterprise_disp1_backlight_data = { .pwm_id = 3, @@ -214,10 +224,21 @@ static struct platform_device enterprise_disp1_backlight_device = { }, }; +static struct platform_device external_pwm_disp1_backlight_device = { + .name = "pwm-backlight", + .id = -1, + .dev = { + .platform_data = &external_pwm_disp1_backlight_data, + }, +}; #ifdef CONFIG_TEGRA_DC static int enterprise_hdmi_vddio_enable(void) { int ret; + struct board_info board_info; + + tegra_get_board_info(&board_info); + if (!enterprise_hdmi_vddio) { enterprise_hdmi_vddio = regulator_get(NULL, "hdmi_5v0"); if (IS_ERR_OR_NULL(enterprise_hdmi_vddio)) { @@ -234,16 +255,40 @@ static int enterprise_hdmi_vddio_enable(void) enterprise_hdmi_vddio = NULL; return ret; } + if (board_info.board_id == BOARD_E1239) { + ret = gpio_request(TEGRA_GPIO_PM4, "en_hdmi_buffers"); + if (ret < 0) { + pr_err("%s: gpio_request failed %d\n", __func__, ret); + return ret; + } + + ret = gpio_direction_output(TEGRA_GPIO_PM4, 1); + if (ret < 0) { + pr_err("%s: gpio_direction_ouput failed %d\n", + __func__, ret); + gpio_free(TEGRA_GPIO_PM4); + return ret; + } + } + return ret; } static int enterprise_hdmi_vddio_disable(void) { + struct board_info board_info; + + tegra_get_board_info(&board_info); + if (enterprise_hdmi_vddio) { regulator_disable(enterprise_hdmi_vddio); regulator_put(enterprise_hdmi_vddio); enterprise_hdmi_vddio = NULL; } + if (board_info.board_id == BOARD_E1239) { + gpio_set_value(TEGRA_GPIO_PM4, 0); + gpio_free(TEGRA_GPIO_PM4); + } return 0; } @@ -530,12 +575,10 @@ static int enterprise_dsi_panel_enable(void) if (ret) return ret; -#if IS_EXTERNAL_PWM - tegra_gpio_disable(enterprise_bl_pwm); -#endif #if DSI_PANEL_RESET - if (board_info.fab >= BOARD_FAB_A03) { + if ((board_info.fab >= BOARD_FAB_A03) || + (board_info.board_id == BOARD_E1239)) { if (enterprise_lcd_reg == NULL) { enterprise_lcd_reg = regulator_get(NULL, "lcd_vddio_en"); if (IS_ERR_OR_NULL(enterprise_lcd_reg)) { @@ -554,16 +597,13 @@ static int enterprise_dsi_panel_enable(void) } } - if (kernel_1st_panel_init != true) { + if (kernel_1st_panel_init == true) { ret = gpio_request(enterprise_dsi_panel_reset, "panel reset"); if (ret < 0) return ret; - - ret = gpio_direction_output(enterprise_dsi_panel_reset, 0); - if (ret < 0) { - gpio_free(enterprise_dsi_panel_reset); - return ret; - } + kernel_1st_panel_init = false; + } else { + gpio_direction_output(enterprise_dsi_panel_reset, 0); gpio_set_value(enterprise_dsi_panel_reset, 0); udelay(2000); @@ -581,10 +621,7 @@ static int enterprise_dsi_panel_disable(void) regulator_disable(enterprise_lcd_reg); #if DSI_PANEL_RESET - if (kernel_1st_panel_init != true) { - gpio_free(enterprise_dsi_panel_reset); - } else - kernel_1st_panel_init = false; + gpio_direction_output(enterprise_dsi_panel_reset, 0); #endif return 0; } @@ -824,6 +861,13 @@ static struct platform_device *enterprise_gfx_devices[] __initdata = { #endif }; +static struct platform_device *external_pwm_gfx_devices[] __initdata = { +#if defined(CONFIG_TEGRA_NVMAP) + &enterprise_nvmap_device, +#endif + &tegra_pwfm3_device, +}; + static struct platform_device *enterprise_bl_devices[] = { &enterprise_disp1_backlight_device, }; @@ -871,14 +915,22 @@ int __init enterprise_panel_init(void) BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a03) != 256); BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a02) != 256); - if (board_info.fab >= BOARD_FAB_A03) { + if (board_info.board_id != BOARD_E1239) { + if (board_info.fab >= BOARD_FAB_A03) { #if !(IS_EXTERNAL_PWM) - enterprise_disp1_backlight_data.clk_div = 0x1D; + enterprise_disp1_backlight_data.clk_div = 0x1D; #endif - bl_output = enterprise_bl_output_measured_a03; - } else - bl_output = enterprise_bl_output_measured_a02; - + bl_output = enterprise_bl_output_measured_a03; + } else + bl_output = enterprise_bl_output_measured_a02; + } else { + enterprise_sd_settings.bl_device = + &external_pwm_disp1_backlight_device; + enterprise_bl_devices[0] = + &external_pwm_disp1_backlight_device; + bl_output = + enterprise_bl_output_measured_a03; + } enterprise_dsi.chip_id = tegra_get_chipid(); enterprise_dsi.chip_rev = tegra_get_revision(); @@ -890,13 +942,25 @@ int __init enterprise_panel_init(void) gpio_request(enterprise_hdmi_hpd, "hdmi_hpd"); gpio_direction_input(enterprise_hdmi_hpd); - gpio_request(enterprise_lcd_2d_3d, "lcd_2d_3d"); - gpio_direction_output(enterprise_lcd_2d_3d, 0); - enterprise_stereo_set_mode(enterprise_stereo.mode_2d_3d); + if (board_info.board_id != BOARD_E1239) { + gpio_request(enterprise_lcd_2d_3d, "lcd_2d_3d"); + gpio_direction_output(enterprise_lcd_2d_3d, 0); + enterprise_stereo_set_mode(enterprise_stereo.mode_2d_3d); - gpio_request(enterprise_lcd_swp_pl, "lcd_swp_pl"); - gpio_direction_output(enterprise_lcd_swp_pl, 0); - enterprise_stereo_set_orientation(enterprise_stereo.orientation); + gpio_request(enterprise_lcd_swp_pl, "lcd_swp_pl"); + gpio_direction_output(enterprise_lcd_swp_pl, 0); + enterprise_stereo_set_orientation( + enterprise_stereo.orientation); +#if IS_EXTERNAL_PWM + gpio_request(enterprise_bl_pwm, "bl_pwm"); + gpio_free(enterprise_bl_pwm); +#endif + } else { + /* External pwm is used but do not use IS_EXTERNAL_PWM + compiler switch for TAI */ + gpio_request(enterprise_bl_pwm, "bl_pwm"); + gpio_free(enterprise_bl_pwm); + } #if !(DC_CTRL_MODE & TEGRA_DC_OUT_ONE_SHOT_MODE) gpio_request(enterprise_lcd_swp_pl, "lcd_te"); @@ -916,9 +980,13 @@ int __init enterprise_panel_init(void) return err; #endif - err = platform_add_devices(enterprise_gfx_devices, - ARRAY_SIZE(enterprise_gfx_devices)); - + if (board_info.board_id != BOARD_E1239) { + err = platform_add_devices(enterprise_gfx_devices, + ARRAY_SIZE(enterprise_gfx_devices)); + } else { + err = platform_add_devices(external_pwm_gfx_devices, + ARRAY_SIZE(external_pwm_gfx_devices)); + } #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) res = nvhost_get_resource_byname(&enterprise_disp1_device, IORESOURCE_MEM, "fbmem"); |