Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp471707pxk; Thu, 17 Sep 2020 07:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHR0fECvbxY3kHbXvJVW8xoja1ZZMu1tHvkBeyLtNN4P/ERXmmVLKfxqllVjNTqv1kSsZo X-Received: by 2002:aa7:ca4f:: with SMTP id j15mr29780971edt.233.1600354472550; Thu, 17 Sep 2020 07:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600354472; cv=none; d=google.com; s=arc-20160816; b=vi5OiavCJ/WG06kuuZd21o8T8rbfpkKOMDZaEHppzGqG87XBoCtJRHxcwL0153SEh9 +Dh6M6tAZU0jQHhw/p/+tcyBVS45efxrZtmjtY+7LCRKPbh1GKRivpbIusfA9MxRM+qf TjCMI8IUEwLG28NKCz8ATKZkUx07w+oWsUsRaMsLIUb+4bl6p3c+IWiPKq0n3ww19qeX hsn64mchZDjjvHGN5q8cHq2lnQ4LuMoUxZ6ISPlP+4bssHLs85PjXIn5If8/I6hNIPdZ POISx1QetZ1sJUNIz7sTaxN9Mf8E3xanBVHHeReO6W3PT3JqGXgPN0buwCb3vaUOLKqO ogCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=4Gu/kgZ0T3sU+bTVTX8rTeW8dj7wNAAwtv+uUkf6kT8=; b=tWOOIFjX/3PBNi+csahvqskj70VCODvgi3HoY85wcL/rgLdHfaYQMmQ128gfKNOhF8 7vKbUJ7KziXbbr5PlXRarAtan4IoLCKVsZzqxVRyIxH19bYfc2/+O3DI3/VhVyn7J8JX KeD3X+9h1U3Mg9MHl8MJxWfzuX0ktbWfGQQFTs2cIIh9FO/oen2azMlzbJ3Sx73iw5LJ xBI6zxgRhH8fCrfyhdOVcn2DJQUHvNq94gdoWlj00hdmx33Oyes9X/FU9AaKcsl3Z8ne SOkemgvHDuhDGaQnhL8SYthoJSEWfs35ucn40YxrSPRNVrX5bFDyJZ4jvus0hmFe/Ov1 FcEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W8C8nlyD; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 18si17284381edv.184.2020.09.17.07.54.09; Thu, 17 Sep 2020 07:54:32 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=W8C8nlyD; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727246AbgIQOtp (ORCPT + 99 others); Thu, 17 Sep 2020 10:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727656AbgIQOdA (ORCPT ); Thu, 17 Sep 2020 10:33:00 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B2C7C061356; Thu, 17 Sep 2020 07:02:46 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id j34so1415578pgi.7; Thu, 17 Sep 2020 07:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=4Gu/kgZ0T3sU+bTVTX8rTeW8dj7wNAAwtv+uUkf6kT8=; b=W8C8nlyDEfLcq8xNbPQymtNUOjR2CD9bMw+KXSxoMB5NpZZhP6vwLJixC1VAm2dV1v L1bDc9dJOQGh3KEttZgduxUfUHwgxNPRqAhrEmAaHi5fiDf+JMOjK8aIQDp/EdLhqljF wbfkurtCOLD/G/Pc2NruSFfGFjwFN78wnrQ/MPvn0TCiNJI5hzI4B1R4N4w2NHiTHJOA yV9xBeK0QNbS9TVcx6fpnLq/AlbGjWb7af4irM4bY1MxbdzBFPEtpWU1wutLg1xPu/pB q4DIsZiwQIiwSRF5mMz9GGuxxMkphfuRl5n1hXpV868O+xj1kAqxNehTFobUit/mJ9O1 KALA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=4Gu/kgZ0T3sU+bTVTX8rTeW8dj7wNAAwtv+uUkf6kT8=; b=ii8vqtA9eYPfs1V6h5i4DjP0fCzYVxKJ44E/vqMQpZ6tXfVd/A6qPQt7657/G2qdXv hxk1RSXeO30iB8Rh8O3i5F5XRJyvJahpovXL2+Z1ngMbcGWWPqgu/g2rNYk50gPdnBsE EAm3jBclLlGAPYHGpLNRzzOTvQqdG9zTVkpEYdgd6rO/1r3dARrM2sWbid5l7o7TYfIN +JpXrherWvqas8Z1EpUd4Qigebw/6pwSSqDWowCDrgpjwLxbA+JlnWXelkqcZjC77Vhg BYoH+3/7XT4ieM6uMhJmqYoimsD/QwrXAVrrGWDNBPlf1nhbTpjVO5ZR81Reedwx58jC NgRw== X-Gm-Message-State: AOAM530EjWssT8bN6lOL/Oa+Nkr/AOAC12/CiW/GlTSAZt59/D7Lh43g zz4l8V28N0RU3tk52bY4zBMVqdU8lm8xYFPJtkY= X-Received: by 2002:a63:c543:: with SMTP id g3mr23083908pgd.203.1600351365583; Thu, 17 Sep 2020 07:02:45 -0700 (PDT) MIME-Version: 1.0 References: <20200917052256.5770-1-sultan@kerneltoast.com> In-Reply-To: <20200917052256.5770-1-sultan@kerneltoast.com> From: Andy Shevchenko Date: Thu, 17 Sep 2020 17:02:27 +0300 Message-ID: Subject: Re: [PATCH v2 0/4] i2c-hid: Save power by reducing i2c xfers with block reads To: Sultan Alsawaf Cc: linux-i2c , Jiri Kosina , Aaron Ma , Pavel Balan , Andy Shevchenko , Benjamin Tissoires , Hans de Goede , HungNien Chen , Jarkko Nikula , Kai-Heng Feng , linux-input , Linux Kernel Mailing List , Mika Westerberg , You-Sheng Yang , Wolfram Sang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 8:26 AM Sultan Alsawaf wro= te: > > From: Sultan Alsawaf > > This is a fixed resubmission of "[PATCH 0/2] i2c-hid: Save power by reduc= ing i2c > xfers with block reads". That original patchset did not have enough fixes= for > the designware i2c adapter's I2C_M_RECV_LEN feature, which is documented > extensively in the original email thread. > > Here is the original cover letter, which still applies: > "I noticed on my Dell Precision 15 5540 with an i9-9880H that simply putt= ing my > finger on the touchpad would increase my system's power consumption by 4W= , which > is quite considerable. Resting my finger on the touchpad would generate r= oughly > 4000 i2c irqs per second, or roughly 20 i2c irqs per touchpad irq. > > Upon closer inspection, I noticed that the i2c-hid driver would always tr= ansfer > the maximum report size over i2c (which is 60 bytes for my touchpad), but= all of > my touchpad's normal touch events are only 32 bytes long according to the= length > byte contained in the buffer sequence. > > Therefore, I was able to save about 2W of power by passing the I2C_M_RECV= _LEN > flag in i2c-hid, which says to look for the payload length in the first b= yte of > the transfer buffer and adjust the i2c transaction accordingly. The only = problem > though is that my i2c controller's driver allows bytes other than the fir= st one > to be used to retrieve the payload length, which is incorrect according t= o the > SMBus spec, and would break my i2c-hid change since not *all* of the repo= rts > from my touchpad are conforming SMBus block reads. > > This patchset fixes the I2C_M_RECV_LEN behavior in the designware i2c dri= ver and > modifies i2c-hid to use I2C_M_RECV_LEN to save quite a bit of power. Even= if the > peripheral controlled by i2c-hid doesn't support block reads, the i2c con= troller > drivers should cope with this and proceed with the i2c transfer using the > original requested length." Reviewed-by: Andy Shevchenko for I=C2=B2C DesignWare patches. > > Sultan > > Sultan Alsawaf (4): > i2c: designware: Fix transfer failures for invalid SMBus block reads > i2c: designware: Ensure tx_buf_len is nonzero for SMBus block reads > i2c: designware: Allow SMBus block reads up to 255 bytes in length > HID: i2c-hid: Use block reads when possible to save power > > drivers/hid/i2c-hid/i2c-hid-core.c | 5 ++++- > drivers/i2c/busses/i2c-designware-master.c | 15 +++++++++------ > 2 files changed, 13 insertions(+), 7 deletions(-) > > -- > 2.28.0 > --=20 With Best Regards, Andy Shevchenko