From patchwork Sun May 13 21:13:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 912591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="A9StMnwR"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40kc6v57sdz9s1d for ; Mon, 14 May 2018 07:15:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751182AbeEMVPF (ORCPT ); Sun, 13 May 2018 17:15:05 -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-Google-Smtp-Source: AB8JxZoflE4xilKFHRfLivDRi2UVvSCUMo9dcc8NFdl/HSlDjSLaQQmqc4wyURNpLAQ61ej3lSdX3Q== 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-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@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: Acked-by: Laxman Dewangan --- 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