From patchwork Wed Jan 27 13:26:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 8133491 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 930A6BEEE5 for ; Wed, 27 Jan 2016 13:27:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4C2420279 for ; Wed, 27 Jan 2016 13:27:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9440920270 for ; Wed, 27 Jan 2016 13:27:04 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9E4702614A4; Wed, 27 Jan 2016 14:27:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9EE942604DD; Wed, 27 Jan 2016 14:26:55 +0100 (CET) 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 905782604DF; Wed, 27 Jan 2016 14:26:54 +0100 (CET) Received: from smtp-out-227.synserver.de (smtp-out-193.synserver.de [212.40.185.193]) by alsa0.perex.cz (Postfix) with ESMTP id 28DED26044B for ; Wed, 27 Jan 2016 14:26:47 +0100 (CET) Received: (qmail 19019 invoked by uid 0); 27 Jan 2016 13:26:46 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 18957 Received: from pd9e2fe85.dip0.t-ipconnect.de (HELO lars-laptop.ad.analog.com) [217.226.254.133] by 217.119.54.77 with SMTP; 27 Jan 2016 13:26:46 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Wed, 27 Jan 2016 14:26:18 +0100 Message-Id: <1453901178-11343-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 Cc: Harsha Priya , Yang A Fang , alsa-devel@alsa-project.org, Lars-Peter Clausen , Anatol Pomozov Subject: [alsa-devel] [PATCH] ASoC: ssm4567: Reset device before regcache_sync() 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP When the ssm4567 is powered up the driver calles regcache_sync() to restore the register map content. regcache_sync() assumes that the device is in its power-on reset state. Make sure that this is the case by explicitly resetting the ssm4567 register map before calling regcache_sync() otherwise we might end up with a incorrect register map which leads to undefined behaviour. One such undefined behaviour was observed when returning from system suspend while a playback stream is active, in that case the ssm4567 was kept muted after resume. Fixes: 1ee44ce03011 ("ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier") Reported-by: Harsha Priya Tested-by: Fang, Yang A Signed-off-by: Lars-Peter Clausen --- sound/soc/codecs/ssm4567.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c index e619d56..080c78e 100644 --- a/sound/soc/codecs/ssm4567.c +++ b/sound/soc/codecs/ssm4567.c @@ -352,6 +352,11 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable) regcache_cache_only(ssm4567->regmap, !enable); if (enable) { + ret = regmap_write(ssm4567->regmap, SSM4567_REG_SOFT_RESET, + 0x00); + if (ret) + return ret; + ret = regmap_update_bits(ssm4567->regmap, SSM4567_REG_POWER_CTRL, SSM4567_POWER_SPWDN, 0x00);