From patchwork Sat Nov 4 11:17:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 740979 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5810FC4167B for ; Sat, 4 Nov 2023 11:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbjKDLSr (ORCPT ); Sat, 4 Nov 2023 07:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjKDLSq (ORCPT ); Sat, 4 Nov 2023 07:18:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4EA91BD for ; Sat, 4 Nov 2023 04:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zk4l95jEHoH1JCWxauxXu/AiDVZKo7MG3MMmwMuKEUU=; b=KRSsphIEfHpfBKn8B7rm8Kp4pyjLO6oY2xX6KdSz+Pzq9+lqGOQqNeRZx4WmeDC8e44PnK pc0TlKKna8bFgGuUC07cgZ3rO6FkNPYV1FLZKleIrrSKVzPUHeeNqlXJ6vD8KWoB1anVdr O4pK2fpSDn+3UcNbOmckJ5PX2WgcdeY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-ZgVZI_fFN86CVJvdtGJzNw-1; Sat, 04 Nov 2023 07:17:48 -0400 X-MC-Unique: ZgVZI_fFN86CVJvdtGJzNw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F1AE811E7D; Sat, 4 Nov 2023 11:17:48 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71096502E; Sat, 4 Nov 2023 11:17:46 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 1/7] HID: i2c-hid: Fold i2c_hid_execute_reset() into i2c_hid_hwreset() Date: Sat, 4 Nov 2023 12:17:37 +0100 Message-ID: <20231104111743.14668-2-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org i2c_hid_hwreset() is the only caller of i2c_hid_execute_reset(), fold the latter into the former. This is a preparation patch for removing the need for I2C_HID_QUIRK_NO_IRQ_AFTER_RESET by making i2c-hid behave more like Windows. No functional changes intended. Signed-off-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-core.c | 80 +++++++++++++----------------- 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 2735cd585af0..12a9edb23f82 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -426,49 +426,9 @@ static int i2c_hid_set_power(struct i2c_hid *ihid, int power_state) return ret; } -static int i2c_hid_execute_reset(struct i2c_hid *ihid) -{ - size_t length = 0; - int ret; - - i2c_hid_dbg(ihid, "resetting...\n"); - - /* Prepare reset command. Command register goes first. */ - *(__le16 *)ihid->cmdbuf = ihid->hdesc.wCommandRegister; - length += sizeof(__le16); - /* Next is RESET command itself */ - length += i2c_hid_encode_command(ihid->cmdbuf + length, - I2C_HID_OPCODE_RESET, 0, 0); - - set_bit(I2C_HID_RESET_PENDING, &ihid->flags); - - ret = i2c_hid_xfer(ihid, ihid->cmdbuf, length, NULL, 0); - if (ret) { - dev_err(&ihid->client->dev, "failed to reset device.\n"); - goto out; - } - - if (ihid->quirks & I2C_HID_QUIRK_NO_IRQ_AFTER_RESET) { - msleep(100); - goto out; - } - - i2c_hid_dbg(ihid, "%s: waiting...\n", __func__); - if (!wait_event_timeout(ihid->wait, - !test_bit(I2C_HID_RESET_PENDING, &ihid->flags), - msecs_to_jiffies(5000))) { - ret = -ENODATA; - goto out; - } - i2c_hid_dbg(ihid, "%s: finished.\n", __func__); - -out: - clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); - return ret; -} - static int i2c_hid_hwreset(struct i2c_hid *ihid) { + size_t length = 0; int ret; i2c_hid_dbg(ihid, "%s\n", __func__); @@ -482,21 +442,49 @@ static int i2c_hid_hwreset(struct i2c_hid *ihid) ret = i2c_hid_set_power(ihid, I2C_HID_PWR_ON); if (ret) - goto out_unlock; + goto err_unlock; - ret = i2c_hid_execute_reset(ihid); + /* Prepare reset command. Command register goes first. */ + *(__le16 *)ihid->cmdbuf = ihid->hdesc.wCommandRegister; + length += sizeof(__le16); + /* Next is RESET command itself */ + length += i2c_hid_encode_command(ihid->cmdbuf + length, + I2C_HID_OPCODE_RESET, 0, 0); + + set_bit(I2C_HID_RESET_PENDING, &ihid->flags); + + ret = i2c_hid_xfer(ihid, ihid->cmdbuf, length, NULL, 0); if (ret) { dev_err(&ihid->client->dev, "failed to reset device: %d\n", ret); - i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP); - goto out_unlock; + goto err_clear_reset; } + if (ihid->quirks & I2C_HID_QUIRK_NO_IRQ_AFTER_RESET) { + msleep(100); + clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); + } + + i2c_hid_dbg(ihid, "%s: waiting...\n", __func__); + if (!wait_event_timeout(ihid->wait, + !test_bit(I2C_HID_RESET_PENDING, &ihid->flags), + msecs_to_jiffies(5000))) { + ret = -ENODATA; + goto err_clear_reset; + } + i2c_hid_dbg(ihid, "%s: finished.\n", __func__); + /* At least some SIS devices need this after reset */ if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET)) ret = i2c_hid_set_power(ihid, I2C_HID_PWR_ON); -out_unlock: + mutex_unlock(&ihid->reset_lock); + return ret; + +err_clear_reset: + clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); + i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP); +err_unlock: mutex_unlock(&ihid->reset_lock); return ret; } From patchwork Sat Nov 4 11:17:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 740980 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85554C4167B for ; Sat, 4 Nov 2023 11:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231913AbjKDLSk (ORCPT ); Sat, 4 Nov 2023 07:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231879AbjKDLSk (ORCPT ); Sat, 4 Nov 2023 07:18:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BAC7B7 for ; Sat, 4 Nov 2023 04:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zSbIs7xQ43DgpxbZyVRIiEzTxV58/zDB2X1TMbD8Ytk=; b=Z41MQXWQLV5cfqwMNHN4v4ver4q/OyHShqwqUJE8CXcdnHdceXaRH1PG4yHFPWCsDBShwC WvtlZZ3rOP0INU+mbXkyc1awjeEJJWJ8MmBzWs8DJZV5Q/WRU5Sv76TxW3uvBzmRhvfr0Y +IjfKKX1GdMk7kduTSQbq7ei68jkIns= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321-59zBLMGvNg6mFZBGQLC8ww-1; Sat, 04 Nov 2023 07:17:50 -0400 X-MC-Unique: 59zBLMGvNg6mFZBGQLC8ww-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F28FD185A780; Sat, 4 Nov 2023 11:17:49 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50AEC502E; Sat, 4 Nov 2023 11:17:48 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 2/7] HID: i2c-hid: Split i2c_hid_hwreset() in start() and finish() functions Date: Sat, 4 Nov 2023 12:17:38 +0100 Message-ID: <20231104111743.14668-3-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Split i2c_hid_hwreset() into: i2c_hid_start_hwreset() which sends the PWR_ON and reset commands; and i2c_hid_finish_hwreset() which actually waits for the reset to complete. This is a preparation patch for removing the need for I2C_HID_QUIRK_NO_IRQ_AFTER_RESET by making i2c-hid behave more like Windows. No functional changes intended. Signed-off-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-core.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 12a9edb23f82..8105b84fb539 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -426,7 +426,7 @@ static int i2c_hid_set_power(struct i2c_hid *ihid, int power_state) return ret; } -static int i2c_hid_hwreset(struct i2c_hid *ihid) +static int i2c_hid_start_hwreset(struct i2c_hid *ihid) { size_t length = 0; int ret; @@ -460,6 +460,20 @@ static int i2c_hid_hwreset(struct i2c_hid *ihid) goto err_clear_reset; } + return 0; + +err_clear_reset: + clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); + i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP); +err_unlock: + mutex_unlock(&ihid->reset_lock); + return ret; +} + +static int i2c_hid_finish_hwreset(struct i2c_hid *ihid) +{ + int ret = 0; + if (ihid->quirks & I2C_HID_QUIRK_NO_IRQ_AFTER_RESET) { msleep(100); clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); @@ -484,7 +498,6 @@ static int i2c_hid_hwreset(struct i2c_hid *ihid) err_clear_reset: clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP); -err_unlock: mutex_unlock(&ihid->reset_lock); return ret; } @@ -732,7 +745,9 @@ static int i2c_hid_parse(struct hid_device *hid) } do { - ret = i2c_hid_hwreset(ihid); + ret = i2c_hid_start_hwreset(ihid); + if (ret == 0) + ret = i2c_hid_finish_hwreset(ihid); if (ret) msleep(1000); } while (tries-- > 0 && ret); @@ -975,10 +990,13 @@ static int i2c_hid_core_resume(struct i2c_hid *ihid) * However some ALPS touchpads generate IRQ storm without reset, so * let's still reset them here. */ - if (ihid->quirks & I2C_HID_QUIRK_RESET_ON_RESUME) - ret = i2c_hid_hwreset(ihid); - else + if (ihid->quirks & I2C_HID_QUIRK_RESET_ON_RESUME) { + ret = i2c_hid_start_hwreset(ihid); + if (ret == 0) + ret = i2c_hid_finish_hwreset(ihid); + } else { ret = i2c_hid_set_power(ihid, I2C_HID_PWR_ON); + } if (ret) return ret; From patchwork Sat Nov 4 11:17:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 741171 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD445C4332F for ; Sat, 4 Nov 2023 11:18:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232005AbjKDLSr (ORCPT ); Sat, 4 Nov 2023 07:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231879AbjKDLSq (ORCPT ); Sat, 4 Nov 2023 07:18:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96378D45 for ; Sat, 4 Nov 2023 04:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9/7bpGQIO06yA6AquGDhmIV6Vj1ccmwMUN6Ffg9PV3k=; b=J52VAQtkl+/9qp9gJ1CSBAYX2Xpq3mOhl5gu6RFLQA/BUBHVHYt2p6Lm0IkAC6vsgCfUSn WO2F1mWmivszMLmaL9AwqJtf3IFKQNhhgAgQj2GNVu4cnE4aqGYqkPHm3oXV1O0UOtILDO TI6k22F9buNxWVNMg+CN1W8S5amlXTE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-AB7dEwubPPOo4nCyOhDEYA-1; Sat, 04 Nov 2023 07:17:52 -0400 X-MC-Unique: AB7dEwubPPOo4nCyOhDEYA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEEED85A58B; Sat, 4 Nov 2023 11:17:51 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3039B5030; Sat, 4 Nov 2023 11:17:50 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 3/7] HID: i2c-hid: Switch i2c_hid_parse() to goto style error handling Date: Sat, 4 Nov 2023 12:17:39 +0100 Message-ID: <20231104111743.14668-4-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Switch i2c_hid_parse() to goto style error handling. This is a preparation patch for removing the need for I2C_HID_QUIRK_NO_IRQ_AFTER_RESET by making i2c-hid behave more like Windows. Note this changes the descriptor read error path to propagate the actual i2c_hid_read_register() error code (which is always negative) instead of hardcoding a -EIO return. Signed-off-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-core.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 8105b84fb539..f029ddce4766 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -776,23 +776,21 @@ static int i2c_hid_parse(struct hid_device *hid) rdesc, rsize); if (ret) { hid_err(hid, "reading report descriptor failed\n"); - kfree(rdesc); - return -EIO; + goto out; } } i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc); ret = hid_parse_report(hid, rdesc, rsize); + if (ret) + dbg_hid("parsing report descriptor failed\n"); + +out: if (!use_override) kfree(rdesc); - if (ret) { - dbg_hid("parsing report descriptor failed\n"); - return ret; - } - - return 0; + return ret; } static int i2c_hid_start(struct hid_device *hid) From patchwork Sat Nov 4 11:17:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 740978 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2156EC4167D for ; Sat, 4 Nov 2023 11:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbjKDLSs (ORCPT ); Sat, 4 Nov 2023 07:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232003AbjKDLSr (ORCPT ); Sat, 4 Nov 2023 07:18:47 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A15D44 for ; Sat, 4 Nov 2023 04:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MsMY4/LcSNi8MII/naoQFzzgpbXIG9j67akh3eZNrek=; b=i0zaPa8q0U9lqZ4OoYZSfaDzrKbJ39+0cYVECd74xOwq7CZRz07+Qfs5wwJ/frP/nzIg8G Ps8Y7KBnsoicCOvQI0AE843Mlq/+9GgUW79PYlKPQEdIM/0P1jTPVrnlgNjKUnxDfrFqC3 3r/3rK2+MLFicbsYDcW+XHvO724UQ74= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-632-gz7WdBh_P0aK39uEk8irLw-1; Sat, 04 Nov 2023 07:17:54 -0400 X-MC-Unique: gz7WdBh_P0aK39uEk8irLw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE3B080F92B; Sat, 4 Nov 2023 11:17:53 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CFA3502E; Sat, 4 Nov 2023 11:17:51 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 4/7] HID: i2c-hid: Move i2c_hid_finish_hwreset() to after reading the report-descriptor Date: Sat, 4 Nov 2023 12:17:40 +0100 Message-ID: <20231104111743.14668-5-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org A recent bug made me look at Microsoft's i2c-hid docs again and I noticed the following: """ 4. Issue a RESET (Host Initiated Reset) to the Device. 5. Retrieve report descriptor from the device. Note: Steps 4 and 5 may be done in parallel to optimize for time on I²C. Since report descriptors are (a) static and (b) quite long, Windows 8 may issue a request for 5 while it is waiting for a response from the device on 4. """ Which made me think that maybe on some touchpads the reset ack is delayed till after the report descriptor is read ? Testing a T-BAO Tbook Air 12.5 with a 0911:5288 (SIPODEV SP1064?) touchpad, for which the I2C_HID_QUIRK_NO_IRQ_AFTER_RESET quirk was first introduced, shows that about 1 ms after the report descriptor read finishes the reset indeed does get acked. Move the waiting for the ack to after reading the report-descriptor, so that the I2C_HID_QUIRK_NO_IRQ_AFTER_RESET quirk is no longer necessary (on this model). While at it drop the dbg_hid() for a malloc failure, malloc failures already get logged extensively by malloc itself. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2247751 Signed-off-by: Hans de Goede --- drivers/hid/i2c-hid/i2c-hid-core.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index f029ddce4766..3bd0c3d77d99 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -502,6 +502,12 @@ static int i2c_hid_finish_hwreset(struct i2c_hid *ihid) return ret; } +static void i2c_hid_abort_hwreset(struct i2c_hid *ihid) +{ + clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); + mutex_unlock(&ihid->reset_lock); +} + static void i2c_hid_get_input(struct i2c_hid *ihid) { u16 size = le16_to_cpu(ihid->hdesc.wMaxInputLength); @@ -746,8 +752,6 @@ static int i2c_hid_parse(struct hid_device *hid) do { ret = i2c_hid_start_hwreset(ihid); - if (ret == 0) - ret = i2c_hid_finish_hwreset(ihid); if (ret) msleep(1000); } while (tries-- > 0 && ret); @@ -763,9 +767,8 @@ static int i2c_hid_parse(struct hid_device *hid) i2c_hid_dbg(ihid, "Using a HID report descriptor override\n"); } else { rdesc = kzalloc(rsize, GFP_KERNEL); - if (!rdesc) { - dbg_hid("couldn't allocate rdesc memory\n"); + i2c_hid_abort_hwreset(ihid); return -ENOMEM; } @@ -776,10 +779,21 @@ static int i2c_hid_parse(struct hid_device *hid) rdesc, rsize); if (ret) { hid_err(hid, "reading report descriptor failed\n"); + i2c_hid_abort_hwreset(ihid); goto out; } } + /* + * Windows directly reads the report-descriptor after sending reset + * and then waits for resets completion afterwards. Some touchpads + * actually wait for the report-descriptor to be read before signalling + * reset completion. + */ + ret = i2c_hid_finish_hwreset(ihid); + if (ret) + goto out; + i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc); ret = hid_parse_report(hid, rdesc, rsize); From patchwork Sat Nov 4 11:17:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 740977 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FA4AC4167B for ; Sat, 4 Nov 2023 11:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232114AbjKDLTY (ORCPT ); Sat, 4 Nov 2023 07:19:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbjKDLTW (ORCPT ); Sat, 4 Nov 2023 07:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B07DD4C for ; Sat, 4 Nov 2023 04:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dCVmEEuGjfAF1XTZdx2/tPYjyNhamBr2VQfPb0Ey7xE=; b=DDQnZy/PfR50sXYy0BKL/tu4xeegu4IHlRbw/wLFGbziS8qUY62wxvcpYpfrdFsqMslLxG +UNgZCx/I0SvFhzxXs/OepRAz+RjrcJRaM8G27wXaAhPHuMVCjY7645Ep8fU/y/q+Akyp3 ovxo64E7bs9NszC8cl8oA1xOJCouC9Q= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-LbH2XY3hMuWz1qSdAIhn9w-1; Sat, 04 Nov 2023 07:17:56 -0400 X-MC-Unique: LbH2XY3hMuWz1qSdAIhn9w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C33580F92B; Sat, 4 Nov 2023 11:17:55 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0816502E; Sat, 4 Nov 2023 11:17:53 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 5/7] HID: i2c-hid: Remove I2C_HID_QUIRK_NO_IRQ_AFTER_RESET quirks Date: Sat, 4 Nov 2023 12:17:41 +0100 Message-ID: <20231104111743.14668-6-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Now that i2c-hid-core waits for the reset after reading the HID report descriptor, the I2C_HID_QUIRK_NO_IRQ_AFTER_RESET quirks appear to no longer be necessary (confirmed on one of the quirked models). Except on laptops where the HID report descriptor is missing and is provided by a DMI quirk instead. On these models the HID report descriptor is not read at all, so moving the wait for reset is a no-op. These laptops have 0911:5288 touchpads for which I2C_HID_QUIRK_NO_IRQ_AFTER_RESET was set, keep the existing behavior there. There might still be devices which really do not ack the reset at all, so to avoid this causing regressions also: 1. Change the wait for ack timeout from an error into a warning; and 2. Lower reset timeout from the very long 5s to 1s which should be plenty Signed-off-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-core.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index 3bd0c3d77d99..df5577fc73c5 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -45,7 +45,6 @@ /* quirks to control the device */ #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) -#define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) #define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) @@ -122,12 +121,6 @@ static const struct i2c_hid_quirks { } i2c_hid_quirks[] = { { USB_VENDOR_ID_WEIDA, HID_ANY_ID, I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, - { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288, - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, - { I2C_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15, - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, - { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118, - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, I2C_HID_QUIRK_RESET_ON_RESUME }, { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393, @@ -470,11 +463,11 @@ static int i2c_hid_start_hwreset(struct i2c_hid *ihid) return ret; } -static int i2c_hid_finish_hwreset(struct i2c_hid *ihid) +static int i2c_hid_finish_hwreset(struct i2c_hid *ihid, bool no_irq_after_reset) { int ret = 0; - if (ihid->quirks & I2C_HID_QUIRK_NO_IRQ_AFTER_RESET) { + if (no_irq_after_reset) { msleep(100); clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); } @@ -482,9 +475,9 @@ static int i2c_hid_finish_hwreset(struct i2c_hid *ihid) i2c_hid_dbg(ihid, "%s: waiting...\n", __func__); if (!wait_event_timeout(ihid->wait, !test_bit(I2C_HID_RESET_PENDING, &ihid->flags), - msecs_to_jiffies(5000))) { - ret = -ENODATA; - goto err_clear_reset; + msecs_to_jiffies(1000))) { + dev_warn(&ihid->client->dev, "device did not ack reset within 1000 ms\n"); + clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); } i2c_hid_dbg(ihid, "%s: finished.\n", __func__); @@ -494,12 +487,6 @@ static int i2c_hid_finish_hwreset(struct i2c_hid *ihid) mutex_unlock(&ihid->reset_lock); return ret; - -err_clear_reset: - clear_bit(I2C_HID_RESET_PENDING, &ihid->flags); - i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP); - mutex_unlock(&ihid->reset_lock); - return ret; } static void i2c_hid_abort_hwreset(struct i2c_hid *ihid) @@ -736,6 +723,7 @@ static int i2c_hid_parse(struct hid_device *hid) struct i2c_client *client = hid->driver_data; struct i2c_hid *ihid = i2c_get_clientdata(client); struct i2c_hid_desc *hdesc = &ihid->hdesc; + bool no_irq_after_reset = false; unsigned int rsize; char *rdesc; int ret; @@ -764,6 +752,7 @@ static int i2c_hid_parse(struct hid_device *hid) if (use_override) { rdesc = use_override; + no_irq_after_reset = true; i2c_hid_dbg(ihid, "Using a HID report descriptor override\n"); } else { rdesc = kzalloc(rsize, GFP_KERNEL); @@ -790,7 +779,7 @@ static int i2c_hid_parse(struct hid_device *hid) * actually wait for the report-descriptor to be read before signalling * reset completion. */ - ret = i2c_hid_finish_hwreset(ihid); + ret = i2c_hid_finish_hwreset(ihid, no_irq_after_reset); if (ret) goto out; @@ -1005,7 +994,7 @@ static int i2c_hid_core_resume(struct i2c_hid *ihid) if (ihid->quirks & I2C_HID_QUIRK_RESET_ON_RESUME) { ret = i2c_hid_start_hwreset(ihid); if (ret == 0) - ret = i2c_hid_finish_hwreset(ihid); + ret = i2c_hid_finish_hwreset(ihid, false); } else { ret = i2c_hid_set_power(ihid, I2C_HID_PWR_ON); } From patchwork Sat Nov 4 11:17:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 741170 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 499CEC0018A for ; Sat, 4 Nov 2023 11:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbjKDLSt (ORCPT ); Sat, 4 Nov 2023 07:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232025AbjKDLSs (ORCPT ); Sat, 4 Nov 2023 07:18:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18842D49 for ; Sat, 4 Nov 2023 04:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Oec4lvr3KY+8o9dTvSeVMfOCCl1PirBThhaqz+FHc0=; b=ha6LNnzqH9j74zYPRK1Y2zIWoa9VlMYBjgdEnUGCMMN6ph4024KnjPbT58BON3tfgQp2Rj vK8Z7ginz8ryG288eaqdTMBP7Up88Ih2hpVpHrY1OGITtqIg6cmFdJRP5JO3AxtrXj8lmh ZispEsUUg3McY9ONQ4AtEXCtPhuCPt0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-680-8cw8X9yWMxqt_BGlBtB1pg-1; Sat, 04 Nov 2023 07:17:58 -0400 X-MC-Unique: 8cw8X9yWMxqt_BGlBtB1pg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C7E03C025C9; Sat, 4 Nov 2023 11:17:57 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDDDC502E; Sat, 4 Nov 2023 11:17:55 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 6/7] HID: i2c-hid: Remove I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV quirk Date: Sat, 4 Nov 2023 12:17:42 +0100 Message-ID: <20231104111743.14668-7-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Re-trying the power-on command on failure on all devices should not be a problem, drop the I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV quirk and simply retry power-on on all devices. Signed-off-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-core.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index df5577fc73c5..ff2659bf5e57 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -44,7 +44,6 @@ #include "i2c-hid.h" /* quirks to control the device */ -#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) #define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) @@ -119,8 +118,6 @@ static const struct i2c_hid_quirks { __u16 idProduct; __u32 quirks; } i2c_hid_quirks[] = { - { USB_VENDOR_ID_WEIDA, HID_ANY_ID, - I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, I2C_HID_QUIRK_RESET_ON_RESUME }, { I2C_VENDOR_ID_SYNAPTICS, I2C_PRODUCT_ID_SYNAPTICS_SYNA2393, @@ -388,8 +385,7 @@ static int i2c_hid_set_power(struct i2c_hid *ihid, int power_state) * The call will get a return value (EREMOTEIO) but device will be * triggered and activated. After that, it goes like a normal device. */ - if (power_state == I2C_HID_PWR_ON && - ihid->quirks & I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV) { + if (power_state == I2C_HID_PWR_ON) { ret = i2c_hid_set_power_command(ihid, I2C_HID_PWR_ON); /* Device was already activated */ From patchwork Sat Nov 4 11:17:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 741169 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA160C4332F for ; Sat, 4 Nov 2023 11:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232101AbjKDLTX (ORCPT ); Sat, 4 Nov 2023 07:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbjKDLTW (ORCPT ); Sat, 4 Nov 2023 07:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70354D52 for ; Sat, 4 Nov 2023 04:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699096683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xutdSylU14dYQkrYI04HpEA/Wb/bCCMUsz+frHiNOjM=; b=C63XP5RDH4t9+7Gsyt4aR4UJlKYiFn9TMWRO3UvqqDI2+7HVfBrHwVy8rzEpRwoKxaHso3 vaaqPOH/mqauJlRC9HfuQhP0VO7Tt1qY58KnFmgd8DTAtSV7RHXzCWFzqsjCnEO+0s+9Wp rPBAYIxD2vV0apmAN+f2GTsWKfwYwIE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-lWV4v2ujPV-xYZuq5RiBFQ-1; Sat, 04 Nov 2023 07:17:59 -0400 X-MC-Unique: lWV4v2ujPV-xYZuq5RiBFQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B0EE80C344; Sat, 4 Nov 2023 11:17:59 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F00E502E; Sat, 4 Nov 2023 11:17:57 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , Douglas Anderson , Julian Sax , ahormann@gmx.net, Bruno Jesus , Dietrich , kloxdami@yahoo.com, Tim Aldridge , Rene Wagner , Federico Ricchiuto , linux-input@vger.kernel.org Subject: [PATCH 7/7] HID: i2c-hid: Renumber I2C_HID_QUIRK_ defines Date: Sat, 4 Nov 2023 12:17:43 +0100 Message-ID: <20231104111743.14668-8-hdegoede@redhat.com> In-Reply-To: <20231104111743.14668-1-hdegoede@redhat.com> References: <20231104111743.14668-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The quirks variable and the I2C_HID_QUIRK_ defines are never used / exported outside of the i2c-hid code renumber them to start at BIT(0) again. Signed-off-by: Hans de Goede Reviewed-by: Douglas Anderson --- drivers/hid/i2c-hid/i2c-hid-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index ff2659bf5e57..2a4c8657cc7e 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -44,10 +44,10 @@ #include "i2c-hid.h" /* quirks to control the device */ -#define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) -#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) -#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) -#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(7) +#define I2C_HID_QUIRK_BOGUS_IRQ BIT(0) +#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(1) +#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(2) +#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(3) /* Command opcodes */ #define I2C_HID_OPCODE_RESET 0x01