From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758297AbcDHMSF (ORCPT ); Fri, 8 Apr 2016 08:18:05 -0400 Received: from mga02.intel.com ([134.134.136.20]:58751 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757888AbcDHMSD (ORCPT ); Fri, 8 Apr 2016 08:18:03 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,449,1455004800"; d="scan'208";a="928249981" Subject: Re: [PATCH] i2c: designware: do not disable adapter after transfer To: Lucas De Marchi , linux-i2c@vger.kernel.org References: <1459478866-3896-1-git-send-email-lucas.de.marchi@gmail.com> Cc: Lucas De Marchi , linux-kernel@vger.kernel.org, Wolfram Sang , Mika Westerberg , christian.ruppert@alitech.com From: Jarkko Nikula Message-ID: <5707A16D.2010800@linux.intel.com> Date: Fri, 8 Apr 2016 15:17:49 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1459478866-3896-1-git-send-email-lucas.de.marchi@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 04/01/2016 05:47 AM, Lucas De Marchi wrote: > From: Lucas De Marchi > > Disabling the adapter after each transfer is pretty bad for sensors and > other devices doing small transfers at a high rate. It slows down the > transfer rate a lot since each of them have to wait the adapter to be > enabled again. > > It was done in order to avoid the adapter to generate interrupts when > it's not being used. Instead of doing that here we just disable the > interrupt generation in the controller. With a small program test to > read/write registers in a sensor the speed doubled. Example below with > write sequences of 16 bytes: > > Before: > i2c-transfer-time -w -a 0x40 -x 6 -n 20000 -- 0 0 0xd0 0x07 0 0 0xd0 0x07 0 0 0xd0 0x07 0 0 0xd0 0x07 > num_transfers=20000 > transfer_time_avg=1032.728500us > > After: > i2c-transfer-time -w -a 0x40 -x 6 -n 20000 -- 0 0 0xd0 0x07 0 0 0xd0 0x07 0 0 0xd0 0x07 0 0 0xd0 0x07 > num_transfers=20000 > transfer_time_avg=470.256050us > I gave a test to this patch and saw similar improvements when dumping large set of registers from I2C connected audio codec. echo Y > /sys/kernel/debug/regmap/i2c-10EC5640\:00/cache_bypass time cat /sys/kernel/debug/regmap/i2c-10EC5640\:00/registers >/dev/null I checked the runtime PM status of adapter was suspended before running above cat command in order to get comparable results. Before patch time was ~0.55 - ~0.76 s and with patch applied time was ~0.16 - ~0.25 s. Hopefully we'll find how to prevent regression on Christian's machines. -- Jarkko