Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
ads7846.c File Reference
#include <linux/types.h>
#include <linux/hwmon.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/pm.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
#include <asm/irq.h>

Go to the source code of this file.

Data Structures

struct  ts_event
 
struct  ads7846_packet
 
struct  ads7846
 
struct  ser_req
 
struct  ads7845_ser_req
 

Macros

#define TS_POLL_DELAY   1 /* ms delay before the first sample */
 
#define TS_POLL_PERIOD   5 /* ms delay between samples */
 
#define SAMPLE_BITS   (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after */)
 
#define CS_CHANGE(xfer)   ((xfer).cs_change = 0)
 
#define ADS_START   (1 << 7)
 
#define ADS_A2A1A0_d_y   (1 << 4) /* differential */
 
#define ADS_A2A1A0_d_z1   (3 << 4) /* differential */
 
#define ADS_A2A1A0_d_z2   (4 << 4) /* differential */
 
#define ADS_A2A1A0_d_x   (5 << 4) /* differential */
 
#define ADS_A2A1A0_temp0   (0 << 4) /* non-differential */
 
#define ADS_A2A1A0_vbatt   (2 << 4) /* non-differential */
 
#define ADS_A2A1A0_vaux   (6 << 4) /* non-differential */
 
#define ADS_A2A1A0_temp1   (7 << 4) /* non-differential */
 
#define ADS_8_BIT   (1 << 3)
 
#define ADS_12_BIT   (0 << 3)
 
#define ADS_SER   (1 << 2) /* non-differential */
 
#define ADS_DFR   (0 << 2) /* differential */
 
#define ADS_PD10_PDOWN   (0 << 0) /* low power mode + penirq */
 
#define ADS_PD10_ADC_ON   (1 << 0) /* ADC on */
 
#define ADS_PD10_REF_ON   (2 << 0) /* vREF on + penirq */
 
#define ADS_PD10_ALL_ON   (3 << 0) /* ADC + vREF on */
 
#define MAX_12BIT   ((1<<12)-1)
 
#define READ_12BIT_DFR(x, adc, vref)
 
#define READ_Y(vref)   (READ_12BIT_DFR(y, 1, vref))
 
#define READ_Z1(vref)   (READ_12BIT_DFR(z1, 1, vref))
 
#define READ_Z2(vref)   (READ_12BIT_DFR(z2, 1, vref))
 
#define READ_X(vref)   (READ_12BIT_DFR(x, 1, vref))
 
#define PWRDOWN   (READ_12BIT_DFR(y, 0, 0)) /* LAST */
 
#define READ_12BIT_SER(x)
 
#define REF_ON   (READ_12BIT_DFR(x, 1, 1))
 
#define REF_OFF   (READ_12BIT_DFR(y, 0, 0))
 

Functions

 module_spi_driver (ads7846_driver)
 
 MODULE_DESCRIPTION ("ADS7846 TouchScreen Driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("spi:ads7846")
 

Macro Definition Documentation

#define ADS_12_BIT   (0 << 3)

Definition at line 170 of file ads7846.c.

#define ADS_8_BIT   (1 << 3)

Definition at line 169 of file ads7846.c.

#define ADS_A2A1A0_d_x   (5 << 4) /* differential */

Definition at line 164 of file ads7846.c.

#define ADS_A2A1A0_d_y   (1 << 4) /* differential */

Definition at line 161 of file ads7846.c.

#define ADS_A2A1A0_d_z1   (3 << 4) /* differential */

Definition at line 162 of file ads7846.c.

#define ADS_A2A1A0_d_z2   (4 << 4) /* differential */

Definition at line 163 of file ads7846.c.

#define ADS_A2A1A0_temp0   (0 << 4) /* non-differential */

Definition at line 165 of file ads7846.c.

#define ADS_A2A1A0_temp1   (7 << 4) /* non-differential */

Definition at line 168 of file ads7846.c.

#define ADS_A2A1A0_vaux   (6 << 4) /* non-differential */

Definition at line 167 of file ads7846.c.

#define ADS_A2A1A0_vbatt   (2 << 4) /* non-differential */

Definition at line 166 of file ads7846.c.

#define ADS_DFR   (0 << 2) /* differential */

Definition at line 172 of file ads7846.c.

#define ADS_PD10_ADC_ON   (1 << 0) /* ADC on */

Definition at line 174 of file ads7846.c.

#define ADS_PD10_ALL_ON   (3 << 0) /* ADC + vREF on */

Definition at line 176 of file ads7846.c.

#define ADS_PD10_PDOWN   (0 << 0) /* low power mode + penirq */

Definition at line 173 of file ads7846.c.

#define ADS_PD10_REF_ON   (2 << 0) /* vREF on + penirq */

Definition at line 175 of file ads7846.c.

#define ADS_SER   (1 << 2) /* non-differential */

Definition at line 171 of file ads7846.c.

#define ADS_START   (1 << 7)

Definition at line 160 of file ads7846.c.

#define CS_CHANGE (   xfer)    ((xfer).cs_change = 0)

Definition at line 152 of file ads7846.c.

#define MAX_12BIT   ((1<<12)-1)

Definition at line 178 of file ads7846.c.

#define PWRDOWN   (READ_12BIT_DFR(y, 0, 0)) /* LAST */

Definition at line 190 of file ads7846.c.

#define READ_12BIT_DFR (   x,
  adc,
  vref 
)
Value:
(ADS_START | ADS_A2A1A0_d_ ## x \
(adc ? ADS_PD10_ADC_ON : 0) | (vref ? ADS_PD10_REF_ON : 0))

Definition at line 181 of file ads7846.c.

#define READ_12BIT_SER (   x)
Value:
(ADS_START | ADS_A2A1A0_ ## x \

Definition at line 195 of file ads7846.c.

#define READ_X (   vref)    (READ_12BIT_DFR(x, 1, vref))

Definition at line 189 of file ads7846.c.

#define READ_Y (   vref)    (READ_12BIT_DFR(y, 1, vref))

Definition at line 185 of file ads7846.c.

#define READ_Z1 (   vref)    (READ_12BIT_DFR(z1, 1, vref))

Definition at line 186 of file ads7846.c.

#define READ_Z2 (   vref)    (READ_12BIT_DFR(z2, 1, vref))

Definition at line 187 of file ads7846.c.

#define REF_OFF   (READ_12BIT_DFR(y, 0, 0))

Definition at line 199 of file ads7846.c.

#define REF_ON   (READ_12BIT_DFR(x, 1, 1))

Definition at line 198 of file ads7846.c.

#define SAMPLE_BITS   (8 /*cmd*/ + 16 /*sample*/ + 2 /* before, after */)

Definition at line 63 of file ads7846.c.

#define TS_POLL_DELAY   1 /* ms delay before the first sample */

Definition at line 59 of file ads7846.c.

#define TS_POLL_PERIOD   5 /* ms delay between samples */

Definition at line 60 of file ads7846.c.

Function Documentation

MODULE_ALIAS ( "spi:ads7846"  )
MODULE_DESCRIPTION ( "ADS7846 TouchScreen Driver"  )
MODULE_LICENSE ( "GPL"  )
module_spi_driver ( ads7846_driver  )