Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1547512pxm; Thu, 3 Mar 2022 21:30:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/FP6O7zhWh9o4vk3oPgchjztSPeGAxwJTlnHlnQWKs7lyXNAcTTJBDz3+GsVHXqEdfnsW X-Received: by 2002:a17:90a:7884:b0:1be:ef64:2212 with SMTP id x4-20020a17090a788400b001beef642212mr8909491pjk.53.1646371838065; Thu, 03 Mar 2022 21:30:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646371838; cv=none; d=google.com; s=arc-20160816; b=USfjeYsVoKga5+YpLUahwAV9eKBSZ17Yh13iL1SR+8TTbu85HOMTfyAtl/tp39YOjG hPofoAYWax2tsA9zKDYmkASavCpt0SySEoJi3Yhfi/dC15O8khHR/RI9ahL5pWV1ZKPq BCs4gfQ+2sQrUoRMJynlPEQOmVygZ1GnDPzWU2PnoQ/mrZ4IFI4mVLTEn9fcTez6SOvT 0XrqukCy0vNsI99ONuimXB1HC/k5htO8NdZA9SQoePh3ctLDx2UJWc9Ycq1Bjyvdvz8q CINH3AN6OzJhsDLq25ipWnunl4lqXISSZVqxopIkMIfVl8NVrgPy+Y5wRArzHZszeXIc 0dWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EKex1J4UfS3p1wGhghJWpFbPklW0Awb7agShppedfn0=; b=S/E9VqsZ+D62HfxUdNTk+LNAe+Ok/CJLPv6HigvtgWAF+SNvucg10KD1pDSTuduiPO iCyLtHc/5G6uDC9pyLxd9pJS8SZJhXvo0qkr18poaGOU+O9S8WmZt+SPGzi9Hwnfqqvf c1aG2sCC7M880cTktTZptjAh5v/Nzod9AcKNeDbaj0OPV6Bnk0uyyMD3Q2LmVEsBcUn5 ZrRSsEvFbGHmJCPyDeM1+YGWP+7/2aU7ppQFkShedwNRPJUV+OuIeu8VM+CDPTAHWOjp 48StR/eRgHDaRJlkfAXxG5HyTPdYKeNjQ3Z2QiRBz09BZSWU9ZNPjMICWaAwiU3Rq7/q 9s1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=AF60PGci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090aba0300b001bd3177ac4esi9553911pjr.28.2022.03.03.21.30.16; Thu, 03 Mar 2022 21:30:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=AF60PGci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235739AbiCCRdE (ORCPT + 99 others); Thu, 3 Mar 2022 12:33:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235426AbiCCRcL (ORCPT ); Thu, 3 Mar 2022 12:32:11 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E928919E0A8; Thu, 3 Mar 2022 09:31:21 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2234AADx028599; Thu, 3 Mar 2022 11:31:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=EKex1J4UfS3p1wGhghJWpFbPklW0Awb7agShppedfn0=; b=AF60PGcioDtGScgyE/uT0lNiUloPzfK65dC7RAPAZx932aTq5kQQ4s9/KrlnKl3vdXpS SL+KjoJrbgFiRWmfzTeGQrLt7k18VGN1CICT2SG8PKE6GCva/wFK7amWfdL6N+3XQqDZ N+uSsHKL/GzIOekXGPAakHsWbO2w95WfuNgO9P6dWECyIR4+qs6+vtS3k4nYqD92V4nK tIZCpnoule3W6UYSiOOhHBVxlZrQoGLrNN+N1GXoSkj02S8/q/u930NKUEq6GTTtdMg0 WUlrbOALVQljlLi9I0YWnKemR5/t/hziW6DsxerANGd9hCL9TmucVxEQGHgaJAQwvB/0 cw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3ejncq8ybk-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 03 Mar 2022 11:31:09 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Thu, 3 Mar 2022 17:31:07 +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.2375.18 via Frontend Transport; Thu, 3 Mar 2022 17:31:07 +0000 Received: from aryzen.ad.cirrus.com (unknown [198.61.65.198]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 5841C7C; Thu, 3 Mar 2022 17:31:07 +0000 (UTC) From: Lucas Tanure To: Liam Girdwood , Mark Brown , Rob Herring , Jaroslav Kysela , Takashi Iwai CC: , , , , Lucas Tanure Subject: [PATCH 14/20] hda: cs35l41: Move boost config to initialization code Date: Thu, 3 Mar 2022 17:30:53 +0000 Message-ID: <20220303173059.269657-15-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220303173059.269657-1-tanureal@opensource.cirrus.com> References: <20220303173059.269657-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: ZMMxzn5RVC8jfYPyNKpPZYLw5FVGTydq X-Proofpoint-GUID: ZMMxzn5RVC8jfYPyNKpPZYLw5FVGTydq X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Boost configuration doesn't need to be written for every new stream, so move it to the initialization code. Signed-off-by: Lucas Tanure --- include/sound/cs35l41.h | 1 + sound/pci/hda/cs35l41_hda.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/sound/cs35l41.h b/include/sound/cs35l41.h index fbf38f32e36d..a8537bccedcf 100644 --- a/include/sound/cs35l41.h +++ b/include/sound/cs35l41.h @@ -661,6 +661,7 @@ #define CS35L41_GLOBAL_EN_SHIFT 0 #define CS35L41_BST_EN_MASK 0x0030 #define CS35L41_BST_EN_SHIFT 4 +#define CS35L41_BST_DIS_FET_OFF 0x00 #define CS35L41_BST_EN_DEFAULT 0x2 #define CS35L41_AMP_EN_SHIFT 0 #define CS35L41_AMP_EN_MASK 1 diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 75c5088cb224..90c833a25599 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -25,7 +25,6 @@ static const struct reg_sequence cs35l41_hda_config[] = { { CS35L41_DAC_PCM1_SRC, 0x00000008 }, // DACPCM1_SRC = ASPRX1 { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB - { CS35L41_PWR_CTRL2, 0x00000001 }, // AMP_EN = 1 }; static const struct reg_sequence cs35l41_hda_mute[] = { @@ -34,7 +33,6 @@ static const struct reg_sequence cs35l41_hda_mute[] = { }; static const struct reg_sequence cs35l41_hda_start_bst[] = { - { CS35L41_PWR_CTRL2, 0x00000021 }, // BST_EN = 10, AMP_EN = 1 { CS35L41_PWR_CTRL1, 0x00000001, 3000}, // set GLOBAL_EN = 1 }; @@ -94,7 +92,6 @@ static const struct reg_sequence cs35l41_active_to_safe[] = { { 0x00000040, 0x00000055 }, { 0x00000040, 0x000000AA }, { 0x00007438, 0x00585941 }, - { CS35L41_PWR_CTRL2, 0x00000000 }, // AMP_EN = 0 { CS35L41_PWR_CTRL1, 0x00000000 }, { 0x0000742C, 0x00000009, 2000 }, { 0x00007438, 0x00580941 }, @@ -144,6 +141,8 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action) case HDA_GEN_PCM_ACT_OPEN: ret = regmap_multi_reg_write(reg, cs35l41_hda_config, ARRAY_SIZE(cs35l41_hda_config)); + regmap_update_bits(reg, CS35L41_PWR_CTRL2, + CS35L41_AMP_EN_MASK, 1 << CS35L41_AMP_EN_SHIFT); break; case HDA_GEN_PCM_ACT_PREPARE: if (reg_seq->prepare) @@ -155,6 +154,8 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action) ret = regmap_multi_reg_write(reg, reg_seq->cleanup, reg_seq->num_cleanup); break; case HDA_GEN_PCM_ACT_CLOSE: + regmap_update_bits(reg, CS35L41_PWR_CTRL2, + CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT); if (reg_seq->close) ret = regmap_multi_reg_write(reg, reg_seq->close, reg_seq->num_close); break; @@ -234,6 +235,8 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41) cs35l41->reg_seq = &cs35l41_hda_reg_seq_no_bst; regmap_multi_reg_write(cs35l41->regmap, cs35l41_reset_to_safe, ARRAY_SIZE(cs35l41_reset_to_safe)); + regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2, CS35L41_BST_EN_MASK, + CS35L41_BST_DIS_FET_OFF << CS35L41_BST_EN_SHIFT); break; default: dev_err(cs35l41->dev, "Boost type %d not supported\n", hw_cfg->bst_type); -- 2.35.1