linux/drivers/input/touchscreen/imx6ul_tsc.c

// SPDX-License-Identifier: GPL-2.0
//
// Freescale i.MX6UL touchscreen controller driver
//
// Copyright (C) 2015 Freescale Semiconductor, Inc.

#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gpio/consumer.h>
#include <linux/input.h>
#include <linux/slab.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/log2.h>

/* ADC configuration registers field define */
#define ADC_AIEN
#define ADC_CONV_DISABLE
#define ADC_AVGE
#define ADC_CAL
#define ADC_CALF
#define ADC_12BIT_MODE
#define ADC_CONV_MODE_MASK
#define ADC_IPG_CLK
#define ADC_INPUT_CLK_MASK
#define ADC_CLK_DIV_8
#define ADC_CLK_DIV_MASK
#define ADC_SHORT_SAMPLE_MODE
#define ADC_SAMPLE_MODE_MASK
#define ADC_HARDWARE_TRIGGER
#define ADC_AVGS_SHIFT
#define ADC_AVGS_MASK
#define SELECT_CHANNEL_4
#define SELECT_CHANNEL_1
#define DISABLE_CONVERSION_INT

/* ADC registers */
#define REG_ADC_HC0
#define REG_ADC_HC1
#define REG_ADC_HC2
#define REG_ADC_HC3
#define REG_ADC_HC4
#define REG_ADC_HS
#define REG_ADC_R0
#define REG_ADC_CFG
#define REG_ADC_GC
#define REG_ADC_GS

#define ADC_TIMEOUT

/* TSC registers */
#define REG_TSC_BASIC_SETING
#define REG_TSC_PRE_CHARGE_TIME
#define REG_TSC_FLOW_CONTROL
#define REG_TSC_MEASURE_VALUE
#define REG_TSC_INT_EN
#define REG_TSC_INT_SIG_EN
#define REG_TSC_INT_STATUS
#define REG_TSC_DEBUG_MODE
#define REG_TSC_DEBUG_MODE2

/* TSC configuration registers field define */
#define DETECT_4_WIRE_MODE
#define AUTO_MEASURE
#define MEASURE_SIGNAL
#define DETECT_SIGNAL
#define VALID_SIGNAL
#define MEASURE_INT_EN
#define MEASURE_SIG_EN
#define VALID_SIG_EN
#define DE_GLITCH_2
#define START_SENSE
#define TSC_DISABLE
#define DETECT_MODE

struct imx6ul_tsc {};

/*
 * TSC module need ADC to get the measure value. So
 * before config TSC, we should initialize ADC module.
 */
static int imx6ul_adc_init(struct imx6ul_tsc *tsc)
{}

/*
 * This is a TSC workaround. Currently TSC misconnect two
 * ADC channels, this function remap channel configure for
 * hardware trigger.
 */
static void imx6ul_tsc_channel_config(struct imx6ul_tsc *tsc)
{}

/*
 * TSC setting, confige the pre-charge time and measure delay time.
 * different touch screen may need different pre-charge time and
 * measure delay time.
 */
static void imx6ul_tsc_set(struct imx6ul_tsc *tsc)
{}

static int imx6ul_tsc_init(struct imx6ul_tsc *tsc)
{}

static void imx6ul_tsc_disable(struct imx6ul_tsc *tsc)
{}

/* Delay some time (max 2ms), wait the pre-charge done. */
static bool tsc_wait_detect_mode(struct imx6ul_tsc *tsc)
{}

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

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

static int imx6ul_tsc_start(struct imx6ul_tsc *tsc)
{}

static void imx6ul_tsc_stop(struct imx6ul_tsc *tsc)
{}


static int imx6ul_tsc_open(struct input_dev *input_dev)
{}

static void imx6ul_tsc_close(struct input_dev *input_dev)
{}

static int imx6ul_tsc_probe(struct platform_device *pdev)
{}

static int imx6ul_tsc_suspend(struct device *dev)
{}

static int imx6ul_tsc_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(imx6ul_tsc_pm_ops,
				imx6ul_tsc_suspend, imx6ul_tsc_resume);

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

static struct platform_driver imx6ul_tsc_driver =;
module_platform_driver();

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