All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tobita, Tatsunosuke" <tatsunosuke.tobita@wacom.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Ping Cheng <pinglinux@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-imx@nxp.com" <linux-imx@nxp.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-input <linux-input@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"alistair23@gmail.com" <alistair23@gmail.com>
Subject: RE: [PATCH v11 1/4] HID: wacom_sys: Add support for flipping the data values
Date: Tue, 19 Oct 2021 22:57:36 +0000	[thread overview]
Message-ID: <AM8PR07MB739659D037054A3B1EB2647087BD9@AM8PR07MB7396.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <YW4kgnI0DQHj4sw4@google.com>

Hi Dmitry,

>I am really confused about this distinction. Could you please elaborate why wacom driver only supports 0x056a (and, curiously, some Lenovo) devices.
We want 0x2d1F to work with ***ONLY*** with the generic HID driver because the every recent firmware is designed for that; no help is needed from other sides.
In contrast, the most of the devices is required help from other sides. Therefore, the devices with VID 0x2D1F devices are supposed to run alone and separated out from our brand shipped products. 
I don't know how much we can go further to tell you about this -because of our business, but 0x2D1F was obtained such purpose. Your understanding is much appreciated.

Thanks,

Tats

-----Original Message-----
From: Dmitry Torokhov <dmitry.torokhov@gmail.com> 
Sent: Tuesday, October 19, 2021 10:51 AM
To: Ping Cheng <pinglinux@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>; shawnguo@kernel.org; s.hauer@pengutronix.de; linux-imx@nxp.com; Jiri Kosina <jikos@kernel.org>; Benjamin Tissoires <benjamin.tissoires@redhat.com>; linux-input <linux-input@vger.kernel.org>; devicetree@vger.kernel.org; LKML <linux-kernel@vger.kernel.org>; linux-arm-kernel@lists.infradead.org; alistair23@gmail.com
Subject: Re: [PATCH v11 1/4] HID: wacom_sys: Add support for flipping the data values

[EXTERNAL]

Hi Ping,

On Mon, Oct 18, 2021 at 10:41:55AM -0700, Ping Cheng wrote:
> Hi Alistair,
>
> On Sat, Oct 9, 2021, 4:44 AM Alistair Francis <alistair@alistair23.me>
> wrote:
>
> > Add support to the Wacom HID device for flipping the values based on 
> > device tree settings. This allows us to support devices where the 
> > panel is installed in a different orientation, such as the reMarkable2.
> >
>
> This device was designed for hid-generic driver, if it's not driven by 
> wacom_i2c.c or an out of tree driver.
>
> wacom.ko doesn't support vid 0x2d1f devices.

I am really confused about this distinction. Could you please elaborate why wacom driver only supports 0x056a (and, curiously, some Lenovo) devices.

Thanks.


>
> Nacked-by: Ping Cheng <Ping.Cheng@wacom.com>
>
> Sorry about that,
> Ping
>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > ---
> >  .../bindings/input/hid-over-i2c.txt           | 20 ++++++
> >  drivers/hid/wacom_sys.c                       | 25 ++++++++
> >  drivers/hid/wacom_wac.c                       | 61 +++++++++++++++++++
> >  drivers/hid/wacom_wac.h                       | 13 ++++
> >  4 files changed, 119 insertions(+)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > b/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > index c76bafaf98d2..16ebd7c46049 100644
> > --- a/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > +++ b/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > @@ -33,6 +33,26 @@ device-specific compatible properties, which 
> > should be used in addition to the
> >  - post-power-on-delay-ms: time required by the device after 
> > enabling its regulators
> >    or powering it on, before it is ready for communication.
> >
> > +  flip-tilt-x:
> > +    type: boolean
> > +    description: Flip the tilt X values read from device
> > +
> > +  flip-tilt-y:
> > +    type: boolean
> > +    description: Flip the tilt Y values read from device

Do these really need to be controlled separately from the main touchcsreen orientation?

