From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D11A3C433EF for ; Tue, 19 Oct 2021 01:52:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F5A161057 for ; Tue, 19 Oct 2021 01:52:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8F5A161057 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BpEiIV9UBbRLs1lgI3r7mGX/s3R5AVcUGaXNGhtVJW4=; b=emMAz42YuxQ+EQ qXlmvOlQ/9QKu4Lf6QzjJ6+L7PGNfGZAyLiYpsDSeWrOr8Cq4q38IPPUbOVeQVLRpIAHtLIpRVn+k dBYbunKirH4VgcRdbsWfz7rbRo7e7IiI2Gt7s6rsKn9TmpVeeNVUg+Z/d+ABKq7tHpkLN7ntsTZcP xmNW6L9Ux7ZtqmP8z10cJi0xLQ9kGUFKJHytWGrXpaRgLh3QHQYQbKsTzAMK/vCAwUG/JVHTfS/q9 Z5LuRfhneD28qXIY3iqmVFTkmlt44BiMnnfV7JWVKx8LBufDsLFcBV1iu6j2T0IeNk75cKbUnuYd8 XwJk9sY5sNwGul94xAOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mceHW-00HXv6-P8; Tue, 19 Oct 2021 01:51:10 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mceHQ-00HXuR-0k for linux-arm-kernel@lists.infradead.org; Tue, 19 Oct 2021 01:51:08 +0000 Received: by mail-pf1-x434.google.com with SMTP id f11so12349787pfc.12 for ; Mon, 18 Oct 2021 18:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=W6zebBp3/cNSIFBEzhNaSJIA/kpiHyPX3FngvMDuHxo=; b=mxEzbJsEej7alf/c7Rqg6s6T4WIWccI+DcmnvVUDAph6F6Y5FvoP4siIha8GB8kWVx zdZazAOrr/Tzstf32iVCiAv9w0XbESc9RwbBn2Pn4Xv63ogmHKK5qsSNoPHybu3B7i5/ GuABv+6FU7h4ihXMcsnvMaofKdtMtL/asG4x3k657hQlkg+ASiTRlCMZZQaygQCJoJID 5tVoUgLW3A0uA7ZD3htTvu5uKSooT5XFUi6artYk7YOqXDRsC6QHd3+sa4W+/B0kBn+y d6FeaqYphYrTcaAFwolbrYtP+upPc5zEKG7X+ljaUno/eH/zAD1N6J0LjLdkRG+u14Du WOzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=W6zebBp3/cNSIFBEzhNaSJIA/kpiHyPX3FngvMDuHxo=; b=h1afkfTejIaTXGTUWPvltmNemBUH0TPieN9koZE3gJvlwRkdrHlAfr6Desp6jGdTN7 B4apT4S6XI0MeLlrbi/deFhdCDdEBxau0fDAibDql7yWYL70Ns0VfkEqCBCsBB5czfRu 0ipjG7UNYxhqXTm4muRDzYY3C1Fh7cJnjgZp+aCSwHwNmuhWXsXqXHiT20r2dh/zWy2P bHfqvgy//U8wOwyDEcTL/8oXY77W0NpUaD80MieVyo3LLp283145faQOI7U92LxLCKVN i+F09eTJGiQ8sO2HC2Ziym1uqsCnXS64ycYGYfcRYyoXMq4dLNHsG8KQgkSJVbGN7v7/ bZwg== X-Gm-Message-State: AOAM533ECHOgeqJRoZZ5JgnvlOTzWerx0UyDlDvh65t1cCT6BpnjCr3f lWMZTjgAHy/A0FPTrkXfFGc= X-Google-Smtp-Source: ABdhPJxePafQXN6g/Am43IBKiWrAhRILmosNqIluLBb3Iskbn1+O/XcM76lOoVlEMOYgtNbf/vj9uQ== X-Received: by 2002:a05:6a00:8c4:b0:44c:9827:16cc with SMTP id s4-20020a056a0008c400b0044c982716ccmr31991830pfu.7.1634608262345; Mon, 18 Oct 2021 18:51:02 -0700 (PDT) Received: from google.com ([2620:15c:202:201:54f8:9d9:1fa7:9eae]) by smtp.gmail.com with ESMTPSA id y142sm14301966pfc.169.2021.10.18.18.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 18:51:01 -0700 (PDT) Date: Mon, 18 Oct 2021 18:50:58 -0700 From: Dmitry Torokhov To: Ping Cheng Cc: Alistair Francis , shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, Jiri Kosina , Benjamin Tissoires , linux-input , devicetree@vger.kernel.org, LKML , 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 Message-ID: References: <20211009114313.17967-1-alistair@alistair23.me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211018_185104_115504_857B8EEC X-CRM114-Status: GOOD ( 35.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > 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 > > Sorry about that, > Ping > > Signed-off-by: Alistair Francis > > --- > > .../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 > > #include > > > > #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