Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3552733imm; Sun, 13 May 2018 14:15:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4N/eOy2tmUdg7gLNSO4cwa3VL1rb7Y4oWCILuF7SV5qdFxZ8MvZxLo8ch/bExl+voPoAt X-Received: by 2002:a63:7b0d:: with SMTP id w13-v6mr6296985pgc.221.1526246133503; Sun, 13 May 2018 14:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526246133; cv=none; d=google.com; s=arc-20160816; b=EaohAVa6KkWeiFXyC9uizqU89V7Hz6cYJwFn0mkHA4uzgvDiySUvHrMX5kLUUtcfCq FlWAepR6hCV9XWthdAswBmr+CTMqFe5Q8S3StzkU9xc71nG299fOO/J634vwakNn5QpN qEVMQTGdpf2Q1qkj6HJUoXFVAnokNmQM6OtNzTNt8MTlt7qsleonqOi56vmqIN8PvId3 c46eNsDkJz1MI56eVFkddR1aDjOC44iNEEaf76DoR0ik9FrO3/lzLoR12xSKHacwuhCR yenKztkjv6cJ8Zxwguwf2LJdg89X0kGxlU9A6tTt+aZJhHd5Z7ijGo9R8erBT/I+KM3O vs8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=SwcyOYoyDQMZLXBAiz788OBGVb0zyL+XHauK8rNjRbE=; b=bh1tLp9NRYdLCEu9Yj1GN7q5l66A+jSGob3NEklxirocZYtyhe8szG7LnrLthfzT0A F23VzOnSKJjbNu0mWM/kVpSyv+qa7RXWDwAPaDRrfAKFtwSoIidcbW463t3JRLcpnJzL eCxx18+8TAFa/99T5yrDJl9R0avGJOloryq1pSZjCyjZ0TCRk7KUGBDKut+DE2NyOngU Mt6DwCtxRjuV9/lAmSjZoyNRAJtWzAr6xTBgxtPqi2iSfEQL0UxV9iZUVr+pusFZDuZ+ OXHEeSyZNfNUL1XHdv4WV6TgU7cPIpTzoN6JOOAiHELCSwcEmigjzqF05OCqqWUwfCdx xsig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=A9StMnwR; 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 c86-v6si8437191pfl.319.2018.05.13.14.15.17; Sun, 13 May 2018 14:15:33 -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=A9StMnwR; 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 S1751596AbeEMVPG (ORCPT + 99 others); Sun, 13 May 2018 17:15:06 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:34058 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750985AbeEMVPE (ORCPT ); Sun, 13 May 2018 17:15:04 -0400 Received: by mail-pl0-f65.google.com with SMTP id ay10-v6so6169436plb.1; Sun, 13 May 2018 14:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SwcyOYoyDQMZLXBAiz788OBGVb0zyL+XHauK8rNjRbE=; b=A9StMnwRouuoWRwrQoYhvrJdoYGx8rEJdGzNLbDu/ifB2kaoS5NGP4MeKNyNqTtczR fuMXxG8wkmU2whzRNWXs5Ki/RTKlzNdrQww36bOzZqza6G64AOGgOwZNI1e5o9wtS2As U8o5yC8RxNcuSfQOJ4+Q/6aic+nNPRkY++LWCfBWjNCRVSEU+YMvxjpFrHghOk6/KqR7 Apg3RViMQhJa6uDTs+fDQGeAZkeUmDwgTTottgHU3apmCwkebWdISb9iuHrTciSlDm1F uvD8cwedk7ASYX2t5g6EZTKQWefDhlp+WYF1Xw36vjHv+S5+Gd9Do4uyIv3CXPaXmuUB Izyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SwcyOYoyDQMZLXBAiz788OBGVb0zyL+XHauK8rNjRbE=; b=jP7sIFi1Y+6rDwHa4upc79x5LsRnyMcEpDopV6qMyDIgGa4y4CtfLq+KyCIrLs/s75 CYwVkJkVkoR3DeKDRfHdLr60CXqhNfvR9Krvsx/g6dC5HyYolnXQMAMu/THsr2RqlDIT xP/pkc8YPQYy+wSOAWCRuHRm3ZKtabnzl9Kwl+caVAUFPB4CD9vYyFEn4vIKfi0KS+RE QIsB8++MaORpBvJ7mSjhlSouq3enOfP9wPgwCb/8KJRsvremeijkyLLDoOeQMhuOrLBO rrviaUmjC4y66BPpev6xN39eDsjMcyBGYcaVjEKK6L2zLPmmYQQXRMOBmF6mOOZIjKm4 4L9Q== X-Gm-Message-State: ALKqPwcRos27Os743gQBtWFwffGC0nZk3f2timksuq1vt9orCY5EVjUN I6y4nJBXh+yO0fPoDGqLxac= X-Received: by 2002:a17:902:2a43:: with SMTP id i61-v6mr7229568plb.54.1526246103775; Sun, 13 May 2018 14:15:03 -0700 (PDT) Received: from localhost.localdomain ([109.252.91.232]) by smtp.gmail.com with ESMTPSA id z62-v6sm18098493pff.57.2018.05.13.14.14.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 May 2018 14:15:03 -0700 (PDT) From: Dmitry Osipenko To: Wolfram Sang , Thierry Reding , Jonathan Hunter , Laxman Dewangan Cc: linux-tegra@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] i2c: tegra: Remove suspend-resume Date: Mon, 14 May 2018 00:13:47 +0300 Message-Id: <20180513211347.7187-1-digetx@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 60292d243e24..5fccd1f1bca8 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -173,7 +173,6 @@ struct tegra_i2c_hw_feature { * @msg_buf_remaining: size of unsent data in the message buffer * @msg_read: identifies read transfers * @bus_clk_rate: current i2c bus clock rate - * @is_suspended: prevents i2c controller accesses after suspend is called */ struct tegra_i2c_dev { struct device *dev; @@ -194,7 +193,6 @@ struct tegra_i2c_dev { int msg_read; u32 bus_clk_rate; u16 clk_divisor_non_hs_mode; - bool is_suspended; bool is_multimaster_mode; spinlock_t xfer_lock; }; @@ -734,9 +732,6 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int i; int ret = 0; - if (i2c_dev->is_suspended) - return -EBUSY; - ret = pm_runtime_get_sync(i2c_dev->dev); if (ret < 0) { dev_err(i2c_dev->dev, "runtime resume failed %d\n", ret); @@ -1051,37 +1046,9 @@ static int tegra_i2c_remove(struct platform_device *pdev) } #ifdef CONFIG_PM_SLEEP -static int tegra_i2c_suspend(struct device *dev) -{ - struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); - - i2c_lock_adapter(&i2c_dev->adapter); - i2c_dev->is_suspended = true; - i2c_unlock_adapter(&i2c_dev->adapter); - - return 0; -} - -static int tegra_i2c_resume(struct device *dev) -{ - struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); - int ret; - - i2c_lock_adapter(&i2c_dev->adapter); - - ret = tegra_i2c_init(i2c_dev); - if (!ret) - i2c_dev->is_suspended = false; - - i2c_unlock_adapter(&i2c_dev->adapter); - - return ret; -} - static const struct dev_pm_ops tegra_i2c_pm = { SET_RUNTIME_PM_OPS(tegra_i2c_runtime_suspend, tegra_i2c_runtime_resume, NULL) - SET_SYSTEM_SLEEP_PM_OPS(tegra_i2c_suspend, tegra_i2c_resume) }; #define TEGRA_I2C_PM (&tegra_i2c_pm) #else -- 2.17.0