Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7473761ybh; Thu, 8 Aug 2019 16:48:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaNEP9QY4KeipNdzectqB5KtLkOifBPpiWnusY+skk6rZFTR18Ac+8Eu1DB9+PCmcQpCJl X-Received: by 2002:a17:902:f087:: with SMTP id go7mr16220347plb.330.1565308121135; Thu, 08 Aug 2019 16:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565308121; cv=none; d=google.com; s=arc-20160816; b=pVBboCjbkMkhZ2b2iol/W1lrZT5kaRI8Vlic70mgPROtzXUk5a1f+NuI+lI+fSn2Og nSZ9llZJ4nw7S8UPN3p6J3+aMOr1da8bn9CBVUyuryk1HDBwuxRwUi751jL5rGn0PRgC T+ydDOezioiFpFIHXwsEB8y2qZNCDlqCec3iXSbCxpBcsI0hARo/N/x6GTlJ8v+HARMr brmd/5IDoynBXfnzkFC8QC5xHQPGSiyOOWkL723GglRe1b+j8IQDQ5GXcwvurUgJ1Nil 82JDZlhH7hxmEGRYJH9QjAEUCm4f/RUJENmjqznFQFSSbkqadzkamkpVsL+FWZvGC9nG Uj2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=MetX0MEocYV00a7mqgBES36OrLqh3mkw6YdN4UcIjLE=; b=sGC7/HbZjzoxA1NX1xGW8Ly46o2/+vCvpskh9BmZBn+haVE+e0WGZ6kA5MHrx4rl9m FGtp/rOnCzBgby06TwFV124krVKL6yu8j4YU0qqWFKqPxRpikNZh5k0JoMUD4D66ZmbJ QOhFxCeYUu1HTzvVFeq0vQJLY7Ssk4fCf/rdrait7c/XbKZHCspvg0cZaO7/n5Pg/Crj M6xhxHgUO6YqW6PNnxTlc6r5Zxzht3eDII+2LIg06JXNsKLvb94UW1pgEqUvV73tv6xu GVjDzPiQYTKEi8ltLRGSIIwAkQGCZYQIoQ5ReJFthTy9F4gLFWXk9IjzR4q7HtPPt1wD yKZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=j1+RoJyz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h15si50051074plk.74.2019.08.08.16.48.25; Thu, 08 Aug 2019 16:48:41 -0700 (PDT) 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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=j1+RoJyz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404993AbfHHXrK (ORCPT + 99 others); Thu, 8 Aug 2019 19:47:10 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:17814 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404557AbfHHXrD (ORCPT ); Thu, 8 Aug 2019 19:47:03 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 08 Aug 2019 16:47:04 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 08 Aug 2019 16:47:03 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 08 Aug 2019 16:47:03 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 8 Aug 2019 23:47:02 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 8 Aug 2019 23:47:02 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.103.110]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 08 Aug 2019 16:47:02 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v8 03/21] clk: tegra: divider: Save and restore divider rate Date: Thu, 8 Aug 2019 16:46:42 -0700 Message-ID: <1565308020-31952-4-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565308020-31952-1-git-send-email-skomatineni@nvidia.com> References: <1565308020-31952-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565308024; bh=MetX0MEocYV00a7mqgBES36OrLqh3mkw6YdN4UcIjLE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=j1+RoJyzmRVH49PCMeOwe2iyZ4Inab12aqdo35yPrrIJJxqdXxedZW/R2mGsF7zj9 aTEvQbqqI4l1SBGC2WD3XHj3ObNy1J2gyre3zPcGRejFEfIO9zgzDb1xrFxrtdLTBt SKIv1u0oFe659xDDp41gBSUMaYh60Wl5YoNbZcS6UnlAG54+A05NiJBFViWe1hapVr nXF2wUoFvN1hkRU79tLW2HHD/bRhc1A7PnbMaHeWFUe9jzDwL80q6cwpHLIMTlV679 FySf0Suz20MXcTkyGjgLhjoj+q3SHQEiZdShSsUxQqn21hjOuPn6JzfZRHOnj1Jnqj XxyfLcQtEXHgQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch implements context restore for clock divider. During system suspend, core power goes off and looses the settings of the Tegra CAR controller registers. So on resume, clock dividers are restored back for normal operation. Reviewed-by: Dmitry Osipenko Signed-off-by: Sowjanya Komatineni --- drivers/clk/tegra/clk-divider.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c index e76731fb7d69..ca0de5f11f84 100644 --- a/drivers/clk/tegra/clk-divider.c +++ b/drivers/clk/tegra/clk-divider.c @@ -109,10 +109,21 @@ static int clk_frac_div_set_rate(struct clk_hw *hw, unsigned long rate, return 0; } +static void clk_divider_restore_context(struct clk_hw *hw) +{ + struct clk_hw *parent = clk_hw_get_parent(hw); + unsigned long parent_rate = clk_hw_get_rate(parent); + unsigned long rate = clk_hw_get_rate(hw); + + if (clk_frac_div_set_rate(hw, rate, parent_rate) < 0) + WARN_ON(1); +} + const struct clk_ops tegra_clk_frac_div_ops = { .recalc_rate = clk_frac_div_recalc_rate, .set_rate = clk_frac_div_set_rate, .round_rate = clk_frac_div_round_rate, + .restore_context = clk_divider_restore_context, }; struct clk *tegra_clk_register_divider(const char *name, -- 2.7.4