Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3677326pxb; Mon, 24 Jan 2022 15:07:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKGWswEJDX3FPf6mHO17gjIoix52iaO3dh/sMdPJJZ4DdW6z7b91QeGMovMJJPP0lmKJm8 X-Received: by 2002:a17:902:dac1:b0:14b:76e6:e24e with SMTP id q1-20020a170902dac100b0014b76e6e24emr183948plx.74.1643065632704; Mon, 24 Jan 2022 15:07:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065632; cv=none; d=google.com; s=arc-20160816; b=XLQp7DQYYtj2jugQL31lvrD50DmJrGHh+rwZUPJYrUed587e5Ilj1lZUwno49dGkNE YYEPdm5r979/oxg59Z58OyJo9pLlFI8DpfCF4fdvjySg7tskn/ZLQr4XlJ36arRfAKFx VtQwsk/rMlItZYlGGORNeCtvIN6Vks4koTOIj1qc9sAuFQ78mARVZFNSBD8pRWxOoa2K gq89yS4HpQ56My2HrmSa2yWE7kbV5HhRx5h4gruTch7rEGQ47DI+w3ObK9CKTZ7zRM1Z Sv7jm1m91OVideqqCvo5SluMHwNwJx1z03L2uIRYJiWankLh58zWHeeMu2m3CmiAWXGX doQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cxIsT4xAvGzhZnFanVxsB4+BI5nSva0kCU0suayrNyM=; b=eWj02+hzrDUM9CAFCbubZLvXCG5bzrAFj+ZS3emH7yuz2dOrT+8Pmv76XwPhhJtvjd qsgAStve6VY2+QBJwdxb+wx6nuja/kU3Yj3yx2GiT1EuWtSWj1inLzWwASjC/n0nQAxW 6hJ5Hmunoj9xpTuBKsLZFYPc6Hztt6CXUGx2k65QqqxJXM2tbZMctODFNE7/PtJjIZFU 7uEPg7QRIWVgp+qceG2xfdrU3Th1r30Sej6FrzWIhMIjBXGUbu6VOIRbtvCxYWCb8853 MMgQoiT4i24kPOXmTzx8iFUAaLpPKts99/DFTlxPVjo7oslPlOx7o9rI7y8Li/itFbhV iWSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sqvJ0j4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si564887pfv.132.2022.01.24.15.06.31; Mon, 24 Jan 2022 15:07:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sqvJ0j4J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1843304AbiAXXDp (ORCPT + 99 others); Mon, 24 Jan 2022 18:03:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1458136AbiAXVzI (ORCPT ); Mon, 24 Jan 2022 16:55:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1014FC07E2A9; Mon, 24 Jan 2022 12:37:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C2981B80FA3; Mon, 24 Jan 2022 20:37:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1835CC340E5; Mon, 24 Jan 2022 20:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056637; bh=liI5oHo+hy1bS9c8mmeSTwJK7B/DrVx+fsHTX63n/SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sqvJ0j4JvbDVEsdihX1lYt+qPBjPhpFeQUa1MGnKYSPhQfmXPm9PeZ9MEgo/4BGd+ crXzGGO/E6Be6qnkA2FSrb0WzvBhpONmN66hDGR8p2J0288GZ5pIqrNrWr2wqIQsj8 ia36E/5sbwmRnDt6489l2gO3Dgc79gWA0F315tdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Francis , Rob Herring , Benjamin Tissoires , Sasha Levin Subject: [PATCH 5.15 551/846] HID: i2c-hid-of: Expose the touchscreen-inverted properties Date: Mon, 24 Jan 2022 19:41:08 +0100 Message-Id: <20220124184120.040406055@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alistair Francis [ Upstream commit b60d3c803d7603432a08aeaf988aff53b3a5ec64 ] Allow the touchscreen-inverted-x/y device tree properties to control the HID_QUIRK_X_INVERT/HID_QUIRK_Y_INVERT quirks for the hid-input device. Signed-off-by: Alistair Francis Acked-by: Rob Herring [bentiss: silence checkpatch warnings] Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20211208124045.61815-3-alistair@alistair23.me Signed-off-by: Sasha Levin --- .../devicetree/bindings/input/hid-over-i2c.txt | 2 ++ drivers/hid/i2c-hid/i2c-hid-acpi.c | 2 +- drivers/hid/i2c-hid/i2c-hid-core.c | 4 +++- drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 2 +- drivers/hid/i2c-hid/i2c-hid-of.c | 10 +++++++++- drivers/hid/i2c-hid/i2c-hid.h | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/input/hid-over-i2c.txt b/Documentation/devicetree/bindings/input/hid-over-i2c.txt index c76bafaf98d2f..34c43d3bddfd1 100644 --- a/Documentation/devicetree/bindings/input/hid-over-i2c.txt +++ b/Documentation/devicetree/bindings/input/hid-over-i2c.txt @@ -32,6 +32,8 @@ device-specific compatible properties, which should be used in addition to the - vdd-supply: phandle of the regulator that provides the supply voltage. - post-power-on-delay-ms: time required by the device after enabling its regulators or powering it on, before it is ready for communication. +- touchscreen-inverted-x: See touchscreen.txt +- touchscreen-inverted-y: See touchscreen.txt Example: diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-hid-acpi.c index a6f0257a26de3..b96ae15e0ad91 100644 --- a/drivers/hid/i2c-hid/i2c-hid-acpi.c +++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c @@ -111,7 +111,7 @@ static int i2c_hid_acpi_probe(struct i2c_client *client) } return i2c_hid_core_probe(client, &ihid_acpi->ops, - hid_descriptor_address); + hid_descriptor_address, 0); } static const struct acpi_device_id i2c_hid_acpi_match[] = { diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 517141138b007..4804d71e5293a 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -912,7 +912,7 @@ static void i2c_hid_core_shutdown_tail(struct i2c_hid *ihid) } int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, - u16 hid_descriptor_address) + u16 hid_descriptor_address, u32 quirks) { int ret; struct i2c_hid *ihid; @@ -1009,6 +1009,8 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, goto err_mem_free; } + hid->quirks |= quirks; + return 0; err_mem_free: diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c index 52674149a2750..b4dad66fa954d 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c +++ b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c @@ -150,7 +150,7 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client, goodix_i2c_hid_deassert_reset(ihid_goodix, true); mutex_unlock(&ihid_goodix->regulator_mutex); - return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001); + return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0); } static const struct goodix_i2c_hid_timing_data goodix_gt7375p_timing_data = { diff --git a/drivers/hid/i2c-hid/i2c-hid-of.c b/drivers/hid/i2c-hid/i2c-hid-of.c index 4bf7cea926379..97a27a803f58d 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of.c +++ b/drivers/hid/i2c-hid/i2c-hid-of.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -71,6 +72,7 @@ static int i2c_hid_of_probe(struct i2c_client *client, struct device *dev = &client->dev; struct i2c_hid_of *ihid_of; u16 hid_descriptor_address; + u32 quirks = 0; int ret; u32 val; @@ -105,8 +107,14 @@ static int i2c_hid_of_probe(struct i2c_client *client, if (ret) return ret; + if (device_property_read_bool(dev, "touchscreen-inverted-x")) + quirks |= HID_QUIRK_X_INVERT; + + if (device_property_read_bool(dev, "touchscreen-inverted-y")) + quirks |= HID_QUIRK_Y_INVERT; + return i2c_hid_core_probe(client, &ihid_of->ops, - hid_descriptor_address); + hid_descriptor_address, quirks); } static const struct of_device_id i2c_hid_of_match[] = { diff --git a/drivers/hid/i2c-hid/i2c-hid.h b/drivers/hid/i2c-hid/i2c-hid.h index 05a7827d211af..236cc062d5ef8 100644 --- a/drivers/hid/i2c-hid/i2c-hid.h +++ b/drivers/hid/i2c-hid/i2c-hid.h @@ -32,7 +32,7 @@ struct i2chid_ops { }; int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, - u16 hid_descriptor_address); + u16 hid_descriptor_address, u32 quirks); int i2c_hid_core_remove(struct i2c_client *client); void i2c_hid_core_shutdown(struct i2c_client *client); -- 2.34.1