Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Driver for MAXI MAX11801 - A Resistive touch screen controller with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * i2c interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 2011 Freescale Semiconductor, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Author: Zhang Jiejing <jiejing.zhang@freescale.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Based on mcs5000_ts.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * This driver aims to support the series of MAXI touch chips max11801
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * through max11803. The main difference between these 4 chips can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * found in the table below:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * -----------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * | CHIP     |  AUTO MODE SUPPORT(FIFO) | INTERFACE    |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * |----------------------------------------------------|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * | max11800 |  YES                     |   SPI        |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * | max11801 |  YES                     |   I2C        |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * | max11802 |  NO                      |   SPI        |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * | max11803 |  NO                      |   I2C        |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * ------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * Currently, this driver only supports max11801.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * Data Sheet:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * http://www.maxim-ic.com/datasheet/index.mvp/id/5943
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include <linux/bitops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /* Register Address define */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define GENERNAL_STATUS_REG		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define GENERNAL_CONF_REG		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define MESURE_RES_CONF_REG		0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define MESURE_AVER_CONF_REG		0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define ADC_SAMPLE_TIME_CONF_REG	0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define PANEL_SETUPTIME_CONF_REG	0x05
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define DELAY_CONVERSION_CONF_REG	0x06
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define TOUCH_DETECT_PULLUP_CONF_REG	0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define AUTO_MODE_TIME_CONF_REG		0x08 /* only for max11800/max11801 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define APERTURE_CONF_REG		0x09 /* only for max11800/max11801 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define AUX_MESURE_CONF_REG		0x0a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define OP_MODE_CONF_REG		0x0b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) /* FIFO is found only in max11800 and max11801 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define FIFO_RD_CMD			(0x50 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define MAX11801_FIFO_INT		(1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define MAX11801_FIFO_OVERFLOW		(1 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define XY_BUFSIZE			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define XY_BUF_OFFSET			4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define MAX11801_MAX_X			0xfff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define MAX11801_MAX_Y			0xfff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define MEASURE_TAG_OFFSET		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define MEASURE_TAG_MASK		(3 << MEASURE_TAG_OFFSET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define EVENT_TAG_OFFSET		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define EVENT_TAG_MASK			(3 << EVENT_TAG_OFFSET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define MEASURE_X_TAG			(0 << MEASURE_TAG_OFFSET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define MEASURE_Y_TAG			(1 << MEASURE_TAG_OFFSET)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) /* These are the state of touch event state machine */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	EVENT_INIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	EVENT_MIDDLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	EVENT_RELEASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	EVENT_FIFO_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) struct max11801_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct i2c_client		*client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct input_dev		*input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) static u8 read_register(struct i2c_client *client, int addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	/* XXX: The chip ignores LSB of register address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	return i2c_smbus_read_byte_data(client, addr << 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static int max11801_write_reg(struct i2c_client *client, int addr, int data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	/* XXX: The chip ignores LSB of register address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	return i2c_smbus_write_byte_data(client, addr << 1, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) static irqreturn_t max11801_ts_interrupt(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	struct max11801_data *data = dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	struct i2c_client *client = data->client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	int status, i, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	u8 buf[XY_BUFSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	int x = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	int y = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	status = read_register(data->client, GENERNAL_STATUS_REG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	if (status & (MAX11801_FIFO_INT | MAX11801_FIFO_OVERFLOW)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		status = read_register(data->client, GENERNAL_STATUS_REG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		ret = i2c_smbus_read_i2c_block_data(client, FIFO_RD_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 						    XY_BUFSIZE, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		 * We should get 4 bytes buffer that contains X,Y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		 * and event tag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		if (ret < XY_BUFSIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		for (i = 0; i < XY_BUFSIZE; i += XY_BUFSIZE / 2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			if ((buf[i + 1] & MEASURE_TAG_MASK) == MEASURE_X_TAG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 				x = (buf[i] << XY_BUF_OFFSET) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 				    (buf[i + 1] >> XY_BUF_OFFSET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			else if ((buf[i + 1] & MEASURE_TAG_MASK) == MEASURE_Y_TAG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 				y = (buf[i] << XY_BUF_OFFSET) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 				    (buf[i + 1] >> XY_BUF_OFFSET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		if ((buf[1] & EVENT_TAG_MASK) != (buf[3] & EVENT_TAG_MASK))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		switch (buf[1] & EVENT_TAG_MASK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		case EVENT_INIT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		case EVENT_MIDDLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			input_report_abs(data->input_dev, ABS_X, x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			input_report_abs(data->input_dev, ABS_Y, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			input_event(data->input_dev, EV_KEY, BTN_TOUCH, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			input_sync(data->input_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		case EVENT_RELEASE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			input_event(data->input_dev, EV_KEY, BTN_TOUCH, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			input_sync(data->input_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		case EVENT_FIFO_END:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static void max11801_ts_phy_init(struct max11801_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct i2c_client *client = data->client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	/* Average X,Y, take 16 samples, average eight media sample */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	max11801_write_reg(client, MESURE_AVER_CONF_REG, 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	/* X,Y panel setup time set to 20us */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	max11801_write_reg(client, PANEL_SETUPTIME_CONF_REG, 0x11);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	/* Rough pullup time (2uS), Fine pullup time (10us)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	max11801_write_reg(client, TOUCH_DETECT_PULLUP_CONF_REG, 0x10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	/* Auto mode init period = 5ms , scan period = 5ms*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	max11801_write_reg(client, AUTO_MODE_TIME_CONF_REG, 0xaa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	/* Aperture X,Y set to +- 4LSB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	max11801_write_reg(client, APERTURE_CONF_REG, 0x33);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	/* Enable Power, enable Automode, enable Aperture, enable Average X,Y */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	max11801_write_reg(client, OP_MODE_CONF_REG, 0x36);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static int max11801_ts_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 				       const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct max11801_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	struct input_dev *input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	input_dev = devm_input_allocate_device(&client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	if (!data || !input_dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		dev_err(&client->dev, "Failed to allocate memory\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	data->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	data->input_dev = input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	input_dev->name = "max11801_ts";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	input_dev->id.bustype = BUS_I2C;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	input_dev->dev.parent = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	__set_bit(EV_ABS, input_dev->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	__set_bit(EV_KEY, input_dev->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	__set_bit(BTN_TOUCH, input_dev->keybit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	input_set_abs_params(input_dev, ABS_X, 0, MAX11801_MAX_X, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	input_set_abs_params(input_dev, ABS_Y, 0, MAX11801_MAX_Y, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	max11801_ts_phy_init(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 					  max11801_ts_interrupt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 					  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 					  "max11801_ts", data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	if (error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		dev_err(&client->dev, "Failed to register interrupt\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	error = input_register_device(data->input_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static const struct i2c_device_id max11801_ts_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	{"max11801", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) MODULE_DEVICE_TABLE(i2c, max11801_ts_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static const struct of_device_id max11801_ts_dt_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	{ .compatible = "maxim,max11801" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	{ /* sentinel */ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) MODULE_DEVICE_TABLE(of, max11801_ts_dt_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static struct i2c_driver max11801_ts_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		.name	= "max11801_ts",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		.of_match_table = max11801_ts_dt_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	.id_table	= max11801_ts_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	.probe		= max11801_ts_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) module_i2c_driver(max11801_ts_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) MODULE_AUTHOR("Zhang Jiejing <jiejing.zhang@freescale.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) MODULE_DESCRIPTION("Touchscreen driver for MAXI MAX11801 controller");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) MODULE_LICENSE("GPL");