linux/drivers/input/touchscreen/sun4i-ts.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Allwinner sunxi resistive touchscreen controller driver
 *
 * Copyright (C) 2013 - 2014 Hans de Goede <[email protected]>
 *
 * The hwmon parts are based on work by Corentin LABBE which is:
 * Copyright (C) 2013 Corentin LABBE <[email protected]>
 */

/*
 * The sun4i-ts controller is capable of detecting a second touch, but when a
 * second touch is present then the accuracy becomes so bad the reported touch
 * location is not useable.
 *
 * The original android driver contains some complicated heuristics using the
 * aprox. distance between the 2 touches to see if the user is making a pinch
 * open / close movement, and then reports emulated multi-touch events around
 * the last touch coordinate (as the dual-touch coordinates are worthless).
 *
 * These kinds of heuristics are just asking for trouble (and don't belong
 * in the kernel). So this driver offers straight forward, reliable single
 * touch functionality only.
 *
 * s.a. A20 User Manual "1.15 TP" (Documentation/arch/arm/sunxi.rst)
 * (looks like the description in the A20 User Manual v1.3 is better
 * than the one in the A10 User Manual v.1.5)
 */

#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/thermal.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

#define TP_CTRL0
#define TP_CTRL1
#define TP_CTRL2
#define TP_CTRL3
#define TP_INT_FIFOC
#define TP_INT_FIFOS
#define TP_TPR
#define TP_CDAT
#define TEMP_DATA
#define TP_DATA

/* TP_CTRL0 bits */
#define ADC_FIRST_DLY(x)
#define ADC_FIRST_DLY_MODE(x)
#define ADC_CLK_SEL(x)
#define ADC_CLK_DIV(x)
#define FS_DIV(x)
#define T_ACQ(x)

/* TP_CTRL1 bits */
#define STYLUS_UP_DEBOUN(x)
#define STYLUS_UP_DEBOUN_EN(x)
#define TOUCH_PAN_CALI_EN(x)
#define TP_DUAL_EN(x)
#define TP_MODE_EN(x)
#define TP_ADC_SELECT(x)
#define ADC_CHAN_SELECT(x)

/* on sun6i, bits 3~6 are left shifted by 1 to 4~7 */
#define SUN6I_TP_MODE_EN(x)

/* TP_CTRL2 bits */
#define TP_SENSITIVE_ADJUST(x)
#define TP_MODE_SELECT(x)
#define PRE_MEA_EN(x)
#define PRE_MEA_THRE_CNT(x)

/* TP_CTRL3 bits */
#define FILTER_EN(x)
#define FILTER_TYPE(x)

/* TP_INT_FIFOC irq and fifo mask / control bits */
#define TEMP_IRQ_EN(x)
#define OVERRUN_IRQ_EN(x)
#define DATA_IRQ_EN(x)
#define TP_DATA_XY_CHANGE(x)
#define FIFO_TRIG(x)
#define DATA_DRQ_EN(x)
#define FIFO_FLUSH(x)
#define TP_UP_IRQ_EN(x)
#define TP_DOWN_IRQ_EN(x)

/* TP_INT_FIFOS irq and fifo status bits */
#define TEMP_DATA_PENDING
#define FIFO_OVERRUN_PENDING
#define FIFO_DATA_PENDING
#define TP_IDLE_FLG
#define TP_UP_PENDING
#define TP_DOWN_PENDING

/* TP_TPR bits */
#define TEMP_ENABLE(x)
#define TEMP_PERIOD(x)

struct sun4i_ts_data {};

static void sun4i_ts_irq_handle_input(struct sun4i_ts_data *ts, u32 reg_val)
{}

static irqreturn_t sun4i_ts_irq(int irq, void *dev_id)
{}

static int sun4i_ts_open(struct input_dev *dev)
{}

static void sun4i_ts_close(struct input_dev *dev)
{}

static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
{}

static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp)
{}

static const struct thermal_zone_device_ops sun4i_ts_tz_ops =;

static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
			 char *buf)
{}

static ssize_t show_temp_label(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{}

static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL);

static struct attribute *sun4i_ts_attrs[] =;
ATTRIBUTE_GROUPS();

static int sun4i_ts_probe(struct platform_device *pdev)
{}

static void sun4i_ts_remove(struct platform_device *pdev)
{}

static const struct of_device_id sun4i_ts_of_match[] =;
MODULE_DEVICE_TABLE(of, sun4i_ts_of_match);

static struct platform_driver sun4i_ts_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();