Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754862AbdHZAm2 (ORCPT ); Fri, 25 Aug 2017 20:42:28 -0400 Received: from mail-cys01nam02on0131.outbound.protection.outlook.com ([104.47.37.131]:30527 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754488AbdHZAlk (ORCPT ); Fri, 25 Aug 2017 20:41:40 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=RyanS.Lee@maximintegrated.com; From: Ryan Lee To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, ryans.lee@maximintegrated.com, kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: ryan.lee.maxim@gmail.com Subject: [PATCH 7/9] ASoC: max98927: Added PM suspend and resume function Date: Fri, 25 Aug 2017 17:41:08 -0700 Message-Id: <1503708070-7906-7-git-send-email-ryans.lee@maximintegrated.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503708070-7906-1-git-send-email-ryans.lee@maximintegrated.com> References: <1503708070-7906-1-git-send-email-ryans.lee@maximintegrated.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [204.17.143.20] X-ClientProxiedBy: CY4PR15CA0022.namprd15.prod.outlook.com (10.172.74.32) To BLUPR11MB0835.namprd11.prod.outlook.com (10.163.217.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25a3cc81-4c4e-4ebd-304d-08d4ec1b3466 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BLUPR11MB0835; X-Microsoft-Exchange-Diagnostics: 1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961vMg8UV5g8lfUd7SE+nzHLRbhxkjj4wuFRonn7bTe/DnlTfRNtA2O5F5uarjsmuVCNz/mMWh6Ym6zGHWA8lR13wTeHEJGbi4zNa5gp8wqgqdWLrCaFbXT9B7BXndxxMDD7kP9Tx1vnklYpjdbdYjoPZXcmuofBSJWDwgCrgr0TLrtEO7en5hX1cJAcBM3U0bOL/PgdwmadDGtUb+H/sD1Bls6B3YYSWElcKjHm0eA89bfMs+gNNBJBmNgr1/FlA0nEF1Pi7QjvexmJ5y2Xx/zbIMLBq12Ez1ThZ3cSk8YgAQAsIAzL0F/NUXvTKqZxDTVGPSa1Nrn8I8MMGvMxw/rD9hKdLn8sOixdGdR+v;4:wTHIYYf95itinAc/FbgvURB0dz5bcOlgjOZ9WPMymfGYFCo0k40wqD+4zRiOfQv5+M2P2nUuCqtZxynrPyL/0WTGPE0WVdhMoX8v1g+Jm+yN+WCHOAD3aKZAYB7LcD3KwRJtG83Z/e6tGlRGx7VoTWFtZInkNBEjPmmn+DUKEoilMmCouASjNLZlXssGCK4zGRysjggLF16usM/rN9FqPXFRNNLcSu0IJMzduax+WMjYjXscK19COxjJUhAfT06SlrgnsdG422eS6X1F/MY+SBceV67HtMSq+R8QwqCTOTc= X-Exchange-Antispam-Report-Test: UriScan:(108721460000369); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123564025)(20161123562025)(20161123558100)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BLUPR11MB0835;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BLUPR11MB0835; X-Forefront-PRVS: 04111BAC64 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(7370300001)(6009001)(39860400002)(189002)(199003)(4326008)(72206003)(97736004)(81166006)(110136004)(81156014)(8676002)(53936002)(189998001)(66066001)(25786009)(478600001)(86362001)(47776003)(305945005)(48376002)(7736002)(50466002)(3846002)(50986999)(2906002)(6486002)(6506006)(6666003)(6512007)(68736007)(76176999)(101416001)(53416004)(50226002)(5660300001)(6116002)(2950100002)(42186005)(69596002)(7350300001)(5003940100001)(106356001)(105586002)(33646002)(36756003)(15650500001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR11MB0835;H:ryan-ThinkPad-T430.maxim-ic.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR11MB0835;23:vZdH69vU4XczyL6lZIHVgtiITYfhU+/d6MBx5X8h9?= =?us-ascii?Q?oa1gER7bYXFubVPPcldKjYvn8vOYMMYbiaCCoXue6/98A+IEsbeu9ygCnh+n?= =?us-ascii?Q?gdZSHCq6ILbyBmBk5xhRm3iJxTAjntBbY+v8HXlOYT6XZ96Bt6U0G5ZhzYa2?= =?us-ascii?Q?K2HOUjZhB4qN+d4lrDd7Hxs8tFI8PcDYCeiM5zpWVty37B9JsfTYYHRBBJDy?= =?us-ascii?Q?kWRSP7yPiRCiXce8cut3bz2nddJbcvT4PqEI3d39COCHgalVQqlzHzkgcH7L?= =?us-ascii?Q?xVxL1jgq8fXZEeTVHobKozHDme+uYqJpK3GTpZoNnrnbvxYe9eCtTOoVpngC?= =?us-ascii?Q?7pdrBfa1S/uhIp4xzn6hVGpXd7Rb2ulp3CHlTpbtYLh6IFKEvYbEfxw+x+NZ?= =?us-ascii?Q?s3mh+XkGbznhsTRI6HCNSACaF3rHVVic/4Rp5T0QS7OAO/+CEjbNAkgGReba?= =?us-ascii?Q?Xeph0EHttqqTW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crrUVfuXzTJhjqYpWCKLUnuKATIxl4EItvsRLngnU7frV1uvkzXPLt6xYB2UffNTKpCZJgxBrTXOvf9D59CEqMYbTccEw+NFfpkiZzteAK8NPvnfOlIA+o0JotyAZpiXhyBR2Dg95V/k8HJuIEW8rpu6hrzT5SFTrJaiZpMBRGQe1NHTwIJ04I+O6vXmQ==;5:pg4xqbgPltt7Rj60zNmEGB5exXB/U4HmcciuukkgOC8cfMqetkeSNySiqwNCIv8Hf6+yJuuXoRrV/XJMSXJXWJq9ESy75pKcQKw7sgLyzsgEI7X3oVBelFgSgE++SX/EsvF0NzQ9CYjpKxo+5NNK6w==;24:7xc1NZgXx/1OeJgG4eqAq82A7k212CQVDJlYSxSQLiLdvB+9avxz5mbQwnFa2mnLEfQ+FObRDckTZV4y/vxWHfl5LZWVcS+R+BqsJTatmIg=;7:jrmIqLfZ5JHHUR+vPZ3NvbxVx4hv3r5bul/dTkzfqRfKCMkrkxfulFHyVzJfUHwIwPRwahRuysKvPnsmEOwA0RMZpljk+0uKcBapHmr7deMr7+Se+4gy6kz9h0eQhh+Ad6kHzu3qlp4ZmKdT/KGBMMlYpnuoIYsPpFo7bcY/tU4n5z27LQmjYHjz4q3ry/rX4eU9NU1JRqe/GGZgEgYy4vycIZGkbY3ikiBK5jaV1Ek= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: maximintegrated.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2017 00:41:34.4872 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR11MB0835 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1625 Lines: 54 Signed-off-by: Ryan Lee --- Changes : added PM suspend and resume function to keep register values from power down sound/soc/codecs/max98927.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 3ab8220..5517251 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -803,6 +803,31 @@ static int max98927_probe(struct snd_soc_codec *codec) return 0; } +#ifdef CONFIG_PM_SLEEP +static int max98927_suspend(struct device *dev) +{ + struct max98927_priv *max98927 = dev_get_drvdata(dev); + + regcache_cache_only(max98927->regmap, true); + regcache_mark_dirty(max98927->regmap); + return 0; +} +static int max98927_resume(struct device *dev) +{ + struct max98927_priv *max98927 = dev_get_drvdata(dev); + + regmap_write(max98927->regmap, + MAX98927_R0100_SOFT_RESET, MAX98927_SOFT_RESET); + regcache_cache_only(max98927->regmap, false); + regcache_sync(max98927->regmap); + return 0; +} +#endif + +static const struct dev_pm_ops max98927_pm = { + SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume) +}; + static const struct snd_soc_codec_driver soc_codec_dev_max98927 = { .probe = max98927_probe, .component_driver = { @@ -936,7 +961,7 @@ static int max98927_i2c_remove(struct i2c_client *client) .name = "max98927", .of_match_table = of_match_ptr(max98927_of_match), .acpi_match_table = ACPI_PTR(max98927_acpi_match), - .pm = NULL, + .pm = &max98927_pm, }, .probe = max98927_i2c_probe, .remove = max98927_i2c_remove, -- 1.9.1