mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 12:46:51 +07:00
d2912cb15b
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
99 lines
2.4 KiB
C
99 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/*
|
|
* Copyright (c) 2008 MtekVision Co., Ltd.
|
|
* Kwangwoo Lee <kwlee@mtekvision.com>
|
|
*
|
|
* Using code from:
|
|
* - ads7846.c
|
|
* Copyright (c) 2005 David Brownell
|
|
* Copyright (c) 2006 Nokia Corporation
|
|
* - corgi_ts.c
|
|
* Copyright (C) 2004-2005 Richard Purdie
|
|
* - omap_ts.[hc], ads7846.h, ts_osk.c
|
|
* Copyright (C) 2002 MontaVista Software
|
|
* Copyright (C) 2004 Texas Instruments
|
|
* Copyright (C) 2005 Dirk Behme
|
|
*/
|
|
|
|
#ifndef _TSC2007_H
|
|
#define _TSC2007_H
|
|
|
|
#define TSC2007_MEASURE_TEMP0 (0x0 << 4)
|
|
#define TSC2007_MEASURE_AUX (0x2 << 4)
|
|
#define TSC2007_MEASURE_TEMP1 (0x4 << 4)
|
|
#define TSC2007_ACTIVATE_XN (0x8 << 4)
|
|
#define TSC2007_ACTIVATE_YN (0x9 << 4)
|
|
#define TSC2007_ACTIVATE_YP_XN (0xa << 4)
|
|
#define TSC2007_SETUP (0xb << 4)
|
|
#define TSC2007_MEASURE_X (0xc << 4)
|
|
#define TSC2007_MEASURE_Y (0xd << 4)
|
|
#define TSC2007_MEASURE_Z1 (0xe << 4)
|
|
#define TSC2007_MEASURE_Z2 (0xf << 4)
|
|
|
|
#define TSC2007_POWER_OFF_IRQ_EN (0x0 << 2)
|
|
#define TSC2007_ADC_ON_IRQ_DIS0 (0x1 << 2)
|
|
#define TSC2007_ADC_OFF_IRQ_EN (0x2 << 2)
|
|
#define TSC2007_ADC_ON_IRQ_DIS1 (0x3 << 2)
|
|
|
|
#define TSC2007_12BIT (0x0 << 1)
|
|
#define TSC2007_8BIT (0x1 << 1)
|
|
|
|
#define MAX_12BIT ((1 << 12) - 1)
|
|
|
|
#define ADC_ON_12BIT (TSC2007_12BIT | TSC2007_ADC_ON_IRQ_DIS0)
|
|
|
|
#define READ_Y (ADC_ON_12BIT | TSC2007_MEASURE_Y)
|
|
#define READ_Z1 (ADC_ON_12BIT | TSC2007_MEASURE_Z1)
|
|
#define READ_Z2 (ADC_ON_12BIT | TSC2007_MEASURE_Z2)
|
|
#define READ_X (ADC_ON_12BIT | TSC2007_MEASURE_X)
|
|
#define PWRDOWN (TSC2007_12BIT | TSC2007_POWER_OFF_IRQ_EN)
|
|
|
|
struct ts_event {
|
|
u16 x;
|
|
u16 y;
|
|
u16 z1, z2;
|
|
};
|
|
|
|
struct tsc2007 {
|
|
struct input_dev *input;
|
|
char phys[32];
|
|
|
|
struct i2c_client *client;
|
|
|
|
u16 model;
|
|
u16 x_plate_ohms;
|
|
u16 max_rt;
|
|
unsigned long poll_period; /* in jiffies */
|
|
int fuzzx;
|
|
int fuzzy;
|
|
int fuzzz;
|
|
|
|
unsigned int gpio;
|
|
int irq;
|
|
|
|
wait_queue_head_t wait;
|
|
bool stopped;
|
|
|
|
int (*get_pendown_state)(struct device *);
|
|
void (*clear_penirq)(void);
|
|
|
|
struct mutex mlock;
|
|
};
|
|
|
|
int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd);
|
|
u32 tsc2007_calculate_resistance(struct tsc2007 *tsc, struct ts_event *tc);
|
|
bool tsc2007_is_pen_down(struct tsc2007 *ts);
|
|
|
|
#if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2007_IIO)
|
|
/* defined in tsc2007_iio.c */
|
|
int tsc2007_iio_configure(struct tsc2007 *ts);
|
|
#else
|
|
static inline int tsc2007_iio_configure(struct tsc2007 *ts)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_TOUCHSCREEN_TSC2007_IIO */
|
|
|
|
#endif /* _TSC2007_H */
|