diff options
Diffstat (limited to 'arch/arm/plat-samsung/dev-pwm.c')
-rw-r--r-- | arch/arm/plat-samsung/dev-pwm.c | 93 |
1 files changed, 80 insertions, 13 deletions
diff --git a/arch/arm/plat-samsung/dev-pwm.c b/arch/arm/plat-samsung/dev-pwm.c index dab47b0..cda8e47 100644 --- a/arch/arm/plat-samsung/dev-pwm.c +++ b/arch/arm/plat-samsung/dev-pwm.c @@ -20,6 +20,7 @@ #include <mach/irqs.h> #include <plat/devs.h> +#include <mach/gpio.h> #define TIMER_RESOURCE_SIZE (1) @@ -32,22 +33,88 @@ } \ } -#define DEFINE_S3C_TIMER(_tmr_no, _irq) \ - .name = "s3c24xx-pwm", \ - .id = _tmr_no, \ - .num_resources = TIMER_RESOURCE_SIZE, \ - .resource = TIMER_RESOURCE(_tmr_no, _irq), \ +#define DEFINE_S3C_TIMER(_tmr_no, _irq, _plat_data) \ + .name = "s3c24xx-pwm", \ + .id = _tmr_no, \ + .num_resources = TIMER_RESOURCE_SIZE, \ + .resource = TIMER_RESOURCE(_tmr_no, _irq), \ + .dev = { \ + .platform_data = _plat_data, \ + } + +#define GPD0_0_TOUT (0x2 << 0) +#ifdef CONFIG_FB_MDNIE_PWM +#define GPD0_1_TOUT (0x3 << 4) +#else +#define GPD0_1_TOUT (0x2 << 4) +#endif +#define GPD0_2_TOUT (0x2 << 8) +#define GPD0_3_TOUT (0x2 << 12) -/* - * since we already have an static mapping for the timer, - * we do not bother setting any IO resource for the base. +/* since we already have an static mapping for the timer, we do not + * bother setting any IO resource for the base. */ +struct s3c_pwm_pdata { + /* PWM output port */ + int gpio_no; + const char *gpio_name; + int gpio_set_value; +}; + +struct s3c_pwm_pdata pwm_data[] = { +#ifdef CONFIG_ARCH_EXYNOS5 + { + .gpio_no = EXYNOS5_GPB2(0), + .gpio_name = "GPB", + .gpio_set_value = GPD0_0_TOUT, + }, { + .gpio_no = EXYNOS5_GPB2(1), + .gpio_name = "GPB", + .gpio_set_value = GPD0_1_TOUT, + }, { + .gpio_no = EXYNOS5_GPB2(2), + .gpio_name = "GPB", + .gpio_set_value = GPD0_2_TOUT, + }, { + .gpio_no = EXYNOS5_GPB2(3), + .gpio_name = "GPB", + .gpio_set_value = GPD0_3_TOUT, + }, { + .gpio_no = 0, + .gpio_name = NULL, + .gpio_set_value = 0, + } +#else + { + .gpio_no = EXYNOS4_GPD0(0), + .gpio_name = "GPD", + .gpio_set_value = GPD0_0_TOUT, + }, { + .gpio_no = EXYNOS4_GPD0(1), + .gpio_name = "GPD", + .gpio_set_value = GPD0_1_TOUT, + }, { + .gpio_no = EXYNOS4_GPD0(2), + .gpio_name = "GPD", + .gpio_set_value = GPD0_2_TOUT, + }, { + .gpio_no = EXYNOS4_GPD0(3), + .gpio_name = "GPD", + .gpio_set_value = GPD0_3_TOUT, + }, { + .gpio_no = 0, + .gpio_name = NULL, + .gpio_set_value = 0, + } +#endif +}; + struct platform_device s3c_device_timer[] = { - [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) }, - [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) }, - [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) }, - [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) }, - [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) }, + [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0, &pwm_data[0]) }, + [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1, &pwm_data[1]) }, + [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2, &pwm_data[2]) }, + [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3, &pwm_data[3]) }, + [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4, &pwm_data[4]) }, }; EXPORT_SYMBOL(s3c_device_timer); |