Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4705653pxt; Wed, 11 Aug 2021 12:05:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwObyLZrrB7T0pipmJpOX91jepQB0DSxMUzncWhr1SpZtLEg462+7uPpZCnhH1douhqScVC X-Received: by 2002:a92:6503:: with SMTP id z3mr1405791ilb.258.1628708732180; Wed, 11 Aug 2021 12:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628708732; cv=none; d=google.com; s=arc-20160816; b=VEDt2LgKvnrbo9QvwGKerDHAj+hSkGM3smppW2IkFb28nYSX7yWEBwsxXEHoqmVG/q +7xpELWCpV43TYlOpbya4Ju+fIJS4hHwHtw5mEHRt9afRzcCOiZTjKGqXuPFvvn4vCol Cz4JdG+vYj4E2dkagGkGrrSPfaaRym0+PRlSKw9788EJN2h1Xb58FPzfEMGdosPjwNLQ EztayvxjQPWnVYKSfQ1Y0GoLqnsHISp7Hy7rVBZVFWPfWaKTiWl4bXcw4X+dKIfF1kro Ni/Zs4csS1LSwliuYRZgvXZCXeIncdN+ggdoYX0Bf1fp5tMrfDRERmZPmSkYsmU0nbk5 hh4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=v5Vu9aZBmdP+Jr7hBzk15imFcZepXERnAkfrfZhtuN0=; b=xjShiBOikFPj/4++b8R5KQvJRj/lBgHycr8tvJfl4aXpwI8HlagkkGGTtoYpv05PI+ TNP2/rkCNzZEkGzwBf5Pxdd29GCY32Zdf0hm04wLbsgvKWGUpT55YnT/qjOr9Va3Xl+8 s5A4jcGSqixVnSR+jGabyBdqKNdk8+JMFAwwgtv2VpWhuPj7YkkVIf4F9Y+kMwKmczNt q8vFtF4kG9RUh4nC0y3zIPI53OZP2AkRyQU9zFRHMbqK/Lq+8BsXMx/nzlZBYm4XLzle tx/w4b5GRd6KyGdR+nEVF3TeC86VV68imyNNC7o5HmBzAAw3mErx5CgNe1Vzf+3LFSLP NnpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Tcq5bmPN; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l19si362668jad.9.2021.08.11.12.05.20; Wed, 11 Aug 2021 12:05: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=@cirrus.com header.s=PODMain02222019 header.b=Tcq5bmPN; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231133AbhHKTFD (ORCPT + 99 others); Wed, 11 Aug 2021 15:05:03 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:62196 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbhHKTFD (ORCPT ); Wed, 11 Aug 2021 15:05:03 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 17B9h6i2011884; Wed, 11 Aug 2021 14:03:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=PODMain02222019; bh=v5Vu9aZBmdP+Jr7hBzk15imFcZepXERnAkfrfZhtuN0=; b=Tcq5bmPNSj6da9PLgEgELcUNG7zA94JWT9v4PaVnCcMZmqJbxbQbKO1G/p951nKKyRw1 Xifk1aTwMmGUON2pTL3ExISdKlUG5WYNON8O/ZL6Lgiy9tVCC2ols0r79Y+WpIRi/eCJ 6Qh6+cMpBRIjTda0I5/GIJ4aXLiATtVcHnZMIWxRmjZhb/VWDxjXGvzsZ1zhcq/j95Rz SPEDYBuhhqWkx//0wJ0Z31/uMRkdWB/PxGtxJsEZ13BhFXTH3poCMR4uAUtkdrrMNXjm srmDzOE7YvxRIaCKfOCb+CI4fe5Jg7RiLVMTxPKTD13asGDrbUH4/rDwGsLF17QRKtbf jw== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 3acc5ngp6n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 11 Aug 2021 14:03:56 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 11 Aug 2021 19:33:49 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Wed, 11 Aug 2021 19:33:49 +0100 Received: from [198.90.238.180] (unknown [198.90.238.180]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 59D1145D; Wed, 11 Aug 2021 18:33:37 +0000 (UTC) Subject: Re: [PATCH v3 13/27] ALSA: hda/cs8409: Dont disable I2C clock between consecutive accesses To: Takashi Iwai CC: Jaroslav Kysela , Takashi Iwai , , , , Lucas Tanure , Stefan Binding References: <20210730151844.7873-1-vitalyr@opensource.cirrus.com> <20210730151844.7873-14-vitalyr@opensource.cirrus.com> From: Vitaly Rodionov Message-ID: <499860c1-bf6f-969a-a987-3302820b66af@opensource.cirrus.com> Date: Wed, 11 Aug 2021 19:33:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-ORIG-GUID: rOFeh5WWX3Sx3NKLHQtwpYVvFBDZHmBR X-Proofpoint-GUID: rOFeh5WWX3Sx3NKLHQtwpYVvFBDZHmBR X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 mlxlogscore=763 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108110130 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/08/2021 9:03 am, Takashi Iwai wrote: > On Fri, 30 Jul 2021 17:18:30 +0200, > Vitaly Rodionov wrote: >> From: Lucas Tanure >> >> Only disable I2C clock 25 ms after not being used. >> >> The current implementation enables and disables the I2C clock for each >> I2C transaction. Each enable/disable call requires two verb transactions. >> This means each I2C transaction requires a total of four verb transactions >> to enable and disable the clock. >> However, if there are multiple consecutive I2C transactions, it is not >> necessary to enable and disable the clock each time, instead it is more >> efficient to enable the clock for the first transaction, and disable it >> after the final transaction, which would improve performance. >> This is achieved by using a timeout which disables the clock if no request >> to enable the clock has occurred for 25 ms. >> >> Signed-off-by: Lucas Tanure >> Signed-off-by: Vitaly Rodionov >> Signed-off-by: Stefan Binding >> --- >> >> Changes in v2: >> - Improved delayed work start/cancel implementation, and re-worked commit message >> adding more explanation why this was required. >> >> Changes in v3: >> - Cancel the disable timer, but do not wait for any running disable functions to finish. >> If the disable timer runs out before cancel, the delayed work thread will be blocked, >> waiting for the mutex to become unlocked. This mutex will be locked for the duration of >> any i2c transaction, so the disable function will run to completion immediately >> afterwards in the scenario. The next enable call will re-enable the clock, regardless. > This looks almost fine, but just a couple of thoughts: > > - cancel_delayed_work_sync() means to it might keep the i2c enabled > after that point (just cancel the pending work). > Would it cause a inconsistency afterwards? > > - A similar procedure is needed for suspend callback to cancel / flush > the work. > The shutdown is another question, but usually it's fine to without > any special handling as long as the resource is kept. Hi Takashi, Thank you very much for your comments. It all make sense. We will make further improvement and submit next version. Thanks, Vitaly > > thanks, > > Takashi