Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4096981imu; Mon, 10 Dec 2018 13:05:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/UabLdNkGNCP/6KCfxorcRXgZEfTwpKJ1IhV8wMxP601XF9LSDWZutdR8BqS+sL0seklU9F X-Received: by 2002:a63:6150:: with SMTP id v77mr11963028pgb.266.1544475931520; Mon, 10 Dec 2018 13:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544475931; cv=none; d=google.com; s=arc-20160816; b=emq4Ux7CiqViPQ++r59keJkgZmC4OY0pJ9wxYi7k7wI46ixnf9XPW29tiFzmUzj2JP k/zHbe4ud0gZCpYWqV9Qy9jcJMzu8do57nuEMRwTeeDLIBBGbWcIv/24DVf7r9YEftlO q6PLl2fhjPXZZbot2b4mvaFSDKNfNk56SgeSkm25exM15/kj+h8hR06+SB36sXTTuW5t ykVntBXXDIbEweDJhULbUBDM76Umw2ZSqQMXCdqr2LwkPtJmYCr/Akqwf1wxEYggTqbI mDlEVjBqMYJl3A0wMGzOXJWmojlJkTiFFZsx4HmF6lUAerugdtladSxfomGwTCli96D8 Lrfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=QPLsXz4A/TbPVRh3n1JGUgeuyf88cPmLxDAy4wLgPog=; b=FftndABVlV0a33/tZX60fVKNdughFmvkChFeNEURwcGrkNC4YOjlAffnOjkVjrb0MR G/K2fZxAf1WFqKOfwCbsVqT4o+XntcsOtdpfpBxUPfn7p3t/YoWiTNhJEnl6TAgE50rn MKRrTuB1JIsX9A2gwkJlqx7Hpc10vTxmZbNrvnYyD88bDWGAnhJSXDrl1DrI85Uphk6W vUpItIZph81EWahrtVPebpXpyq+OoRcjvq8ciH6T8OFnL2wt4v+j4RzGb/t0aW4qcI2u atX4Fxh2NSFUXSCFvyzew0SY9Eq/IUO/eZxZTsFvO7kdbnpPm+QwCeErub07Ww2tpaYp 7g+Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si10865518pla.65.2018.12.10.13.05.16; Mon, 10 Dec 2018 13:05:31 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729988AbeLJVDZ (ORCPT + 99 others); Mon, 10 Dec 2018 16:03:25 -0500 Received: from sauhun.de ([88.99.104.3]:36726 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729936AbeLJVDW (ORCPT ); Mon, 10 Dec 2018 16:03:22 -0500 Received: from localhost (p54B335CF.dip0.t-ipconnect.de [84.179.53.207]) by pokefinder.org (Postfix) with ESMTPSA id 46C014C3C85; Mon, 10 Dec 2018 22:03:20 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Hans de Goede , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Wolfram Sang , Hiromitsu Yamasaki , linux-kernel@vger.kernel.org Subject: [RFC/RFT 10/10] i2c: rcar: add suspend/resume support Date: Mon, 10 Dec 2018 22:03:08 +0100 Message-Id: <20181210210310.12677-11-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181210210310.12677-1-wsa+renesas@sang-engineering.com> References: <20181210210310.12677-1-wsa+renesas@sang-engineering.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because the adapter will be set up before every transaction anyhow, we just need to mark it as adapted to the I2C core. Signed-off-by: Hiromitsu Yamasaki Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-rcar.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 254e6219e538..30cff066e0da 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -1017,10 +1017,35 @@ static int rcar_i2c_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int rcar_i2c_suspend(struct device *dev) +{ + struct rcar_i2c_priv *priv = dev_get_drvdata(dev); + + i2c_mark_adapter_suspended(&priv->adap, true); + return 0; +} + +static int rcar_i2c_resume(struct device *dev) +{ + struct rcar_i2c_priv *priv = dev_get_drvdata(dev); + + i2c_mark_adapter_suspended(&priv->adap, false); + return 0; +} + +static SIMPLE_DEV_PM_OPS(rcar_i2c_pm_ops, rcar_i2c_suspend, rcar_i2c_resume); + +#define DEV_PM_OPS (&rcar_i2c_pm_ops) +#else +#define DEV_PM_OPS NULL +#endif /* CONFIG_PM_SLEEP */ + static struct platform_driver rcar_i2c_driver = { .driver = { .name = "i2c-rcar", .of_match_table = rcar_i2c_dt_ids, + .pm = DEV_PM_OPS, }, .probe = rcar_i2c_probe, .remove = rcar_i2c_remove, -- 2.11.0