linux/drivers/input/misc/ad714x.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * AD714X CapTouch Programmable Controller driver supporting AD7142/3/7/8/7A
 *
 * Copyright 2009-2011 Analog Devices Inc.
 */

#include <linux/device.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/input/ad714x.h>
#include <linux/module.h>
#include "ad714x.h"

#define AD714X_PWR_CTRL
#define AD714X_STG_CAL_EN_REG
#define AD714X_AMB_COMP_CTRL0_REG
#define AD714X_PARTID_REG
#define AD7142_PARTID
#define AD7143_PARTID
#define AD7147_PARTID
#define AD7148_PARTID
#define AD714X_STAGECFG_REG
#define AD714X_SYSCFG_REG

#define STG_LOW_INT_EN_REG
#define STG_HIGH_INT_EN_REG
#define STG_COM_INT_EN_REG
#define STG_LOW_INT_STA_REG
#define STG_HIGH_INT_STA_REG
#define STG_COM_INT_STA_REG

#define CDC_RESULT_S0
#define CDC_RESULT_S1
#define CDC_RESULT_S2
#define CDC_RESULT_S3
#define CDC_RESULT_S4
#define CDC_RESULT_S5
#define CDC_RESULT_S6
#define CDC_RESULT_S7
#define CDC_RESULT_S8
#define CDC_RESULT_S9
#define CDC_RESULT_S10
#define CDC_RESULT_S11

#define STAGE0_AMBIENT
#define STAGE1_AMBIENT
#define STAGE2_AMBIENT
#define STAGE3_AMBIENT
#define STAGE4_AMBIENT
#define STAGE5_AMBIENT
#define STAGE6_AMBIENT
#define STAGE7_AMBIENT
#define STAGE8_AMBIENT
#define STAGE9_AMBIENT
#define STAGE10_AMBIENT
#define STAGE11_AMBIENT

#define PER_STAGE_REG_NUM
#define STAGE_CFGREG_NUM
#define SYS_CFGREG_NUM

/*
 * driver information which will be used to maintain the software flow
 */
enum ad714x_device_state {};

struct ad714x_slider_drv {};

struct ad714x_wheel_drv {};

struct ad714x_touchpad_drv {};

struct ad714x_button_drv {};

struct ad714x_driver_data {};

/*
 * information to integrate all things which will be private data
 * of spi/i2c device
 */

static void ad714x_use_com_int(struct ad714x_chip *ad714x,
				int start_stage, int end_stage)
{}

static void ad714x_use_thr_int(struct ad714x_chip *ad714x,
				int start_stage, int end_stage)
{}

static int ad714x_cal_highest_stage(struct ad714x_chip *ad714x,
					int start_stage, int end_stage)
{}

static int ad714x_cal_abs_pos(struct ad714x_chip *ad714x,
				int start_stage, int end_stage,
				int highest_stage, int max_coord)
{}

/*
 * One button can connect to multi positive and negative of CDCs
 * Multi-buttons can connect to same positive/negative of one CDC
 */
static void ad714x_button_state_machine(struct ad714x_chip *ad714x, int idx)
{}

/*
 * The response of a sensor is defined by the absolute number of codes
 * between the current CDC value and the ambient value.
 */
static void ad714x_slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
{}

/*
 * The formulae are very straight forward. It uses the sensor with the
 * highest response and the 2 adjacent ones.
 * When Sensor 0 has the highest response, only sensor 0 and sensor 1
 * are used in the calculations. Similarly when the last sensor has the
 * highest response, only the last sensor and the second last sensors
 * are used in the calculations.
 *
 * For i= idx_of_peak_Sensor-1 to i= idx_of_peak_Sensor+1
 *         v += Sensor response(i)*i
 *         w += Sensor response(i)
 * POS=(Number_of_Positions_Wanted/(Number_of_Sensors_Used-1)) *(v/w)
 */
static void ad714x_slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
{}

/*
 * To minimise the Impact of the noise on the algorithm, ADI developed a
 * routine that filters the CDC results after they have been read by the
 * host processor.
 * The filter used is an Infinite Input Response(IIR) filter implemented
 * in firmware and attenuates the noise on the CDC results after they've
 * been read by the host processor.
 * Filtered_CDC_result = (Filtered_CDC_result * (10 - Coefficient) +
 *				Latest_CDC_result * Coefficient)/10
 */
static void ad714x_slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_slider_use_com_int(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_slider_state_machine(struct ad714x_chip *ad714x, int idx)
{}

/*
 * When the scroll wheel is activated, we compute the absolute position based
 * on the sensor values. To calculate the position, we first determine the
 * sensor that has the greatest response among the 8 sensors that constitutes
 * the scrollwheel. Then we determined the 2 sensors on either sides of the
 * sensor with the highest response and we apply weights to these sensors.
 */
static void ad714x_wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
{}

/*
 * When the scroll wheel is activated, we compute the absolute position based
 * on the sensor values. To calculate the position, we first determine the
 * sensor that has the greatest response among the sensors that constitutes
 * the scrollwheel. Then we determined the sensors on either sides of the
 * sensor with the highest response and we apply weights to these sensors. The
 * result of this computation gives us the mean value.
 */

static void ad714x_wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_wheel_state_machine(struct ad714x_chip *ad714x, int idx)
{}

static void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
{}

static void touchpad_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
{}

/*
 * If 2 fingers are touching the sensor then 2 peaks can be observed in the
 * distribution.
 * The arithmetic doesn't support to get absolute coordinates for multi-touch
 * yet.
 */
static int touchpad_check_second_peak(struct ad714x_chip *ad714x, int idx)
{}

/*
 * If only one finger is used to activate the touch pad then only 1 peak will be
 * registered in the distribution. This peak and the 2 adjacent sensors will be
 * used in the calculation of the absolute position. This will prevent hand
 * shadows to affect the absolute position calculation.
 */
static void touchpad_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
{}

static void touchpad_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
{}

/*
 * To prevent distortion from showing in the absolute position, it is
 * necessary to detect the end points. When endpoints are detected, the
 * driver stops updating the status variables with absolute positions.
 * End points are detected on the 4 edges of the touchpad sensor. The
 * method to detect them is the same for all 4.
 * To detect the end points, the firmware computes the difference in
 * percent between the sensor on the edge and the adjacent one. The
 * difference is calculated in percent in order to make the end point
 * detection independent of the pressure.
 */

#define LEFT_END_POINT_DETECTION_LEVEL
#define RIGHT_END_POINT_DETECTION_LEVEL
#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL
#define TOP_END_POINT_DETECTION_LEVEL
#define BOTTOM_END_POINT_DETECTION_LEVEL
#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL
static int touchpad_check_endpoint(struct ad714x_chip *ad714x, int idx)
{}

static void touchpad_use_com_int(struct ad714x_chip *ad714x, int idx)
{}

static void touchpad_use_thr_int(struct ad714x_chip *ad714x, int idx)
{}

static void ad714x_touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
{}

static int ad714x_hw_detect(struct ad714x_chip *ad714x)
{}

static void ad714x_hw_init(struct ad714x_chip *ad714x)
{}

static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
{}

struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
				 ad714x_read_t read, ad714x_write_t write)
{}
EXPORT_SYMBOL();

static int ad714x_suspend(struct device *dev)
{}

static int ad714x_resume(struct device *dev)
{}

EXPORT_SIMPLE_DEV_PM_OPS();

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