Thread (16 messages) 16 messages, 3 authors, 2010-11-18

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

From: Chris Leech <hidden>
Date: 2010-11-18 19:41:13

On Thu, Nov 18, 2010 at 10:09:35PM +0900, Joonyoung Shim wrote:
Hi, Chris.
On 2010-11-17 오전 5:42, Chris Leech wrote:
quoted
+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?
quoted
+	/*
+	 * 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help