Re: [PATCH 3/5] qt602240_ts: Trust factory configuration of touchscreen.

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

 



On Thu, Nov 18, 2010 at 10:09:35PM +0900, Joonyoung Shim wrote:
> Hi, Chris.
> On 2010-11-17 ìì 5:42, Chris Leech wrote:

>> +static void qt602240_read_config(struct qt602240_data *data)
>> +{
>> +	struct qt602240_platform_data *pdata = data->pdata;
>> +	u8 val;
>> +	u8 high, low;
>> +
>> +	/* touchscreen lines */
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_XSIZE,
>> +			&val);
>> +		pdata->x_line = val;
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_YSIZE,
>> +			&val);
>> +		pdata->x_line = val;
>> +
>> +	/* touchscreen orient */
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_ORIENT,
>> +			&val);
>> +		pdata->orient = val;
>> +
>> +	/* touchscreen burst length */
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_BLEN,
>> +			&val);
>> +		pdata->blen = val;
>> +
>> +	/* touchscreen threshold */
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI, QT602240_TOUCH_TCHTHR,
>> +			&val);
>> +		pdata->threshold = val;
>> +
>> +	/* touchscreen resolution */
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI,
>> +			QT602240_TOUCH_XRANGE_LSB,&low);
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI,
>> +			QT602240_TOUCH_XRANGE_MSB,&high);
>> +	pdata->x_size = (high<<  8) | (low + 1);
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI,
>> +			QT602240_TOUCH_YRANGE_LSB,&low);
>> +	qt602240_read_object(data, QT602240_TOUCH_MULTI,
>> +			QT602240_TOUCH_YRANGE_MSB,&high);
>> +	pdata->y_size = (high<<  8) | (low + 1);
>> +}
>> +
>
> Please don't modify pdata, the pdata means platform specific data from
> machine file. The pdata of struct qt602240_data be used only in
> qt602240_initialize function when driver is probed, so we need to
> remove pdata from struct qt602240_data.

OK. If I add the relevant fields to qt602240_data, and either copy over
from pdata or read from the hardware configuration based on trust_nvm,
does that approach seem acceptable to you?

>> +	/*
>> +	 * Bit 0 of TOUCH_ORIENT is the X/Y swap configuration.
>> +	 * If the axises are swapped the reporting will change, and in order to
>> +	 * get the scaling correct we need to swap the maximum range values
>> +	 * reported to the input layer.
>> +	 */
>> +	if (data->pdata->orient&  1) {
>> +		x_size = data->pdata->y_size;
>> +		y_size = data->pdata->x_size;
>> +	} else {
>> +		x_size = data->pdata->x_size;
>> +		y_size = data->pdata->y_size;
>> +	}
>> +
>> +	/* For single touch */
>> +	input_set_abs_params(input_dev, ABS_X, 0, x_size, 0, 0);
>> +	input_set_abs_params(input_dev, ABS_Y, 0, y_size, 0, 0);
>> +
>> +	/* For multi touch */
>> +	input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0,
>> +			QT602240_MAX_AREA, 0, 0);
>> +	input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, x_size, 0, 0);
>> +	input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, y_size, 0, 0);
>> +
>
> I'm not sure but i know this max is maximum value to be supported by
> touch chip.

I think the maxtouch scales it's output based on the TOUCH_XRANGE and
TOUCH_YRANGE configuration, so there should be the maximum values that
will ever be reported.

I can test this again, but if these values are wrong I get messed up
scaling when they events are translated to windowing coordinates.

- Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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