Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1717742ybi; Fri, 12 Jul 2019 22:49:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwy4LSMQaBlOmexpk0bVGw//T5IExwpWcKhls0hdUIkZJiNcvqtwFUOPLZyA8eRi0bcZT2/ X-Received: by 2002:a63:2784:: with SMTP id n126mr14761981pgn.92.1562996970052; Fri, 12 Jul 2019 22:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562996970; cv=none; d=google.com; s=arc-20160816; b=E+bfjcVhj7oHqfIDMhECgsBQMlQ0q3oqwVCxFvf1wTKowiDK3926pU2OIjH8s7W+8i C3pwNxqgrCUFUJJL3tsaCVBshMMXPMVDug4Q8K37BUa55U4mhDODck/6md47ELvJhiWy ld7ttnVhrs8MiqWn8WScmjH1zLI575pCUeuSLLDIdLA5nibj01qBidP1wgfShb8ya/Vl 3fekDf2vQ/zpirp3lF1z4AGDu2byYYAvZGjWe/TOXT9cjZaokfV29fiT+i/Gp/z6JGzo ElOuYewhRaPw6Kbl8DQj/vId0YmIr8yGc/1CiFoVqJNh5wtQ1fQwKuJxRHkzcDB55iuo ojLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=V5YSXRCDqJE1Lp26gLju5B4zeiq8tooctY2ofUX9yHk=; b=IhaLX4b8ILMx1cx4JFFO/IgtG6HzA6J2ath+86rjNgSqkj+tc1gOLcdu3/4A6u2Ufl pagAfjn3vNbYiEURjxoXHVG7Pdg8AlIi3a6TOeS3+cXePHvZW2IW6lWyCKazvWWEKfIn aCd8IeAAp/gXTyIZb03pFP24Cigt5QzK7WYaZCUQUQcGmSF656eQtvRxaYXfXJFZ2AKZ A5ZQe+T+ezzKWKksdZ4KrgBYJEXKK/BYlF8z1jqKd4GvBUDrihekNTBenk88yUSms8h2 l8OEc7vtARAuYy0ev/FJuvagh50BPsALTEohWv7zHDuj1iLx+iNPAA5cYwciR+tw/MB0 LQeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="lh0EZF/E"; 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 l3si9977124pju.85.2019.07.12.22.49.03; Fri, 12 Jul 2019 22:49:30 -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="lh0EZF/E"; 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 S1726454AbfGMFsd (ORCPT + 99 others); Sat, 13 Jul 2019 01:48:33 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:7981 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726274AbfGMFsd (ORCPT ); Sat, 13 Jul 2019 01:48:33 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 12 Jul 2019 22:48:36 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 12 Jul 2019 22:48:30 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 12 Jul 2019 22:48:30 -0700 Received: from [10.2.168.186] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sat, 13 Jul 2019 05:48:29 +0000 Subject: Re: [PATCH V5 02/18] pinctrl: tegra: Add suspend and resume support To: Dmitry Osipenko , , , , , , , , CC: , , , , , , , , , , , , , References: <1561687972-19319-1-git-send-email-skomatineni@nvidia.com> <1561687972-19319-3-git-send-email-skomatineni@nvidia.com> From: Sowjanya Komatineni Message-ID: Date: Fri, 12 Jul 2019 22:48:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1562996916; bh=V5YSXRCDqJE1Lp26gLju5B4zeiq8tooctY2ofUX9yHk=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Transfer-Encoding: Content-Language; b=lh0EZF/EXutxhJHjbOnyiFdZQVa3y+6Hmv6X30h/cLCkgQvxYLkDoxZhcS8Xo7Wcg mZWe0bR93O7MxjKIrD4Ti3I4L0G7SYW4LuWfrdOR9ua5JaJBowk+TURP6hHZ8Pxxp3 J413BHjoDl2u5Jghi/X05Gtg5f3KBhOC+rCYTs234Cqob53Gt5F20gmOIU9ZAJD+uG 4lYsOV8hHtkPNqw+ILqf0EXg6hRFah/Z/ZswQEeI5bZE7nKa8Doi8S3t8LUTjONMxl 84FCiO+IH5IPQUVeQD4FNo01eLumxzNZOEwXZS4mlfd8iopt5GKN00mNwwMfb6RZeG KpXF1CUL0ay6g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/29/19 8:46 AM, Dmitry Osipenko wrote: > 28.06.2019 5:12, Sowjanya Komatineni =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> This patch adds support for Tegra pinctrl driver suspend and resume. >> >> During suspend, context of all pinctrl registers are stored and >> on resume they are all restored to have all the pinmux and pad >> configuration for normal operation. >> >> Acked-by: Thierry Reding >> Signed-off-by: Sowjanya Komatineni >> --- >> drivers/pinctrl/tegra/pinctrl-tegra.c | 52 ++++++++++++++++++++++++= ++++++++ >> drivers/pinctrl/tegra/pinctrl-tegra.h | 3 ++ >> drivers/pinctrl/tegra/pinctrl-tegra210.c | 1 + >> 3 files changed, 56 insertions(+) >> >> diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/teg= ra/pinctrl-tegra.c >> index 34596b246578..e7c0a1011cba 100644 >> --- a/drivers/pinctrl/tegra/pinctrl-tegra.c >> +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c >> @@ -621,6 +621,43 @@ static void tegra_pinctrl_clear_parked_bits(struct = tegra_pmx *pmx) >> } >> } >> =20 >> +static int tegra_pinctrl_suspend(struct device *dev) >> +{ >> + struct tegra_pmx *pmx =3D dev_get_drvdata(dev); >> + u32 *backup_regs =3D pmx->backup_regs; >> + u32 *regs; >> + unsigned int i, j; >> + >> + for (i =3D 0; i < pmx->nbanks; i++) { >> + regs =3D pmx->regs[i]; >> + for (j =3D 0; j < pmx->reg_bank_size[i] / 4; j++) >> + *backup_regs++ =3D readl(regs++); >> + } >> + >> + return pinctrl_force_sleep(pmx->pctl); >> +} >> + >> +static int tegra_pinctrl_resume(struct device *dev) >> +{ >> + struct tegra_pmx *pmx =3D dev_get_drvdata(dev); >> + u32 *backup_regs =3D pmx->backup_regs; >> + u32 *regs; >> + unsigned int i, j; >> + >> + for (i =3D 0; i < pmx->nbanks; i++) { >> + regs =3D pmx->regs[i]; >> + for (j =3D 0; j < pmx->reg_bank_size[i] / 4; j++) >> + writel(*backup_regs++, regs++); >> + } >> + >> + return 0; >> +} >> + >> +const struct dev_pm_ops tegra_pinctrl_pm =3D { >> + .suspend =3D &tegra_pinctrl_suspend, >> + .resume =3D &tegra_pinctrl_resume >> +}; > Hm, so this are the generic platform-driver suspend-resume OPS here, whic= h is very > nice! But.. shouldn't pinctrl be resumed before the CLK driver (which is = syscore_ops > in this version of the series)? .. Given that "clock" function may need t= o be > selected for some of the pins. selection of clock functions on some Tegra pins through corresponding=20 pinmux (like extperiph clks) can happen after clock driver resume as=20 well where clock source is restored to state during suspend before=20 selecting clock function on that pin.