Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp114366pxx; Tue, 27 Oct 2020 23:19:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsbS5LHqPk8e3Y/rSrOmFTmSLgks+RIPY0fyEFds7Tgo/YBO8rKHG/85V/KHoC4l/pQL9f X-Received: by 2002:a17:906:1c57:: with SMTP id l23mr5852955ejg.372.1603865951633; Tue, 27 Oct 2020 23:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603865951; cv=none; d=google.com; s=arc-20160816; b=R+Pw6cIJXXPjoxPkJ1ohnJ2BB4AC1e2DNux7UOIzKFS2VSDFtn/VvBGdJB53s4gVA9 k6dERbPNR8mGyUZcWkMPaqh79ZcXZN2+9TvstEyAW5eBpessF6XdpPiiZ+Cvb8hyW6Po fXoQ2VD83k/r10kY40KZSvnEu/F7gixO9MmuUESzzLRXcyxqLJ15y7gpqMAj7Hjl1bs8 UTFBcYyifh5sIXrpdeJfX2ONj3tV+JqR1L72yxirANqw13YW76R0umdzgw9TOAuMM3V3 iLGNs616oK8dQeK9lFYvmEjrQFjsb8F4sjB3WZp1zagc21zA8T/C2x88W+RlPai+HCyz xWGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=1phbf9nP/JdnVs9Te4TQSzfkG3pPtuHiUYXLQB0Q/Ss=; b=kmxkf42CtlLjquIVZ+Mffp4RQqmDmQHS9DStkLPOw3kKkxs03B34utQ4+cxczfvi/U bboMhs5Niodk5DJsxxd6GAwjr1LXlvMMmRzhjMNuQTNevc+qC00OjRfdqmc7xocVWxV0 bJBzcTStBWaUk9x0RFjTuxqbGviwLJtMw18UxvHPkqgzscyYidusIxXpLtm0rlvmprvf PdvmM2GrNRGxsUyJtXt2njhFh+xGSGTIMO8c6laIV86AqN/280V84UABtukTJGs+KWpT y2sTQ04ORwp/4KColbwr1hROwjs283CJzDzREcsCoG0MFRpgqpFWn+WMnlgLrL3aH9hR hBaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=mkbXDw2n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o60si2640395eda.61.2020.10.27.23.18.49; Tue, 27 Oct 2020 23:19:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=mkbXDw2n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2895709AbgJ0Jlg (ORCPT + 99 others); Tue, 27 Oct 2020 05:41:36 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:21460 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2895700AbgJ0Jlg (ORCPT ); Tue, 27 Oct 2020 05:41:36 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 09R9VdVe016828; Tue, 27 Oct 2020 04:41:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=PODMain02222019; bh=1phbf9nP/JdnVs9Te4TQSzfkG3pPtuHiUYXLQB0Q/Ss=; b=mkbXDw2n1Rsa9TncuDdvMC29k7VfasrjdeoGp69iV+KRQt26bi8ZpkfhXG9o7QJ5s+L3 U3PeqOGmDnp3YEaeXgciPdRXlw9JRRQnA0C846kZGrLSwXZ1+yO9pHQfjdg1ZdV4PRAZ T5pTtv60Y4L2GfZ4KthS7677ppDgIihQvru/BJkxWWLc+AEWcUufN90iyt1eVRZUR7eM RZOJlkINaQJ/KlLreKUNslse46rwoLeUTqzTMQZhrKdUv8odXwv0gUEs5MRA9PTZlhjU 5t7P2dyu6+7dQkpOshDcyZIBkkBf0WkhUKHpw1ZTG0wwDJniEXDeu5JS4nKZhEn2kVkm gA== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 34chp1m3me-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 27 Oct 2020 04:41:35 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Tue, 27 Oct 2020 09:41:33 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Tue, 27 Oct 2020 09:41:33 +0000 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 033D42AA; Tue, 27 Oct 2020 09:41:33 +0000 (UTC) From: Charles Keepax To: CC: , Subject: [PATCH RESEND 1/2] mfd: madera: Add reset as part of resume Date: Tue, 27 Oct 2020 09:41:31 +0000 Message-ID: <20201027094132.16472-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=1 priorityscore=1501 mlxlogscore=904 mlxscore=0 spamscore=0 clxscore=1015 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010270063 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DCVDD supply does not always power down when the CODEC enters suspend, for example shared regulators or always-on regulators. In these cases if a register is written back to the default value whilst the CODEC is in suspend that register will retain the previous value. As DCVDD never powered down, the register retains its old value and as the cache sync only synchronises registers that differ from the default the new value is never written out. Ensure the registers are in the expected state after suspend by always resetting the CODEC on resume. This also has the benefit of being recommended by the datasheet for DCVDD supplies that take longer than 2mS to rise. Signed-off-by: Charles Keepax --- drivers/mfd/madera-core.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c index 4ed6ad8ce0020..a9c6f0833f327 100644 --- a/drivers/mfd/madera-core.c +++ b/drivers/mfd/madera-core.c @@ -291,6 +291,8 @@ static int __maybe_unused madera_runtime_resume(struct device *dev) dev_dbg(dev, "Leaving sleep mode\n"); + madera_enable_hard_reset(madera); + ret = regulator_enable(madera->dcvdd); if (ret) { dev_err(dev, "Failed to enable DCVDD: %d\n", ret); @@ -300,7 +302,19 @@ static int __maybe_unused madera_runtime_resume(struct device *dev) regcache_cache_only(madera->regmap, false); regcache_cache_only(madera->regmap_32bit, false); - usleep_range(MADERA_RESET_MIN_US, MADERA_RESET_MAX_US); + madera_disable_hard_reset(madera); + + if (!madera->pdata.reset) { + ret = madera_wait_for_boot(madera); + if (ret) + goto err; + + ret = madera_soft_reset(madera); + if (ret) { + dev_err(dev, "Failed to reset: %d\n", ret); + goto err; + } + } ret = madera_wait_for_boot(madera); if (ret) -- 2.11.0