> > +
> > +  flip-pos-x:
> > +    type: boolean
> > +    description: Flip the X position values read from device
> > +
> > +  flip-pos-y:
> > +    type: boolean
> > +    description: Flip the Y position values read from device

We already have touchscreen-inverted-x/y defined in Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml,
why are they not sufficient?

> > +
> > +  flip-distance:
> > +    type: boolean
> > +    description: Flip the distance values read from device

I am still confused of the notion of flipped distance.

> > +
> >  Example:
> >
> >         i2c-hid-dev@2c {
> > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 
> > 93f49b766376..47d9590b10bd 100644
> > --- a/drivers/hid/wacom_sys.c
> > +++ b/drivers/hid/wacom_sys.c
> > @@ -10,6 +10,7 @@
> >
> >  #include "wacom_wac.h"
> >  #include "wacom.h"
> > +#include <linux/of.h>
> >  #include <linux/input/mt.h>
> >
> >  #define WAC_MSG_RETRIES                5
> > @@ -2730,6 +2731,28 @@ static void wacom_mode_change_work(struct 
> > work_struct *work)
> >         return;
> >  }
> >
> > +static void wacom_of_read(struct hid_device *hdev, struct wacom_wac
> > *wacom_wac)
> > +{
> > +       if (IS_ENABLED(CONFIG_OF)) {
> > +               wacom_wac->flip_tilt_x =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-tilt-x");
> > +               wacom_wac->flip_tilt_y =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-tilt-y");
> > +               wacom_wac->flip_pos_x =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-pos-x");
> > +               wacom_wac->flip_pos_y =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-pos-y");
> > +               wacom_wac->flip_distance =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-distance");
> > +       } else {
> > +               wacom_wac->flip_tilt_x = false;
> > +               wacom_wac->flip_tilt_y = false;
> > +               wacom_wac->flip_pos_x = false;
> > +               wacom_wac->flip_pos_y = false;
> > +               wacom_wac->flip_distance = false;
> > +       }
> > +}
> > +
> >  static int wacom_probe(struct hid_device *hdev,
> >                 const struct hid_device_id *id)  { @@ -2797,6 
> > +2820,8 @@ static int wacom_probe(struct hid_device *hdev,
> >                                  error);
> >         }
> >
> > +       wacom_of_read(hdev, wacom_wac);
> > +
> >         wacom_wac->probe_complete = true;
> >         return 0;
> >  }
> > diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 
> > 33a6908995b1..c01f683e23fa 100644
> > --- a/drivers/hid/wacom_wac.c
> > +++ b/drivers/hid/wacom_wac.c
> > @@ -3261,6 +3261,63 @@ static int wacom_status_irq(struct wacom_wac 
> > *wacom_wac, size_t len)
> >         return 0;
> >  }
> >
> > +static int wacom_of_irq(struct wacom_wac *wacom_wac, size_t len) {
> > +       const struct wacom_features *features = &wacom_wac->features;
> > +       unsigned char *data = wacom_wac->data;
> > +       struct input_dev *input = wacom_wac->pen_input;
> > +       unsigned int x, y, pressure;
> > +       unsigned char tsw, f1, f2, ers;
> > +       short tilt_x, tilt_y, distance;
> > +
> > +       if (!IS_ENABLED(CONFIG_OF))
> > +               return 0;
> > +
> > +       tsw = data[1] & WACOM_TIP_SWITCH_bm;
> > +       ers = data[1] & WACOM_ERASER_bm;
> > +       f1 = data[1] & WACOM_BARREL_SWITCH_bm;
> > +       f2 = data[1] & WACOM_BARREL_SWITCH_2_bm;
> > +       x = le16_to_cpup((__le16 *)&data[2]);
> > +       y = le16_to_cpup((__le16 *)&data[4]);
> > +       pressure = le16_to_cpup((__le16 *)&data[6]);
> > +
> > +       /* Signed */
> > +       tilt_x = get_unaligned_le16(&data[9]);
> > +       tilt_y = get_unaligned_le16(&data[11]);
> > +
> > +       distance = get_unaligned_le16(&data[13]);

You are still parsing raw data. The point of HID is to provide common framework for scaling raw values.

Thanks.

--
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: "Tobita, Tatsunosuke" <tatsunosuke.tobita@wacom.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Ping Cheng <pinglinux@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-imx@nxp.com" <linux-imx@nxp.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-input <linux-input@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"alistair23@gmail.com" <alistair23@gmail.com>
Subject: RE: [PATCH v11 1/4] HID: wacom_sys: Add support for flipping the data values
Date: Tue, 19 Oct 2021 22:57:36 +0000	[thread overview]
Message-ID: <AM8PR07MB739659D037054A3B1EB2647087BD9@AM8PR07MB7396.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <YW4kgnI0DQHj4sw4@google.com>

Hi Dmitry,

>I am really confused about this distinction. Could you please elaborate why wacom driver only supports 0x056a (and, curiously, some Lenovo) devices.
We want 0x2d1F to work with ***ONLY*** with the generic HID driver because the every recent firmware is designed for that; no help is needed from other sides.
In contrast, the most of the devices is required help from other sides. Therefore, the devices with VID 0x2D1F devices are supposed to run alone and separated out from our brand shipped products. 
I don't know how much we can go further to tell you about this -because of our business, but 0x2D1F was obtained such purpose. Your understanding is much appreciated.

Thanks,

Tats

-----Original Message-----
From: Dmitry Torokhov <dmitry.torokhov@gmail.com> 
Sent: Tuesday, October 19, 2021 10:51 AM
To: Ping Cheng <pinglinux@gmail.com>
Cc: Alistair Francis <alistair@alistair23.me>; shawnguo@kernel.org; s.hauer@pengutronix.de; linux-imx@nxp.com; Jiri Kosina <jikos@kernel.org>; Benjamin Tissoires <benjamin.tissoires@redhat.com>; linux-input <linux-input@vger.kernel.org>; devicetree@vger.kernel.org; LKML <linux-kernel@vger.kernel.org>; linux-arm-kernel@lists.infradead.org; alistair23@gmail.com
Subject: Re: [PATCH v11 1/4] HID: wacom_sys: Add support for flipping the data values

[EXTERNAL]

Hi Ping,

On Mon, Oct 18, 2021 at 10:41:55AM -0700, Ping Cheng wrote:
> Hi Alistair,
>
> On Sat, Oct 9, 2021, 4:44 AM Alistair Francis <alistair@alistair23.me>
> wrote:
>
> > Add support to the Wacom HID device for flipping the values based on 
> > device tree settings. This allows us to support devices where the 
> > panel is installed in a different orientation, such as the reMarkable2.
> >
>
> This device was designed for hid-generic driver, if it's not driven by 
> wacom_i2c.c or an out of tree driver.
>
> wacom.ko doesn't support vid 0x2d1f devices.

I am really confused about this distinction. Could you please elaborate why wacom driver only supports 0x056a (and, curiously, some Lenovo) devices.

Thanks.


>
> Nacked-by: Ping Cheng <Ping.Cheng@wacom.com>
>
> Sorry about that,
> Ping
>
> Signed-off-by: Alistair Francis <alistair@alistair23.me>
> > ---
> >  .../bindings/input/hid-over-i2c.txt           | 20 ++++++
> >  drivers/hid/wacom_sys.c                       | 25 ++++++++
> >  drivers/hid/wacom_wac.c                       | 61 +++++++++++++++++++
> >  drivers/hid/wacom_wac.h                       | 13 ++++
> >  4 files changed, 119 insertions(+)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > b/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > index c76bafaf98d2..16ebd7c46049 100644
> > --- a/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > +++ b/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > @@ -33,6 +33,26 @@ device-specific compatible properties, which 
> > should be used in addition to the
> >  - post-power-on-delay-ms: time required by the device after 
> > enabling its regulators
> >    or powering it on, before it is ready for communication.
> >
> > +  flip-tilt-x:
> > +    type: boolean
> > +    description: Flip the tilt X values read from device
> > +
> > +  flip-tilt-y:
> > +    type: boolean
> > +    description: Flip the tilt Y values read from device

Do these really need to be controlled separately from the main touchcsreen orientation?

> > +
> > +  flip-pos-x:
> > +    type: boolean
> > +    description: Flip the X position values read from device
> > +
> > +  flip-pos-y:
> > +    type: boolean
> > +    description: Flip the Y position values read from device

We already have touchscreen-inverted-x/y defined in Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml,
why are they not sufficient?

> > +
> > +  flip-distance:
> > +    type: boolean
> > +    description: Flip the distance values read from device

I am still confused of the notion of flipped distance.

> > +
> >  Example:
> >
> >         i2c-hid-dev@2c {
> > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 
> > 93f49b766376..47d9590b10bd 100644
> > --- a/drivers/hid/wacom_sys.c
> > +++ b/drivers/hid/wacom_sys.c
> > @@ -10,6 +10,7 @@
> >
> >  #include "wacom_wac.h"
> >  #include "wacom.h"
> > +#include <linux/of.h>
> >  #include <linux/input/mt.h>
> >
> >  #define WAC_MSG_RETRIES                5
> > @@ -2730,6 +2731,28 @@ static void wacom_mode_change_work(struct 
> > work_struct *work)
> >         return;
> >  }
> >
> > +static void wacom_of_read(struct hid_device *hdev, struct wacom_wac
> > *wacom_wac)
> > +{
> > +       if (IS_ENABLED(CONFIG_OF)) {
> > +               wacom_wac->flip_tilt_x =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-tilt-x");
> > +               wacom_wac->flip_tilt_y =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-tilt-y");
> > +               wacom_wac->flip_pos_x =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-pos-x");
> > +               wacom_wac->flip_pos_y =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-pos-y");
> > +               wacom_wac->flip_distance =
> > of_property_read_bool(hdev->dev.parent->of_node,
> > +                                                       "flip-distance");
> > +       } else {
> > +               wacom_wac->flip_tilt_x = false;
> > +               wacom_wac->flip_tilt_y = false;
> > +               wacom_wac->flip_pos_x = false;
> > +               wacom_wac->flip_pos_y = false;
> > +               wacom_wac->flip_distance = false;
> > +       }
> > +}
> > +
> >  static int wacom_probe(struct hid_device *hdev,
> >                 const struct hid_device_id *id)  { @@ -2797,6 
> > +2820,8 @@ static int wacom_probe(struct hid_device *hdev,
> >                                  error);
> >         }
> >
> > +       wacom_of_read(hdev, wacom_wac);
> > +
> >         wacom_wac->probe_complete = true;
> >         return 0;
> >  }
> > diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 
> > 33a6908995b1..c01f683e23fa 100644
> > --- a/drivers/hid/wacom_wac.c
> > +++ b/drivers/hid/wacom_wac.c
> > @@ -3261,6 +3261,63 @@ static int wacom_status_irq(struct wacom_wac 
> > *wacom_wac, size_t len)
> >         return 0;
> >  }
> >
> > +static int wacom_of_irq(struct wacom_wac *wacom_wac, size_t len) {
> > +       const struct wacom_features *features = &wacom_wac->features;
> > +       unsigned char *data = wacom_wac->data;
> > +       struct input_dev *input = wacom_wac->pen_input;
> > +       unsigned int x, y, pressure;
> > +       unsigned char tsw, f1, f2, ers;
> > +       short tilt_x, tilt_y, distance;
> > +
> > +       if (!IS_ENABLED(CONFIG_OF))
> > +               return 0;
> > +
> > +       tsw = data[1] & WACOM_TIP_SWITCH_bm;
> > +       ers = data[1] & WACOM_ERASER_bm;
> > +       f1 = data[1] & WACOM_BARREL_SWITCH_bm;
> > +       f2 = data[1] & WACOM_BARREL_SWITCH_2_bm;
> > +       x = le16_to_cpup((__le16 *)&data[2]);
> > +       y = le16_to_cpup((__le16 *)&data[4]);
> > +       pressure = le16_to_cpup((__le16 *)&data[6]);
> > +
> > +       /* Signed */
> > +       tilt_x = get_unaligned_le16(&data[9]);
> > +       tilt_y = get_unaligned_le16(&data[11]);
> > +
> > +       distance = get_unaligned_le16(&data[13]);

You are still parsing raw data. The point of HID is to provide common framework for scaling raw values.

Thanks.

--
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-10-19 22:57 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-09 11:43 [PATCH v11 1/4] HID: wacom_sys: Add support for flipping the data values Alistair Francis
2021-10-09 11:43 ` Alistair Francis
2021-10-09 11:43 ` [PATCH v11 2/4] HID: wacom: Add support for the AG14 Wacom device Alistair Francis
2021-10-09 11:43   ` Alistair Francis
2021-10-09 13:41   ` kernel test robot
2021-10-09 13:41     ` kernel test robot
2021-10-09 13:41     ` kernel test robot
2021-10-09 14:32   ` kernel test robot
2021-10-09 14:32     ` kernel test robot
2021-10-09 14:32     ` kernel test robot
2021-10-09 11:43 ` [PATCH v11 3/4] ARM: imx_v6_v7_defconfig: Enable HID I2C Alistair Francis
2021-10-09 11:43   ` Alistair Francis
2021-10-15  2:50   ` Shawn Guo
2021-10-15  2:50     ` Shawn Guo
2021-10-09 11:43 ` [PATCH v11 4/4] ARM: dts: imx7d: remarkable2: add wacom digitizer device Alistair Francis
2021-10-09 11:43   ` Alistair Francis
2021-10-10  8:24   ` kernel test robot
2021-10-10  8:24     ` kernel test robot
2021-10-10  8:24     ` kernel test robot
2021-10-16 14:34 ` [PATCH v11 1/4] HID: wacom_sys: Add support for flipping the data values Rob Herring
2021-10-16 14:34   ` Rob Herring
     [not found] ` <CAF8JNh+OUzvAHA9tBrH2d_WxWPXRgiunhGO5KV4-fqVG+tUOyQ@mail.gmail.com>
2021-10-18 21:54   ` Alistair Francis
2021-10-18 21:54     ` Alistair Francis
2021-10-19  1:50   ` Dmitry Torokhov
2021-10-19  1:50     ` Dmitry Torokhov
2021-10-19 22:57     ` Tobita, Tatsunosuke [this message]
2021-10-19 22:57       ` Tobita, Tatsunosuke
2021-10-19 23:33     ` Alistair Francis
2021-10-19 23:33       ` Alistair Francis
2021-10-20  1:05       ` Dmitry Torokhov
2021-10-20  1:05         ` Dmitry Torokhov
2021-10-20  1:44         ` Alistair Francis
2021-10-20  1:44           ` Alistair Francis
2021-10-20  2:14           ` Dmitry Torokhov
2021-10-20  2:14             ` Dmitry Torokhov
2021-10-20  7:40             ` Benjamin Tissoires
2021-10-20  7:40               ` Benjamin Tissoires
2021-10-20 11:34               ` Alistair Francis
2021-10-20 11:34                 ` Alistair Francis
2021-10-20 12:04                 ` Benjamin Tissoires
2021-10-20 12:04                   ` Benjamin Tissoires
2021-10-21  9:27                   ` Alistair Francis
2021-10-21  9:27                     ` Alistair Francis
2021-10-20 11:28             ` Alistair Francis
2021-10-20 11:28               ` Alistair Francis
2021-10-20 11:46               ` Benjamin Tissoires
2021-10-20 11:46                 ` Benjamin Tissoires

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=AM8PR07MB739659D037054A3B1EB2647087BD9@AM8PR07MB7396.eurprd07.prod.outlook.com \
    --to=tatsunosuke.tobita@wacom.com \
    --cc=alistair23@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=benjamin.tissoires@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pinglinux@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.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.