Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1181228lqe; Mon, 8 Apr 2024 00:38:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkCLQyu97FIDl1eeDeieZRwNWYbNqE/tWgbj/0Pf3ETwQYAtd4khoWhIcbizWDcpAxk8KZYhRu2tKvOW0+jhgJwbLCl70bvlsntt4rRQ== X-Google-Smtp-Source: AGHT+IHPYGCZEW2JMnab0irZwrpnDg2Lgk3Ib350JTtzwdQSBy/k+q4BB8lqkL7+Jv9cjwwtQ80i X-Received: by 2002:a17:907:ea7:b0:a51:b1b1:b772 with SMTP id ho39-20020a1709070ea700b00a51b1b1b772mr4683417ejc.65.1712561894983; Mon, 08 Apr 2024 00:38:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712561894; cv=pass; d=google.com; s=arc-20160816; b=o38JM5PTDPkELsAvfjf7IM6TK3MMCrJn/ycHAvr8kVff3pcYjAq0xRZq/n+e+rnAkg f4h8XL5s78n1k3zuRCcoHdBwDEFGgbJCB8sVMS32YOhbhGowY0UO7vhjFB4z9D4nRZIY K4ZrFPLOSYj2/62lMo+/QT5khvALgbDxsYAdj6xj83mqYCU9eRWWyJ8NNYOyh2aDAOej SXn3jGzSfe9ibBub9uFkje1z+7PYbfgbPoHPRczGhmV1AXQCJscfQz3Fw72xxoEvOMGf zTA5uzG1RSBpgMHKBonxY77u4XKPJ9XzXVTT+i7g0ItGuPY4LDSCksiDyoNdK7SQhQ22 9EzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=eP8ZXgXWmiKGZPbclhja3eEpb8H9KCOmhQXqx8Am8vQ=; fh=xRO676lGxx/WdmgOdV6L3F+0Oia9cvViD4k2+phagjY=; b=mIQ4aPFqgzGErHWeXPdy3HbnqqGzx4XrnxV7uf7H+SxJswdaAHdDbvgWY4Lretjw9S TwOi7ethAXlsGjq/q4ef7cs8vH1qeuCFWr+gwymkvOmbTu3JldcMHvZzCN2Nsmli/JFI RGrCHnCp1dejQYK9wg84PWfcaYBModa5/4dERCAjJ3xXjFAZLLwL1n48bO9ODRWN4cQM 0WHjQUhszA5MWaEHG8gUzT2VMrG9e6P8G5X4jy+K1LUYOmSOpADnAAVDreENgmTq5TEV 5g3E8yAblovo14fEJ9rBQ6Ls/uM2UA5MaXtp88wh0ma6jjsiwzth/YUtAEhARbEMgPD4 SEaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NwonCKgu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-134900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x24-20020a1709064a9800b00a4750b04151si3332703eju.484.2024.04.08.00.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 00:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NwonCKgu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-134900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 199901F22953 for ; Mon, 8 Apr 2024 07:28:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B5F5025622; Mon, 8 Apr 2024 07:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NwonCKgu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC55F23A8; Mon, 8 Apr 2024 07:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712561272; cv=none; b=ag8nx3AI4tSVDxeqLI6DtaseG4TtxAQiZfbQpvkVFCQ7JTBHrabfKHWke+8f/11a1iRSYynDvobPOsXaMwr5/6WSMDogWBdSWd64MiAqPWRY/84aYpEhEKqRqUQbw3Ec4yTa436geHrd4Hroo+oJeyQvqOQItrmeOa2y9V4U/LU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712561272; c=relaxed/simple; bh=Cbtn6smWWKHguoUqrvDzEVxp21alRHdEffFw0eAnkII=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rD6QR+aZkEhwoXFEkxyJpQA8gYNn0DAKuaHoMcOa9nfAwC4XDnGOWcYKUaQsCdPR+Sg6CqqpXV6V5QAKe4F9w7qCLvlp/+cVbBg7m0POs5+U5ekkgOJJogwx08salKJ0q/CJLOl2GnkLOMYdtJQKrGSMX9VthXFaTjQBxxB3oZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NwonCKgu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF07C433C7; Mon, 8 Apr 2024 07:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712561271; bh=Cbtn6smWWKHguoUqrvDzEVxp21alRHdEffFw0eAnkII=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NwonCKguouYcMyi8r9RJXdu2ywc3drewzhnRdlqXQSN+Ml80saFF0LentyUw0GLXh DkMHPfuOdVU+dAVx5G1u8k5fUbM6Tj/QD3c5GwTfCY43uDe/+0mKd31hSU1n2VVTSc LpC2PuV6ZdQ0S5Oe6tHcHQJl3XI3lb96H/X8YEwM84EylpXzxyrVlFndhw/TW2ZSx8 6DUiwv0g0+zACGYbNAgxeFwfSX8wRvl0ZmHGBAyi62FrnqvxgBHGSCoMBpSzFZSe6a ivMZxaoOz/w/1pG9I3d5OeW9OPcH+7xLKh/xIlz47a+NvqJTMgcGARMACJ/2tUdV/T tn8uLmw5rBoeg== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rtjPs-000000000Cb-3ihr; Mon, 08 Apr 2024 09:27:45 +0200 Date: Mon, 8 Apr 2024 09:27:44 +0200 From: Johan Hovold To: Lukasz Majczak Cc: Jiri Kosina , Dmitry Torokhov , Benjamin Tissoires , Douglas Anderson , Hans de Goede , Maxime Ripard , Kai-Heng Feng , Johan Hovold , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Radoslaw Biernacki Subject: Re: [PATCH v2] HID: i2c-hid: wait for i2c touchpad deep-sleep to power-up transition Message-ID: References: <20240405102436.3479210-1-lma@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240405102436.3479210-1-lma@chromium.org> On Fri, Apr 05, 2024 at 10:24:36AM +0000, Lukasz Majczak wrote: > This patch extends the early bailout for probing procedure introduced in > commit b3a81b6c4fc6 ("HID: i2c-hid: check if device is there before > really probing"), in order to cover devices > based on STM microcontrollers. For touchpads based on STM uC, > the probe sequence needs to take into account the increased response time > for i2c transaction if the device already entered a deep power state. > STM specify the wakeup time as 400us between positive strobe of > the clock line. Deep sleep is controlled by Touchpad FW, > though some devices enter it pretty early to conserve power > in case of lack of activity on the i2c bus. > Failing to follow this requirement will result in touchpad device not being > detected due initial transaction being dropped by STM i2c slave controller. > By adding additional try, first transaction will wake up the touchpad > STM controller, and the second will produce proper detection response. Can you please explain why this would not a problem for all future transactions as well? If it is, then it sounds like this needs to be addressed in the i2c driver. If not, then perhaps the problem is really that you just need a delay after enabling the power supplies? > v1->v2: > * Updated commit message with short sha of a base commit and proper tags > * Rearranged while loop to perform check only once > * Loosened sleeping range > > Co-developed-by: Radoslaw Biernacki > Signed-off-by: Radoslaw Biernacki > Signed-off-by: Lukasz Majczak > --- > drivers/hid/i2c-hid/i2c-hid-core.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c > index 2df1ab3c31cc..ece1a5815e0b 100644 > --- a/drivers/hid/i2c-hid/i2c-hid-core.c > +++ b/drivers/hid/i2c-hid/i2c-hid-core.c > @@ -1013,9 +1013,17 @@ static int __i2c_hid_core_probe(struct i2c_hid *ihid) > struct i2c_client *client = ihid->client; > struct hid_device *hid = ihid->hid; > int ret; > + int tries = 2; Nit: move above the 'ret' declaration to maintain reverse xmas style ordering. Johan