diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2012-10-18 16:07:06 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2012-10-18 16:07:06 +0200 |
commit | c3bc68db362df2de9a557825220b94296a578ca3 (patch) | |
tree | f90fe0bdd9642a1f77f3e9a7179b18f7c3fa1a96 | |
parent | 273a774ba14e9e947dcaa1b5dc26c6b9ed0386ef (diff) |
colibri_t20: integrate PWM LED functionality
Backlight PWM now runs at 1 kHZ rather than 500kHz.
Make PWM B, C, D accessible from userspace. e.g as /sys/class/leds/pwm_b.
Make PWM A or C a led PWM depending on MECS_TELLURIUM.
-rw-r--r-- | arch/arm/configs/colibri_t20_defconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-colibri_t20.c | 56 |
2 files changed, 57 insertions, 2 deletions
diff --git a/arch/arm/configs/colibri_t20_defconfig b/arch/arm/configs/colibri_t20_defconfig index cb9c40d2f3fa..5e615a727344 100644 --- a/arch/arm/configs/colibri_t20_defconfig +++ b/arch/arm/configs/colibri_t20_defconfig @@ -280,6 +280,9 @@ CONFIG_MMC_BKOPS=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_MMC_SDHCI_TEGRA=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_PWM=y CONFIG_SWITCH=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_DS1307=y diff --git a/arch/arm/mach-tegra/board-colibri_t20.c b/arch/arm/mach-tegra/board-colibri_t20.c index 3f0bdf7a6bad..cfd51b2f2ce1 100644 --- a/arch/arm/mach-tegra/board-colibri_t20.c +++ b/arch/arm/mach-tegra/board-colibri_t20.c @@ -29,6 +29,7 @@ #include <linux/input.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/leds_pwm.h> #include <linux/memblock.h> #include <linux/mfd/tps6586x.h> #include <linux/platform_data/tegra_usb.h> @@ -108,7 +109,7 @@ static __initdata struct tegra_clk_init_table colibri_t20_clk_init_table[] = { {"blink", "clk_32k", 32768, false}, /* SMSC3340 REFCLK 24 MHz */ {"pll_p_out4", "pll_p", 24000000, true}, - {"pwm", "clk_32k", 32768, false}, + {"pwm", "clk_m", 0, false}, {"spdif_out", "pll_a_out0", 0, false}, //required otherwise getting disabled by "Disabling clocks left on by bootloader" stage @@ -482,6 +483,50 @@ static struct platform_device tegra_nand_device = { }, }; +/* PWM LEDs */ +static struct led_pwm tegra_leds_pwm[] = { + { + .name = "pwm_b", + .pwm_id = 1, + .max_brightness = 255, + .pwm_period_ns = 19600, + }, +#ifndef MECS_TELLURIUM + { + .name = "pwm_c", + .pwm_id = 2, + .max_brightness = 255, + .pwm_period_ns = 19600, + }, +#else + { + .name = "pwm_a", + .pwm_id = 0, + .max_brightness = 255, + .pwm_period_ns = 19600, + }, +#endif + { + .name = "pwm_d", + .pwm_id = 3, + .max_brightness = 255, + .pwm_period_ns = 19600, + }, +}; + +static struct led_pwm_platform_data tegra_leds_pwm_data = { + .num_leds = ARRAY_SIZE(tegra_leds_pwm), + .leds = tegra_leds_pwm, +}; + +static struct platform_device tegra_led_pwm_device = { + .name = "leds_pwm", + .id = -1, + .dev = { + .platform_data = &tegra_leds_pwm_data, + }, +}; + /* RTC */ static struct resource tegra_rtc_resources[] = { [0] = { @@ -908,8 +953,15 @@ static struct platform_device *colibri_t20_devices[] __initdata = { //bluetooth &tegra_pcm_device, &colibri_t20_audio_device, - &tegra_spi_device4, + &tegra_led_pwm_device, + &tegra_pwfm1_device, +#ifndef MECS_TELLURIUM + &tegra_pwfm2_device, +#else + &tegra_pwfm0_device, +#endif + &tegra_pwfm3_device, }; static void __init tegra_colibri_t20_init(void) |