root/drivers/input/touchscreen/tsc2007.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. tsc2007_iio_configure

   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 
   3 /*
   4  * Copyright (c) 2008 MtekVision Co., Ltd.
   5  *      Kwangwoo Lee <kwlee@mtekvision.com>
   6  *
   7  * Using code from:
   8  *  - ads7846.c
   9  *      Copyright (c) 2005 David Brownell
  10  *      Copyright (c) 2006 Nokia Corporation
  11  *  - corgi_ts.c
  12  *      Copyright (C) 2004-2005 Richard Purdie
  13  *  - omap_ts.[hc], ads7846.h, ts_osk.c
  14  *      Copyright (C) 2002 MontaVista Software
  15  *      Copyright (C) 2004 Texas Instruments
  16  *      Copyright (C) 2005 Dirk Behme
  17  */
  18 
  19 #ifndef _TSC2007_H
  20 #define _TSC2007_H
  21 
  22 #define TSC2007_MEASURE_TEMP0           (0x0 << 4)
  23 #define TSC2007_MEASURE_AUX             (0x2 << 4)
  24 #define TSC2007_MEASURE_TEMP1           (0x4 << 4)
  25 #define TSC2007_ACTIVATE_XN             (0x8 << 4)
  26 #define TSC2007_ACTIVATE_YN             (0x9 << 4)
  27 #define TSC2007_ACTIVATE_YP_XN          (0xa << 4)
  28 #define TSC2007_SETUP                   (0xb << 4)
  29 #define TSC2007_MEASURE_X               (0xc << 4)
  30 #define TSC2007_MEASURE_Y               (0xd << 4)
  31 #define TSC2007_MEASURE_Z1              (0xe << 4)
  32 #define TSC2007_MEASURE_Z2              (0xf << 4)
  33 
  34 #define TSC2007_POWER_OFF_IRQ_EN        (0x0 << 2)
  35 #define TSC2007_ADC_ON_IRQ_DIS0         (0x1 << 2)
  36 #define TSC2007_ADC_OFF_IRQ_EN          (0x2 << 2)
  37 #define TSC2007_ADC_ON_IRQ_DIS1         (0x3 << 2)
  38 
  39 #define TSC2007_12BIT                   (0x0 << 1)
  40 #define TSC2007_8BIT                    (0x1 << 1)
  41 
  42 #define MAX_12BIT                       ((1 << 12) - 1)
  43 
  44 #define ADC_ON_12BIT    (TSC2007_12BIT | TSC2007_ADC_ON_IRQ_DIS0)
  45 
  46 #define READ_Y          (ADC_ON_12BIT | TSC2007_MEASURE_Y)
  47 #define READ_Z1         (ADC_ON_12BIT | TSC2007_MEASURE_Z1)
  48 #define READ_Z2         (ADC_ON_12BIT | TSC2007_MEASURE_Z2)
  49 #define READ_X          (ADC_ON_12BIT | TSC2007_MEASURE_X)
  50 #define PWRDOWN         (TSC2007_12BIT | TSC2007_POWER_OFF_IRQ_EN)
  51 
  52 struct ts_event {
  53         u16     x;
  54         u16     y;
  55         u16     z1, z2;
  56 };
  57 
  58 struct tsc2007 {
  59         struct input_dev        *input;
  60         char                    phys[32];
  61 
  62         struct i2c_client       *client;
  63 
  64         u16                     model;
  65         u16                     x_plate_ohms;
  66         u16                     max_rt;
  67         unsigned long           poll_period; /* in jiffies */
  68         int                     fuzzx;
  69         int                     fuzzy;
  70         int                     fuzzz;
  71 
  72         unsigned int            gpio;
  73         int                     irq;
  74 
  75         wait_queue_head_t       wait;
  76         bool                    stopped;
  77 
  78         int                     (*get_pendown_state)(struct device *);
  79         void                    (*clear_penirq)(void);
  80 
  81         struct mutex            mlock;
  82 };
  83 
  84 int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd);
  85 u32 tsc2007_calculate_resistance(struct tsc2007 *tsc, struct ts_event *tc);
  86 bool tsc2007_is_pen_down(struct tsc2007 *ts);
  87 
  88 #if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2007_IIO)
  89 /* defined in tsc2007_iio.c */
  90 int tsc2007_iio_configure(struct tsc2007 *ts);
  91 #else
  92 static inline int tsc2007_iio_configure(struct tsc2007 *ts)
  93 {
  94         return 0;
  95 }
  96 #endif /* CONFIG_TOUCHSCREEN_TSC2007_IIO */
  97 
  98 #endif /* _TSC2007_H */

/* [<][>][^][v][top][bottom][index][help] */