From patchwork Tue Jan 10 06:50:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9506505 X-Patchwork-Delegate: sboyd@codeaurora.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 DC885601E9 for ; Tue, 10 Jan 2017 06:51:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D603A2823D for ; Tue, 10 Jan 2017 06:51:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA6DB28462; Tue, 10 Jan 2017 06:51:21 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 406B72823D for ; Tue, 10 Jan 2017 06:51:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765132AbdAJGvI (ORCPT ); Tue, 10 Jan 2017 01:51:08 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:6354 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754723AbdAJGvF (ORCPT ); Tue, 10 Jan 2017 01:51:05 -0500 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 10 Jan 2017 15:51:01 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 8B0FF70344; Tue, 10 Jan 2017 15:51:01 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 710C518070; Tue, 10 Jan 2017 15:51:01 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 689191806F; Tue, 10 Jan 2017 15:51:01 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id RAA30122; Tue, 10 Jan 2017 15:51:01 +0900 X-IronPort-AV: E=Sophos;i="5.33,342,1477926000"; d="scan'208";a="230153089" Received: from mail-hk2apc01lp0214.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.214]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 10 Jan 2017 15:51:00 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CaOnnUKwBSp/pTR4pXU/lZ5z9SUx3MKO11AnV5CHH1k=; b=aWBkMpC4mNKYc67R0CrRTtLh454LEwFkQeo7z+08z3G02Fz/sRlcgi4C2/LU3lQgLtCOUmVV8RwnphBCVK/OkjxPifSM7EcrAZO0xL6x1MieY/3ZqYaoCgs8dgkdvXQGlPV3Fm5ajnBKUxc/nUuuZZMBlDoHP2MrUJrtq03pKkE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HK2PR0601MB1442.apcprd06.prod.outlook.com (10.165.182.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Tue, 10 Jan 2017 06:50:58 +0000 Message-ID: <87pojvxve9.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH] clk: cs2000: add Suspend/Redume feature User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Simon , Michael Turquette , Stephen Boyd CC: Magnus , , , , , Gaku Inami , Khiem Nguyen MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 10 Jan 2017 06:50:58 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0105.jpnprd01.prod.outlook.com (10.174.152.151) To HK2PR0601MB1442.apcprd06.prod.outlook.com (10.165.182.148) X-MS-Office365-Filtering-Correlation-Id: 826807e8-f16f-47d8-6401-08d4392508c3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:HK2PR0601MB1442; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 3:iC7/YxYX+/lhZYW8qBY1KpI4+mtsrBSArlYQuEsppHGaNk/HUCuiKq/JqVeaiGE4ivRmpKRar6YuPu5ORBObPrJBsGikZvWVd3FzQkOmp7j2Rp6M+X0dGJ7CTKGfwq4BhvK1gbgCcMLJYA8TLYOejfK4SKD8oW/6P3K6kiDTK4b/8z5ZABY5tnjdBqAcfAVUwZu2b/tjjtHKb4OfQHLe9fbUgx6SVSc3x/oBMYaYlFnIQ9YHDrVYsI5RH6WC/yQH6ib8bSm39Zbi95yUBrGIWA== X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 25:6270IBH/lzp0BQFYEjmtsBwd4YsStY8mBlKG3VXZAt0rj7/rANar3r1nLPX+l+3V8WCuRh3hFIErMR9m5Wrj8DviZrqPYG3B/iIp8oI+eX+xjS0WsV0GXUnMySaqi3pKHNdsr5yzgvdAPo/aSadrA6YdGova44AFkfEKnVGFacOKXMDXhRcLw9CoS5fZcA/9w9+4cB9AVIF1VlLlNL+VFr8kBXvbSi75AV8HOtCPVh1lM6zGev1iQY+81EuobcnZom9IRQxg3tqZ1PSF+MnBH8JsRe+iPcfPoXL4Nm591fFGnf+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KovMRt2YrLvxU8UyjGyFDuj64WEUXvt6W2kKZw/xqch4xAShDrKVivU6OS5MrHNXSgqiEgDMgGYOLYflLFsSTlQ/N88s99I0Oh8Euck/mlcrcNf4r2nRV8FbKyfD2dT+oJC4KxJwTcRgCAB5SZhiKBxHO3phjNMil9/i3UAlief2xHqraGFLCXoKtEYS7oh35NrZZU0J0KK8UIoLax6S+Mql2m1iCer6FmUQZ8UTQTtR/482849/Sai6Or X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123558021)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:HK2PR0601MB1442; BCL:0; PCL:0; RULEID:; SRVR:HK2PR0601MB1442; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 4:mpOUw7zGQn3y2Hi//x/vZuEGQssfaOtUezGUo9iLMmXDwg8pT62O+x8VW1D7MQkdnfUmVIqLfcpoFyGjNmTRJhdq6Y7/0hBYxGjCw9I7sN4gqWOp/jxV6eUmptWSjoG2bvTOblVTetA07u2bokZ73dTXwmFADohE48Ct/JANc9yIp4stbAtJokfhHwdNklIssAEMyYm2ilvVXFFGmp9/s/OG4P6yFYxL9OoMuiK3KfaFkWXcsG77Zosf2m7yRGY4ypdp0cAYQoH/f1nZeJiFI6sQy35HS96G3vZOvkXjaGKceqCMq4WHb09hJQAn51Yg4GdkkzKYKTqo2mRVmHpvH33q7znmHLewDBMIZPJ3r7D4QecS7R9ZH7S5NbNPTJYKVezPHYgtcD8DGxYzXC4/cj6R9qbV2aQeJnTFSs7IzV7AiAgM5OI0/BmQGrRsVzCspInbqOg4XkoaMU/56d+sOUcyUF2X8suNvQblMxrx7PabjYFyNKCKgnx3SrSTrQf14HxwPE5v836daNCtOhuBR3mog/Y3qleJY+EkluyQNOdHWx51PDQ39JCpOZOtscPKPFWLJfCw2NdBqYfeBXyxkLIMQ12VRNwruW5U3HW6X+aFk6KsC+3Op/Sb6vt4k1pW X-Forefront-PRVS: 01834E39B7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(39860400002)(39850400002)(39450400003)(39840400002)(39410400002)(199003)(189002)(3846002)(101416001)(15650500001)(6116002)(23726003)(50466002)(33646002)(81166006)(81156014)(68736007)(86362001)(4326007)(8676002)(54906002)(105586002)(36756003)(106356001)(69596002)(53416004)(2906002)(46406003)(42186005)(189998001)(6486002)(25786008)(5660300001)(83506001)(38730400001)(5001770100001)(66066001)(50986999)(92566002)(54356999)(7736002)(47776003)(305945005)(4001430100002)(4001350100001)(97736004)(39060400001)(107886002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR0601MB1442; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR0601MB1442; 23:9yx4s56ZBm0mYxObl+0QgJomQ78lvXoBqxbXigv?= =?us-ascii?Q?zB9sYbnIyJuNXoJK8+tQY6e4U8L0LPQAMpC5izXPJmrX2bfV//uwDTYj466Z?= =?us-ascii?Q?0Gmo/w1pvkHnMGKL3WVSwHJgiT7rLBuQY9kcaijSKPC/SkbG3OR5ym+LwNFb?= =?us-ascii?Q?zy1Px03H2+7d2YwyWQqpr+X5WUoDC4EY1ph7wMBscaZtEHFvQuoeHY6Emgcr?= =?us-ascii?Q?+SJ1G8v+kUDJbMgk0wX6NBzQ2G7NHvABg2f5Q5oD02/8WkHdRnUAToeQLxty?= =?us-ascii?Q?EnF24wb79FwauAgoX3tPAd9RmP7s/veOWvl/QWoonkqC2Jzzz6IQ+kFgwbGC?= =?us-ascii?Q?O94XmDXjJ+OqGebWLLKtvtwx9vA8fxECftatp4oFjfgUq+ElY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zstuH3gH1nUfxGeq12HRV9k86PsE0fvEv/pTzd?= =?us-ascii?Q?iUxyiNh3jAgjgXNVX6S87VNw=3D?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 6:vucDhoZfd3NmPbsr7vgFX0Br9bUsb6uVUKeI967iZLld4nos5X8he8bCPUeZUxtyqPx64374UlLcLZggVr2cH3YR7IwhLOBJsHEVzoO3cfEsUOnSFv976RL0bmw9nX5Nmteb/6gaFwhmjm0VbGzzPrIvwUBhfGEvZL+CuQ0YjaoLQDnuow9e5cylg35X4KyjqEwwcvmb1/cLlzjoCZypU1odKGzWu5GXlJPJsBaW1aRXYGMvxfCqyO3IT8r8zOGQ/rlBtsbdOgC1Pb/B/ICpbEuZ620NessNRKBM8CLVxGOKaA92b/TgVs2PDocQtKgjNUNveITSaQdz5BCt3P6wBpkocrD6i2LAvVIwtGrSkxlM1oGKt1RbZwO+sRcMEsz3wt54sJDBu5fdHJFY8/MBgy/jSxJjdEq2dooGTlWYKTyEBPfupVckQD3kX2RhVEyk; 5:C84qA7K4+Cr7010GAIBS33SihNy+BC2zC9cQy6PwpMiUkjdw39fcCLaAAS5UZcMoTUck8WMqScbsMQ6HNEfmV5kwXQU3gfpvZYjZDiWnZ1qQWjM9Zxe65dvH1ZBlwIditxDdTQ4uV1hlZmVAsuWdoLI7D4E44f5wSmlQzmOLoy0=; 24:cwCG3q50Ra+CZbDxUEXxibCThMtGbzJyatqlShIFCHNZ7J3bOsUqMtDew3RK97s1WMCu3Mi00Ji9wZ/p7oaVFEQIYNwu9jMnYyB+KfF2kRA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 7:yUJXRp2z+ZWOvuABbi/UR4hHrPl4g1AVR579tr6uuJkM9jVf/mzKhTwAFJ4aeXdSiQVFI+ZikQxiaMvQiSK7aPf9uY69AaRyDExGdq8Kw23Xoa9n3VRmt0Lfri0w9zKToL0WgOQuBekKNiVIi9GfODPIOyAsgK5xGU7xsu044oKpIj1FjI60g0E22dANaurMBycwMr3hSdTm8YBTmzoYmR38vm0da9ebi3/td0Od14mLVkRZd6UEFzqAICaFx/aRJliQ5wtnbdsu4izz4MCOQU+XHVOqODF4yDHm/5Mh4o7nr3DucEpGxJMQxWsTfMFRZ6RbpQyRSwT3nktpJTxzpj2Ww8fZUiN/XurGHMlTH+8wtFdiA9Q121d13a/gdcIz80ONpKvTIDQhOf9+nYckBOm2X5ytSNqbA792r5Lh/9VbzsvzldsjwRK4Q3bM6WYWrhQzsSIlrolwCgn+XpTZcQ==; 20:qWwTmuuRqAL/4e72MpoXJCAE0YmdNEJXr9SfcCr4M9Vuhfhn7aTszbB5BMDnEQXsOJADM6N4UJjAcaGk7prJkM/jbHeiTFEeQjNVrMNKsvj6E87nD2tPv6IxtHc4AtRPbpT9NIqs+S6dy0+QKfOY1wJ6nV6dwn2artiywK2A/HE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2017 06:50:58.0421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1442 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Khiem Nguyen CS2000 needs re-setup when redume, otherwise, it can't handle correct clock rate. Signed-off-by: Khiem Nguyen [Kuninori: cleanup original patch] Signed-off-by: Kuninori Morimoto --- drivers/clk/clk-cs2000-cp.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c index 021f3da..3fca052 100644 --- a/drivers/clk/clk-cs2000-cp.c +++ b/drivers/clk/clk-cs2000-cp.c @@ -59,6 +59,10 @@ struct cs2000_priv { struct i2c_client *client; struct clk *clk_in; struct clk *ref_clk; + + /* suspend/resume */ + unsigned long saved_rate; + unsigned long saved_parent_rate; }; static const struct of_device_id cs2000_of_match[] = { @@ -286,6 +290,9 @@ static int __cs2000_set_rate(struct cs2000_priv *priv, int ch, if (ret < 0) return ret; + priv->saved_rate = rate; + priv->saved_parent_rate = parent_rate; + return 0; } @@ -489,9 +496,24 @@ static int cs2000_probe(struct i2c_client *client, return ret; } +static int cs2000_resume(struct device *dev) +{ + struct cs2000_priv *priv = dev_get_drvdata(dev); + int ch = 0; /* it uses ch0 only at this point */ + + return __cs2000_set_rate(priv, ch, + priv->saved_rate, + priv->saved_parent_rate); +} + +static const struct dev_pm_ops cs2000_pm_ops = { + .resume_early = cs2000_resume, +}; + static struct i2c_driver cs2000_driver = { .driver = { .name = "cs2000-cp", + .pm = &cs2000_pm_ops, .of_match_table = cs2000_of_match, }, .probe = cs2000_probe,