summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Lai <b04597@freescale.com>2009-07-31 17:37:28 +0800
committerJustin Waters <justin.waters@timesys.com>2009-10-13 11:04:56 -0400
commit3310dad74faa20432d0b7e6fd516bf66e60b5a8b (patch)
treed9dcf0d3acaee9ee80442d41fe97b2a1242d8f58
parentd4e66520b9721daef9734214fbe36a58860ebfad (diff)
ENGR00114644-1 MX51 PWM: Add pwm and backlight devices
1. Add the platform device of mxc_pwm 2. Add the platform device of pwm-backlight 3. Change the name of the per_clk for the PWM module from pwm_clk to pwm, consisting with the code in the open source. Signed-off-by: William Lai<b04597@freescale.com>
-rw-r--r--arch/arm/mach-mx51/clock.c4
-rw-r--r--arch/arm/mach-mx51/devices.c66
-rw-r--r--arch/arm/mach-mx51/mx51_babbage_gpio.c5
3 files changed, 69 insertions, 6 deletions
diff --git a/arch/arm/mach-mx51/clock.c b/arch/arm/mach-mx51/clock.c
index 4316c16f299e..566926f046c2 100644
--- a/arch/arm/mach-mx51/clock.c
+++ b/arch/arm/mach-mx51/clock.c
@@ -1916,7 +1916,7 @@ static struct clk gpt_clk[] = {
static struct clk pwm1_clk[] = {
{
- .name = "pwm_clk",
+ .name = "pwm",
.parent = &ipg_perclk,
.id = 0,
.enable_reg = MXC_CCM_CCGR2,
@@ -1943,7 +1943,7 @@ static struct clk pwm1_clk[] = {
static struct clk pwm2_clk[] = {
{
- .name = "pwm_clk",
+ .name = "pwm",
.parent = &ipg_perclk,
.id = 1,
.enable_reg = MXC_CCM_CCGR2,
diff --git a/arch/arm/mach-mx51/devices.c b/arch/arm/mach-mx51/devices.c
index c8c7442b3cd4..599b9863f0ff 100644
--- a/arch/arm/mach-mx51/devices.c
+++ b/arch/arm/mach-mx51/devices.c
@@ -23,6 +23,7 @@
#include <linux/spi/spi.h>
#include <linux/uio_driver.h>
#include <linux/mxc_scc2_driver.h>
+#include <linux/pwm_backlight.h>
#include <mach/hardware.h>
#include <mach/spba.h>
#include <asm/mach-types.h>
@@ -200,6 +201,69 @@ static inline void mxc_init_wdt(void)
}
#endif
+#if defined(CONFIG_MXC_PWM)
+static struct resource pwm_resources[] = {
+ {
+ .start = PWM1_BASE_ADDR,
+ .end = PWM1_BASE_ADDR + 0x14,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device mxc_pwm_device = {
+ .name = "mxc_pwm",
+ .id = 0,
+ .dev = {
+ .release = mxc_nop_release,
+ },
+ .num_resources = ARRAY_SIZE(pwm_resources),
+ .resource = pwm_resources,
+};
+
+static void mxc_init_pwm(void)
+{
+ printk(KERN_INFO "mxc_pwm_device registered\n");
+ if (platform_device_register(&mxc_pwm_device) < 0)
+ printk(KERN_ERR "registration of mxc_pwm device failed\n");
+}
+#else
+static void mxc_init_pwm(void)
+{
+
+}
+#endif
+
+#if defined(CONFIG_BACKLIGHT_PWM)
+static struct platform_pwm_backlight_data mxc_pwm_backlight_data = {
+ .pwm_id = 0,
+ .max_brightness = 255,
+ .dft_brightness = 128,
+ .pwm_period_ns = 78770,
+};
+
+static struct platform_device mxc_pwm_backlight_device = {
+ .name = "pwm-backlight",
+ .id = -1,
+ .dev = {
+ .release = mxc_nop_release,
+ .platform_data = &mxc_pwm_backlight_data,
+ },
+};
+
+static void mxc_init_pwm_backlight(void)
+{
+ printk(KERN_INFO "pwm-backlight device registered\n");
+ if (platform_device_register(&mxc_pwm_backlight_device) < 0)
+ printk(KERN_ERR
+ "registration of pwm-backlight device failed\n");
+}
+#else
+static void mxc_init_pwm_backlight(void)
+{
+
+}
+#endif
+
#if defined(CONFIG_MXC_IPU_V3) || defined(CONFIG_MXC_IPU_V3_MODULE)
static struct mxc_ipu_config mxc_ipu_data = {
.rev = 1,
@@ -1094,5 +1158,7 @@ int __init mxc_init_devices(void)
mxc_init_iim();
mxc_init_gpu();
mxc_init_gpu2d();
+ mxc_init_pwm();
+ mxc_init_pwm_backlight();
return 0;
}
diff --git a/arch/arm/mach-mx51/mx51_babbage_gpio.c b/arch/arm/mach-mx51/mx51_babbage_gpio.c
index aad9c34b01a3..7fd47b54061c 100644
--- a/arch/arm/mach-mx51/mx51_babbage_gpio.c
+++ b/arch/arm/mach-mx51/mx51_babbage_gpio.c
@@ -200,10 +200,7 @@ static struct mxc_iomux_pin_cfg __initdata mxc_iomux_pins[] = {
0x1E4,
},
{
- MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT2 | IOMUX_CONFIG_SION,
- (PAD_CTL_SRE_FAST | PAD_CTL_ODE_OPENDRAIN_ENABLE | PAD_CTL_DRV_HIGH |
- PAD_CTL_100K_PU | PAD_CTL_HYS_ENABLE),
- MUX_IN_I2C2_IPP_SCL_IN_SELECT_INPUT, INPUT_CTL_PATH3,
+ MX51_PIN_GPIO1_2, IOMUX_CONFIG_ALT1,
},
{
MX51_PIN_GPIO1_3, IOMUX_CONFIG_ALT2 | IOMUX_CONFIG_SION,