summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorFred Fan <r01011@freescale.com>2010-02-01 17:59:21 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-05-25 11:13:36 +0200
commit98ad73d7a7f0feda04bb6f08bcb3e52d3371e291 (patch)
tree9681810d575c2e5c1c043168827119e673ccbdce /arch
parenta60bb4552efe784d8ebde51c34965c1119ac537c (diff)
ENGR00120621-2 i.MX28 LED support
1. Add platform support 2. Changed LED to control brightness by inactve couter Signed-off-by: Yao Jeremy <r65161@freescale.com> Signed-off-by: Fred.fan <r01011@freescale.com> Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx28/device.c2
-rw-r--r--arch/arm/mach-mx28/mx28evk.c45
-rw-r--r--arch/arm/mach-mx28/mx28evk_pins.c22
-rw-r--r--arch/arm/plat-mxs/Kconfig6
-rw-r--r--arch/arm/plat-mxs/device.c28
-rw-r--r--arch/arm/plat-mxs/include/mach/device.h12
6 files changed, 109 insertions, 6 deletions
diff --git a/arch/arm/mach-mx28/device.c b/arch/arm/mach-mx28/device.c
index 3ed83d0b99f4..1b6a08f7a193 100644
--- a/arch/arm/mach-mx28/device.c
+++ b/arch/arm/mach-mx28/device.c
@@ -751,6 +751,7 @@ static void __init mx28_init_ts(void)
;
}
#endif
+
int __init mx28_device_init(void)
{
mx28_init_dma();
@@ -765,7 +766,6 @@ int __init mx28_device_init(void)
mx28_init_kbd();
mx28_init_ts();
mx28_init_lcdif();
-
return 0;
}
diff --git a/arch/arm/mach-mx28/mx28evk.c b/arch/arm/mach-mx28/mx28evk.c
index cf7eaaa23457..a449571a134c 100644
--- a/arch/arm/mach-mx28/mx28evk.c
+++ b/arch/arm/mach-mx28/mx28evk.c
@@ -19,6 +19,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <linux/err.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
@@ -39,9 +40,53 @@ static void __init fixup_board(struct machine_desc *desc, struct tag *tags,
mx28_set_input_clk(24000000, 24000000, 32000, 50000000);
}
+#if defined(CONFIG_LEDS_MXS) || defined(CONFIG_LEDS_MXS_MODULE)
+static struct mxs_pwm_led mx28evk_led_pwm[2] = {
+ [0] = {
+ .name = "led-pwm0",
+ .pwm = 0,
+ },
+ [1] = {
+ .name = "led-pwm1",
+ .pwm = 1,
+ },
+};
+
+struct mxs_pwm_leds_plat_data mx28evk_led_data = {
+ .num = ARRAY_SIZE(mx28evk_led_pwm),
+ .leds = mx28evk_led_pwm,
+};
+
+static struct resource mx28evk_led_res = {
+ .flags = IORESOURCE_MEM,
+ .start = PWM_PHYS_ADDR,
+ .end = PWM_PHYS_ADDR + 0x3FFF,
+};
+
+static void __init mx28evk_init_leds(void)
+{
+ struct platform_device *pdev;
+
+ pdev = mxs_get_device("mxs-leds", 0);
+ if (pdev == NULL || IS_ERR(pdev))
+ return;
+
+ pdev->resource = &mx28evk_led_res;
+ pdev->num_resources = 1;
+ pdev->dev.platform_data = &mx28evk_led_data;
+ mxs_add_device(pdev, 3);
+}
+#else
+static void __init mx28evk_init_leds(void)
+{
+ ;
+}
+#endif
+
static void __init mx28evk_device_init(void)
{
/* Add mx28evk special code */
+ mx28evk_init_leds();
}
static void __init mx28evk_init_machine(void)
diff --git a/arch/arm/mach-mx28/mx28evk_pins.c b/arch/arm/mach-mx28/mx28evk_pins.c
index 7199c718f464..b8f98a20b51d 100644
--- a/arch/arm/mach-mx28/mx28evk_pins.c
+++ b/arch/arm/mach-mx28/mx28evk_pins.c
@@ -672,6 +672,28 @@ static struct pin_desc mx28evk_fixed_pins[] = {
.drive = 1,
},
#endif
+#if defined(CONFIG_LEDS_MXS) || defined(CONFIG_LEDS_MXS_MODULE)
+ {
+ .name = "LEDS_PWM0",
+ .id = PINID_AUART1_RX,
+ .fun = PIN_FUN3,
+ .strength = PAD_8MA,
+ .voltage = PAD_3_3V,
+ .pullup = 1,
+ .drive = 1,
+ .pull = 1,
+ },
+ {
+ .name = "LEDS_PWM1",
+ .id = PINID_AUART1_TX,
+ .fun = PIN_FUN3,
+ .strength = PAD_8MA,
+ .voltage = PAD_3_3V,
+ .pullup = 1,
+ .drive = 1,
+ .pull = 1,
+ },
+#endif
};
#if defined(CONFIG_FEC) || defined(CONFIG_FEC_MODULE)
diff --git a/arch/arm/plat-mxs/Kconfig b/arch/arm/plat-mxs/Kconfig
index 6c02d308f173..befd404a3f11 100644
--- a/arch/arm/plat-mxs/Kconfig
+++ b/arch/arm/plat-mxs/Kconfig
@@ -52,6 +52,12 @@ config MXS_LRADC
help
Enable LRADC support
+config MXS_PWM_CHANNELS
+ int
+ default 8
+ help
+ The number of pwm channel on Freescale MXS platform.
+
menu "Freescale Application UART:"
config MXS_AUART_DMA_SUPPORT
diff --git a/arch/arm/plat-mxs/device.c b/arch/arm/plat-mxs/device.c
index 165d3e0ad462..ae42a711057f 100644
--- a/arch/arm/plat-mxs/device.c
+++ b/arch/arm/plat-mxs/device.c
@@ -118,7 +118,7 @@ static struct platform_device mxs_i2c[] = {
.name = "mxs-i2c",
.id = 0,
.dev = {
- .dma_mask = &common_dmamask,
+ .dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.release = mxs_nop_release,
},
@@ -129,7 +129,7 @@ static struct platform_device mxs_i2c[] = {
.name = "mxs-i2c",
.id = 1,
.dev = {
- .dma_mask = &common_dmamask,
+ .dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.release = mxs_nop_release,
},
@@ -145,7 +145,7 @@ static struct platform_device mxs_mmc[] = {
.name = "mxs-mmc",
.id = 0,
.dev = {
- .dma_mask = &common_dmamask,
+ .dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.release = mxs_nop_release,
},
@@ -154,7 +154,7 @@ static struct platform_device mxs_mmc[] = {
.name = "mxs-mmc",
.id = 1,
.dev = {
- .dma_mask = &common_dmamask,
+ .dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.release = mxs_nop_release,
},
@@ -190,7 +190,7 @@ static struct platform_device mxs_fb = {
.name = "mxs-fb",
.id = 0,
.dev = {
- .dma_mask = &common_dmamask,
+ .dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
.release = mxs_nop_release,
},
@@ -308,6 +308,16 @@ static struct platform_device mxs_auart[] = {
};
#endif
+#if defined(CONFIG_LEDS_MXS) || defined(CONFIG_LEDS_MXS_MODULE)
+static struct platform_device mxs_led = {
+ .name = "mxs-leds",
+ .id = 0,
+ .dev = {
+ .release = mxs_nop_release,
+ },
+};
+#endif
+
static struct mxs_dev_lookup dev_lookup[] = {
#if defined(CONFIG_SERIAL_MXS_DUART) || \
defined(CONFIG_SERIAL_MXS_DUART_MODULE)
@@ -413,6 +423,14 @@ static struct mxs_dev_lookup dev_lookup[] = {
.pdev = mxs_auart,
},
#endif
+
+#if defined(CONFIG_LEDS_MXS) || defined(CONFIG_LEDS_MXS_MODULE)
+ {
+ .name = "mxs-leds",
+ .size = 1,
+ .pdev = &mxs_led,
+ },
+#endif
};
struct platform_device *mxs_get_device(char *name, int id)
diff --git a/arch/arm/plat-mxs/include/mach/device.h b/arch/arm/plat-mxs/include/mach/device.h
index a8b59a3a6c81..aaf61bfe067a 100644
--- a/arch/arm/plat-mxs/include/mach/device.h
+++ b/arch/arm/plat-mxs/include/mach/device.h
@@ -23,6 +23,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/ioport.h>
+#include <linux/leds.h>
#include <asm/mach/time.h>
@@ -94,6 +95,17 @@ struct mxs_auart_plat_data {
const char *clk;
};
+struct mxs_pwm_led {
+ struct led_classdev dev;
+ const char *name;
+ unsigned int pwm;
+};
+
+struct mxs_pwm_leds_plat_data {
+ unsigned int num;
+ struct mxs_pwm_led *leds;
+};
+
extern void mxs_timer_init(struct mxs_sys_timer *timer);
extern void mxs_nop_release(struct device *dev);