Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
atmel_pwm.c File Reference
#include <linux/module.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/atmel_pwm.h>

Go to the source code of this file.

Data Structures

struct  pwm
 

Macros

#define PWM_NCHAN   4 /* max 32 */
 
#define PWM_MR   0x00
 
#define PWM_ENA   0x04
 
#define PWM_DIS   0x08
 
#define PWM_SR   0x0c
 
#define PWM_IER   0x10
 
#define PWM_IDR   0x14
 
#define PWM_IMR   0x18
 
#define PWM_ISR   0x1c
 

Functions

int pwm_channel_alloc (int index, struct pwm_channel *ch)
 
 EXPORT_SYMBOL (pwm_channel_alloc)
 
int pwm_channel_free (struct pwm_channel *ch)
 
 EXPORT_SYMBOL (pwm_channel_free)
 
int __pwm_channel_onoff (struct pwm_channel *ch, int enabled)
 
 EXPORT_SYMBOL (__pwm_channel_onoff)
 
int pwm_clk_alloc (unsigned prescale, unsigned div)
 
 EXPORT_SYMBOL (pwm_clk_alloc)
 
void pwm_clk_free (unsigned clk)
 
 EXPORT_SYMBOL (pwm_clk_free)
 
int pwm_channel_handler (struct pwm_channel *ch, void(*handler)(struct pwm_channel *ch))
 
 EXPORT_SYMBOL (pwm_channel_handler)
 
 module_init (pwm_init)
 
 module_exit (pwm_exit)
 
 MODULE_DESCRIPTION ("Driver for AT32/AT91 PWM module")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("platform:atmel_pwm")
 

Macro Definition Documentation

#define PWM_DIS   0x08

Definition at line 37 of file atmel_pwm.c.

#define PWM_ENA   0x04

Definition at line 36 of file atmel_pwm.c.

#define PWM_IDR   0x14

Definition at line 40 of file atmel_pwm.c.

#define PWM_IER   0x10

Definition at line 39 of file atmel_pwm.c.

#define PWM_IMR   0x18

Definition at line 41 of file atmel_pwm.c.

#define PWM_ISR   0x1c

Definition at line 42 of file atmel_pwm.c.

#define PWM_MR   0x00

Definition at line 35 of file atmel_pwm.c.

#define PWM_NCHAN   4 /* max 32 */

Definition at line 20 of file atmel_pwm.c.

#define PWM_SR   0x0c

Definition at line 38 of file atmel_pwm.c.

Function Documentation

int __pwm_channel_onoff ( struct pwm_channel ch,
int  enabled 
)

Definition at line 170 of file atmel_pwm.c.

EXPORT_SYMBOL ( pwm_channel_alloc  )
EXPORT_SYMBOL ( pwm_channel_free  )
EXPORT_SYMBOL ( __pwm_channel_onoff  )
EXPORT_SYMBOL ( pwm_clk_alloc  )
EXPORT_SYMBOL ( pwm_clk_free  )
EXPORT_SYMBOL ( pwm_channel_handler  )
MODULE_ALIAS ( "platform:atmel_pwm"  )
MODULE_DESCRIPTION ( "Driver for AT32/AT91 PWM module )
module_exit ( pwm_exit  )
module_init ( pwm_init  )
MODULE_LICENSE ( "GPL"  )
int pwm_channel_alloc ( int  index,
struct pwm_channel ch 
)

pwm_channel_alloc - allocate an unused PWM channel : identifies the channel : structure to be initialized

Drivers allocate PWM channels according to the board's wiring, and matching board-specific setup code. Returns zero or negative errno.

Definition at line 88 of file atmel_pwm.c.

int pwm_channel_free ( struct pwm_channel ch)

pwm_channel_free - release a previously allocated channel : the channel being released

The channel is completely shut down (counter and IRQ disabled), and made available for re-use. Returns zero, or negative errno.

Definition at line 147 of file atmel_pwm.c.

int pwm_channel_handler ( struct pwm_channel ch,
void(*)(struct pwm_channel *ch)  handler 
)

pwm_channel_handler - manage channel's IRQ handler : the channel : the handler to use, possibly NULL

If the handler is non-null, the handler will be called after every period of this PWM channel. If the handler is null, this channel won't generate an IRQ.

Definition at line 255 of file atmel_pwm.c.

int pwm_clk_alloc ( unsigned  prescale,
unsigned  div 
)

pwm_clk_alloc - allocate and configure CLKA or CLKB : from 0..10, the power of two used to divide MCK : from 1..255, the linear divisor to use

Returns PWM_CPR_CLKA, PWM_CPR_CLKB, or negative errno. The allocated clock will run with a period of (2^prescale * div) / MCK, or twice as long if center aligned PWM output is used. The clock must later be deconfigured using pwm_clk_free().

Definition at line 200 of file atmel_pwm.c.

void pwm_clk_free ( unsigned  clk)

pwm_clk_free - deconfigure and release CLKA or CLKB

Reverses the effect of pwm_clk_alloc().

Definition at line 231 of file atmel_pwm.c.