From patchwork Wed Apr 19 17:46:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Kaneko X-Patchwork-Id: 9688503 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 DC2FC602DC for ; Wed, 19 Apr 2017 17:48:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D267428354 for ; Wed, 19 Apr 2017 17:48:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C71432841F; Wed, 19 Apr 2017 17:48:09 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 6596728354 for ; Wed, 19 Apr 2017 17:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968671AbdDSRsJ (ORCPT ); Wed, 19 Apr 2017 13:48:09 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:33453 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968587AbdDSRsI (ORCPT ); Wed, 19 Apr 2017 13:48:08 -0400 Received: by mail-io0-f194.google.com with SMTP id k87so5593874ioi.0; Wed, 19 Apr 2017 10:48:07 -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=PbQyUHHMugwzim0cCFbBMeA6CcDtttiSPVWgESJdOLU=; b=dgQM8eBBqRkeEBktCR6x1+gDPhLIGAjPRQPodejQYCX5gzXYinJMaDDXOAyP4LRYT9 FB1bAwglRuPFWSuJozS1ZscWujvQvqxd5afQAVr3DUfSZY0GPN6G471olSofEiJXotaG oE8icHE2DYvvKvORZe8Ok4P40ZPRDBD23+CDqFfJWDTY91VkojpbZbqudqcyZZgP/wSE i4KBWaxTmxAEXsTJ5qC0NmWCq2AZid3hDuNONlZuDC51EM/K+KqJvjL1e+Hbi2w5oMIc 5vKypnz0RNTWE7zhnEI/5kyzd5jOGyQl7f+b7rric7iw99R4tsNaT+yXX38seqMPuIkQ ClOg== 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=PbQyUHHMugwzim0cCFbBMeA6CcDtttiSPVWgESJdOLU=; b=KoGfhjRdRdUDa9+B8zQKS5XDSbBhauoZkeHhpViShoH97qilE/Ant7mxFxbGIGZ204 XHIhmon/UL/bpcZN411taXrp8laYS/5gsGKCE82FcrofSgnzKG0uPmV34abD6DJccWhi G6tQj2CFQt+xRlbSyEVmqRJwyYzqBiH4eSahCeVqkJmT8rjboycqcl7/7E9tT/uqIt2p 31VnXcQ1Roa+q6JgUw257yDuUZmHcZn+EGyU4Ij/AjppYdzmsSxj2Sw1EICSwAgOVMqG xhfKdaEVZ3qUMHPV1fbQg0eYFFseulnMRDc6fqhXKx1finK/BWLszgBs7ZzXBJ5Rx04C F4jg== X-Gm-Message-State: AN3rC/7KC+Wf37a6PAemw6HZA8d3qEXV/z9saX8M+KB7AfRBTw0tPmdG BXNrwGtYuENp4A== X-Received: by 10.98.204.93 with SMTP id a90mr4110811pfg.6.1492624087262; Wed, 19 Apr 2017 10:48:07 -0700 (PDT) Received: from localhost.localdomain (KD118152108246.ppp-bb.dion.ne.jp. [118.152.108.246]) by smtp.gmail.com with ESMTPSA id x68sm5760574pgx.57.2017.04.19.10.48.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 10:48:06 -0700 (PDT) From: Yoshihiro Kaneko To: linux-clk@vger.kernel.org Cc: Michael Turquette , Stephen Boyd , Geert Uytterhoeven , Simon Horman , Magnus Damm , linux-renesas-soc@vger.kernel.org Subject: [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process Date: Thu, 20 Apr 2017 02:46:32 +0900 Message-Id: <1492624001-3758-12-git-send-email-ykaneko0929@gmail.com> X-Mailer: git-send-email 1.9.1 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 In the resume process, there is the case that other drivers call cs2000_enable before cs2000_resume is called. Since the order of resume process is not guaranteed, it is needed to reset the clk rate in any cases before cs2000 is used. Also, the current cs2000 driver is using resume_early function. The using .resume_early is bad idea because the dependency with other drivers is to be complicated. This patch adds to reset the clk rate in cs2000_enable and changes to use from .resume_early to .resume. Signed-off-by: Gaku Inami Signed-off-by: Hiroyuki Yokoyama Signed-off-by: Yoshihiro Kaneko Acked-by: Kuninori Morimoto --- This patch is based on the clk-next branch of linux-clk tree. drivers/clk/clk-cs2000-cp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c index 5b3516d..de6e8c6 100644 --- a/drivers/clk/clk-cs2000-cp.c +++ b/drivers/clk/clk-cs2000-cp.c @@ -338,6 +338,10 @@ static int cs2000_enable(struct clk_hw *hw) struct cs2000_priv *priv = hw_to_priv(hw); int ret; + ret = cs2000_set_saved_rate(priv); + if (ret < 0) + return ret; + ret = cs2000_enable_dev_config(priv, true); if (ret < 0) return ret; @@ -530,7 +534,7 @@ static int cs2000_resume(struct device *dev) } static const struct dev_pm_ops cs2000_pm_ops = { - .resume_early = cs2000_resume, + .resume = cs2000_resume, }; static struct i2c_driver cs2000_driver = {