diff options
author | Seema Khowala <seemaj@nvidia.com> | 2012-08-22 11:14:29 -0700 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-27 17:17:21 -0700 |
commit | b536b496165f0de2e854e6297f54371e27233dd2 (patch) | |
tree | dc7bb9961dedad323185ead38ab07de1b7e1c4be /arch/arm/mach-tegra/board-enterprise-panel.c | |
parent | 59983fe4193541acfd8c7df7bf98139e2ec44d11 (diff) |
ARM: tegra: TAI: Add E1239 support
Bug 1002637
Change-Id: I1271f95e8c174422bcb93eed3cc2bd7df8012479
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/123537
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-enterprise-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-panel.c | 112 |
1 files changed, 96 insertions, 16 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c index 366bf921393d..c27201171e4b 100644 --- a/arch/arm/mach-tegra/board-enterprise-panel.c +++ b/arch/arm/mach-tegra/board-enterprise-panel.c @@ -63,6 +63,8 @@ #define enterprise_lcd_te TEGRA_GPIO_PJ1 +#define enterprise_bl_pwm TEGRA_GPIO_PH3 + #ifdef CONFIG_TEGRA_DC static struct regulator *enterprise_dsi_reg; static bool dsi_regulator_status; @@ -167,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, @@ -212,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)) { @@ -232,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; } @@ -528,8 +575,10 @@ static int enterprise_dsi_panel_enable(void) if (ret) return ret; + #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)) { @@ -812,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, }; @@ -859,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(); @@ -878,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"); @@ -904,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"); |