From: "Henrik Rydberg" <rydberg@euromail.se>
To: Daniel Kurtz <djkurtz@chromium.org>
Cc: chase.douglas@canonical.com, dmitry.torokhov@gmail.com,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
olofj@chromium.org, chris@cnpbagwell.com
Subject: Re: [PATCH 4/8 v3] Input: synaptics - add image sensor support
Date: Fri, 12 Aug 2011 23:09:12 +0200 [thread overview]
Message-ID: <20110812210911.GA9124@polaris.bitmath.org> (raw)
In-Reply-To: <1313169407-4358-5-git-send-email-djkurtz@chromium.org>
Hi Daniel,
looks good, some details below.
> +static void synaptics_report_slot_empty(struct input_dev *dev, int slot)
> +{
> + input_mt_slot(dev, slot);
> + input_mt_report_slot_state(dev, MT_TOOL_FINGER, false);
> +}
> +
> +static void synaptics_report_slot_sgm(struct input_dev *dev, int slot,
> + const struct synaptics_hw_state *sgm)
> +{
> + input_mt_slot(dev, slot);
> + input_mt_report_slot_state(dev, MT_TOOL_FINGER, true);
> + input_report_abs(dev, ABS_MT_POSITION_X, sgm->x);
> + input_report_abs(dev, ABS_MT_POSITION_Y, invert_y(sgm->y));
> + input_report_abs(dev, ABS_MT_PRESSURE, sgm->z);
> + /* SGM can sometimes contain valid width */
> + if (sgm->w >= 4)
> + input_report_abs(dev, ABS_MT_TOUCH_MAJOR, sgm->w);
> +}
The ABS_MT_TOUCH_MAJOR is supposed to have zero intercept, to remain
compatible with user space handling of type A devices. Also, the scale
should match the screen/pad size, such that the actual size of the
touch area can be deduced. In addition, based on the current sensor
technologies, ABS_MT_PRESSURE and ABS_MT_TOUCH_MAJOR are normally
mutually exclusive.
All in all, I would prefer to only report width via (the single-finger
axis) ABS_TOOL_WIDTH, and only for compatibility reasons.
> +
> +static void synaptics_report_slot_agm(struct input_dev *dev, int slot,
> + const struct synaptics_hw_state *agm)
> +{
> + input_mt_slot(dev, slot);
> + input_mt_report_slot_state(dev, MT_TOOL_FINGER, true);
> + input_report_abs(dev, ABS_MT_POSITION_X, agm->x);
> + input_report_abs(dev, ABS_MT_POSITION_Y, invert_y(agm->y));
> + input_report_abs(dev, ABS_MT_PRESSURE, agm->z);
> +}
With ABS_MT_TOUCH_MAJOR dropped, sgm and agm seems to coincide...
> +
> +static void synaptics_report_mt(struct psmouse *psmouse,
> + int count,
> + const struct synaptics_hw_state *sgm)
> +{
> + struct input_dev *dev = psmouse->dev;
> + struct synaptics_data *priv = psmouse->private;
> + struct synaptics_hw_state *agm = &priv->agm;
> +
> + switch (count) {
> + case 0:
> + synaptics_report_slot_empty(dev, 0);
> + synaptics_report_slot_empty(dev, 1);
> + break;
> + case 1:
> + synaptics_report_slot_sgm(dev, 0, sgm);
> + synaptics_report_slot_empty(dev, 1);
> + break;
> + case 2:
> + case 3: /* Fall-through case */
> + synaptics_report_slot_sgm(dev, 0, sgm);
> + synaptics_report_slot_agm(dev, 1, agm);
> + break;
> + }
> +
> + /* Don't use active slot count to generate BTN_TOOL events. */
> + input_mt_report_pointer_emulation(dev, false);
> +
> + /* Send the number of fingers reported by touchpad itself. */
> + input_mt_report_finger_count(dev, count);
> +
> + input_report_key(dev, BTN_LEFT, sgm->left);
> + input_sync(dev);
> +}
> +
> +static void synaptics_image_sensor_process(struct psmouse *psmouse,
> + struct synaptics_hw_state *sgm)
> +{
> + int count;
> +
> + if (sgm->z == 0)
> + count = 0;
> + else if (sgm->w >= 4)
> + count = 1;
> + else if (sgm->w == 0)
> + count = 2;
> + else
> + count = 3;
> +
> + /* Send resulting input events to user space */
> + synaptics_report_mt(psmouse, count, sgm);
> +}
> +
> /*
> * called for each full received packet from the touchpad
> */
> @@ -558,6 +642,11 @@ static void synaptics_process_packet(struct psmouse *psmouse)
> if (synaptics_parse_hw_state(psmouse->packet, priv, &hw))
> return;
>
> + if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
> + synaptics_image_sensor_process(psmouse, &hw);
> + return;
> + }
> +
> if (hw.scroll) {
> priv->scroll += hw.scroll;
>
> @@ -739,7 +828,16 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
> set_abs_position_params(dev, priv, ABS_X, ABS_Y);
> input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
>
> - if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
> + if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
> + input_mt_init_slots(dev, 2);
> + set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
> + ABS_MT_POSITION_Y);
> + /* Image sensors can report per-contact pressure */
> + input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
> + /* Image sensors can sometimes report per-contact width */
> + input_set_abs_params(dev, ABS_MT_TOUCH_MAJOR, 4, 15, 0, 0);
> + } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
> + /* Non-image sensors with AGM use semi-mt */
> __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
> input_mt_init_slots(dev, 2);
> set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
> diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
> index a9efbf3..0ea7616 100644
> --- a/drivers/input/mouse/synaptics.h
> +++ b/drivers/input/mouse/synaptics.h
> @@ -74,6 +74,8 @@
> * 2 0x04 reduced filtering firmware does less filtering on
> * position data, driver should watch
> * for noise.
> + * 2 0x08 image sensor image sensor tracks 5 fingers, but only
> + * reports 2.
> * 2 0x20 report min query 0x0f gives min coord reported
> */
> #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */
> @@ -82,6 +84,7 @@
> #define SYN_CAP_MIN_DIMENSIONS(ex0c) ((ex0c) & 0x002000)
> #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000)
> #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400)
> +#define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800)
>
> /* synaptics modes query bits */
> #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
> --
> 1.7.3.1
>
Looks good otherwise.
Thanks,
Henrik
next prev parent reply other threads:[~2011-08-12 21:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 17:16 [PATCH 0/8 v3] Synaptics image sensor support Daniel Kurtz
2011-08-12 17:16 ` [PATCH 1/8 v3] Input: synaptics - refactor y inversion Daniel Kurtz
2011-08-12 17:16 ` [PATCH 2/8 v3] Input: synaptics - refactor agm packet parsing Daniel Kurtz
2011-08-12 17:16 ` [PATCH 3/8 v3] Input: synaptics - refactor initialization of abs position axes Daniel Kurtz
2011-08-12 17:16 ` [PATCH 4/8 v3] Input: synaptics - add image sensor support Daniel Kurtz
2011-08-12 21:09 ` Henrik Rydberg [this message]
2011-08-15 7:17 ` Daniel Kurtz
2011-08-15 7:17 ` Daniel Kurtz
2011-08-17 14:05 ` Daniel Kurtz
2011-08-17 16:32 ` Dmitry Torokhov
2011-08-17 16:32 ` Dmitry Torokhov
2011-08-17 16:47 ` Daniel Kurtz
2011-08-17 16:47 ` Daniel Kurtz
[not found] ` <CAGS+omAR1uxS_RA=axmWzwZUgkhZEW+9W8Zk=LHPtALqA990+w@mail.gmail.com>
2011-08-17 17:34 ` Dmitry Torokhov
2011-08-12 17:16 ` [PATCH 5/8 v3] Input: synaptics - decode AGM packet types Daniel Kurtz
2011-08-12 17:16 ` [PATCH 6/8 v3] Input: synaptics - process finger (<=3) transitions Daniel Kurtz
2011-08-12 21:52 ` Henrik Rydberg
2011-08-15 7:46 ` Daniel Kurtz
2011-08-12 17:16 ` [PATCH 7/8 v3] Input: add BTN_TOOL_QUINTTAP for reporting 5 fingers on touchpad Daniel Kurtz
2011-08-12 17:16 ` [PATCH 8/8 v3] Input: synaptics - process finger (<=5) transitions Daniel Kurtz
2011-08-16 17:41 ` [PATCH 0/8 v3] Synaptics image sensor support Chase Douglas
2011-08-16 22:20 ` Chase Douglas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110812210911.GA9124@polaris.bitmath.org \
--to=rydberg@euromail.se \
--cc=chase.douglas@canonical.com \
--cc=chris@cnpbagwell.com \
--cc=djkurtz@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olofj@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.