code style scripts/checkpatch.pl (linux-3.9-rc1) formatting
[linux-2.6.34.14-moxart.git] / arch / arm / mach-s3c64xx / include / mach / pwm-clock.h
blobb25bedee0d5217e98f671786278b32e9e45e2c0c
1 /* linux/arch/arm/mach-s3c6400/include/mach/pwm-clock.h
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
8 * S3C64xx - pwm clock and timer support
9 */
11 /**
12 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
13 * @tcfg: The timer TCFG1 register bits shifted down to 0.
15 * Return true if the given configuration from TCFG1 is a TCLK instead
16 * any of the TDIV clocks.
18 static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
20 return tcfg >= S3C64XX_TCFG1_MUX_TCLK;
23 /**
24 * tcfg_to_divisor() - convert tcfg1 setting to a divisor
25 * @tcfg1: The tcfg1 setting, shifted down.
27 * Get the divisor value for the given tcfg1 setting. We assume the
28 * caller has already checked to see if this is not a TCLK source.
30 static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)
32 return 1 << tcfg1;
35 /**
36 * pwm_tdiv_has_div1() - does the tdiv setting have a /1
38 * Return true if we have a /1 in the tdiv setting.
40 static inline unsigned int pwm_tdiv_has_div1(void)
42 return 1;
45 /**
46 * pwm_tdiv_div_bits() - calculate TCFG1 divisor value.
47 * @div: The divisor to calculate the bit information for.
49 * Turn a divisor into the necessary bit field for TCFG1.
51 static inline unsigned long pwm_tdiv_div_bits(unsigned int div)
53 return ilog2(div);
56 #define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK