Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4307557imm; Mon, 14 May 2018 05:50:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquESpnWZeiBPWSsUdfbelFVXtmeVdstFIue/rDXDiDYLblH5fFuBaDxp+k0VcPHvEwgaur X-Received: by 2002:a17:902:5602:: with SMTP id h2-v6mr9966319pli.115.1526302200586; Mon, 14 May 2018 05:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526302200; cv=none; d=google.com; s=arc-20160816; b=P5LMqOXTtXcFVbGatk5HPPJVn2awB6pbp4XOV3DHuroxRuolbLl8ZrJg43wSs5ofZw QDDoP76mIi8NM+4kqJV2zvY+4v2iRjGZrYF0KoQKL9Mpi9lXLtZ2VMKuRmoMcQ7u2+se 7vFGsGlOZkFNs5tc/DbfFNK6+7b6d2aOdwMQoifnqPTHOutf9TOHxj4Ukod//J1h051g tPVIcDNtH8XLDc2DBAt9305qRxxg3LxsxqHZig9e9QJnmOXJ1uBEmOCEmLo4paYIa/DU 2beO9b13bAvwCg+63izASu/ORObeg3MhhU7GDP5tfoaIR7IVEThTBYaYRlIUAyWgAfQ4 gPwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=WZUz6ngC5Qa9TyFeKrp23JdHd2d8VnwOl4XkPYRvpqM=; b=qCpi6E6kLEIkYYnI4TPZGrEHv+xchLOuCl7RLD8jLz0+NxQQiKgJv9lbUgDnDkzCYw uPqEG9tqN4OXoYsu4HgWzbwj7rh7CjstBCZWR7xNx2Mo8AnHWnOYlydYsaJ8SoZaZ0fo CrR4sW61saTnHh/4hq16f8BnezQTtjL/MzZhf2024bJ3JAPuWLfWeyJ8ooQq1KEgp2ho 1HgH+lsp5UO0unDvTHjmXjQFEepPENunHPAjiOnRjsowwfweAuGnlBquwHVw5c7doMU+ Q2Yi59qRuGk4b0aL2pG2XlxBzIYOGDF3fUDXx0SJJcIn/bXdr3nZDHuB1+Vlswr+fbEd GUuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OUAvmhXD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23-v6si9714402pfd.153.2018.05.14.05.49.45; Mon, 14 May 2018 05:50:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OUAvmhXD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753482AbeENMr3 (ORCPT + 99 others); Mon, 14 May 2018 08:47:29 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36713 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753281AbeENMr0 (ORCPT ); Mon, 14 May 2018 08:47:26 -0400 Received: by mail-wm0-f67.google.com with SMTP id n10-v6so14919406wmc.1; Mon, 14 May 2018 05:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WZUz6ngC5Qa9TyFeKrp23JdHd2d8VnwOl4XkPYRvpqM=; b=OUAvmhXD0xdmuTVi5XiYHR5vf2P/5hj+ItRZNZADAOwZI/CZFoibTS72WnkCkjyZXk Q9Tu6LtdMK5bQMRZ0cWYoZktW5EK8zoj7stB+8X6bAG3XCnXNO8NirsGu8sduonD+rz5 BszaUCJbDSs+abQoPcWYux1ELDFpURrk29UN+XvavESLfAL2CKO9vDwMm1zpe3/GJ/mq /OsTsJ/sOGeT/u3TySjtoW/38GGS2USlAoL/XtGj777KR3Kuk4+sF8bjCHHp1qSCDshC wr+cXYaQrNQijzlEk6iE4gy8nreKY9WSc/YUHhVd513OBYOHSRfKmHlqFMpCTBeL+kYw er3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WZUz6ngC5Qa9TyFeKrp23JdHd2d8VnwOl4XkPYRvpqM=; b=nd7qcf6schNdHDY9q+DsOCzyfMrw0oDjdzLbQ8dDdaZIi8NbACq97qJYPTcwjAwd3z 660RTCONEz+dovTixLXWXs68mH8IbV/daIzkLPCMhxi1XMfKmU8VUuC7h741f72Fo75Z alA83/SSnLEc1uFreAD/pPDl+c8KvDo9AzpbzvjfClKCuRRqPwKOWgVAVtBgSCtjbaN+ wTwZRoIuBdrv9zBqSvXwjK+3dpg5myB9GJ4fYdAVMGvMT7H00KL1Z7YLu7+krAj7HkeO 1YM/2PCSJ/uyCqmxK51QPzP3thT/m3lgKpb+H5y9mWW5GZQ5vZ54Ra5/Hl02sDDkzoPL u+ow== X-Gm-Message-State: ALKqPwclKCKnJxpH582VsN5UFnqtCRx9uxlOlTf6ghYCoXggz8w/ts4+ 62cKDFpa/8JUnbuLRMA8tjU= X-Received: by 2002:a1c:374f:: with SMTP id e76-v6mr4802061wma.141.1526302044992; Mon, 14 May 2018 05:47:24 -0700 (PDT) Received: from localhost (p200300E41F19FC00D958180F3872A5C5.dip0.t-ipconnect.de. [2003:e4:1f19:fc00:d958:180f:3872:a5c5]) by smtp.gmail.com with ESMTPSA id a185-v6sm9802995wmf.30.2018.05.14.05.47.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 05:47:24 -0700 (PDT) Date: Mon, 14 May 2018 14:47:23 +0200 From: Thierry Reding To: Laxman Dewangan Cc: Dmitry Osipenko , Wolfram Sang , Jonathan Hunter , Shardar Shariff Md , linux-tegra@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] i2c: tegra: Remove suspend-resume Message-ID: <20180514124723.GJ18312@ulmo> References: <20180513211347.7187-1-digetx@gmail.com> <20180514115933.GH18312@ulmo> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BEa57a89OpeoUzGD" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --BEa57a89OpeoUzGD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 14, 2018 at 05:51:58PM +0530, Laxman Dewangan wrote: >=20 >=20 > On Monday 14 May 2018 05:29 PM, Thierry Reding wrote: > > * PGP Signed by an unknown key > >=20 > > 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 be= ing > > > suspended, this results in -EBUSY error returned to the clients and t= hat > > > 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 re= ads > > > the status register while Tegra's I2C driver is suspended, i.e. just = after > > > kernel enabled IRQ's during of resume-from-suspend process. > > >=20 > > > Note that the removed tegra_i2c_resume() invoked tegra_i2c_init() whi= ch > > > performs HW reset. That seems was also not entirely correct because m= oving > > > tegra_i2c_resume to an earlier stage of resume-from-suspend process c= auses > > > 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 cas= e of > > > using lowest power-mode during suspend, which upstream kernel doesn't > > > support. > > >=20 > > > 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. > >=20 >=20 > 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 all= ow > the transfer when system interrupt disabled in downstream. > SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(tegra_i2c_suspend, tegra_i2c_resu= me) That seems to me like it shouldn't be necessary. If all clients are properly suspended, then when the I2C controller gets suspended there should be no pending transfers. That's provided that the driver model properly orders suspend of clients vs. their controller. I think it didn't use to do that (especially when deferred probing was involved) but I remember that getting fixed sometime in the last couple of years. > In shutdown path, where interrupt disabled and still need i2c, we use the > bit-bang method via GPIO for i2c transfer. Do we really need to bit-bang the GPIOs? Couldn't the I2C controller operate in a polling mode where only the interrupt was disabled but we still polled the status register to know when a transfer was finished? Thierry --BEa57a89OpeoUzGD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlr5hVsACgkQ3SOs138+ s6GL5Q/8Cl1aMjNKGqcGrhayr5QbjG5arrOLj90/fmCnVgZrX2XkCny8MkbXvPcz q/HNi2TRBwvaBOfGGODKM3NtTsxmMWmpSmDS1AChaVtyI0YLLbcof20dJylv4WAY RqSp3aDJs6254RjN3TUg5E2MlHA/f+sNeOyaL91j1XfN77dCGiqI4i7AflFfWJp+ 0s5r+hwGOGvt+BBXc6NZQlGM4M8TKwWDYSM+ae+nccKJSBcQo7Mjns/49vnOUD4G 6Sd6zk5gceNokgK6YEWzGU/YmK06kDwkJU3HMFJ2XP6wzNgj+ayL10YJTv9Tjep1 sO3vLYv9H62uoaFsNWXBXDpkwiMv+wgJGjderVeO4q/aF5SNm7K3iZdssoxQ3buH 9zVFWWLR+ZkVPmnLRVnWlqmijaA0C1ISAVat5fG8SuQZdz43/ilBjlCO11EIDfcL a5wqYlsHpDrd5Aw7g/1fX0WxYiHRggV77+5eCTPPOceQEtweY+S1T9flBYeMGzOm KF53+gvwZ2x8HS3cOlb6GlU68RHDa0fk+pHkOimzyPs7+xdVucyzsTfynLuNAqXG 2VQ/tkUgDq1+AHfkAy1FedpQc9/rEbzNT2UL0ZFLjMBaaxFt6+NBPFAjmNKLsyTu NrNV7eopWVtIkjtIafV1/zyRHjFq8mlfqCttcu2pj2//zIcw8CY= =cpLT -----END PGP SIGNATURE----- --BEa57a89OpeoUzGD--