Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2305610rwi; Thu, 3 Nov 2022 15:33:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7g9Otr77xS/MUtswoopZ5/a7dylcvfwWg5Yh1pETqA3zHjhqR4SCW618Oi85X41d479ccc X-Received: by 2002:a17:90b:4b0e:b0:214:1328:e33a with SMTP id lx14-20020a17090b4b0e00b002141328e33amr16132679pjb.207.1667514785258; Thu, 03 Nov 2022 15:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667514785; cv=none; d=google.com; s=arc-20160816; b=Q3BpidF7+VvW+NoPgp8s0NR8KT5gAbyoebS5MSIY0YzbhP34S81Bo+C9riLacCMmb/ xTa5k/VqQKqQg1GgilgCbOhwURToSmj0sshO+A1Kr8nSLJntGowqkh1zm7hxKQ9HWi2n PZ25ny4BNmqh3ezPbnMBmUEQjPk5OkCrO1OUIiM7WrDvkNB0nc//Q8jSB+7FbGF3tTcc N1Y3Tdbzt5ClSrpXmxuw11+FZw+CxW3skn8Bpzm+SZV540s/ofKO048uccvZtCEF//KJ JhFU9uDksgekLGFA0d54VYoxRyLutLztWS+bQODBCp8PKUiMI6AKETWPUJNum2OZQYNI 24vg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=59FBwAeroTKaIV20DkKsMcitTiSHpuFKo/q1qhLyBe8=; b=AIwNLQsx4T4YyZ/4NQIcSI2E7OByk8M3UzyaCNLrF5obVWW98yESc3NiMQZGxLsT07 zFs9vVR2pa/YJ+Uc7p/dRIZ8bmNK0/I9XuhZxsDhB1FygbjxrRsfmCr6AsVh8l4vgdfs 3i24Xy5UdAlqaT1ck60sBa1pyW0ngqdOqa/4xTnZJ2OJaLUv2Jqf7RTaofj9in7DfBcE Sh5Z0hgkh/xsZqJUQgzTS6IFKqNXk9T0YIEn1J4MGRqjn/AmYqvLU4t1YBNpLqvpaKUa yYEfoa8yO1mxfQGqrAQ4b+fBfC7OsK1at/+0wFEqLnHAUC82/eIukodV8yPnpiRmaWtT 17dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 14-20020a63060e000000b00438854c876esi2371212pgg.419.2022.11.03.15.32.52; Thu, 03 Nov 2022 15:33:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229567AbiKCW1j (ORCPT + 98 others); Thu, 3 Nov 2022 18:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231708AbiKCW13 (ORCPT ); Thu, 3 Nov 2022 18:27:29 -0400 Received: from mail.inka.de (mail.inka.de [IPv6:2a04:c9c7:0:1073:217:a4ff:fe3b:e77c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7453120358; Thu, 3 Nov 2022 15:27:28 -0700 (PDT) Received: from mail3.berkhan-weisser.de ([2a03:4000:54:b9a::4]) by mail.inka.de with esmtpsa id 1oqigI-005aIq-38; Thu, 03 Nov 2022 23:27:26 +0100 Received: from 127.0.0.1 (helo=localhost.localdomain) by mail3.berkhan-weisser.de with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1oqigH-005Ggn-MS; Thu, 03 Nov 2022 23:27:25 +0100 From: Enrik Berkhan To: linux-input@vger.kernel.org Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Rishi Gupta , Enrik Berkhan , Tobias Junghans Subject: [PATCH v2 2/3] HID: mcp2221: enable HID I/O during GPIO probe Date: Thu, 3 Nov 2022 23:27:13 +0100 Message-Id: <20221103222714.21566-3-Enrik.Berkhan@inka.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103222714.21566-1-Enrik.Berkhan@inka.de> References: <20220926202239.16379-1-Enrik.Berkhan@inka.de> <20221103222714.21566-1-Enrik.Berkhan@inka.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As soon as the GPIO driver part will be enabled in mcp2221_probe(), the first HID reports will be exchanged with the chip because the GPIO driver immediately calls mcp_gpio_get_direction(). HID I/O has to be enabled explicitly during mcp2221_probe() to receive response reports. Otherwise, all four mcp_gpio_get_direction() calls will run into the four second timeout of mcp_send_report(), which will block the driver for about 16s during startup. A very similar patch appeared some time ago in https://lore.kernel.org/r/20210818152743.163929-1-tobias.junghans@inhub.de which obviously got lost somehow. CC: Tobias Junghans Signed-off-by: Enrik Berkhan --- drivers/hid/hid-mcp2221.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index e61dd039354b..0705526231ec 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -1178,6 +1178,9 @@ static int mcp2221_probe(struct hid_device *hdev, mcp->gc->can_sleep = 1; mcp->gc->parent = &hdev->dev; + /* Enable reception of HID reports during GPIO initialization */ + hid_device_io_start(hdev); + ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp); if (ret) return ret; -- 2.34.1