linux/drivers/input/mouse/elan_i2c_core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Elan I2C/SMBus Touchpad driver
 *
 * Copyright (c) 2013 ELAN Microelectronics Corp.
 *
 * Author: 林政維 (Duson Lin) <[email protected]>
 * Author: KT Liao <[email protected]>
 * Version: 1.6.3
 *
 * Based on cyapa driver:
 * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
 * copyright (c) 2011-2012 Google, Inc.
 *
 * Trademarks are the property of their respective owners.
 */

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/input/mt.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/input.h>
#include <linux/uaccess.h>
#include <linux/jiffies.h>
#include <linux/completion.h>
#include <linux/of.h>
#include <linux/pm_wakeirq.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/unaligned.h>

#include "elan_i2c.h"

#define DRIVER_NAME
#define ELAN_VENDOR_ID
#define ETP_MAX_PRESSURE
#define ETP_FWIDTH_REDUCE
#define ETP_FINGER_WIDTH
#define ETP_RETRY_COUNT

/* quirks to control the device */
#define ETP_QUIRK_QUICK_WAKEUP

/* The main device structure */
struct elan_tp_data {};

static u32 elan_i2c_lookup_quirks(u16 ic_type, u16 product_id)
{}

static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u16 *validpage_count,
			   u32 *signature_address, u16 *page_size)
{}

static int elan_set_power(struct elan_tp_data *data, bool on)
{}

static int elan_sleep(struct elan_tp_data *data)
{}

static int elan_query_product(struct elan_tp_data *data)
{}

static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
{}

static int __elan_initialize(struct elan_tp_data *data, bool skip_reset)
{}

static int elan_initialize(struct elan_tp_data *data, bool skip_reset)
{}

static int elan_query_device_info(struct elan_tp_data *data)
{}

static unsigned int elan_convert_resolution(u8 val, u8 pattern)
{}

static int elan_query_device_parameters(struct elan_tp_data *data)
{}

/*
 **********************************************************
 * IAP firmware updater related routines
 **********************************************************
 */
static int elan_write_fw_block(struct elan_tp_data *data, u16 page_size,
			       const u8 *page, u16 checksum, int idx)
{}

static int __elan_update_firmware(struct elan_tp_data *data,
				  const struct firmware *fw)
{}

static int elan_update_firmware(struct elan_tp_data *data,
				const struct firmware *fw)
{}

/*
 *******************************************************************
 * SYSFS attributes
 *******************************************************************
 */
static ssize_t elan_sysfs_read_fw_checksum(struct device *dev,
					   struct device_attribute *attr,
					   char *buf)
{}

static ssize_t elan_sysfs_read_product_id(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{}

static ssize_t elan_sysfs_read_fw_ver(struct device *dev,
				      struct device_attribute *attr,
				      char *buf)
{}

static ssize_t elan_sysfs_read_sm_ver(struct device *dev,
				      struct device_attribute *attr,
				      char *buf)
{}

static ssize_t elan_sysfs_read_iap_ver(struct device *dev,
				       struct device_attribute *attr,
				       char *buf)
{}

static ssize_t elan_sysfs_update_fw(struct device *dev,
				    struct device_attribute *attr,
				    const char *buf, size_t count)
{}

static ssize_t calibrate_store(struct device *dev,
			       struct device_attribute *attr,
			       const char *buf, size_t count)
{}

static ssize_t elan_sysfs_read_mode(struct device *dev,
				    struct device_attribute *attr,
				    char *buf)
{}

static DEVICE_ATTR(product_id, S_IRUGO, elan_sysfs_read_product_id, NULL);
static DEVICE_ATTR(firmware_version, S_IRUGO, elan_sysfs_read_fw_ver, NULL);
static DEVICE_ATTR(sample_version, S_IRUGO, elan_sysfs_read_sm_ver, NULL);
static DEVICE_ATTR(iap_version, S_IRUGO, elan_sysfs_read_iap_ver, NULL);
static DEVICE_ATTR(fw_checksum, S_IRUGO, elan_sysfs_read_fw_checksum, NULL);
static DEVICE_ATTR(mode, S_IRUGO, elan_sysfs_read_mode, NULL);
static DEVICE_ATTR(update_fw, S_IWUSR, NULL, elan_sysfs_update_fw);

static DEVICE_ATTR_WO(calibrate);

static struct attribute *elan_sysfs_entries[] =;

static const struct attribute_group elan_sysfs_group =;

static ssize_t acquire_store(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{}

static ssize_t min_show(struct device *dev,
			struct device_attribute *attr, char *buf)
{}

static ssize_t max_show(struct device *dev,
			struct device_attribute *attr, char *buf)
{}


static DEVICE_ATTR_WO(acquire);
static DEVICE_ATTR_RO(min);
static DEVICE_ATTR_RO(max);

static struct attribute *elan_baseline_sysfs_entries[] =;

static const struct attribute_group elan_baseline_sysfs_group =;

static const struct attribute_group *elan_sysfs_groups[] =;

/*
 ******************************************************************
 * Elan isr functions
 ******************************************************************
 */
static void elan_report_contact(struct elan_tp_data *data, int contact_num,
				bool contact_valid, bool high_precision,
				u8 *packet, u8 *finger_data)
{}

static void elan_report_absolute(struct elan_tp_data *data, u8 *packet,
				 bool high_precision)
{}

static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report)
{}

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

/*
 ******************************************************************
 * Elan initialization functions
 ******************************************************************
 */

static int elan_setup_trackpoint_input_device(struct elan_tp_data *data)
{}

static int elan_setup_input_device(struct elan_tp_data *data)
{}

static void elan_disable_regulator(void *_data)
{}

static int elan_probe(struct i2c_client *client)
{}

static int elan_suspend(struct device *dev)
{}

static int elan_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume);

static const struct i2c_device_id elan_id[] =;
MODULE_DEVICE_TABLE(i2c, elan_id);

#ifdef CONFIG_ACPI
#include <linux/input/elan-i2c-ids.h>
MODULE_DEVICE_TABLE(acpi, elan_acpi_id);
#endif

#ifdef CONFIG_OF
static const struct of_device_id elan_of_match[] =;
MODULE_DEVICE_TABLE(of, elan_of_match);
#endif

static struct i2c_driver elan_driver =;

module_i2c_driver();

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