diff options
Diffstat (limited to 'arch/arm/mach-s5pv210/include/mach/pwm-clock.h')
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/pwm-clock.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pv210/include/mach/pwm-clock.h b/arch/arm/mach-s5pv210/include/mach/pwm-clock.h new file mode 100644 index 000000000000..69027fea987a --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/pwm-clock.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/pwm-clock.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
8 | * http://www.samsung.com/ | ||
9 | * | ||
10 | * Based on arch/arm/plat-s3c24xx/include/mach/pwm-clock.h | ||
11 | * | ||
12 | * S5PV210 - pwm clock and timer support | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | */ | ||
18 | |||
19 | #ifndef __ASM_ARCH_PWMCLK_H | ||
20 | #define __ASM_ARCH_PWMCLK_H __FILE__ | ||
21 | |||
22 | /** | ||
23 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | ||
24 | * @cfg: The timer TCFG1 register bits shifted down to 0. | ||
25 | * | ||
26 | * Return true if the given configuration from TCFG1 is a TCLK instead | ||
27 | * any of the TDIV clocks. | ||
28 | */ | ||
29 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | ||
30 | { | ||
31 | return tcfg == S3C2410_TCFG1_MUX_TCLK; | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * tcfg_to_divisor() - convert tcfg1 setting to a divisor | ||
36 | * @tcfg1: The tcfg1 setting, shifted down. | ||
37 | * | ||
38 | * Get the divisor value for the given tcfg1 setting. We assume the | ||
39 | * caller has already checked to see if this is not a TCLK source. | ||
40 | */ | ||
41 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | ||
42 | { | ||
43 | return 1 << (1 + tcfg1); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * pwm_tdiv_has_div1() - does the tdiv setting have a /1 | ||
48 | * | ||
49 | * Return true if we have a /1 in the tdiv setting. | ||
50 | */ | ||
51 | static inline unsigned int pwm_tdiv_has_div1(void) | ||
52 | { | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * pwm_tdiv_div_bits() - calculate TCFG1 divisor value. | ||
58 | * @div: The divisor to calculate the bit information for. | ||
59 | * | ||
60 | * Turn a divisor into the necessary bit field for TCFG1. | ||
61 | */ | ||
62 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | ||
63 | { | ||
64 | return ilog2(div) - 1; | ||
65 | } | ||
66 | |||
67 | #define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK | ||
68 | |||
69 | #endif /* __ASM_ARCH_PWMCLK_H */ | ||