From patchwork Fri Apr 13 17:01:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 10340607 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E652260153 for ; Fri, 13 Apr 2018 17:01:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D11FF28926 for ; Fri, 13 Apr 2018 17:01:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C55A828942; Fri, 13 Apr 2018 17:01:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 646E628926 for ; Fri, 13 Apr 2018 17:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbeDMRBx (ORCPT ); Fri, 13 Apr 2018 13:01:53 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:37113 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbeDMRBx (ORCPT ); Fri, 13 Apr 2018 13:01:53 -0400 Received: by mail-wr0-f193.google.com with SMTP id l49so9832187wrl.4; Fri, 13 Apr 2018 10:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=/Des33KFR5GiL0QQzqwV1N3XT8DInJsHdTpmwW6dQbo=; b=XKIjNqTz4M+x53IBf40Uq1n4l6uPNLJ9qxlBXijfll/ARemvQ6h5mq3/XJemirmffX PsekBKfxzQ1SgXC45V/ypgkPek+Q+2KDDO9XDqBOQD+D08kXMdDjzzhy7pzBwCeJtZAq QzMYMntKM+YbxsQEaoKhSVcTeo3C+/+tTDlTv7TTizK+H0XzM/IqwYG+EZ2KDOJPcoZb MGqhpSeZviEsFqzP174tz+WPhFqDBRsPghQ0Xz9prv7WXxclKm9ljtlmdsnrYoFu5oH4 FbfVWMx5tNElHNu2HXGQsOc3WO1ejz/bF3v/oC6ZcKAg1FhJmXt24u7tenYzxL2pYoSc GATw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=/Des33KFR5GiL0QQzqwV1N3XT8DInJsHdTpmwW6dQbo=; b=Ey75LSee5ci1jk5jfM3qEpB4/C4/FqRgQJ8166AJTYA85vYa4FEUY929cNwL9jFQBS yFi2hPnyTTTWCCm1eHyTcN6Q4hLX0d9CGgkDi18zwGo29UrTAW3S9OYwmiEWN9DQzX3i SL4Z2qHE9bhDLuixJ4d6ah7miLtSSHC2mjxSt/O5bn3K/ZUMd0cLtCQsfbXwRnyywKPr uSVcacZEdbG8XCKQMJzcys1OogzlpSX1mDRxCoP8kWk8PDlD3e0uisiOK0gsYvMFCKCV pj3KnKA+EPUZP/pWMUlBrpJ/igIlAZmI/Z4lC3bvhPYhi0mmS6EyONNsnsi8tIrrYhMW tYNw== X-Gm-Message-State: ALQs6tC5Z156NkjxARcjQtX7ICkRrdnKbiYiu4JNjme6uUfAchpU8CjZ UJTotIPrfU+qYGpnF5IYwmjBMGU= X-Google-Smtp-Source: AIpwx4/sDC3w2WniSnV/RmDcKkazOGf2eTk2lUigLr0TbkyFIGwlx1WOG+5VDwkZMNP5mdd4n05DRQ== X-Received: by 10.28.163.5 with SMTP id m5mr4410869wme.33.1523638911352; Fri, 13 Apr 2018 10:01:51 -0700 (PDT) Received: from groucho.site (ipbcc0ce2f.dynamic.kabel-deutschland.de. [188.192.206.47]) by smtp.gmail.com with ESMTPSA id 33sm4554170wrs.74.2018.04.13.10.01.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Apr 2018 10:01:50 -0700 (PDT) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org Cc: wsa@the-dreams.de, geert@linux-m68k.org, linux-spi@vger.kernel.org, magnus.damm@gmail.com, Gaku Inami , Hiromitsu Yamasaki , Ulrich Hecht Subject: [PATCH] spi: sh-msiof: Add spi_master_suspend/spi_master_resume Date: Fri, 13 Apr 2018 19:01:48 +0200 Message-Id: <1523638908-21924-1-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gaku Inami Add spi_master_suspend(), spi_master_resume() in PM callback since it needs to start/stop the queue during suspend/resume. Signed-off-by: Gaku Inami Signed-off-by: Hiromitsu Yamasaki [uli: simplified code, added pm field to platform driver] Signed-off-by: Ulrich Hecht Reviewed-by: Geert Uytterhoeven --- Slightly brushed up port from the BSP; tested to execute on suspend/resume without breaking anything. CU Uli drivers/spi/spi-sh-msiof.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index ae086aa..db30aad 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -1415,12 +1415,35 @@ static const struct platform_device_id spi_driver_ids[] = { }; MODULE_DEVICE_TABLE(platform, spi_driver_ids); +#ifdef CONFIG_PM_SLEEP +static int sh_msiof_spi_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev); + + return spi_master_suspend(p->master); +} + +static int sh_msiof_spi_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev); + + return spi_master_resume(p->master); +} +#endif /* CONFIG_PM_SLEEP */ + +static SIMPLE_DEV_PM_OPS(sh_msiof_spi_pm_ops, + sh_msiof_spi_suspend, + sh_msiof_spi_resume); + static struct platform_driver sh_msiof_spi_drv = { .probe = sh_msiof_spi_probe, .remove = sh_msiof_spi_remove, .id_table = spi_driver_ids, .driver = { .name = "spi_sh_msiof", + .pm = &sh_msiof_spi_pm_ops, .of_match_table = of_match_ptr(sh_msiof_match), }, };