Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4277476imm; Mon, 14 May 2018 05:24:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpTSECJHkohFM7VPkreVOH7AmVPdQsPXbv5Gy7twZ4xdfVfjG5vCdoVsLkYe0CuG48MCX4b X-Received: by 2002:a62:8ac1:: with SMTP id o62-v6mr10362030pfk.141.1526300654453; Mon, 14 May 2018 05:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526300654; cv=none; d=google.com; s=arc-20160816; b=Uw2T+HL6fEDxOT/QWieHwaeOpyey7XVfjAd7F2NvFUALdmRGBZuEycg7X1psPpfFKc ol3uNNQdszWvflkkYQ5KI/4iZxnxFb5gjnEylHL59j7IeBJMakI3XlgLsJX+w9F112rN xcsb/l+CdUtecNnJdcDIrhPC7idQ1IIX3ilJzIqGXkOlmiMEL32OxFCvXMHDVAW3Ra5i 1tUumdYoHuAf4xv/DOiU3rIvbz1x4aoN7TwZMFWwadXalJs9HF1coQywPbKwnA9vZlu1 kp/0qiCGW+BpGpHW2N3otSAIexPRXoSzoNkUdC3D+enaLH/4+zUoeodTXyzQcYfqOSKc 5ZQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=DmvVpCR+lD1CXHMr1LKxsx/+x49z0tGWitPNRgHppT4=; b=009YPJr7Ev4IzUH34U4xn/Cg/T+8Qbt6N8JItTOQ9kUcikPTNHoyNCaiNR7KJ5xpz3 +KjfzaLqFH1wX1hSE+MDM1nOSsHmuuz3XcbGhoZFNRK0P4dYhBftVuN9Urp68fejiMYj RlPkiR4FP8eJ+/T6dL4rptFwHUP48LP+lpGpZCvt9ANFWr+zXZxgBCImhHlnBuLnDX4X 1R/ZVuFit4tNVN4Xiq+HOzBFSSr677vuJGl3J4CuNWup6vxl+ngFG/orXd4W8PoHZflb V959v84XHseWE6ZJkySu8Qq1krsWQFlN81dlDo4BjxMNkunzx2+R8s16sicEGcRbqpov GB4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2-v6si5574562pgs.676.2018.05.14.05.24.00; Mon, 14 May 2018 05:24:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753235AbeENMWL (ORCPT + 99 others); Mon, 14 May 2018 08:22:11 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:13045 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbeENMWJ (ORCPT ); Mon, 14 May 2018 08:22:09 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Mon, 14 May 2018 05:22:06 -0700 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 14 May 2018 05:22:08 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 14 May 2018 05:22:08 -0700 Received: from BGMAIL102.nvidia.com (10.25.59.11) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 14 May 2018 12:22:07 +0000 Received: from [10.19.64.176] (10.19.64.176) by bgmail102.nvidia.com (10.25.59.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 14 May 2018 12:22:02 +0000 Subject: Re: [PATCH v1] i2c: tegra: Remove suspend-resume To: Thierry Reding , Dmitry Osipenko References: <20180513211347.7187-1-digetx@gmail.com> <20180514115933.GH18312@ulmo> CC: Wolfram Sang , Jonathan Hunter , Shardar Shariff Md , , , From: Laxman Dewangan Message-ID: Date: Mon, 14 May 2018 17:51:58 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180514115933.GH18312@ulmo> X-Originating-IP: [10.19.64.176] X-ClientProxiedBy: DRBGMAIL103.nvidia.com (10.18.16.22) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 14 May 2018 05:29 PM, Thierry Reding wrote: > * PGP Signed by an unknown key > > On Mon, May 14, 2018 at 12:13:47AM +0300, Dmitry Osipenko wrote: >> Nothing prevents I2C clients to access I2C while Tegra's driver is being >> suspended, this results in -EBUSY error returned to the clients and that >> may have unfortunate consequences. In particular this causes problems >> for the TPS6586x MFD driver which emits hundreds of "failed to read >> interrupt status" error messages on resume from suspend. This happens if >> TPS6586X is used to wake system from suspend by the expired RTC alarm >> timer because TPS6586X is an I2C device driver and its IRQ handler reads >> the status register while Tegra's I2C driver is suspended, i.e. just after >> kernel enabled IRQ's during of resume-from-suspend process. >> >> Note that the removed tegra_i2c_resume() invoked tegra_i2c_init() which >> performs HW reset. That seems was also not entirely correct because moving >> tegra_i2c_resume to an earlier stage of resume-from-suspend process causes >> I2C transfer to fail in the case of TPS6586X. It is fine to remove the >> HW-reinitialization for now because it should be only needed in a case of >> using lowest power-mode during suspend, which upstream kernel doesn't >> support. >> >> Signed-off-by: Dmitry Osipenko >> Cc: >> --- >> drivers/i2c/busses/i2c-tegra.c | 33 --------------------------------- >> 1 file changed, 33 deletions(-) > Shardar, Laxman, any thoughts on this? The is_suspended thing looks to > me like a workaround of some sort that may not be needed if clients have > proper suspend/resume implementations. Even without suspend/resume > support in client drivers, the driver core should resume devices in the > right order (I2C adapter before any of the clients), so I don't see any > cases where the is_suspended logic would be useful. > Our I2C driver is based on the interrupt. So we have converted the suspend/resume to suspend_noirq and reseume_noirq so that we will not allow the transfer when system interrupt disabled in downstream. SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_i2c_suspend, tegra_i2c_resume) In shutdown path, where interrupt disabled and still need i2c, we use the bit-bang method via GPIO for i2c transfer.