linux/drivers/input/mouse/elan_i2c_i2c.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Elan I2C/SMBus Touchpad driver - I2C interface
 *
 * Copyright (c) 2013 ELAN Microelectronics Corp.
 *
 * Author: 林政維 (Duson Lin) <[email protected]>
 *
 * 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/completion.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/unaligned.h>

#include "elan_i2c.h"

/* Elan i2c commands */
#define ETP_I2C_RESET
#define ETP_I2C_WAKE_UP
#define ETP_I2C_SLEEP
#define ETP_I2C_DESC_CMD
#define ETP_I2C_REPORT_DESC_CMD
#define ETP_I2C_STAND_CMD
#define ETP_I2C_PATTERN_CMD
#define ETP_I2C_UNIQUEID_CMD
#define ETP_I2C_FW_VERSION_CMD
#define ETP_I2C_IC_TYPE_CMD
#define ETP_I2C_OSM_VERSION_CMD
#define ETP_I2C_NSM_VERSION_CMD
#define ETP_I2C_XY_TRACENUM_CMD
#define ETP_I2C_MAX_X_AXIS_CMD
#define ETP_I2C_MAX_Y_AXIS_CMD
#define ETP_I2C_RESOLUTION_CMD
#define ETP_I2C_PRESSURE_CMD
#define ETP_I2C_IAP_VERSION_CMD
#define ETP_I2C_IC_TYPE_P0_CMD
#define ETP_I2C_IAP_VERSION_P0_CMD
#define ETP_I2C_SET_CMD
#define ETP_I2C_POWER_CMD
#define ETP_I2C_FW_CHECKSUM_CMD
#define ETP_I2C_IAP_CTRL_CMD
#define ETP_I2C_IAP_CMD
#define ETP_I2C_IAP_RESET_CMD
#define ETP_I2C_IAP_CHECKSUM_CMD
#define ETP_I2C_CALIBRATE_CMD
#define ETP_I2C_MAX_BASELINE_CMD
#define ETP_I2C_MIN_BASELINE_CMD
#define ETP_I2C_IAP_TYPE_REG
#define ETP_I2C_IAP_TYPE_CMD

#define ETP_I2C_REPORT_LEN
#define ETP_I2C_REPORT_LEN_ID2
#define ETP_I2C_REPORT_MAX_LEN
#define ETP_I2C_DESC_LENGTH
#define ETP_I2C_REPORT_DESC_LENGTH
#define ETP_I2C_INF_LENGTH
#define ETP_I2C_IAP_PASSWORD
#define ETP_I2C_IAP_RESET
#define ETP_I2C_MAIN_MODE_ON
#define ETP_I2C_IAP_REG_L
#define ETP_I2C_IAP_REG_H

static int elan_i2c_read_block(struct i2c_client *client,
			       u16 reg, u8 *val, u16 len)
{}

static int elan_i2c_read_cmd(struct i2c_client *client, u16 reg, u8 *val)
{}

static int elan_i2c_write_cmd(struct i2c_client *client, u16 reg, u16 cmd)
{}

static int elan_i2c_initialize(struct i2c_client *client)
{}

static int elan_i2c_sleep_control(struct i2c_client *client, bool sleep)
{}

static int elan_i2c_power_control(struct i2c_client *client, bool enable)
{}

static int elan_i2c_set_mode(struct i2c_client *client, u8 mode)
{}


static int elan_i2c_calibrate(struct i2c_client *client)
{}

static int elan_i2c_calibrate_result(struct i2c_client *client, u8 *val)
{}

static int elan_i2c_get_baseline_data(struct i2c_client *client,
				      bool max_baseline, u8 *value)
{}

static int elan_i2c_get_pattern(struct i2c_client *client, u8 *pattern)
{}

static int elan_i2c_get_version(struct i2c_client *client,
				u8 pattern, bool iap, u8 *version)
{}

static int elan_i2c_get_sm_version(struct i2c_client *client, u8 pattern,
				   u16 *ic_type, u8 *version, u8 *clickpad)
{}

static int elan_i2c_get_product_id(struct i2c_client *client, u16 *id)
{}

static int elan_i2c_get_checksum(struct i2c_client *client,
				 bool iap, u16 *csum)
{}

static int elan_i2c_get_max(struct i2c_client *client,
			    unsigned int *max_x, unsigned int *max_y)
{}

static int elan_i2c_get_resolution(struct i2c_client *client,
				   u8 *hw_res_x, u8 *hw_res_y)
{}

static int elan_i2c_get_num_traces(struct i2c_client *client,
				   unsigned int *x_traces,
				   unsigned int *y_traces)
{}

static int elan_i2c_get_pressure_adjustment(struct i2c_client *client,
					    int *adjustment)
{}

static int elan_i2c_iap_get_mode(struct i2c_client *client, enum tp_mode *mode)
{}

static int elan_i2c_iap_reset(struct i2c_client *client)
{}

static int elan_i2c_set_flash_key(struct i2c_client *client)
{}

static int elan_read_write_iap_type(struct i2c_client *client, u16 fw_page_size)
{}

static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type,
				      u8 iap_version, u16 fw_page_size)
{}

static int elan_i2c_write_fw_block(struct i2c_client *client, u16 fw_page_size,
				   const u8 *page, u16 checksum, int idx)
{}

static int elan_i2c_finish_fw_update(struct i2c_client *client,
				     struct completion *completion)
{}

static int elan_i2c_get_report_features(struct i2c_client *client, u8 pattern,
					unsigned int *features,
					unsigned int *report_len)
{}

static int elan_i2c_get_report(struct i2c_client *client,
			       u8 *report, unsigned int report_len)
{}

const struct elan_transport_ops elan_i2c_ops =;