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

Go to the source code of this file.

Data Structures

struct  atmel_tsadcc
 

Macros

#define ATMEL_TSADCC_CR   0x00 /* Control register */
 
#define ATMEL_TSADCC_SWRST   (1 << 0) /* Software Reset*/
 
#define ATMEL_TSADCC_START   (1 << 1) /* Start conversion */
 
#define ATMEL_TSADCC_MR   0x04 /* Mode register */
 
#define ATMEL_TSADCC_TSAMOD   (3 << 0) /* ADC mode */
 
#define ATMEL_TSADCC_TSAMOD_ADC_ONLY_MODE   (0x0) /* ADC Mode */
 
#define ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE   (0x1) /* Touch Screen Only Mode */
 
#define ATMEL_TSADCC_LOWRES   (1 << 4) /* Resolution selection */
 
#define ATMEL_TSADCC_SLEEP   (1 << 5) /* Sleep mode */
 
#define ATMEL_TSADCC_PENDET   (1 << 6) /* Pen Detect selection */
 
#define ATMEL_TSADCC_PRES   (1 << 7) /* Pressure Measurement Selection */
 
#define ATMEL_TSADCC_PRESCAL   (0x3f << 8) /* Prescalar Rate Selection */
 
#define ATMEL_TSADCC_EPRESCAL   (0xff << 8) /* Prescalar Rate Selection (Extended) */
 
#define ATMEL_TSADCC_STARTUP   (0x7f << 16) /* Start Up time */
 
#define ATMEL_TSADCC_SHTIM   (0xf << 24) /* Sample & Hold time */
 
#define ATMEL_TSADCC_PENDBC   (0xf << 28) /* Pen Detect debouncing time */
 
#define ATMEL_TSADCC_TRGR   0x08 /* Trigger register */
 
#define ATMEL_TSADCC_TRGMOD   (7 << 0) /* Trigger mode */
 
#define ATMEL_TSADCC_TRGMOD_NONE   (0 << 0)
 
#define ATMEL_TSADCC_TRGMOD_EXT_RISING   (1 << 0)
 
#define ATMEL_TSADCC_TRGMOD_EXT_FALLING   (2 << 0)
 
#define ATMEL_TSADCC_TRGMOD_EXT_ANY   (3 << 0)
 
#define ATMEL_TSADCC_TRGMOD_PENDET   (4 << 0)
 
#define ATMEL_TSADCC_TRGMOD_PERIOD   (5 << 0)
 
#define ATMEL_TSADCC_TRGMOD_CONTINUOUS   (6 << 0)
 
#define ATMEL_TSADCC_TRGPER   (0xffff << 16) /* Trigger period */
 
#define ATMEL_TSADCC_TSR   0x0C /* Touch Screen register */
 
#define ATMEL_TSADCC_TSFREQ   (0xf << 0) /* TS Frequency in Interleaved mode */
 
#define ATMEL_TSADCC_TSSHTIM   (0xf << 24) /* Sample & Hold time */
 
#define ATMEL_TSADCC_CHER   0x10 /* Channel Enable register */
 
#define ATMEL_TSADCC_CHDR   0x14 /* Channel Disable register */
 
#define ATMEL_TSADCC_CHSR   0x18 /* Channel Status register */
 
#define ATMEL_TSADCC_CH(n)   (1 << (n)) /* Channel number */
 
#define ATMEL_TSADCC_SR   0x1C /* Status register */
 
#define ATMEL_TSADCC_EOC(n)   (1 << ((n)+0)) /* End of conversion for channel N */
 
#define ATMEL_TSADCC_OVRE(n)   (1 << ((n)+8)) /* Overrun error for channel N */
 
#define ATMEL_TSADCC_DRDY   (1 << 16) /* Data Ready */
 
#define ATMEL_TSADCC_GOVRE   (1 << 17) /* General Overrun Error */
 
#define ATMEL_TSADCC_ENDRX   (1 << 18) /* End of RX Buffer */
 
#define ATMEL_TSADCC_RXBUFF   (1 << 19) /* TX Buffer full */
 
#define ATMEL_TSADCC_PENCNT   (1 << 20) /* Pen contact */
 
#define ATMEL_TSADCC_NOCNT   (1 << 21) /* No contact */
 
#define ATMEL_TSADCC_LCDR   0x20 /* Last Converted Data register */
 
#define ATMEL_TSADCC_DATA   (0x3ff << 0) /* Channel data */
 
#define ATMEL_TSADCC_IER   0x24 /* Interrupt Enable register */
 
#define ATMEL_TSADCC_IDR   0x28 /* Interrupt Disable register */
 
#define ATMEL_TSADCC_IMR   0x2C /* Interrupt Mask register */
 
#define ATMEL_TSADCC_CDR0   0x30 /* Channel Data 0 */
 
#define ATMEL_TSADCC_CDR1   0x34 /* Channel Data 1 */
 
#define ATMEL_TSADCC_CDR2   0x38 /* Channel Data 2 */
 
#define ATMEL_TSADCC_CDR3   0x3C /* Channel Data 3 */
 
#define ATMEL_TSADCC_CDR4   0x40 /* Channel Data 4 */
 
#define ATMEL_TSADCC_CDR5   0x44 /* Channel Data 5 */
 
#define ATMEL_TSADCC_XPOS   0x50
 
#define ATMEL_TSADCC_Z1DAT   0x54
 
#define ATMEL_TSADCC_Z2DAT   0x58
 
#define PRESCALER_VAL(x)   ((x) >> 8)
 
#define ADC_DEFAULT_CLOCK   100000
 
