Path: blob/master/arch/arm/mach-exynos4/include/mach/pwm-clock.h
10820 views
/* linux/arch/arm/mach-exynos4/include/mach/pwm-clock.h1*2* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.3* http://www.samsung.com4*5* Copyright 2008 Openmoko, Inc.6* Copyright 2008 Simtec Electronics7* Ben Dooks <[email protected]>8* http://armlinux.simtec.co.uk/9*10* Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h11*12* EXYNOS4 - pwm clock and timer support13*14* This program is free software; you can redistribute it and/or modify15* it under the terms of the GNU General Public License version 2 as16* published by the Free Software Foundation.17*/1819#ifndef __ASM_ARCH_PWMCLK_H20#define __ASM_ARCH_PWMCLK_H __FILE__2122/**23* pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk24* @tcfg: The timer TCFG1 register bits shifted down to 0.25*26* Return true if the given configuration from TCFG1 is a TCLK instead27* any of the TDIV clocks.28*/29static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)30{31return tcfg == S3C64XX_TCFG1_MUX_TCLK;32}3334/**35* tcfg_to_divisor() - convert tcfg1 setting to a divisor36* @tcfg1: The tcfg1 setting, shifted down.37*38* Get the divisor value for the given tcfg1 setting. We assume the39* caller has already checked to see if this is not a TCLK source.40*/41static inline unsigned long tcfg_to_divisor(unsigned long tcfg1)42{43return 1 << tcfg1;44}4546/**47* pwm_tdiv_has_div1() - does the tdiv setting have a /148*49* Return true if we have a /1 in the tdiv setting.50*/51static inline unsigned int pwm_tdiv_has_div1(void)52{53return 1;54}5556/**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*/62static inline unsigned long pwm_tdiv_div_bits(unsigned int div)63{64return ilog2(div);65}6667#define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK6869#endif /* __ASM_ARCH_PWMCLK_H */707172