Re: [PATCH V3 10/10] input: touchscreen: ili210x: Add ILI251X support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/15/19 1:38 AM, Dmitry Torokhov wrote:
> On Thu, Jan 03, 2019 at 02:29:38AM +0100, Marek Vasut wrote:
>> Add support for ILI251x touch controller. This controller is similar
>> to the ILI210x, except for the following differences:
>> - Does not support I2C R-W transfer, Read must be followed by an
>>   obscenely long delay, and then followed by Write
>> - Does support 10 simultaneous touch inputs.
>> - Touch data format is slightly different, pressure reporting does not
>>   work although the touch data contain such information.
>>
>> Signed-off-by: Marek Vasut <marex@xxxxxxx>
>> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
>> Cc: Henrik Rydberg <rydberg@xxxxxxxxxxx>
>> Cc: Olivier Sobrie <olivier@xxxxxxxxx>
>> Cc: Philipp Puschmann <pp@xxxxxxxxx>
>> To: linux-input@xxxxxxxxxxxxxxx
>> ---
>> V2: - Implement delayed work for ILI251x
>>     - Fix operation with >6 fingers in ili210x_work
>> V3: - Use get_unaligned_be16()
>> ---
>>  drivers/input/touchscreen/ili210x.c | 119 ++++++++++++++++++++++++----
>>  1 file changed, 104 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
>> index bc327d75c046..7da46c293a74 100644
>> --- a/drivers/input/touchscreen/ili210x.c
>> +++ b/drivers/input/touchscreen/ili210x.c
>> @@ -6,9 +6,11 @@
>>  #include <linux/input/mt.h>
>>  #include <linux/delay.h>
>>  #include <linux/gpio/consumer.h>
>> +#include <linux/of_device.h>
>>  #include <asm/unaligned.h>
>>  
>> -#define MAX_TOUCHES		2
>> +#define ILI210X_TOUCHES		2
>> +#define ILI251X_TOUCHES		10
>>  #define DEFAULT_POLL_PERIOD	20
>>  
>>  /* Touchscreen commands */
>> @@ -32,17 +34,25 @@ struct firmware_version {
>>  	u8 minor;
>>  } __packed;
>>  
>> +enum ili2xxx_model {
>> +	MODEL_ILI210X,
>> +	MODEL_ILI251X,
>> +};
>> +
>>  struct ili210x {
>>  	struct i2c_client *client;
>>  	struct input_dev *input;
>>  	unsigned int poll_period;
>>  	struct delayed_work dwork;
>>  	struct gpio_desc *reset_gpio;
>> +	enum ili2xxx_model model;
>> +	unsigned int max_touches;
>>  };
>>  
>>  static int ili210x_read_reg(struct i2c_client *client, u8 reg, void *buf,
>>  			    size_t len)
>>  {
>> +	struct ili210x *priv = i2c_get_clientdata(client);
>>  	struct i2c_msg msg[2] = {
>>  		{
>>  			.addr	= client->addr,
>> @@ -58,7 +68,38 @@ static int ili210x_read_reg(struct i2c_client *client, u8 reg, void *buf,
>>  		}
>>  	};
>>  
>> -	if (i2c_transfer(client->adapter, msg, 2) != 2) {
>> +	if (priv->model == MODEL_ILI251X) {
>> +		if (i2c_transfer(client->adapter, msg, 1) != 1) {
>> +			dev_err(&client->dev, "i2c transfer failed\n");
>> +			return -EIO;
>> +		}
>> +
>> +		mdelay(5);
> 
> usleep_range(5000, 5500) ?

Fixed

-- 
Best regards,
Marek Vasut



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux