From patchwork Fri Aug 7 06:21:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 6965101 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 996D2C05AC for ; Fri, 7 Aug 2015 06:20:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BC232064B for ; Fri, 7 Aug 2015 06:20:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 515D520651 for ; Fri, 7 Aug 2015 06:20:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 35DB926071A; Fri, 7 Aug 2015 08:20:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, NO_DNS_FOR_FROM,RCVD_IN_DNSWL_LOW,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 12A2A260670; Fri, 7 Aug 2015 08:19:57 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 110D8260698; Fri, 7 Aug 2015 08:19:56 +0200 (CEST) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0106.outbound.protection.outlook.com [65.55.169.106]) by alsa0.perex.cz (Postfix) with ESMTP id 81B582604C5 for ; Fri, 7 Aug 2015 08:19:48 +0200 (CEST) Received: from DM2PR03CA0038.namprd03.prod.outlook.com (10.141.96.37) by BN3PR0301MB1249.namprd03.prod.outlook.com (10.161.207.25) with Microsoft SMTP Server (TLS) id 15.1.225.19; Fri, 7 Aug 2015 06:19:46 +0000 Received: from BN1BFFO11FD050.protection.gbl (2a01:111:f400:7c10::1:105) by DM2PR03CA0038.outlook.office365.com (2a01:111:e400:2428::37) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Fri, 7 Aug 2015 06:19:46 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD050.mail.protection.outlook.com (10.58.145.5) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Fri, 7 Aug 2015 06:19:45 +0000 Received: from b50113.ap.freescale.net (b50113.ap.freescale.net [10.192.241.89]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t776JeIj029536; Thu, 6 Aug 2015 23:19:41 -0700 From: Zidan Wang To: Date: Fri, 7 Aug 2015 14:21:05 +0800 Message-ID: <6fa4e6ebf1f34f5d637324c9f62e68b03037568c.1438928296.git.zidan.wang@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD050; 1:lXv+n/0VSMosGQ1q464n8MbA2IQGbu44IRScExnlxwQW6i+YKV91c6iauwh5Ludo0ca0xLnVJn3Y4WT3+P28ejKt0Arq2J0/tc9R72KJaLku8RJ0N4eogAbOLbxtwVIGeaZNDE2W4bHfsA0SX56fY91BkXSJ3qMee2zD8RRWLrqwUfV/vO1zLb8tMRDEjd9AkSW0UQEpQroZtoobNSoFOFIWpJZKkLNMHN6F50+f1SJj5y70AL3tljPz+k9HrZx650Gc/7TC9X3OWFz3gxqDrX9o5Ld7O88Eyx7SWcrrYGdt1mxAinufg6FpIwioc+QVp8c3sp07jXsx2Xm/20FHlQ4kxhaSmFi1uhjQplKy0Nk= X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(1060300003)(2980300002)(339900001)(189002)(199003)(77096005)(68736005)(5003940100001)(106466001)(19580405001)(6806004)(4001540100001)(5001860100001)(97736004)(81156007)(5001960100002)(19580395003)(5001830100001)(4290100001)(110136002)(92566002)(86362001)(107886002)(64706001)(105606002)(47776003)(50226001)(87936001)(118296001)(229853001)(2351001)(104016003)(110436001)(33646002)(50986999)(69596002)(85426001)(46102003)(62966003)(36756003)(48376002)(50466002)(77156002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR0301MB1249; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1249; 2:V80vCMT79VbeErxsHk7U4CLw2Fav/94yvy+ojy5JQq0fxbsvdlwxXiwmvzVWbd5LYRey7sYiYt5ZEhEtgAJFFK2TRcHf+vuItR3pcIrEPxNuf2yw4GR2M2RoL0lFRR3GP0ZkoyernsvIbCDOr7rjVpgo4paxeLQ86gxo+AOCP7c=; 3:1QbfLujBxnqQteq3e8vQTnSrrzWXEnXEGrrP9noA+AMzWCfh/yiEqSLDGrM8rtnwijkJuyKb8qjJ4jbq6KpYz9mh8Rp+yGOfAx6j4vQg4CRpgcvjQdMWb90hVQlGdNFzIIrCDJwmmFQi+CGTDW8a8vQuCj1dhFJrzvBc7Ul+2ISOnixG0z6Cr5/+DwQ2AGxfFeYq0ujy3uljS6DamPOlnCCzlPJcvw5kVsSzAMeZWaY=; 25:jWpp3R/QctqnC5liSTfNPHEQY8G9KBs3eTw06Qb7iFGSGZ3P97MVnW1TuvCM0I3t5ajPedIp8Ic+k03HHzKVLT9gwQdHKuBBW6UQmrP0F+0yj/lf5eor0GPopHDL0NjZu/fJCzVWxM6gPedt89GfwMQhcidBszxtU5Z72gcIy7MQH3u4sRm/c4vSazpfJGimOmT26LHcGBMe7/D2aXVeb0UbriNBH6zxL9hUZVCpXZGyfNSOVspcF3PsBVqzP3K8 X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BN3PR0301MB1249; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1249; 20:aiRJXzceZIMYNaA36LzdvcUkKTpTR3N0mINRPhwUHaAuh0EjMz0c+n80NmRXABpL+AGwUN5jrthBXwgBY/sbl6tZ349iU4MzEmDGeK0FbDoKI+5jd07BnUYDNZH4xJ81ExagFDybKnHLFrQ8op+bTebMLMvvXE8LA/bOBJzp7GHwZ4IMGVK4IWGFMqfOQgal9gNvigv0adXs6bVuYfaZ80bi4dKnc9FmB40uD+uhL0z1rUhs+ASRIflaQNz5Fkp1t3rvs0yGph2cHP1nV0pK1FlWzt6GdP7mW62JGKZFmA9hHpCNG5md+Nrus7PMqn+oHHmRS/FXg38uehr0kUDcFglEtgmTkvPrGZv8Mz2Mse0=; 4:o8g0C5j9SHErqZRfqaYoYX/QgLoqmx6NdDxoZ9MCqZgiltSjuQd8FexPwwlVCKRT2ADv7u8rK6HJOs3a5zVsicKRwZtr+Tcr8X/KKaf1ICoMGIohzcVxH+bIa47ETbB4t3kvS2ATtaXVW0Lu3yf5d2kb8fHdomsPWJLc/8XYxGIV4H3cwgnhQt9BSIltmSvQeLNgPkD/Z7A5SYBzZwDrj5c/tkKJIkkcVYf8BITLBKDQon/NAGh+fZKyQbu38ZVm3lESwHiTB4HgyQcz0PvpNLxvn17yVJfRGkDuYldcr5BilLga+XZ+leeMWlTzqqse X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1; PCL:0; RULEID:(601004)(5005006)(1201001)(3002001); SRVR:BN3PR0301MB1249; BCL:1; PCL:0; RULEID:; SRVR:BN3PR0301MB1249; X-Forefront-PRVS: 066153096A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB1249; 23:JCgZIa6bfBCgjuKtIx+cbVFwBu0y7d7szHFPBtt?= =?us-ascii?Q?bgk30HMlmNIzFvJb3ervs+DQUJ0HoAhXiLHgEXRorZjzrba3HlqESSt8ljAp?= =?us-ascii?Q?tKGVM509IGLLfBpuwV55xH0R3kF+hhDU8ExsmSZqnLh6B6+gaKxwLj+Sk3eE?= =?us-ascii?Q?HDS5OY7m/Oc5fm9kytLOIEy4gt92yWNRv72KKBtqbm3ugYXwkTdcgdAQNc1T?= =?us-ascii?Q?7NjvOacVcq5ycReVsSbbH5zApWu5qv0UVsFMaziNo4jKA1Z4SMWp+f/7RRLG?= =?us-ascii?Q?UjOIf0UKpV6i7/MT1Or/o9aMgSRMW/6rDYCeIdnFOfLYqT9/d5Ax4HJvcHDg?= =?us-ascii?Q?S83VB/kbWlJ9iMLUFtjV+3aiQ0Q/QL9tvGkVWbyrIhQK1s13RUxTAoA7G4Ke?= =?us-ascii?Q?DmFduBbFBY0D5goDz8G+5iSHvtHqAUnHBp5QP4uBfeXlibF8Y+ex1rRgLf7g?= =?us-ascii?Q?pqATfx189lMIvrsOVK/0esaMpDycPpXuWghM8JfJmZEEzliUvLjYlDdcVueA?= =?us-ascii?Q?EBE/nGGRSQCv7ze+cp2DgSLZVRD8rW0wW51dv169d31/jEBy1iyT04G5Rlim?= =?us-ascii?Q?+/do71qRD4HY5UpZG2nXmwPIIDGqGhrTM3k3uzIfheoWg4LDq2O8FKupV1t3?= =?us-ascii?Q?DxWQtZrDsBQPsF44KOKpBV4N2q6OZj8PWKMPbp+aI2CVpUdguV6/93fGEP1x?= =?us-ascii?Q?y1M5hfL1a9Ws9qdhryQ28Ti8gZGCI1k6MmMUGGK3l7+oybcnQmtMZFFLknsY?= =?us-ascii?Q?hvks1RtLaF7nOJsdJqv6D95SiraGdO8xa57lcM+8md4vfdiji/ZgXjRhvCHJ?= =?us-ascii?Q?8/JXd1nTkpt8vkYYm8mzARE4LQHruuc0POChHIueP2Dr4BVe2Jn0pb3qqH9u?= =?us-ascii?Q?xMtsZWol/1K48adfQWjpvAHE7ohgIZMRGoWJ0Pl8oAPuy2TDEv6ADp7ruwLv?= =?us-ascii?Q?O2HYymiskh/dgv/ZLLKByEIiCt+rrLsJCtrxhr5pP1UIGn0wiLsON5mLEDNA?= =?us-ascii?Q?lgK48/Tan9zzgV1UC1EVwP3h5E5D4ak7PylOLFMhlfw+GREVYgXIkZf7otdT?= =?us-ascii?Q?+afEqgaWrD5EKKPpzouSzU4V/s9yJ9VuOPrgmEejbBgwDmIt1YKrbfC7ilzL?= =?us-ascii?Q?uwAuER98DeEzMlz3Yh/IxVFjhvyWoORw3kWY+dkdNhw+z6ebOmTCJcFYv2Fz?= =?us-ascii?Q?kEVa1URPok9Bn/Uo=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1249; 5:oWIHXTYRYpS1S7VsA7Ce6meNbFPYzp9jsvakRsGZ9I6icum+eQISo5laJK4UIids7oJ0gbFDvTM6VukKXMnBPbskovIen0367Jvl5DB/9d/hUPZRUZnRMq/gDJxkcXXNIn/ol6XqJ2NbsluRPGJUmA==; 24:yyJrP+x2Nmbt/dQj/eAYQQKdCyqKFqq+cm0MWZDaptOnhgVdbhzt1Epo6APf5waA/8y45MXvX4TCBWD6E82/jTUwoNkMW6Nju+745IoyL+w=; 20:dQ3MwZJtO5UiNXmaa0Els5MUC05rqDYzxdof5az+aMovjQrJhKrZDsYQNLJkOM7wtxIVIoTPVvuJ7+6jWCxu5Q== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2015 06:19:45.8952 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1249 Cc: alsa-devel@alsa-project.org, timur@tabi.org, Zidan Wang , Xiubo.Lee@gmail.com, tiwai@suse.com, lgirdwood@gmail.com, broonie@kernel.org Subject: [alsa-devel] [PATCH v3 1/4] ASoC: fsl_sai: Add driver suspend and resume to support MEGA Fast X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP For i.MX6 SoloX, there is a mode of the SoC to shutdown all power source of modules during system suspend and resume procedure. Thus, SAI needs to save all the values of registers before the system suspend and restore them after the system resume. Signed-off-by: Zidan Wang Acked-by: Nicolin Chen --- sound/soc/fsl/fsl_sai.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index a18fd92..5c737f1 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -637,6 +637,8 @@ static bool fsl_sai_readable_reg(struct device *dev, unsigned int reg) static bool fsl_sai_volatile_reg(struct device *dev, unsigned int reg) { switch (reg) { + case FSL_SAI_TCSR: + case FSL_SAI_RCSR: case FSL_SAI_TFR: case FSL_SAI_RFR: case FSL_SAI_TDR: @@ -681,6 +683,7 @@ static const struct regmap_config fsl_sai_regmap_config = { .readable_reg = fsl_sai_readable_reg, .volatile_reg = fsl_sai_volatile_reg, .writeable_reg = fsl_sai_writeable_reg, + .cache_type = REGCACHE_FLAT, }; static int fsl_sai_probe(struct platform_device *pdev) @@ -802,10 +805,40 @@ static const struct of_device_id fsl_sai_ids[] = { { /* sentinel */ } }; +#if CONFIG_PM_SLEEP +static int fsl_sai_suspend(struct device *dev) +{ + struct fsl_sai *sai = dev_get_drvdata(dev); + + regcache_cache_only(sai->regmap, true); + regcache_mark_dirty(sai->regmap); + + return 0; +} + +static int fsl_sai_resume(struct device *dev) +{ + struct fsl_sai *sai = dev_get_drvdata(dev); + + regcache_cache_only(sai->regmap, false); + regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR); + regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR); + msleep(1); + regmap_write(sai->regmap, FSL_SAI_TCSR, 0); + regmap_write(sai->regmap, FSL_SAI_RCSR, 0); + return regcache_sync(sai->regmap); +} +#endif /* CONFIG_PM_SLEEP */ + +static const struct dev_pm_ops fsl_sai_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(fsl_sai_suspend, fsl_sai_resume) +}; + static struct platform_driver fsl_sai_driver = { .probe = fsl_sai_probe, .driver = { .name = "fsl-sai", + .pm = &fsl_sai_pm_ops, .of_match_table = fsl_sai_ids, }, };