summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Huang <kevinh@nvidia.com>2012-06-20 10:34:29 -0700
committerSimone Willett <swillett@nvidia.com>2012-06-27 17:41:50 -0700
commit8192e9996b7a32b8aef49f18b8d72cdc43b71ee3 (patch)
tree834a0335376e9224b42b23903ea4f279ec4b75a8
parent2706d59f63e2897959362f2f1a1be840801ada90 (diff)
arm: tegra: enterprise: Add support to externel pwm.
Bug 995402 Change-Id: I53e9f1801d3b37626abb89c67b4e63662dab8c65 Reviewed-on: http://git-master/r/111306 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-enterprise-panel.c31
-rw-r--r--arch/arm/mach-tegra/board-enterprise-pinmux.c7
-rw-r--r--arch/arm/mach-tegra/board-enterprise.c2
-rw-r--r--arch/arm/mach-tegra/board-enterprise.h3
4 files changed, 41 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c
index 97a2294e6f5b..9561e5ad0406 100644
--- a/arch/arm/mach-tegra/board-enterprise-panel.c
+++ b/arch/arm/mach-tegra/board-enterprise-panel.c
@@ -26,6 +26,7 @@
#include <linux/platform_device.h>
#include <linux/earlysuspend.h>
#include <linux/tegra_pwm_bl.h>
+#include <linux/pwm_backlight.h>
#include <asm/atomic.h>
#include <linux/nvhost.h>
#include <linux/nvmap.h>
@@ -62,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;
@@ -166,6 +169,17 @@ static int enterprise_backlight_notify(struct device *unused, int brightness)
static int enterprise_disp1_check_fb(struct device *dev, struct fb_info *info);
+#if IS_EXTERNAL_PWM
+static struct platform_pwm_backlight_data enterprise_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,
+};
+#else
/*
* In case which_pwm is TEGRA_PWM_PM0,
* gpio_conf_to_sfio should be TEGRA_GPIO_PW0: set LCD_CS1_N pin to SFIO
@@ -186,9 +200,15 @@ static struct platform_tegra_pwm_backlight_data enterprise_disp1_backlight_data
/* Only toggle backlight on fb blank notifications for disp1 */
.check_fb = enterprise_disp1_check_fb,
};
+#endif
+
static struct platform_device enterprise_disp1_backlight_device = {
+#if IS_EXTERNAL_PWM
+ .name = "pwm-backlight",
+#else
.name = "tegra-pwm-bl",
+#endif
.id = -1,
.dev = {
.platform_data = &enterprise_disp1_backlight_data,
@@ -511,8 +531,11 @@ static int enterprise_dsi_panel_enable(void)
if (ret)
return ret;
-#if DSI_PANEL_RESET
+#if IS_EXTERNAL_PWM
+ tegra_gpio_disable(enterprise_bl_pwm);
+#endif
+#if DSI_PANEL_RESET
if (board_info.fab >= BOARD_FAB_A03) {
if (enterprise_lcd_reg == NULL) {
enterprise_lcd_reg = regulator_get(NULL, "lcd_vddio_en");
@@ -795,7 +818,11 @@ static struct platform_device *enterprise_gfx_devices[] __initdata = {
#if defined(CONFIG_TEGRA_NVMAP)
&enterprise_nvmap_device,
#endif
+#if IS_EXTERNAL_PWM
+ &tegra_pwfm3_device,
+#else
&tegra_pwfm0_device,
+#endif
};
static struct platform_device *enterprise_bl_devices[] = {
@@ -846,7 +873,9 @@ int __init enterprise_panel_init(void)
BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a02) != 256);
if (board_info.fab >= BOARD_FAB_A03) {
+#if !(IS_EXTERNAL_PWM)
enterprise_disp1_backlight_data.clk_div = 0x1D;
+#endif
bl_output = enterprise_bl_output_measured_a03;
} else
bl_output = enterprise_bl_output_measured_a02;
diff --git a/arch/arm/mach-tegra/board-enterprise-pinmux.c b/arch/arm/mach-tegra/board-enterprise-pinmux.c
index e64d65b84153..721eb0d27576 100644
--- a/arch/arm/mach-tegra/board-enterprise-pinmux.c
+++ b/arch/arm/mach-tegra/board-enterprise-pinmux.c
@@ -265,6 +265,9 @@ static __initdata struct tegra_pingroup_config enterprise_pinmux_common[] = {
DEFAULT_PINMUX(GMI_AD8, PWM0, NORMAL, NORMAL, OUTPUT),
DEFAULT_PINMUX(GMI_AD9, NAND, NORMAL, NORMAL, OUTPUT),
DEFAULT_PINMUX(GMI_AD10, NAND, NORMAL, NORMAL, OUTPUT),
+#if IS_EXTERNAL_PWM
+ DEFAULT_PINMUX(GMI_AD11, PWM3, NORMAL, NORMAL, OUTPUT),
+#endif
DEFAULT_PINMUX(GMI_A16, UARTD, NORMAL, NORMAL, OUTPUT),
DEFAULT_PINMUX(GMI_A17, UARTD, NORMAL, NORMAL, INPUT),
DEFAULT_PINMUX(GMI_A18, UARTD, NORMAL, NORMAL, INPUT),
@@ -379,7 +382,9 @@ static __initdata struct tegra_pingroup_config enterprise_unused_pinmux_common[]
DEFAULT_PINMUX(GMI_AD5, GMI, NORMAL, TRISTATE, OUTPUT),
DEFAULT_PINMUX(GMI_AD6, GMI, NORMAL, TRISTATE, OUTPUT),
DEFAULT_PINMUX(GMI_AD7, GMI, NORMAL, TRISTATE, OUTPUT),
+#if !(IS_EXTERNAL_PWM)
DEFAULT_PINMUX(GMI_AD11, GMI, PULL_DOWN, TRISTATE, OUTPUT),
+#endif
DEFAULT_PINMUX(GMI_CS0_N, GMI, PULL_DOWN, TRISTATE, OUTPUT),
DEFAULT_PINMUX(GMI_CS2_N, GMI, PULL_DOWN, TRISTATE, OUTPUT),
DEFAULT_PINMUX(GMI_CS3_N, GMI, PULL_DOWN, TRISTATE, OUTPUT),
@@ -460,7 +465,9 @@ static __initdata struct pin_info_low_power_mode enterprise_unused_gpio_pins_com
PIN_GPIO_LPM("GMI_AD5", TEGRA_GPIO_PG5, 0, 0),
PIN_GPIO_LPM("GMI_AD6", TEGRA_GPIO_PG6, 0, 0),
PIN_GPIO_LPM("GMI_AD7", TEGRA_GPIO_PG7, 0, 0),
+#if !(IS_EXTERNAL_PWM)
PIN_GPIO_LPM("GMI_AD11", TEGRA_GPIO_PH3, 0, 0),
+#endif
PIN_GPIO_LPM("GMI_CS0_N", TEGRA_GPIO_PJ0, 0, 0),
PIN_GPIO_LPM("GMI_CS2_N", TEGRA_GPIO_PK3, 0, 0),
PIN_GPIO_LPM("GMI_CS3_N", TEGRA_GPIO_PK4, 0, 0),
diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c
index 06acb18f68db..2bf5356f512a 100644
--- a/arch/arm/mach-tegra/board-enterprise.c
+++ b/arch/arm/mach-tegra/board-enterprise.c
@@ -136,7 +136,7 @@ static __initdata struct tegra_clk_init_table enterprise_clk_init_table[] = {
{ "pll_m", NULL, 0, false},
{ "hda", "pll_p", 108000000, false},
{ "hda2codec_2x","pll_p", 48000000, false},
- { "pwm", "clk_32k", 32768, false},
+ { "pwm", "pll_p", 3187500, false},
{ "blink", "clk_32k", 32768, true},
{ "i2s0", "pll_a_out0", 0, false},
{ "i2s1", "pll_a_out0", 0, false},
diff --git a/arch/arm/mach-tegra/board-enterprise.h b/arch/arm/mach-tegra/board-enterprise.h
index f47672091bf8..3c6d149abdff 100644
--- a/arch/arm/mach-tegra/board-enterprise.h
+++ b/arch/arm/mach-tegra/board-enterprise.h
@@ -158,4 +158,7 @@ enum tegra_bb_type {
TEGRA_BB_M7400,
};
+/* Indicate the pwm of backlight, DC pwm or external pwm3. */
+#define IS_EXTERNAL_PWM 0
+
#endif /*_MACH_TEGRA_BOARD_ENTERPRISE_H */