#define atmel_tsadcc_read(reg)   __raw_readl(tsc_base + (reg))
 
#define atmel_tsadcc_write(reg, val)   __raw_writel((val), tsc_base + (reg))
 

Functions

 module_platform_driver (atmel_tsadcc_driver)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DESCRIPTION ("Atmel TouchScreen Driver")
 
 MODULE_AUTHOR ("Dan Liang <[email protected]>")
 

Macro Definition Documentation

#define ADC_DEFAULT_CLOCK   100000

Definition at line 97 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CDR0   0x30 /* Channel Data 0 */

Definition at line 84 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CDR1   0x34 /* Channel Data 1 */

Definition at line 85 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CDR2   0x38 /* Channel Data 2 */

Definition at line 86 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CDR3   0x3C /* Channel Data 3 */

Definition at line 87 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CDR4   0x40 /* Channel Data 4 */

Definition at line 88 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CDR5   0x44 /* Channel Data 5 */

Definition at line 89 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CH (   n)    (1 << (n)) /* Channel number */

Definition at line 66 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CHDR   0x14 /* Channel Disable register */

Definition at line 64 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CHER   0x10 /* Channel Enable register */

Definition at line 63 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CHSR   0x18 /* Channel Status register */

Definition at line 65 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_CR   0x00 /* Control register */

Definition at line 30 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_DATA   (0x3ff << 0) /* Channel data */

Definition at line 79 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_DRDY   (1 << 16) /* Data Ready */

Definition at line 71 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_ENDRX   (1 << 18) /* End of RX Buffer */

Definition at line 73 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_EOC (   n)    (1 << ((n)+0)) /* End of conversion for channel N */

Definition at line 69 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_EPRESCAL   (0xff << 8) /* Prescalar Rate Selection (Extended) */

Definition at line 43 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_GOVRE   (1 << 17) /* General Overrun Error */

Definition at line 72 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_IDR   0x28 /* Interrupt Disable register */

Definition at line 82 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_IER   0x24 /* Interrupt Enable register */

Definition at line 81 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_IMR   0x2C /* Interrupt Mask register */

Definition at line 83 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_LCDR   0x20 /* Last Converted Data register */

Definition at line 78 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_LOWRES   (1 << 4) /* Resolution selection */

Definition at line 38 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_MR   0x04 /* Mode register */

Definition at line 34 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_NOCNT   (1 << 21) /* No contact */

Definition at line 76 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_OVRE (   n)    (1 << ((n)+8)) /* Overrun error for channel N */

Definition at line 70 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_PENCNT   (1 << 20) /* Pen contact */

Definition at line 75 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_PENDBC   (0xf << 28) /* Pen Detect debouncing time */

Definition at line 46 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_PENDET   (1 << 6) /* Pen Detect selection */

Definition at line 40 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_PRES   (1 << 7) /* Pressure Measurement Selection */

Definition at line 41 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_PRESCAL   (0x3f << 8) /* Prescalar Rate Selection */

Definition at line 42 of file atmel_tsadcc.c.

#define atmel_tsadcc_read (   reg)    __raw_readl(tsc_base + (reg))

Definition at line 111 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_RXBUFF   (1 << 19) /* TX Buffer full */

Definition at line 74 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_SHTIM   (0xf << 24) /* Sample & Hold time */

Definition at line 45 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_SLEEP   (1 << 5) /* Sleep mode */

Definition at line 39 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_SR   0x1C /* Status register */

Definition at line 68 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_START   (1 << 1) /* Start conversion */

Definition at line 32 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_STARTUP   (0x7f << 16) /* Start Up time */

Definition at line 44 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_SWRST   (1 << 0) /* Software Reset*/

Definition at line 31 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD   (7 << 0) /* Trigger mode */

Definition at line 49 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_CONTINUOUS   (6 << 0)

Definition at line 56 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_EXT_ANY   (3 << 0)

Definition at line 53 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_EXT_FALLING   (2 << 0)

Definition at line 52 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_EXT_RISING   (1 << 0)

Definition at line 51 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_NONE   (0 << 0)

Definition at line 50 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_PENDET   (4 << 0)

Definition at line 54 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGMOD_PERIOD   (5 << 0)

Definition at line 55 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGPER   (0xffff << 16) /* Trigger period */

Definition at line 57 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TRGR   0x08 /* Trigger register */

Definition at line 48 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TSAMOD   (3 << 0) /* ADC mode */

Definition at line 35 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TSAMOD_ADC_ONLY_MODE   (0x0) /* ADC Mode */

Definition at line 36 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE   (0x1) /* Touch Screen Only Mode */

Definition at line 37 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TSFREQ   (0xf << 0) /* TS Frequency in Interleaved mode */

Definition at line 60 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TSR   0x0C /* Touch Screen register */

Definition at line 59 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_TSSHTIM   (0xf << 24) /* Sample & Hold time */

Definition at line 61 of file atmel_tsadcc.c.

#define atmel_tsadcc_write (   reg,
  val 
)    __raw_writel((val), tsc_base + (reg))

Definition at line 112 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_XPOS   0x50

Definition at line 91 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_Z1DAT   0x54

Definition at line 92 of file atmel_tsadcc.c.

#define ATMEL_TSADCC_Z2DAT   0x58

Definition at line 93 of file atmel_tsadcc.c.

#define PRESCALER_VAL (   x)    ((x) >> 8)

Definition at line 95 of file atmel_tsadcc.c.

Function Documentation

MODULE_AUTHOR ( "Dan Liang <[email protected]>"  )
MODULE_DESCRIPTION ( "Atmel TouchScreen Driver"  )
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( atmel_tsadcc_driver  )