Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4440312ioa; Wed, 27 Apr 2022 04:03:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNrf3FMdx0tTjvjpQtm/5S6X1vq9eqaumcFbaJPIbwupIgUyKowODYBasi0rhGWrgxoCEc X-Received: by 2002:a17:90a:c246:b0:1d9:3a2e:5495 with SMTP id d6-20020a17090ac24600b001d93a2e5495mr23880838pjx.170.1651057426736; Wed, 27 Apr 2022 04:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651057426; cv=none; d=google.com; s=arc-20160816; b=Go/SfA8QPOf2gaDwcr8oCgiH3Vi0tH8MdmiALgJZW6TCzIiP0cF2JSCRuLyWzbmWrA e3x62ULJEQ38fwktEgNrWxXkT88qPm4WFmwBxEPMC/fGIPAxyBsgwTQ7BqilOXvWX0KP woJklKvlp7a9uZLkWwfs5viN9Pm3n8vOvAxu6B4No4e9p6aU53WEd/8Hz1REa5S+CjrN DN1jlLesE8etvuMy16/DhVYCUtDPmZJcTLrhCzIlocy0yvM0LK10zAa7o0nMRK+Sv04l 83/D2d2D+qiAngR9sPYpQaVK4mg+WRnOwaQFLMagueTlFZVDTa5boMW5M/zIWQsAuc1K j96w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=//C2PUMow3gK8EiCUwWHWKApXSFEjJwxpigTK8Lwapg=; b=D2mMd6OLIIGAWBJHoCmEXUrvm1ByCbcx07fJ8yoRHImHP79MFA14Q57+7d+VNva9Qy bdpleErP8+gWi8HGBVp9ryMGBfqzw9+1AJSZQWwUOpBfWyHarNbiol9zRzxFlYP+LRpY kXMqHLt5VydYZZF2T5lWtviarDN4eadw/2BMzawe3DNr1Rd8TFl3BSmhVFO+RUUGKi1c kA5BfBjAuSRosVYsiYJNhj4pp4xbQEtG+ycfmJbjSTA5VLU9H5bwsrgZGiVj88ZZ51i/ B8RNmbDQG+GJ15aq9XVyf/Gy5wjJ9NcnFDksuZde4qplHoFIPa2zKQ+avernlgJ6JahD heAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RA0DX9Tx; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q8-20020a63e948000000b003aa63a39ba9si1203254pgj.193.2022.04.27.04.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:03:46 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RA0DX9Tx; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5491D321A51; Wed, 27 Apr 2022 03:13:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349072AbiDZJ00 (ORCPT + 99 others); Tue, 26 Apr 2022 05:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345874AbiDZJCp (ORCPT ); Tue, 26 Apr 2022 05:02:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B158CC3E2C; Tue, 26 Apr 2022 01:43:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E7241B81C76; Tue, 26 Apr 2022 08:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A5FDC385A0; Tue, 26 Apr 2022 08:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962617; bh=nyzb5SSmK/jZCYBddQRdW43tebhvDVL3O1UKfr9EU3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RA0DX9TxMNHrEJbnVT+RLRCJF0prFrNgz0cd5HCVqRE8I4zsOnWqHd2C35kIZZyjn 4mf7QyR/jNOa7fL27W8oQ6SP1DcOwGdIkqaU7m2xJFvR5dYVxwhSYV3B+MWX4vh2IL RIGAjxBcHbjBMZxzEs0Xh+rrULj7xcNmm62ux70M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amit Pundir , Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.17 015/146] ASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in use Date: Tue, 26 Apr 2022 10:20:10 +0200 Message-Id: <20220426081750.493500101@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081750.051179617@linuxfoundation.org> References: <20220426081750.051179617@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla [ Upstream commit db6dd1bee63d1d88fbddfe07af800af5948ac28e ] SIDO(Single-Inductor Dual-Ouput) Buck powers up both analog and digital circuits along with internal memory, powering off this is the last thing that codec should do when going to very low power. Current code was powering off this Buck if there are no users of sysclk, which is not correct. Powering off this buck will result in no register access. This code path was never tested until recently after adding pm support in SoundWire controller. Fix this by removing the buck poweroff when the codec is active and also the code that is not used. Without this patch all the read/write transactions will never complete and results in SLIMBus Errors like: qcom,slim-ngd qcom,slim-ngd.1: Tx:MT:0x0, MC:0x60, LA:0xcf failed:-110 wcd934x-codec wcd934x-codec.1.auto: ASoC: error at soc_component_read_no_lock on wcd934x-codec.1.auto for register: [0x00000d05] -110 qcom,slim-ngd-ctrl 171c0000.slim: Error Interrupt received 0x82000000 Reported-by: Amit Pundir Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec") Signed-off-by: Srinivas Kandagatla Tested-by: Amit Pundir Link: https://lore.kernel.org/r/20220407094313.2880-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wcd934x.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 1e75e93cf28f..6298ebe96e94 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1274,29 +1274,7 @@ static int wcd934x_set_sido_input_src(struct wcd934x_codec *wcd, int sido_src) if (sido_src == wcd->sido_input_src) return 0; - if (sido_src == SIDO_SOURCE_INTERNAL) { - regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, - WCD934X_ANA_BUCK_HI_ACCU_EN_MASK, 0); - usleep_range(100, 110); - regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, - WCD934X_ANA_BUCK_HI_ACCU_PRE_ENX_MASK, 0x0); - usleep_range(100, 110); - regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, - WCD934X_ANA_RCO_BG_EN_MASK, 0); - usleep_range(100, 110); - regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, - WCD934X_ANA_BUCK_PRE_EN1_MASK, - WCD934X_ANA_BUCK_PRE_EN1_ENABLE); - usleep_range(100, 110); - regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, - WCD934X_ANA_BUCK_PRE_EN2_MASK, - WCD934X_ANA_BUCK_PRE_EN2_ENABLE); - usleep_range(100, 110); - regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, - WCD934X_ANA_BUCK_HI_ACCU_EN_MASK, - WCD934X_ANA_BUCK_HI_ACCU_ENABLE); - usleep_range(100, 110); - } else if (sido_src == SIDO_SOURCE_RCO_BG) { + if (sido_src == SIDO_SOURCE_RCO_BG) { regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, WCD934X_ANA_RCO_BG_EN_MASK, WCD934X_ANA_RCO_BG_ENABLE); @@ -1382,8 +1360,6 @@ static int wcd934x_disable_ana_bias_and_syclk(struct wcd934x_codec *wcd) regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, WCD934X_EXT_CLK_BUF_EN_MASK | WCD934X_MCLK_EN_MASK, 0x0); - wcd934x_set_sido_input_src(wcd, SIDO_SOURCE_INTERNAL); - regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, WCD934X_ANA_BIAS_EN_MASK, 0); regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, -- 2.35.1