Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2590642ybt; Tue, 16 Jun 2020 09:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5dW4MRG/9+LYwZ8m/XfQJFuF5u8m1YcBhnMeh7bpYgu29YsVhtfhbjKIzATjLwflBk3PI X-Received: by 2002:a17:906:32d4:: with SMTP id k20mr3452994ejk.364.1592325913488; Tue, 16 Jun 2020 09:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592325913; cv=none; d=google.com; s=arc-20160816; b=cVFOnQTzI5Z46qLI8U8HlrLwRHlL/B0nbWJMsfckEB0L+tJpSuZ5jVvTx1vO3ou+iU LzjkBeVdsQgGJPKRkLOSzMJTccHrbt69OT0nI8RaUMJ3Lqd0wc7yahGXXX7ZCDM9FMV1 LkI7BKlhvVYFWRWotLEQGg4/kWUYv7EnyhMEsagKoZYwGE4dshVivTWqjdPSQzN9zupB 6qpfZMnEvMEP2hIjPGbyQmOUgLIUwLPj44CXHcHHoqRgjvZiQYMnSqwlvMqmRGZEZqKX nldJrz/8G1XyZcQLNxheSrCBEv9W4Cubpbp83vqViHAcady3sSJlNMSb5N4ItaC45KfW Jgsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=poU2igctl0GcnORO0mQYasLAd6SH8GxlxumkwWPnDb4=; b=thBwVXmkajxK46KyFdJAVQS7cxxC9UCAbgz2pOxLatXpYid16xzyPj3/8RAZJAeoiu /b+a7/gVuQZ5VLdVSYo4nUjsoMPw38f85BWwzc6AnyYS/hB7ckoODhz3J3eHyaVo+0LX UgP23mLOhoIFXLDOskKqocRuo1KZ9ZSdEf9MYwnoYJviLJ0VXEm25nP97Dv6zfXCIbUN 7GPlWPAVi+Qey8mFVfDN5o1cBwpT0a+9kRdfS9T0dsj0FMJ+xz2lgIeuO6NjakUXNJOz FSOCX1xvKZI6kFRLkYRTRZkYuycBEIp4FcyqEIrB39zjrXS9QVLD/ZCdPY0Sbldp7aOT PQ+A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si12346851ejy.140.2020.06.16.09.44.51; Tue, 16 Jun 2020 09:45:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729784AbgFPQlF (ORCPT + 99 others); Tue, 16 Jun 2020 12:41:05 -0400 Received: from mga07.intel.com ([134.134.136.100]:41184 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729128AbgFPQlF (ORCPT ); Tue, 16 Jun 2020 12:41:05 -0400 IronPort-SDR: qmZyRixgNGHyu/UWp921TM85C6Ta/qcy4FvXhNRQsSHMZUVjPC7/eAx2h0PtIOHBGzA026ox9D 8ZraUZeuj3GQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 09:41:03 -0700 IronPort-SDR: vOTL9Z9BRo/G3pbkgYs1YGSfddmO6CUcxYjGuz7mKVEO6WPdtEplFfuA7hAAj5snw1hRJWTyYh KkAHxDxAyDCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,518,1583222400"; d="scan'208";a="298972651" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004.fm.intel.com with ESMTP; 16 Jun 2020 09:40:59 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1jlEdx-00DsI7-UL; Tue, 16 Jun 2020 19:41:01 +0300 Date: Tue, 16 Jun 2020 19:41:01 +0300 From: Andy Shevchenko To: Sultan Alsawaf , Andi Shyti Cc: jarkko.nikula@linux.intel.com, aaron.ma@canonical.com, admin@kryma.net, benjamin.tissoires@redhat.com, hdegoede@redhat.com, hn.chen@weidahitech.com, jikos@kernel.org, kai.heng.feng@canonical.com, linux-i2c@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, mika.westerberg@linux.intel.com, vicamo.yang@canonical.com, wsa@kernel.org Subject: Re: [PATCH v2] HID: i2c-hid: Use block reads when possible to save power Message-ID: <20200616164101.GY2428291@smile.fi.intel.com> References: <20200616154951.3050-1-sultan@kerneltoast.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200616154951.3050-1-sultan@kerneltoast.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 08:49:51AM -0700, Sultan Alsawaf wrote: > From: Sultan Alsawaf > > We have no way of knowing how large an incoming payload is going to be, > so the only strategy available up until now has been to always retrieve > the maximum possible report length over i2c, which can be quite > inefficient. For devices that send reports in block read format, the i2c > controller driver can read the payload length on the fly and terminate > the i2c transaction early, resulting in considerable power savings. > > On a Dell Precision 15 5540 with an i9-9880H, resting my finger on the > touchpad causes psys power readings to go up by about 4W and hover there > until I remove my finger. With this patch, my psys readings go from 4.7W > down to 3.1W, yielding about 1.6W in savings. This is because my > touchpad's max report length is 60 bytes, but all of the regular reports > it sends for touch events are only 32 bytes, so the i2c transfer is > roughly halved for the common case. > + /* Try to do a block read if the size fits in one byte */ > + flags = size > 255 ? I2C_M_RD : I2C_M_RD | I2C_M_RECV_LEN; AFAIR SMBus specification tells about 256. Why 255? Andi, am I correct? -- With Best Regards, Andy Shevchenko