Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4668907ioa; Wed, 27 Apr 2022 08:34:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4Tyiwu4gwa854NTtYkNKxRrPhk9ZG2KtZ0MeBABXMXVKfVPd/ZXPPA2wgrSbxIsauQ7Y4 X-Received: by 2002:a05:6a00:114b:b0:4f7:915:3ec3 with SMTP id b11-20020a056a00114b00b004f709153ec3mr30857322pfm.8.1651073686508; Wed, 27 Apr 2022 08:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651073686; cv=none; d=google.com; s=arc-20160816; b=0WNWyQjhmeuiWoR6KCFhP65gztnGnmFf2kvJdeYAp46nKZt6iZzPYHOIA3TNufq1OY fz4uTYQv0UWWaGArFvvsm1pI4E56xwrctPPX8l38Y1Cw777PbXP0iA2Lin6yIxqPQ5Za sqvOtYPy1/wmdvl7yoDDEeCVFsS2dkiH0y4uqdfNUSdanfirPcBMW1fzxpT8L4gGJfXh hU7lFB5jOAoqVqIGXUeKeNf5/KZ/C9vwBrIpiLWIEeCcpDu8/VwOadHe6W9ch/K0b/ya t42mQLcZur+mwRqE66TntxkNGrKz4pLD4C62E72K3IOS8/RCzqyMQF2sSiIAGjWjjJbj G2Bg== 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=oexWDZMMh/7506IlXy/tU91+gIURReqabzxPCviuK/4=; b=sb1fiH4StKGuU1q2MgybGB+elAU17bCklO4CkfLg4Uriea3vvaDQcqMckTE0r3e50P T5xkwwijCByp4aYZ3Kh6OYd5jNuwRKrHPfn8Ghuxk7o8rc6uPl7JY4jMHt4imrP3RNzV oz26fzWrmR8bgycBGYPapsHOo/Jdx5qDoZ8vZUdN33zwItWyhVqxqKAFBgOdmur/geHs i91XtjERdiOSsD71ysL3yI4Hg1geRnIo3PblodQx6TFHssNdAQRYII5y2e9Yttv1bg9A I/80GKMpthVhfqs8MNOETULGqKxj+8vcKXxO5ZPjbxz2yZ98rxIddpJ8UT6VoW3QntMG BXZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WTQNBVhV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b11-20020a056a000a8b00b0050acaaed691si1844735pfl.268.2022.04.27.08.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 08:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WTQNBVhV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A4C954F94; Wed, 27 Apr 2022 08:07:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239060AbiD0PK7 (ORCPT + 99 others); Wed, 27 Apr 2022 11:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238909AbiD0PK4 (ORCPT ); Wed, 27 Apr 2022 11:10:56 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3661338A9 for ; Wed, 27 Apr 2022 08:07:44 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23RBg6qE022428; Wed, 27 Apr 2022 10:07:36 -0500 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=oexWDZMMh/7506IlXy/tU91+gIURReqabzxPCviuK/4=; b=WTQNBVhV8D807snXKPHhjaII8By5fVUkw35/AjmyYI/NJLol8R4gQp1xHl1uo9sBbb9b s+emR+aNKlNGC9camdAU756IadnQMc4RPVFxiSlttA4wCZlINdqWWhmGCOLCA3qzr5Ju RhspINXbduk0Yggki/csBrENgkplYGAXnkYTeC1qAYghuuNGO6K4ii540DZv8MOQB8Id OxV57kh6tyPIkmNV5ANO/j0TOA4QFZbLTImeDA6Kt9ns4RYhILZ1alYuklk9SMdOsfq5 lXhGA7FpiDVZ7lN0q/NSCnfwjYNGOwZa0x6+kBywdMOPpkuF4dnL3GeiHsGVwPtHB1rc Cw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3fprt60xte-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 27 Apr 2022 10:07:36 -0500 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.24; Wed, 27 Apr 2022 16:07:25 +0100 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.24 via Frontend Transport; Wed, 27 Apr 2022 16:07:25 +0100 Received: from vitaly-Legion-7-16ACHg6.ad.cirrus.com (unknown [198.90.238.170]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id B69F146C; Wed, 27 Apr 2022 15:07:24 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai , Mark Brown CC: , , , Stefan Binding Subject: [PATCH 07/26] ASoC: cs35l41: Move cs35l41 fs errata into shared code Date: Wed, 27 Apr 2022 16:07:01 +0100 Message-ID: <20220427150720.9194-8-vitalyr@opensource.cirrus.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220427150720.9194-1-vitalyr@opensource.cirrus.com> References: <20220427150720.9194-1-vitalyr@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: SugMQLUQVDdRxosv0negCrPeLDnd-fdI X-Proofpoint-ORIG-GUID: SugMQLUQVDdRxosv0negCrPeLDnd-fdI X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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: Stefan Binding This sequence is required to setup firmware, and will be needed for hda driver. Signed-off-by: Stefan Binding Signed-off-by: Vitaly Rodionov --- include/sound/cs35l41.h | 1 + sound/soc/codecs/cs35l41-lib.c | 32 ++++++++++++++++++++++++++++++++ sound/soc/codecs/cs35l41.c | 26 ++------------------------ 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/include/sound/cs35l41.h b/include/sound/cs35l41.h index 2271471225b1..d0cfb41495b0 100644 --- a/include/sound/cs35l41.h +++ b/include/sound/cs35l41.h @@ -879,6 +879,7 @@ int cs35l41_set_channels(struct device *dev, struct regmap *reg, int cs35l41_gpio_config(struct regmap *regmap, struct cs35l41_hw_cfg *hw_cfg); int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap, enum cs35l41_cspl_mbox_cmd cmd); +int cs35l41_write_fs_errata(struct device *dev, struct regmap *regmap); int cs35l41_init_boost(struct device *dev, struct regmap *regmap, struct cs35l41_hw_cfg *hw_cfg); bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type); diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c index 451d3be37157..85fe5f88d6b4 100644 --- a/sound/soc/codecs/cs35l41-lib.c +++ b/sound/soc/codecs/cs35l41-lib.c @@ -667,6 +667,25 @@ static const struct reg_sequence cs35l41_revb2_errata_patch[] = { { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, }; +static const struct reg_sequence cs35l41_fs_errata_patch[] = { + { CS35L41_DSP1_RX1_RATE, 0x00000001 }, + { CS35L41_DSP1_RX2_RATE, 0x00000001 }, + { CS35L41_DSP1_RX3_RATE, 0x00000001 }, + { CS35L41_DSP1_RX4_RATE, 0x00000001 }, + { CS35L41_DSP1_RX5_RATE, 0x00000001 }, + { CS35L41_DSP1_RX6_RATE, 0x00000001 }, + { CS35L41_DSP1_RX7_RATE, 0x00000001 }, + { CS35L41_DSP1_RX8_RATE, 0x00000001 }, + { CS35L41_DSP1_TX1_RATE, 0x00000001 }, + { CS35L41_DSP1_TX2_RATE, 0x00000001 }, + { CS35L41_DSP1_TX3_RATE, 0x00000001 }, + { CS35L41_DSP1_TX4_RATE, 0x00000001 }, + { CS35L41_DSP1_TX5_RATE, 0x00000001 }, + { CS35L41_DSP1_TX6_RATE, 0x00000001 }, + { CS35L41_DSP1_TX7_RATE, 0x00000001 }, + { CS35L41_DSP1_TX8_RATE, 0x00000001 }, +}; + static const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[] = { { .id = 0x01, @@ -1263,6 +1282,19 @@ int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap, } EXPORT_SYMBOL_GPL(cs35l41_set_cspl_mbox_cmd); +int cs35l41_write_fs_errata(struct device *dev, struct regmap *regmap) +{ + int ret; + + ret = regmap_multi_reg_write(regmap, cs35l41_fs_errata_patch, + ARRAY_SIZE(cs35l41_fs_errata_patch)); + if (ret < 0) + dev_err(dev, "Failed to write fs errata: %d\n", ret); + + return ret; +} +EXPORT_SYMBOL_GPL(cs35l41_write_fs_errata); + MODULE_DESCRIPTION("CS35L41 library"); MODULE_AUTHOR("David Rhodes, Cirrus Logic Inc, "); MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, "); diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c index 0285946688f7..75527649bb14 100644 --- a/sound/soc/codecs/cs35l41.c +++ b/sound/soc/codecs/cs35l41.c @@ -1093,25 +1093,6 @@ static int cs35l41_handle_pdata(struct device *dev, struct cs35l41_hw_cfg *hw_cf return 0; } -static const struct reg_sequence cs35l41_fs_errata_patch[] = { - { CS35L41_DSP1_RX1_RATE, 0x00000001 }, - { CS35L41_DSP1_RX2_RATE, 0x00000001 }, - { CS35L41_DSP1_RX3_RATE, 0x00000001 }, - { CS35L41_DSP1_RX4_RATE, 0x00000001 }, - { CS35L41_DSP1_RX5_RATE, 0x00000001 }, - { CS35L41_DSP1_RX6_RATE, 0x00000001 }, - { CS35L41_DSP1_RX7_RATE, 0x00000001 }, - { CS35L41_DSP1_RX8_RATE, 0x00000001 }, - { CS35L41_DSP1_TX1_RATE, 0x00000001 }, - { CS35L41_DSP1_TX2_RATE, 0x00000001 }, - { CS35L41_DSP1_TX3_RATE, 0x00000001 }, - { CS35L41_DSP1_TX4_RATE, 0x00000001 }, - { CS35L41_DSP1_TX5_RATE, 0x00000001 }, - { CS35L41_DSP1_TX6_RATE, 0x00000001 }, - { CS35L41_DSP1_TX7_RATE, 0x00000001 }, - { CS35L41_DSP1_TX8_RATE, 0x00000001 }, -}; - static int cs35l41_dsp_init(struct cs35l41_private *cs35l41) { struct wm_adsp *dsp; @@ -1132,12 +1113,9 @@ static int cs35l41_dsp_init(struct cs35l41_private *cs35l41) dsp->cs_dsp.num_mems = ARRAY_SIZE(cs35l41_dsp1_regions); dsp->cs_dsp.lock_regions = 0xFFFFFFFF; - ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41_fs_errata_patch, - ARRAY_SIZE(cs35l41_fs_errata_patch)); - if (ret < 0) { - dev_err(cs35l41->dev, "Failed to write fs errata: %d\n", ret); + ret = cs35l41_write_fs_errata(cs35l41->dev, cs35l41->regmap); + if (ret < 0) return ret; - } ret = wm_halo_init(dsp); if (ret) { -- 2.32.0