Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751351AbdH1Xbr (ORCPT ); Mon, 28 Aug 2017 19:31:47 -0400 Received: from mail-cys01nam02on0125.outbound.protection.outlook.com ([104.47.37.125]:29802 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751300AbdH1Xbm (ORCPT ); Mon, 28 Aug 2017 19:31:42 -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: Mon, 28 Aug 2017 16:30:59 -0700 Message-Id: <1503963061-14763-7-git-send-email-ryans.lee@maximintegrated.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503963061-14763-1-git-send-email-ryans.lee@maximintegrated.com> References: <1503963061-14763-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: BN6PR16CA0010.namprd16.prod.outlook.com (10.172.212.148) To SN1PR11MB0848.namprd11.prod.outlook.com (10.163.208.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0bfd7205-a9d7-4bf1-ee37-08d4ee6ceefc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:SN1PR11MB0848; X-Microsoft-Exchange-Diagnostics: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tjSSFPNuBvHhVcZbfiBxq66Sf7pJBN7S0NGviRZTTTKneV2grENTpBnQiGmHJKAZekK0TzVtgHNkB2CiV+CxTAynUMabgIvjVOwU0MyrFheETtf+VimmVef5xiyia0fqlOGRRrp05jZLixDY3p1Nx2rMpLpQnUZz0pp/hTSJzgyoxI7PxkCx/tstyMf92CRyJngjepAZ7EsHhCUBkb04wQwZC+HI+b+OjIqOQu/rQKwaVfeXlvchWKRCBoLKLsn7bUSNA3p34f73v+7KR/++3plWZmO3hHPlB0M4Xrh1boTgsBJu1HG2Z495UN39+akIK6NvBg5f420M+uPNkLMa85Jaazz2poxJyuz6f4;4:xMzW9eh/hxTnq9yO9IHvPVxioj7EtIZcsCFksbJjnAFrGmwB28nJT4zTGbA2DEUQmOoCOQS3IBpi6xUMsKYKqPXVmxZeZIo+11JSO4FTuGxsFhn471DYUG6OZjQBWB7VFCpVpHzw11O+LRXozh3Dk8YzIav+1rb2hlb7Mbp0+5dH9G2ZrjIEDGUhtlqUFKm/h4qY0Ys/DI2S1veibCl+rBB8/nwD79uxJNlxEDQmOO0AOqmER57kO1q2dwg04avG4FftmbOkzpbEjyY7gk0NCh1EBsyzqFPdY+I9/EYUGi4= 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)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR11MB0848;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR11MB0848; X-Forefront-PRVS: 0413C9F1ED X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(7370300001)(6009001)(39860400002)(199003)(189002)(2950100002)(101416001)(81166006)(6666003)(6486002)(6506006)(25786009)(48376002)(8676002)(50466002)(81156014)(305945005)(97736004)(36756003)(72206003)(69596002)(7736002)(5660300001)(53936002)(50226002)(478600001)(86362001)(50986999)(76176999)(2906002)(6512007)(53416004)(42186005)(110136004)(33646002)(106356001)(105586002)(189998001)(4326008)(3846002)(5003940100001)(47776003)(7350300001)(66066001)(68736007)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR11MB0848;H:ryan-ThinkPad-T430.maxim-ic.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR11MB0848;23:RRzJM9SmSLHlqw3kXPT00z0rn6swneoAty5FfQVam?= =?us-ascii?Q?0EOnll94a4h71iodqHOmqxNxRltbQ0a3hydN9xwpCzz91yAYc3THOLjGBzkO?= =?us-ascii?Q?16jocODl/qpf5Fip0ft3njTk0d2QoqqRhrfWPKPyFruBXsA1XO+61x9D14oO?= =?us-ascii?Q?8ZQZKcok5+s7XdfYWQZAQSSK71BnccTs3q5K4KgY8VG5qt+cuCk9hzaijGrY?= =?us-ascii?Q?GVI6u03d0K3jAp5EWkDdz93lpKcG381Fdo0/uPSanjlaDpLXNCJoOrK3Xrry?= =?us-ascii?Q?291utMtLvZ75QaUUTMFIcFZUdEQlvC+8RJ41YRxliPMlCc60fuNva9/95x60?= =?us-ascii?Q?E3NoFXZjBKOYxO5Ry7jGl3BGKP2JwazXcVBxpGNiM86t8vp/ERSQVYdsl4b2?= =?us-ascii?Q?Qk2eQNs0Zj/3JrWXv5wbSdvNerssZZKooZ2RQTt1YR2uIl00lS8tWVr5nubQ?= =?us-ascii?Q?amzphSeIdMXiKRqpvy2Bla96KWMoHUPFzZL+mvamWL81OQuVviOjSDqDXbKJ?= =?us-ascii?Q?5oTaHIzWx2gy85Yehcl0CSSYibTBxE+gxNMVzgSIZmcReUf63zKFVn7uaoRp?= =?us-ascii?Q?B1B7g8JATIqp44+6zFDEnnc1OkDw9NwX17IVuK+0fc7iXjAi4jdGPULMeEUa?= =?us-ascii?Q?PzkPxI8fXGMp3FLlqHlw1g+qcAXxJnvJ3ghHzMRDQz0S8wp441c330kEkoTK?= =?us-ascii?Q?Xlct/ikQIp03JSgMwYrhi+sysJK2BLwGatVRlNVjgbdls17LeG9ZAnegV9i5?= =?us-ascii?Q?QMpaqlJU/fFRV0Jp8/5XlHiJOrvV7Y31ah9sGUyh68P4bbeUjRQV/f2xvRy2?= =?us-ascii?Q?/Dvjm4NxuJUzxw47eQ12XGvjZfxZoWtUNA3j4PuRJHCQ9tOqrnFMsMkSUnjC?= =?us-ascii?Q?McgP+HLGfIhkiB0QKzooP1MajgxATKo1uYxAv+4RZ7O9TH0d2rFafPQuYDKA?= =?us-ascii?Q?t/z2r+mabl7yW0sNu0xA84/38nsFJjcfWItM54d+PXU6bF3cIP70Jo0JVKnk?= =?us-ascii?Q?Ny158wxLdEkHptFoo2R4Rl18CgasZsqVCIsnOYnMFtOM148xGVWGsR3aEUh0?= =?us-ascii?Q?8zRQiq4JboKsR762J2/kag7oGEoaj/5h4ZgCXIwX6kIAFh3iTkcL+c730e1T?= =?us-ascii?Q?cA77bti5TcImav924pkNu/Sy5qnFrep7+KuudqqjnTtSBz7pPGWVQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;SN1PR11MB0848;6:pElH5JP8vpIyhx+UZd/GTPKpLzRxGcpyAuHZpt/dKpErEkW9wR3Q5IPCstg2RRCx54prXSU25WEF8y7GM+gGq82INE3aaUTl40qYFdUYoVlNZebgeVLExnfvcxfyZNikVRjC0cxl+GEDEpDKAdMhiWF/I99fjkyafJ37ddnaO7z7X3DbgEaCcaI45aIfYFvQnzajprU4PJiot75s0fbeUkP4TjmbdYujfcsMJyfSebhtci5EWF/DnMwxz/NIcoXuiJIvdae41N1zqlfXK1ekz8+0acYyRDjMKDZiee8LNvZ/Rxpar+1ylMFMy8Rhoi+aNLsQ3iy8X3dtQdYnkd0zHQ==;5:1noKI2zct156zCl5wsXIFbqzC9ukDMZK67oV2py7zyTjyNX3vCLY+l8r0ltKzGvfWlT2e587ef9cTyEIeisNxaKmmUYpqKFMBwxarzPROWrg5ySt/iU6WfueWNX9CWhb9KB0AfTyuQji8zl2W7X02w==;24:G2Wk7EyZjmrCKmlKA6M2ZzMFOSCBMwCaSctPwpySYScPnJaE5gpF918DOlf1Hh9PkRGhLJyxJBOrlrnYq7+feHenLh8hOkQPCwoYTm/eZKQ=;7:25BZD0qYsCyqqttQSXbIg7iL46fwLQ03TwqPqkxf7b8VAZB1k93uSJbU2v5Y8T27XCTigguUzWu5kgzabzuP7D7uoPWgwcbsG4WMAyAP8nveUzHzI52lNlWkiZrSxUy6ywFi+93ImKhIfOuMLd7vAU2UMslsTLDQl5OMTUMP8FzHvjhtye591mXgW9U4VLyqdjUpLJishzZQu/M2Fc8yogUS7DKGzj6M6URgdENnaNg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: maximintegrated.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2017 23:31:38.8576 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR11MB0848 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1537 Lines: 52 Signed-off-by: Ryan Lee --- 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